Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

/check:uninit: scalars vs. arrays

jlamls
Beginner
818 Views
/check:uninit will correctly detect this use of uninitilized variables when scalars are used:

DOUBLE PRECISION A, B

A = 1D0/B

but it will not detect this case:

DOUBLE PRECISION A, B(1)

A = 1D0/B(1)

Is there any way to check for use of uninitialized array space? I am using IVF version 11.1.3470.2005 within Visual Studio 8.0.50727.762 (SP .050727-7600).
0 Kudos
2 Replies
Steven_L_Intel1
Employee
818 Views
Correct - that feature works for local scalars only. You might see if the "Source Checker" feature helps.
0 Kudos
jimdempseyatthecove
Honored Contributor III
818 Views
>>Is there any way to check for use of uninitialized array space?

In Debug build under Windows unwritten to allocations hold 0xcacacaca....
The programmer could insert conditional compiled asserts against this value.

An alternate way is immediately after allocation of REAL/DOUBLE is to wipe the array with Signaling NaNs. If these are subsequently used you will be immediately notified. Or in the case on non-Signaling NaNs you can insert fewer asserts and hopefully trace back to the origination of the error within a few test runs.

Jim Dempsey

0 Kudos
Reply