Developer Guide and Reference

  • 2021.2
  • 04/07/2021
  • Public Content
  • Download as PDF
Contents

GS

Determines whether the compiler generates code that detects some buffer overruns.

Syntax

Linux:
None
Windows:
/GS
[
:
keyword
]
/GS-
Arguments
keyword
Specifies the level of stack protection heuristics used by the compiler. Possible values are:
off
Tells the compiler to ignore buffer overruns. This is the same as specifying
/GS-
.
partial
Tells the compiler to provide a stack protection level that is compatible with Microsoft* Visual Studio 2008.
strong
Tells the compiler to provide full stack security level checking. This setting is compatible with more recent Microsoft* Visual Studio stack protection heuristics. This is the same as specifying
/GS
with no keyword.
Default
/GS-
The compiler does not detect buffer overruns.
Description
This option determines whether the compiler generates code that detects some buffer overruns that overwrite a function's return address, exception handler address, or certain types of parameters.
This option has been added for Microsoft compatibility.
Following Visual Studio 2008, the Microsoft implementation of option
/GS
became more extensive (for example, more routines are protected). The performance of some programs may be impacted by the newer heuristics. In such cases, you may see better performance if you specify
/GS:partial
.
For more details about option
/GS
, see the Microsoft documentation.
IDE Equivalent
Visual Studio:
Code Generation > Security Check
Eclipse:
None
Alternate Options
DPC++: None
C++: Linux:
-fstack-security-check
C++: Windows: None

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.