summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/c-dialect-options.html
blob: 821643d416379274b2064b88e5dfbd455d9935c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<div class="section-level-extent" id="C-Dialect-Options"> <div class="nav-panel"> <p> Next: <a href="c_002b_002b-dialect-options" accesskey="n" rel="next">Options Controlling C++ Dialect</a>, Previous: <a href="invoking-g_002b_002b" accesskey="p" rel="prev">Compiling C++ Programs</a>, Up: <a href="invoking-gcc" accesskey="u" rel="up">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div>  <h1 class="section" id="Options-Controlling-C-Dialect"><span>3.4 Options Controlling C Dialect<a class="copiable-link" href="#Options-Controlling-C-Dialect"> ¶</a></span></h1>    <p>The following options control the dialect of C (or languages derived from C, such as C++, Objective-C and Objective-C++) that the compiler accepts: </p> <dl class="table"> <dt>
  <span><code class="code">-ansi</code><a class="copiable-link" href="#index-ANSI-support"> ¶</a></span>
</dt> <dd>
<p>In C mode, this is equivalent to <samp class="option">-std=c90</samp>. In C++ mode, it is equivalent to <samp class="option">-std=c++98</samp>. </p> <p>This turns off certain features of GCC that are incompatible with ISO C90 (when compiling C code), or of standard C++ (when compiling C++ code), such as the <code class="code">asm</code> and <code class="code">typeof</code> keywords, and predefined macros such as <code class="code">unix</code> and <code class="code">vax</code> that identify the type of system you are using. It also enables the undesirable and rarely used ISO trigraph feature. For the C compiler, it disables recognition of C++ style ‘<samp class="samp">//</samp>’ comments as well as the <code class="code">inline</code> keyword. </p> <p>The alternate keywords <code class="code">__asm__</code>, <code class="code">__extension__</code>, <code class="code">__inline__</code> and <code class="code">__typeof__</code> continue to work despite <samp class="option">-ansi</samp>. You would not want to use them in an ISO C program, of course, but it is useful to put them in header files that might be included in compilations done with <samp class="option">-ansi</samp>. Alternate predefined macros such as <code class="code">__unix__</code> and <code class="code">__vax__</code> are also available, with or without <samp class="option">-ansi</samp>. </p> <p>The <samp class="option">-ansi</samp> option does not cause non-ISO programs to be rejected gratuitously. For that, <samp class="option">-Wpedantic</samp> is required in addition to <samp class="option">-ansi</samp>. See <a class="xref" href="warning-options">Options to Request or Suppress Warnings</a>. </p> <p>The macro <code class="code">__STRICT_ANSI__</code> is predefined when the <samp class="option">-ansi</samp> option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ISO standard doesn’t call for; this is to avoid interfering with any programs that might use these names for other things. </p> <p>Functions that are normally built in but do not have semantics defined by ISO C (such as <code class="code">alloca</code> and <code class="code">ffs</code>) are not built-in functions when <samp class="option">-ansi</samp> is used. See <a class="xref" href="other-builtins">Other built-in functions provided by GCC</a>, for details of the functions affected. </p> </dd> <dt>
<span><code class="code">-std=</code><a class="copiable-link" href="#index-std-1"> ¶</a></span>
</dt> <dd>
<p>Determine the language standard. See <a class="xref" href="standards">Language Standards Supported by GCC</a>, for details of these standard versions. This option is currently only supported when compiling C or C++. </p> <p>The compiler can accept several base standards, such as ‘<samp class="samp">c90</samp>’ or ‘<samp class="samp">c++98</samp>’, and GNU dialects of those standards, such as ‘<samp class="samp">gnu90</samp>’ or ‘<samp class="samp">gnu++98</samp>’. When a base standard is specified, the compiler accepts all programs following that standard plus those using GNU extensions that do not contradict it. For example, <samp class="option">-std=c90</samp> turns off certain features of GCC that are incompatible with ISO C90, such as the <code class="code">asm</code> and <code class="code">typeof</code> keywords, but not other GNU extensions that do not have a meaning in ISO C90, such as omitting the middle term of a <code class="code">?:</code> expression. On the other hand, when a GNU dialect of a standard is specified, all features supported by the compiler are enabled, even when those features change the meaning of the base standard. As a result, some strict-conforming programs may be rejected. The particular standard is used by <samp class="option">-Wpedantic</samp> to identify which features are GNU extensions given that version of the standard. For example <samp class="option">-std=gnu90 -Wpedantic</samp> warns about C++ style ‘<samp class="samp">//</samp>’ comments, while <samp class="option">-std=gnu99 -Wpedantic</samp> does not. </p> <p>A value for this option must be provided; possible values are </p> <dl class="table"> <dt>‘<samp class="samp">c90</samp>’</dt> <dt>‘<samp class="samp">c89</samp>’</dt> <dt>‘<samp class="samp">iso9899:1990</samp>’</dt> <dd>
<p>Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are disabled). Same as <samp class="option">-ansi</samp> for C code. </p> </dd> <dt>‘<samp class="samp">iso9899:199409</samp>’</dt> <dd>
<p>ISO C90 as modified in amendment 1. </p> </dd> <dt>‘<samp class="samp">c99</samp>’</dt> <dt>‘<samp class="samp">c9x</samp>’</dt> <dt>‘<samp class="samp">iso9899:1999</samp>’</dt> <dt>‘<samp class="samp">iso9899:199x</samp>’</dt> <dd>
<p>ISO C99. This standard is substantially completely supported, modulo bugs and floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G). See <a class="uref" href="https://gcc.gnu.org/c99status.html">https://gcc.gnu.org/c99status.html</a> for more information. The names ‘<samp class="samp">c9x</samp>’ and ‘<samp class="samp">iso9899:199x</samp>’ are deprecated. </p> </dd> <dt>‘<samp class="samp">c11</samp>’</dt> <dt>‘<samp class="samp">c1x</samp>’</dt> <dt>‘<samp class="samp">iso9899:2011</samp>’</dt> <dd>
<p>ISO C11, the 2011 revision of the ISO C standard. This standard is substantially completely supported, modulo bugs, floating-point issues (mainly but not entirely relating to optional C11 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability). The name ‘<samp class="samp">c1x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c17</samp>’</dt> <dt>‘<samp class="samp">c18</samp>’</dt> <dt>‘<samp class="samp">iso9899:2017</samp>’</dt> <dt>‘<samp class="samp">iso9899:2018</samp>’</dt> <dd>
<p>ISO C17, the 2017 revision of the ISO C standard (published in 2018). This standard is same as C11 except for corrections of defects (all of which are also applied with <samp class="option">-std=c11</samp>) and a new value of <code class="code">__STDC_VERSION__</code>, and so is supported to the same extent as C11. </p> </dd> <dt>‘<samp class="samp">c2x</samp>’</dt> <dd>
<p>The next version of the ISO C standard, still under development. The support for this version is experimental and incomplete. </p> </dd> <dt>‘<samp class="samp">gnu90</samp>’</dt> <dt>‘<samp class="samp">gnu89</samp>’</dt> <dd>
<p>GNU dialect of ISO C90 (including some C99 features). </p> </dd> <dt>‘<samp class="samp">gnu99</samp>’</dt> <dt>‘<samp class="samp">gnu9x</samp>’</dt> <dd>
<p>GNU dialect of ISO C99. The name ‘<samp class="samp">gnu9x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu11</samp>’</dt> <dt>‘<samp class="samp">gnu1x</samp>’</dt> <dd>
<p>GNU dialect of ISO C11. The name ‘<samp class="samp">gnu1x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu17</samp>’</dt> <dt>‘<samp class="samp">gnu18</samp>’</dt> <dd>
<p>GNU dialect of ISO C17. This is the default for C code. </p> </dd> <dt>‘<samp class="samp">gnu2x</samp>’</dt> <dd>
<p>The next version of the ISO C standard, still under development, plus GNU extensions. The support for this version is experimental and incomplete. </p> </dd> <dt>‘<samp class="samp">c++98</samp>’</dt> <dt>‘<samp class="samp">c++03</samp>’</dt> <dd>
<p>The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect reports. Same as <samp class="option">-ansi</samp> for C++ code. </p> </dd> <dt>‘<samp class="samp">gnu++98</samp>’</dt> <dt>‘<samp class="samp">gnu++03</samp>’</dt> <dd>
<p>GNU dialect of <samp class="option">-std=c++98</samp>. </p> </dd> <dt>‘<samp class="samp">c++11</samp>’</dt> <dt>‘<samp class="samp">c++0x</samp>’</dt> <dd>
<p>The 2011 ISO C++ standard plus amendments. The name ‘<samp class="samp">c++0x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++11</samp>’</dt> <dt>‘<samp class="samp">gnu++0x</samp>’</dt> <dd>
<p>GNU dialect of <samp class="option">-std=c++11</samp>. The name ‘<samp class="samp">gnu++0x</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++14</samp>’</dt> <dt>‘<samp class="samp">c++1y</samp>’</dt> <dd>
<p>The 2014 ISO C++ standard plus amendments. The name ‘<samp class="samp">c++1y</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++14</samp>’</dt> <dt>‘<samp class="samp">gnu++1y</samp>’</dt> <dd>
<p>GNU dialect of <samp class="option">-std=c++14</samp>. The name ‘<samp class="samp">gnu++1y</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++17</samp>’</dt> <dt>‘<samp class="samp">c++1z</samp>’</dt> <dd>
<p>The 2017 ISO C++ standard plus amendments. The name ‘<samp class="samp">c++1z</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++17</samp>’</dt> <dt>‘<samp class="samp">gnu++1z</samp>’</dt> <dd>
<p>GNU dialect of <samp class="option">-std=c++17</samp>. This is the default for C++ code. The name ‘<samp class="samp">gnu++1z</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++20</samp>’</dt> <dt>‘<samp class="samp">c++2a</samp>’</dt> <dd>
<p>The 2020 ISO C++ standard plus amendments. Support is experimental, and could change in incompatible ways in future releases. The name ‘<samp class="samp">c++2a</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">gnu++20</samp>’</dt> <dt>‘<samp class="samp">gnu++2a</samp>’</dt> <dd>
<p>GNU dialect of <samp class="option">-std=c++20</samp>. Support is experimental, and could change in incompatible ways in future releases. The name ‘<samp class="samp">gnu++2a</samp>’ is deprecated. </p> </dd> <dt>‘<samp class="samp">c++2b</samp>’</dt> <dt>‘<samp class="samp">c++23</samp>’</dt> <dd>
<p>The next revision of the ISO C++ standard, planned for 2023. Support is highly experimental, and will almost certainly change in incompatible ways in future releases. </p> </dd> <dt>‘<samp class="samp">gnu++2b</samp>’</dt> <dt>‘<samp class="samp">gnu++23</samp>’</dt> <dd><p>GNU dialect of <samp class="option">-std=c++2b</samp>. Support is highly experimental, and will almost certainly change in incompatible ways in future releases. </p></dd> </dl> </dd> <dt>
<span><code class="code">-aux-info <var class="var">filename</var></code><a class="copiable-link" href="#index-aux-info"> ¶</a></span>
</dt> <dd>
<p>Output to the given filename prototyped declarations for all functions declared and/or defined in a translation unit, including those in header files. This option is silently ignored in any language other than C. </p> <p>Besides declarations, the file indicates, in comments, the origin of each declaration (source file and line), whether the declaration was implicit, prototyped or unprototyped (‘<samp class="samp">I</samp>’, ‘<samp class="samp">N</samp>’ for new or ‘<samp class="samp">O</samp>’ for old, respectively, in the first character after the line number and the colon), and whether it came from a declaration or a definition (‘<samp class="samp">C</samp>’ or ‘<samp class="samp">F</samp>’, respectively, in the following character). In the case of function definitions, a K&amp;R-style list of arguments followed by their declarations is also provided, inside comments, after the declaration. </p> </dd> <dt>
 <span><code class="code">-fno-asm</code><a class="copiable-link" href="#index-fno-asm"> ¶</a></span>
</dt> <dd>
<p>Do not recognize <code class="code">asm</code>, <code class="code">inline</code> or <code class="code">typeof</code> as a keyword, so that code can use these words as identifiers. You can use the keywords <code class="code">__asm__</code>, <code class="code">__inline__</code> and <code class="code">__typeof__</code> instead. In C, <samp class="option">-ansi</samp> implies <samp class="option">-fno-asm</samp>. </p> <p>In C++, <code class="code">inline</code> is a standard keyword and is not affected by this switch. You may want to use the <samp class="option">-fno-gnu-keywords</samp> flag instead, which disables <code class="code">typeof</code> but not <code class="code">asm</code> and <code class="code">inline</code>. In C99 mode (<samp class="option">-std=c99</samp> or <samp class="option">-std=gnu99</samp>), this switch only affects the <code class="code">asm</code> and <code class="code">typeof</code> keywords, since <code class="code">inline</code> is a standard keyword in ISO C99. In C2X mode (<samp class="option">-std=c2x</samp> or <samp class="option">-std=gnu2x</samp>), this switch only affects the <code class="code">asm</code> keyword, since <code class="code">typeof</code> is a standard keyword in ISO C2X. </p> </dd> <dt>
  <span><code class="code">-fno-builtin</code><a class="copiable-link" href="#index-fno-builtin"> ¶</a></span>
</dt> <dt><code class="code">-fno-builtin-<var class="var">function</var></code></dt> <dd>
<p>Don’t recognize built-in functions that do not begin with ‘<samp class="samp">__builtin_</samp>’ as prefix. See <a class="xref" href="other-builtins">Other built-in functions provided by GCC</a>, for details of the functions affected, including those which are not built-in functions when <samp class="option">-ansi</samp> or <samp class="option">-std</samp> options for strict ISO C conformance are used because they do not have an ISO standard meaning. </p> <p>GCC normally generates special code to handle certain built-in functions more efficiently; for instance, calls to <code class="code">alloca</code> may become single instructions which adjust the stack directly, and calls to <code class="code">memcpy</code> may become inline copy loops. The resulting code is often both smaller and faster, but since the function calls no longer appear as such, you cannot set a breakpoint on those calls, nor can you change the behavior of the functions by linking with a different library. In addition, when a function is recognized as a built-in function, GCC may use information about that function to warn about problems with calls to that function, or to generate more efficient code, even if the resulting code still contains calls to that function. For example, warnings are given with <samp class="option">-Wformat</samp> for bad calls to <code class="code">printf</code> when <code class="code">printf</code> is built in and <code class="code">strlen</code> is known not to modify global memory. </p> <p>With the <samp class="option">-fno-builtin-<var class="var">function</var></samp> option only the built-in function <var class="var">function</var> is disabled. <var class="var">function</var> must not begin with ‘<samp class="samp">__builtin_</samp>’. If a function is named that is not built-in in this version of GCC, this option is ignored. There is no corresponding <samp class="option">-fbuiltin-<var class="var">function</var></samp> option; if you wish to enable built-in functions selectively when using <samp class="option">-fno-builtin</samp> or <samp class="option">-ffreestanding</samp>, you may define macros such as: </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">#define abs(n)          __builtin_abs ((n))
#define strcpy(d, s)    __builtin_strcpy ((d), (s))</pre>
</div> </dd> <dt>
<span><code class="code">-fcond-mismatch</code><a class="copiable-link" href="#index-fcond-mismatch"> ¶</a></span>
</dt> <dd>
<p>Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void. This option is not supported for C++. </p> </dd> <dt>
 <span><code class="code">-ffreestanding</code><a class="copiable-link" href="#index-ffreestanding-1"> ¶</a></span>
</dt> <dd> <p>Assert that compilation targets a freestanding environment. This implies <samp class="option">-fno-builtin</samp>. A freestanding environment is one in which the standard library may not exist, and program startup may not necessarily be at <code class="code">main</code>. The most obvious example is an OS kernel. This is equivalent to <samp class="option">-fno-hosted</samp>. </p> <p>See <a class="xref" href="standards">Language Standards Supported by GCC</a>, for details of freestanding and hosted environments. </p> </dd> <dt>
<span><code class="code">-fgimple</code><a class="copiable-link" href="#index-fgimple"> ¶</a></span>
</dt> <dd> <p>Enable parsing of function definitions marked with <code class="code">__GIMPLE</code>. This is an experimental feature that allows unit testing of GIMPLE passes. </p> </dd> <dt>
<span><code class="code">-fgnu-tm</code><a class="copiable-link" href="#index-fgnu-tm"> ¶</a></span>
</dt> <dd>
<p>When the option <samp class="option">-fgnu-tm</samp> is specified, the compiler generates code for the Linux variant of Intel’s current Transactional Memory ABI specification document (Revision 1.1, May 6 2009). This is an experimental feature whose interface may change in future versions of GCC, as the official specification changes. Please note that not all architectures are supported for this feature. </p> <p>For more information on GCC’s support for transactional memory, See <a data-manual="libitm" href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/libitm_html/Enabling-libitm.html#Enabling-libitm">The GNU Transactional Memory Library</a> in GNU Transactional Memory Library. </p> <p>Note that the transactional memory feature is not supported with non-call exceptions (<samp class="option">-fnon-call-exceptions</samp>). </p> </dd> <dt>
<span><code class="code">-fgnu89-inline</code><a class="copiable-link" href="#index-fgnu89-inline"> ¶</a></span>
</dt> <dd>
<p>The option <samp class="option">-fgnu89-inline</samp> tells GCC to use the traditional GNU semantics for <code class="code">inline</code> functions when in C99 mode. See <a class="xref" href="inline">An Inline Function is As Fast As a Macro</a>. Using this option is roughly equivalent to adding the <code class="code">gnu_inline</code> function attribute to all inline functions (see <a class="pxref" href="function-attributes">Declaring Attributes of Functions</a>). </p> <p>The option <samp class="option">-fno-gnu89-inline</samp> explicitly tells GCC to use the C99 semantics for <code class="code">inline</code> when in C99 or gnu99 mode (i.e., it specifies the default behavior). This option is not supported in <samp class="option">-std=c90</samp> or <samp class="option">-std=gnu90</samp> mode. </p> <p>The preprocessor macros <code class="code">__GNUC_GNU_INLINE__</code> and <code class="code">__GNUC_STDC_INLINE__</code> may be used to check which semantics are in effect for <code class="code">inline</code> functions. See <a data-manual="cpp" href="https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros">Common Predefined Macros</a> in The C Preprocessor. </p> </dd> <dt>
 <span><code class="code">-fhosted</code><a class="copiable-link" href="#index-fhosted"> ¶</a></span>
</dt> <dd> <p>Assert that compilation targets a hosted environment. This implies <samp class="option">-fbuiltin</samp>. A hosted environment is one in which the entire standard library is available, and in which <code class="code">main</code> has a return type of <code class="code">int</code>. Examples are nearly everything except a kernel. This is equivalent to <samp class="option">-fno-freestanding</samp>. </p> </dd> <dt>
<span><code class="code">-flax-vector-conversions</code><a class="copiable-link" href="#index-flax-vector-conversions"> ¶</a></span>
</dt> <dd>
<p>Allow implicit conversions between vectors with differing numbers of elements and/or incompatible element types. This option should not be used for new code. </p> </dd> <dt>
<span><code class="code">-fms-extensions</code><a class="copiable-link" href="#index-fms-extensions"> ¶</a></span>
</dt> <dd>
<p>Accept some non-standard constructs used in Microsoft header files. </p> <p>In C++ code, this allows member names in structures to be similar to previous types declarations. </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">typedef int UOW;
struct ABC {
  UOW UOW;
};</pre>
</div> <p>Some cases of unnamed fields in structures and unions are only accepted with this option. See <a class="xref" href="unnamed-fields">Unnamed struct/union fields within structs/unions</a>, for details. </p> <p>Note that this option is off for all targets except for x86 targets using ms-abi. </p> </dd> <dt>
   <span><code class="code">-foffload=disable</code><a class="copiable-link" href="#index-foffload"> ¶</a></span>
</dt> <dt><code class="code">-foffload=default</code></dt> <dt><code class="code">-foffload=<var class="var">target-list</var></code></dt> <dd>
<p>Specify for which OpenMP and OpenACC offload targets code should be generated. The default behavior, equivalent to <samp class="option">-foffload=default</samp>, is to generate code for all supported offload targets. The <samp class="option">-foffload=disable</samp> form generates code only for the host fallback, while <samp class="option">-foffload=<var class="var">target-list</var></samp> generates code only for the specified comma-separated list of offload targets. </p> <p>Offload targets are specified in GCC’s internal target-triplet format. You can run the compiler with <samp class="option">-v</samp> to show the list of configured offload targets under <code class="code">OFFLOAD_TARGET_NAMES</code>. </p> </dd> <dt>
   <span><code class="code">-foffload-options=<var class="var">options</var></code><a class="copiable-link" href="#index-foffload-options"> ¶</a></span>
</dt> <dt><code class="code">-foffload-options=<var class="var">target-triplet-list</var>=<var class="var">options</var></code></dt> <dd> <p>With <samp class="option">-foffload-options=<var class="var">options</var></samp>, GCC passes the specified <var class="var">options</var> to the compilers for all enabled offloading targets. You can specify options that apply only to a specific target or targets by using the <samp class="option">-foffload-options=<var class="var">target-list</var>=<var class="var">options</var></samp> form. The <var class="var">target-list</var> is a comma-separated list in the same format as for the <samp class="option">-foffload=</samp> option. </p> <p>Typical command lines are </p> <div class="example smallexample"> <pre class="example-preformatted" data-language="cpp">-foffload-options=-lgfortran -foffload-options=-lm
-foffload-options="-lgfortran -lm" -foffload-options=nvptx-none=-latomic
-foffload-options=amdgcn-amdhsa=-march=gfx906 -foffload-options=-lm</pre>
</div> </dd> <dt>
 <span><code class="code">-fopenacc</code><a class="copiable-link" href="#index-fopenacc"> ¶</a></span>
</dt> <dd>
<p>Enable handling of OpenACC directives <code class="code">#pragma acc</code> in C/C++ and <code class="code">!$acc</code> in Fortran. When <samp class="option">-fopenacc</samp> is specified, the compiler generates accelerated code according to the OpenACC Application Programming Interface v2.6 <a class="uref" href="https://www.openacc.org">https://www.openacc.org</a>. This option implies <samp class="option">-pthread</samp>, and thus is only supported on targets that have support for <samp class="option">-pthread</samp>. </p> </dd> <dt>
 <span><code class="code">-fopenacc-dim=<var class="var">geom</var></code><a class="copiable-link" href="#index-fopenacc-dim"> ¶</a></span>
</dt> <dd>
<p>Specify default compute dimensions for parallel offload regions that do not explicitly specify. The <var class="var">geom</var> value is a triple of ’:’-separated sizes, in order ’gang’, ’worker’ and, ’vector’. A size can be omitted, to use a target-specific default value. </p> </dd> <dt>
 <span><code class="code">-fopenmp</code><a class="copiable-link" href="#index-fopenmp"> ¶</a></span>
</dt> <dd>
<p>Enable handling of OpenMP directives <code class="code">#pragma omp</code> in C/C++, <code class="code">[[omp::directive(...)]]</code> and <code class="code">[[omp::sequence(...)]]</code> in C++ and <code class="code">!$omp</code> in Fortran. When <samp class="option">-fopenmp</samp> is specified, the compiler generates parallel code according to the OpenMP Application Program Interface v4.5 <a class="uref" href="https://www.openmp.org">https://www.openmp.org</a>. This option implies <samp class="option">-pthread</samp>, and thus is only supported on targets that have support for <samp class="option">-pthread</samp>. <samp class="option">-fopenmp</samp> implies <samp class="option">-fopenmp-simd</samp>. </p> </dd> <dt>
  <span><code class="code">-fopenmp-simd</code><a class="copiable-link" href="#index-fopenmp-simd"> ¶</a></span>
</dt> <dd>
<p>Enable handling of OpenMP’s <code class="code">simd</code>, <code class="code">declare simd</code>, <code class="code">declare reduction</code>, <code class="code">assume</code>, <code class="code">ordered</code>, <code class="code">scan</code>, <code class="code">loop</code> directives and combined or composite directives with <code class="code">simd</code> as constituent with <code class="code">#pragma omp</code> in C/C++, <code class="code">[[omp::directive(...)]]</code> and <code class="code">[[omp::sequence(...)]]</code> in C++ and <code class="code">!$omp</code> in Fortran. Other OpenMP directives are ignored. </p> </dd> <dt>
 <span><code class="code">-fopenmp-target-simd-clone</code><a class="copiable-link" href="#index-fopenmp-target-simd-clone"> ¶</a></span>
</dt> <dt><code class="code">-fopenmp-target-simd-clone=<var class="var">device-type</var></code></dt> <dd>
<p>In addition to generating SIMD clones for functions marked with the <code class="code">declare simd</code> directive, GCC also generates clones for functions marked with the OpenMP <code class="code">declare target</code> directive that are suitable for vectorization when this option is in effect. The <var class="var">device-type</var> may be one of <code class="code">none</code>, <code class="code">host</code>, <code class="code">nohost</code>, and <code class="code">any</code>, which correspond to keywords for the <code class="code">device_type</code> clause of the <code class="code">declare target</code> directive; clones are generated for the intersection of devices specified. <samp class="option">-fopenmp-target-simd-clone</samp> is equivalent to <samp class="option">-fopenmp-target-simd-clone=any</samp> and <samp class="option">-fno-openmp-target-simd-clone</samp> is equivalent to <samp class="option">-fopenmp-target-simd-clone=none</samp>. </p> <p>At <samp class="option">-O2</samp> and higher (but not <samp class="option">-Os</samp> or <samp class="option">-Og</samp>) this optimization defaults to <samp class="option">-fopenmp-target-simd-clone=nohost</samp>; otherwise it is disabled by default. </p> </dd> <dt>
  <span><code class="code">-fpermitted-flt-eval-methods=<var class="var">style</var></code><a class="copiable-link" href="#index-fpermitted-flt-eval-methods"> ¶</a></span>
</dt> <dd>
<p>ISO/IEC TS 18661-3 defines new permissible values for <code class="code">FLT_EVAL_METHOD</code> that indicate that operations and constants with a semantic type that is an interchange or extended format should be evaluated to the precision and range of that type. These new values are a superset of those permitted under C99/C11, which does not specify the meaning of other positive values of <code class="code">FLT_EVAL_METHOD</code>. As such, code conforming to C11 may not have been written expecting the possibility of the new values. </p> <p><samp class="option">-fpermitted-flt-eval-methods</samp> specifies whether the compiler should allow only the values of <code class="code">FLT_EVAL_METHOD</code> specified in C99/C11, or the extended set of values specified in ISO/IEC TS 18661-3. </p> <p><var class="var">style</var> is either <code class="code">c11</code> or <code class="code">ts-18661-3</code> as appropriate. </p> <p>The default when in a standards compliant mode (<samp class="option">-std=c11</samp> or similar) is <samp class="option">-fpermitted-flt-eval-methods=c11</samp>. The default when in a GNU dialect (<samp class="option">-std=gnu11</samp> or similar) is <samp class="option">-fpermitted-flt-eval-methods=ts-18661-3</samp>. </p> </dd> <dt>
<span><code class="code">-fplan9-extensions</code><a class="copiable-link" href="#index-fplan9-extensions"> ¶</a></span>
</dt> <dd>
<p>Accept some non-standard constructs used in Plan 9 code. </p> <p>This enables <samp class="option">-fms-extensions</samp>, permits passing pointers to structures with anonymous fields to functions that expect pointers to elements of the type of the field, and permits referring to anonymous fields declared using a typedef. See <a class="xref" href="unnamed-fields">Unnamed struct/union fields within structs/unions</a>, for details. This is only supported for C, not C++. </p> </dd> <dt>
   <span><code class="code">-fsigned-bitfields</code><a class="copiable-link" href="#index-fsigned-bitfields"> ¶</a></span>
</dt> <dt><code class="code">-funsigned-bitfields</code></dt> <dt><code class="code">-fno-signed-bitfields</code></dt> <dt><code class="code">-fno-unsigned-bitfields</code></dt> <dd>
<p>These options control whether a bit-field is signed or unsigned, when the declaration does not use either <code class="code">signed</code> or <code class="code">unsigned</code>. By default, such a bit-field is signed, because this is consistent: the basic integer types such as <code class="code">int</code> are signed types. </p> </dd> <dt>
<span><code class="code">-fsigned-char</code><a class="copiable-link" href="#index-fsigned-char"> ¶</a></span>
</dt> <dd>
<p>Let the type <code class="code">char</code> be signed, like <code class="code">signed char</code>. </p> <p>Note that this is equivalent to <samp class="option">-fno-unsigned-char</samp>, which is the negative form of <samp class="option">-funsigned-char</samp>. Likewise, the option <samp class="option">-fno-signed-char</samp> is equivalent to <samp class="option">-funsigned-char</samp>. </p> </dd> <dt>
<span><code class="code">-funsigned-char</code><a class="copiable-link" href="#index-funsigned-char"> ¶</a></span>
</dt> <dd>
<p>Let the type <code class="code">char</code> be unsigned, like <code class="code">unsigned char</code>. </p> <p>Each kind of machine has a default for what <code class="code">char</code> should be. It is either like <code class="code">unsigned char</code> by default or like <code class="code">signed char</code> by default. </p> <p>Ideally, a portable program should always use <code class="code">signed char</code> or <code class="code">unsigned char</code> when it depends on the signedness of an object. But many programs have been written to use plain <code class="code">char</code> and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default. </p> <p>The type <code class="code">char</code> is always a distinct type from each of <code class="code">signed char</code> or <code class="code">unsigned char</code>, even though its behavior is always just like one of those two. </p> </dd> <dt>
 <span><code class="code">-fstrict-flex-arrays</code><a class="copiable-link" href="#index-fstrict-flex-arrays"> ¶</a></span>
</dt> <dd>
<p>Control when to treat the trailing array of a structure as a flexible array member for the purpose of accessing the elements of such an array. The positive form is equivalent to <samp class="option">-fstrict-flex-arrays=3</samp>, which is the strictest. A trailing array is treated as a flexible array member only when it is declared as a flexible array member per C99 standard onwards. The negative form is equivalent to <samp class="option">-fstrict-flex-arrays=0</samp>, which is the least strict. All trailing arrays of structures are treated as flexible array members. </p> </dd> <dt>
<span><code class="code">-fstrict-flex-arrays=<var class="var">level</var></code><a class="copiable-link" href="#index-fstrict-flex-arrays_003dlevel"> ¶</a></span>
</dt> <dd>
<p>Control when to treat the trailing array of a structure as a flexible array member for the purpose of accessing the elements of such an array. The value of <var class="var">level</var> controls the level of strictness. </p> <p>The possible values of <var class="var">level</var> are the same as for the <code class="code">strict_flex_array</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> <p>You can control this behavior for a specific trailing array field of a structure by using the variable attribute <code class="code">strict_flex_array</code> attribute (see <a class="pxref" href="variable-attributes">Specifying Attributes of Variables</a>). </p> </dd> <dt>
<span><code class="code">-fsso-struct=<var class="var">endianness</var></code><a class="copiable-link" href="#index-fsso-struct"> ¶</a></span>
</dt> <dd>
<p>Set the default scalar storage order of structures and unions to the specified endianness. The accepted values are ‘<samp class="samp">big-endian</samp>’, ‘<samp class="samp">little-endian</samp>’ and ‘<samp class="samp">native</samp>’ for the native endianness of the target (the default). This option is not supported for C++. </p> <p><strong class="strong">Warning:</strong> the <samp class="option">-fsso-struct</samp> switch causes GCC to generate code that is not binary compatible with code generated without it if the specified endianness is not the native endianness of the target. </p>
</dd> </dl> </div>  <div class="nav-panel"> <p> Next: <a href="c_002b_002b-dialect-options">Options Controlling C++ Dialect</a>, Previous: <a href="invoking-g_002b_002b">Compiling C++ Programs</a>, Up: <a href="invoking-gcc">GCC Command Options</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
  <p class="_attribution-p">
    &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
    <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Dialect-Options.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C-Dialect-Options.html</a>
  </p>
</div>