Product and Version
Intel® Fortran and C++ Compilers 13 and newer
Windows*, Linux*, macOS*
If the switch /Qftrapuv (-ftrapuv) for run-time detection of uninitialized local scalar variables is used in conjunction with optimization flags such as /O2 (-O2), it may lead to unexpected floating-point exceptions that are not related to uninitialized variables.
The switch /Qftrapuv (-ftrapuv) sets local, scalar variables that are not otherwise initialized to an "unusual" initial value such as 0xCCCCCCCC. When the main program is compiled with this switch, it also unmasks the "INVALID" floating-point exception. so that exceptions may be raised when the "unusual" values are used in floating-point operations. The switch also changes the default optimization level from /O2 to /Od (from -O2 to -O0). This is so that exceptions will not be raised as a result of speculated floating-point operations or other optimizations. If the new default optimization level of /Od (-O0) is explicitly overridden, optimizations such as floating-point speculation associated with masked vector operations may result in INVALID exceptions that would not otherwise have been raised.
Do not override the default /Od (-O0) optimization level when using /Qtrapuv (-ftrapuv). Sometimes, it may be sufficient to use /Qfp-speculation:safe (-fp-speculation safe) in conjunction with -O2.
Intel® Inspector, a component of Intel® Parallel Studio XE, may also be used for the detection of some instances of uninitialized variables being read.
or (Fortran only)
Use the switch /check:uninit (-check uninit) in preference to /Qtrapuv (-ftrapuv) for the run-time detection of uninitialized, local scalar variables. This uses a different mechanism for uninitialized variable detection and is less likely to produce unrelated floating-point exceptions.
Beginning with Intel Fortran Compiler 18, the initialization values of classes of variables caused by the switch /Qinit:keyword (-init=keyword) has been expanded from zero and signaling NaN (snan) to include huge (largest representable positive real value), minus huge (largest representable negative real value), infinity, minus infinity, tiny and minus tiny. For a complete description of this compiler switch, see the Intel Fortran User Guide.
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.