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

Breaking on uninitialized variables

Antoon
Beginner
408 Views

Hi,

For me one of the most important features of a debugger is, that the debugger breaks on uninitialized variables. In my IVF properties I have chosen: Runtime Error Checking: All, so that includes checking for uninitialized variables. But to my surprise the debugger does not break on statements withuninitialized variables, but simply assigns value zero toall uninitialized variables, and continues without giving any warning.

Any idea how to force the debugger to really break onstatements including uninitialized variables ?

Many thanks,

Antoon

0 Kudos
4 Replies
Steven_L_Intel1
Employee
408 Views

If you do not get an error for an uninitialized variable, then the compiler is failing to detect it. The uninitialized variable detection has some significant gaps. Can you show a small test case that fails to detect the error?

0 Kudos
Antoon
Beginner
408 Views

If you do not get an error for an uninitialized variable, then the compiler is failing to detect it. The uninitialized variable detection has some significant gaps. Can you show a small test case that fails to detect the error?


I tried to reproduce this problem in a small program, but then the debugger indeed breaks on uninitialized variables.

In my much more complex software package (100 modules) where the problem occurs, I see in the watch windows that all uninitialized variables are set on zero, andall dynam. allocated arrays are set on value -1.3270393E-03, does that ringa bell ?

My command line parameters (from the Property pages) are:

/nologo /Zi /Od /include:"....include" /extend_source:132 /error_limit:500 /warn:all /module:"....include"

/object:"Debug" /traceback /check:all /libs:static /threads /dbglibs /c

Does that help, anything strange ??

Many thanks !

0 Kudos
sarma_amras
New Contributor I
408 Views
Quoting - Antoon

If you do not get an error for an uninitialized variable, then the compiler is failing to detect it. The uninitialized variable detection has some significant gaps. Can you show a small test case that fails to detect the error?


I tried to reproduce this problem in a small program, but then the debugger indeed breaks on uninitialized variables.

In my much more complex software package (100 modules) where the problem occurs, I see in the watch windows that all uninitialized variables are set on zero, andall dynam. allocated arrays are set on value -1.3270393E-03, does that ringa bell ?

My command line parameters (from the Property pages) are:

/nologo /Zi /Od /include:"....include" /extend_source:132 /error_limit:500 /warn:all /module:"....include"

/object:"Debug" /traceback /check:all /libs:static /threads /dbglibs /c

Does that help, anything strange ??

Many thanks !


what you have specified is absolutely correct. But I suggest you to configure it exactly as requiredinstead of doing it like /check:all that you are doing. So, try this option to find the uninitialised variables especially using /check:uninit.

0 Kudos
Steven_L_Intel1
Employee
408 Views

The value that happens to be in memory on allocated arrays is just accidental. The uninitialized variable checking does not rely on special values. It also does not work on arrays.

0 Kudos
Reply