Checking for unitialized variables using init compiler option

The Intel® Fortran Compiler 15.0 provides new capability for checking certain uses of uninitialized variables.   This new capability is provided by the -init option on Linux* and OS X*, and the /Qinit option on Windows*

This option allows initializing a class of saved variables to either zero or to signaling NaN. Variables affected include variables with an explicit SAVE attribute and those variables that are implicitly saved, with the following key exceptions:

  • This option does not work with derived types, allocatable variables, automatic variables, or adjustable arrays.
  • To force variables to be saved you can add the -save or /Qsave option

The available keywords to the -init and /Qinit option are

  • zero: integer logical real and complex set to zero
  • snan: for real and complex Signaling NAN
  • arrays: initializes arrays as well

Examples

  • -init=zero -init=arrays  initializes all saved uninitialized variables and arrays to 0
  • -init=Nan  initializes all saved uninitialized real and complex variables to Signaling NaNs
  • -init=snan -init=zero  initializes all saved uninitialized real and complex variables to Signaling NaNs, and all  saved uninitialized integer and logical variables to zero
For more complete information about compiler optimizations, see our Optimization Notice.