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

Is this a volatile variable problem?

michael_green
Beginner
394 Views
Hi all,
I have a large program that works perfectly well in debug mode but fails in release mode. The problem appears to be the closing of a file (on unit 1) but I'm unable to find out where this happens because it doesn't happen in debug mode.Could this be the result ofa volatile variable? I've heard about them but never met one before - how do I go about tracking it down?
Any suggestions?
With many thanks in advance,
Mike
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
394 Views
Actually, this could be a problem of uninitialized variable -- "volatile" is something entirely different (VOLATILE keyword declares that the variable is changeable outside of compiler's view, like a shared-memory mapped variable or a port value, and prevents certain optimization).

You can debug the release configuration, if you set "debug info" to "full" and rebuild. The stepping through the code can be kind of funny, and many variables are unreadable as they're stored in registers, but you still can have basic control what happens.

It can also happen, though, that it's not reproducible even in this case. It could help, though, to try to reproduce the exact conditions -- insert a call to DebugBreak() (use DFWIN) somewhere in your startup code, then run the program without debugger (Ctrl+F5). DebugBreak statement will cause the just-in-time debugger to attach itself to the process.

If that still doesn't help reproduce the problem, well...

Jugoslav
0 Kudos
Reply