# ftrapuv, Qtrapuv

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

## Syntax

Linux: | -ftrapuv

Windows: | /Qtrapuv (C++ only)

Windows: | None (DPC++ only)

## 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 /Zi or /Z7 (Windows*), which changes the default optimization level from O2 to -O0 (Linux) or /Od (Windows). You can override this effect by explicitly specifying an O option setting.

For more details on using options -ftrapuv and /Qtrapuv (C++) 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/content/www/us/en/develop/articles/dont-optimize-when-using-ftrapuv-for-uninitialized-variable-detection.html.

Another way to detect uninitialized local scalar variables is by specifying keyword uninit for option check.

## IDE Equivalent

Visual Studio: None

Eclipse: Run-Time > Initialize Stack Variables to an Unusual Value

## Alternate Options

None

Parent topic: Output, Debug, and Precompiled Header (PCH) Options

## See Also

g compiler option
Zi, Z7, ZI compiler option
O compiler option