Developer Guide and Reference

Contents

ftrapuv
, Qtrapuv

Initializes stack local variables to an unusual value to aid error detection.

Syntax

Linux:
-ftrapuv
macOS:
-ftrapuv
Windows:
/Qtrapuv
Arguments
None
Default
OFF
The compiler does not initialize local variables.
Description
This option initializes stack local variables to an unusual value to aid error detection. Normally, these local variables should be initialized in the application. It also unmasks the floating-point invalid exception.
The option sets any uninitialized local variables that are allocated on the stack to a value that is typically interpreted as a very large integer or an invalid address. References to these variables are then likely to cause run-time errors that can help you detect coding errors.
This option sets option
-g
(Linux*
and
macOS*
) and
/Zi
or
/Z7
(Windows*), which changes the default optimization level from
O2
to
-O0
(Linux
and
macOS*
) or
/Od
(Windows). You can override this effect by explicitly specifying an
O
option setting.
If option
O2
and option
-ftrapuv
(Linux
and
macOS*
) or
/Qtrapuv
(Windows) are used together, you should specify option
-fp-speculation safe
(Linux
and
macOS*
) or
/Qfp-speculation:safe
(Windows) to prevent exceptions resulting from speculated floating-point operations from being trapped.
For more details on using options
-ftrapuv
and
/Qtrapuv
with compiler option
O
, see the article in Intel® Developer Zone titled
Don't optimize when using -ftrapuv for uninitialized variable detection
, which is located in https://software.intel.com/en-us/articles/dont-optimize-when-using-ftrapuv-for-uninitialized-variable-detection/ .
Another way to detect uninitialized local scalar variables is by specifying keyword
uninit
for option
check
.
Alternate Options
None

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804