Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

initialization of local variables

jayb
Beginner
755 Views

My co-developer reports that, contrary to his expectations, Intel Fortran seems to be initializing local numeric variables, both scalar and array, to 0 or 0.0

I should note that In our application, all local variables are saved, and all arrays are pre-allocated (sizes are explicit in the code).  No arrays or structures are allocated at run-time, and no local variables are recursive.

Is his generalization correct?

Jay

 

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
755 Views

By default the Debug build implies -init=zero (-Qinit=zero), Release build does not. The Fortran standard states the value of uninitialized variables are undefined. Do not rely on what "seems to be initialized". Explicitly add the option for initialization, however, note the section in the option descriptions as to what is NOT initialized with this option.

Jim Dempsey

0 Kudos
jayb
Beginner
755 Views

Please disregard my post.  I now have a better idea of what my colleague was reporting, based on a small test case that I asked him to send me.  When I get a better handle on the unexpected behavior, I will create a new post with an appropriate title.

Jay

 

 

0 Kudos
Reply