Daily bump.
[official-gcc.git] / gcc / doc / invoke.texi
blobdc4c5a3189d774dcc385b6f088dad8b7cee6d248
1 @c Copyright (C) 1988-2024 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2024 Free Software Foundation, Inc.
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below).  A copy of the license is
19 included in the gfdl(7) man page.
21 (a) The FSF's Front-Cover Text is:
23      A GNU Manual
25 (b) The FSF's Back-Cover Text is:
27      You have freedom to copy and modify this GNU Manual, like GNU
28      software.  Copies published by the Free Software Foundation raise
29      funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37     [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41     [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43 Only the most useful options are listed here; see below for the
44 remainder.  @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{https://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking.  The ``overall options'' allow you to stop this
72 process at an intermediate stage.  For example, the @option{-c} option
73 says not to run the linker.  Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
77 Other options are passed on to one or more stages of processing.  Some options
78 control the preprocessor and others the compiler itself.  Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly.  If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++} 
98 instead.  @xref{Invoking G++,,Compiling C++ Programs}, 
99 for information about the differences in behavior between @command{gcc} 
100 and @command{g++} when compiling C++ programs.
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands.  Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments.  For the most part, the order
112 you use doesn't matter.  Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified.  Also,
115 the placement of the @option{-l} option is significant.
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on.  Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}.  This manual documents
122 only one of these two forms, whichever one is not the default.
124 Some options take one or more arguments typically separated either
125 by a space or by the equals sign (@samp{=}) from the option name.
126 Unless documented otherwise, an argument can be either numeric or
127 a string.  Numeric arguments must typically be small unsigned decimal
128 or hexadecimal integers.  Hexadecimal arguments must begin with
129 the @samp{0x} prefix.  Arguments to options that specify a size
130 threshold of some sort may be arbitrarily large decimal or hexadecimal
131 integers followed by a byte size suffix designating a multiple of bytes
132 such as @code{kB} and @code{KiB} for kilobyte and kibibyte, respectively,
133 @code{MB} and @code{MiB} for megabyte and mebibyte, @code{GB} and
134 @code{GiB} for gigabyte and gigibyte, and so on.  Such arguments are
135 designated by @var{byte-size} in the following text.  Refer to the NIST,
136 IEC, and other relevant national and international standards for the full
137 listing and explanation of the binary and decimal byte size prefixes.
139 @c man end
141 @xref{Option Index}, for an index to GCC's options.
143 @menu
144 * Option Summary::      Brief list of all options, without explanations.
145 * Overall Options::     Controlling the kind of output:
146                         an executable, object files, assembler files,
147                         or preprocessed source.
148 * Invoking G++::        Compiling C++ programs.
149 * C Dialect Options::   Controlling the variant of C language compiled.
150 * C++ Dialect Options:: Variations on C++.
151 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
152                         and Objective-C++.
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
154                         be formatted.
155 * Warning Options::     How picky should the compiler be?
156 * Static Analyzer Options:: More expensive warnings.
157 * Debugging Options::   Producing debuggable code.
158 * Optimize Options::    How much optimization?
159 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
160 * Preprocessor Options:: Controlling header files and macro definitions.
161                          Also, getting dependency information for Make.
162 * Assembler Options::   Passing options to the assembler.
163 * Link Options::        Specifying libraries and so on.
164 * Directory Options::   Where to find header files and libraries.
165                         Where to find the compiler executable files.
166 * Code Gen Options::    Specifying conventions for function calls, data layout
167                         and register usage.
168 * Developer Options::   Printing GCC configuration info, statistics, and
169                         debugging dumps.
170 * Submodel Options::    Target-specific options, such as compiling for a
171                         specific processor variant.
172 * Spec Files::          How to pass switches to sub-processes.
173 * Environment Variables:: Env vars that affect GCC.
174 * Precompiled Headers:: Compiling a header once, and using it many times.
175 * C++ Modules::         Experimental C++20 module system.
176 @end menu
178 @c man begin OPTIONS
180 @node Option Summary
181 @section Option Summary
183 Here is a summary of all the options, grouped by type.  Explanations are
184 in the following sections.
186 @table @emph
187 @item Overall Options
188 @xref{Overall Options,,Options Controlling the Kind of Output}.
189 @gccoptlist{-c  -S  -E  -o @var{file}
190 -dumpbase @var{dumpbase}  -dumpbase-ext @var{auxdropsuf}
191 -dumpdir @var{dumppfx}  -x @var{language}
192 -v  -###  --help@r{[}=@var{class}@r{[},@dots{}@r{]]}  --target-help  --version
193 -pass-exit-codes  -pipe  -specs=@var{file}  -wrapper
194 @@@var{file}  -ffile-prefix-map=@var{old}=@var{new}  -fcanon-prefix-map
195 -fplugin=@var{file}  -fplugin-arg-@var{name}=@var{arg}
196 -fdump-ada-spec@r{[}-slim@r{]}  -fada-spec-parent=@var{unit}  -fdump-go-spec=@var{file}}
198 @item C Language Options
199 @xref{C Dialect Options,,Options Controlling C Dialect}.
200 @gccoptlist{-ansi  -std=@var{standard}  -aux-info @var{filename}
201 -fno-asm
202 -fno-builtin  -fno-builtin-@var{function}  -fcond-mismatch
203 -ffreestanding  -fgimple  -fgnu-tm  -fgnu89-inline  -fhosted
204 -flax-vector-conversions  -fms-extensions
205 -foffload=@var{arg}  -foffload-options=@var{arg}
206 -fopenacc  -fopenacc-dim=@var{geom}
207 -fopenmp  -fopenmp-simd  -fopenmp-target-simd-clone@r{[}=@var{device-type}@r{]}
208 -fpermitted-flt-eval-methods=@var{standard}
209 -fplan9-extensions  -fsigned-bitfields  -funsigned-bitfields
210 -fsigned-char  -funsigned-char  -fstrict-flex-arrays[=@var{n}]
211 -fsso-struct=@var{endianness}}
213 @item C++ Language Options
214 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
215 @gccoptlist{-fabi-version=@var{n}  -fno-access-control
216 -faligned-new=@var{n}  -fargs-in-order=@var{n}  -fchar8_t  -fcheck-new
217 -fconstexpr-depth=@var{n}  -fconstexpr-cache-depth=@var{n}
218 -fconstexpr-loop-limit=@var{n}  -fconstexpr-ops-limit=@var{n}
219 -fno-elide-constructors
220 -fno-enforce-eh-specs
221 -fno-gnu-keywords
222 -fno-immediate-escalation
223 -fno-implicit-templates
224 -fno-implicit-inline-templates
225 -fno-implement-inlines
226 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts
227 -fmodule-implicit-inline
228 -fno-module-lazy
229 -fmodule-mapper=@var{specification}
230 -fmodule-version-ignore
231 -fms-extensions
232 -fnew-inheriting-ctors
233 -fnew-ttp-matching
234 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names
235 -fno-optional-diags
236 -fno-pretty-templates
237 -fno-rtti  -fsized-deallocation
238 -ftemplate-backtrace-limit=@var{n}
239 -ftemplate-depth=@var{n}
240 -fno-threadsafe-statics  -fuse-cxa-atexit
241 -fno-weak  -nostdinc++
242 -fvisibility-inlines-hidden
243 -fvisibility-ms-compat
244 -fext-numeric-literals
245 -flang-info-include-translate@r{[}=@var{header}@r{]}
246 -flang-info-include-translate-not
247 -flang-info-module-cmi@r{[}=@var{module}@r{]}
248 -stdlib=@var{libstdc++,libc++}
249 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n}
250 -Wno-class-conversion  -Wclass-memaccess
251 -Wcomma-subscript  -Wconditionally-supported
252 -Wno-conversion-null  -Wctad-maybe-unsupported
253 -Wctor-dtor-privacy  -Wdangling-reference
254 -Wno-delete-incomplete
255 -Wdelete-non-virtual-dtor  -Wno-deprecated-array-compare
256 -Wdeprecated-copy -Wdeprecated-copy-dtor
257 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion
258 -Weffc++ -Wno-elaborated-enum-base
259 -Wno-exceptions -Wextra-semi -Wno-global-module -Wno-inaccessible-base
260 -Wno-inherited-variadic-ctor  -Wno-init-list-lifetime
261 -Winvalid-constexpr -Winvalid-imported-macros
262 -Wno-invalid-offsetof  -Wno-literal-suffix
263 -Wmismatched-new-delete -Wmismatched-tags
264 -Wmultiple-inheritance  -Wnamespaces  -Wnarrowing
265 -Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor
266 -Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n}
267 -Wrange-loop-construct -Wredundant-move -Wredundant-tags
268 -Wreorder  -Wregister
269 -Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates
270 -Wno-non-template-friend  -Wold-style-cast
271 -Woverloaded-virtual  -Wno-pmf-conversions -Wself-move -Wsign-promo
272 -Wsized-deallocation  -Wsuggest-final-methods
273 -Wsuggest-final-types  -Wsuggest-override  -Wno-template-id-cdtor
274 -Wno-terminate  -Wno-vexing-parse  -Wvirtual-inheritance
275 -Wno-virtual-move-assign  -Wvolatile  -Wzero-as-null-pointer-constant}
277 @item Objective-C and Objective-C++ Language Options
278 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
279 Objective-C and Objective-C++ Dialects}.
280 @gccoptlist{-fconstant-string-class=@var{class-name}
281 -fgnu-runtime  -fnext-runtime
282 -fno-nil-receivers
283 -fobjc-abi-version=@var{n}
284 -fobjc-call-cxx-cdtors
285 -fobjc-direct-dispatch
286 -fobjc-exceptions
287 -fobjc-gc
288 -fobjc-nilcheck
289 -fobjc-std=objc1
290 -fno-local-ivars
291 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
292 -freplace-objc-classes
293 -fzero-link
294 -gen-decls
295 -Wassign-intercept  -Wno-property-assign-default
296 -Wno-protocol -Wobjc-root-class -Wselector
297 -Wstrict-selector-match
298 -Wundeclared-selector}
300 @item Diagnostic Message Formatting Options
301 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
302 @gccoptlist{-fmessage-length=@var{n}
303 -fdiagnostics-plain-output
304 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}
305 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]}
306 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]}
307 -fdiagnostics-format=@r{[}text@r{|}sarif-stderr@r{|}sarif-file@r{|}json@r{|}json-stderr@r{|}json-file@r{]}
308 -fno-diagnostics-json-formatting
309 -fno-diagnostics-show-option  -fno-diagnostics-show-caret
310 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers
311 -fno-diagnostics-show-cwe
312 -fno-diagnostics-show-rule
313 -fdiagnostics-minimum-margin-width=@var{width}
314 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch
315 -fdiagnostics-show-template-tree  -fno-elide-type
316 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]}
317 -fdiagnostics-show-path-depths
318 -fno-show-column
319 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]}
320 -fdiagnostics-column-origin=@var{origin}
321 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}
322 -fdiagnostics-text-art-charset=@r{[}none@r{|}ascii@r{|}unicode@r{|}emoji@r{]}}
324 @item Warning Options
325 @xref{Warning Options,,Options to Request or Suppress Warnings}.
326 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic
327 -pedantic-errors -fpermissive
328 -w  -Wextra  -Wall  -Wabi=@var{n}
329 -Waddress  -Wno-address-of-packed-member  -Waggregate-return
330 -Walloc-size  -Walloc-size-larger-than=@var{byte-size}  -Walloc-zero
331 -Walloca  -Walloca-larger-than=@var{byte-size}
332 -Wno-aggressive-loop-optimizations
333 -Warith-conversion
334 -Warray-bounds  -Warray-bounds=@var{n}  -Warray-compare
335 -Warray-parameter  -Warray-parameter=@var{n}
336 -Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias
337 -Wno-attribute-warning
338 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
339 -Wbool-compare  -Wbool-operation
340 -Wno-builtin-declaration-mismatch
341 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat
342 -Wc11-c23-compat
343 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat
344 -Wc++20-compat
345 -Wno-c++11-extensions  -Wno-c++14-extensions -Wno-c++17-extensions
346 -Wno-c++20-extensions  -Wno-c++23-extensions
347 -Wcalloc-transposed-args
348 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual
349 -Wchar-subscripts
350 -Wclobbered  -Wcomment
351 -Wcompare-distinct-pointer-types
352 -Wno-complain-wrong-lang
353 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp
354 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}
355 -Wdate-time
356 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init
357 -Wdisabled-optimization
358 -Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers
359 -Wno-div-by-zero  -Wdouble-promotion
360 -Wduplicated-branches  -Wduplicated-cond
361 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion
362 -Wenum-int-mismatch
363 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors
364 -Wflex-array-member-not-at-end
365 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2
366 -Wno-format-contains-nul  -Wno-format-extra-args
367 -Wformat-nonliteral  -Wformat-overflow=@var{n}
368 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n}
369 -Wformat-y2k  -Wframe-address
370 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object
371 -Wno-if-not-aligned  -Wno-ignored-attributes
372 -Wignored-qualifiers  -Wno-incompatible-pointer-types  -Whardened
373 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n}
374 -Wno-implicit-function-declaration  -Wno-implicit-int
375 -Winfinite-recursion
376 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context
377 -Wno-int-to-pointer-cast  -Wno-invalid-memory-model
378 -Winvalid-pch  -Winvalid-utf8  -Wno-unicode  -Wjump-misses-init
379 -Wlarger-than=@var{byte-size}  -Wlogical-not-parentheses  -Wlogical-op
380 -Wlong-long  -Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized
381 -Wmemset-elt-size  -Wmemset-transposed-args
382 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces
383 -Wmissing-field-initializers  -Wmissing-format-attribute
384 -Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile
385 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare
386 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
387 -Wnull-dereference  -Wno-odr
388 -Wopenacc-parallelism
389 -Wopenmp -Wopenmp-simd
390 -Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects
391 -Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded
392 -Wparentheses  -Wno-pedantic-ms-format
393 -Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast
394 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls
395 -Wrestrict  -Wno-return-local-addr  -Wreturn-type
396 -Wno-scalar-storage-order  -Wsequence-point
397 -Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local
398 -Wno-shadow-ivar
399 -Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value
400 -Wno-shift-overflow  -Wshift-overflow=@var{n}
401 -Wsign-compare  -Wsign-conversion
402 -Wno-sizeof-array-argument
403 -Wsizeof-array-div
404 -Wsizeof-pointer-div  -Wsizeof-pointer-memaccess
405 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing
406 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n}
407 -Wstring-compare
408 -Wno-stringop-overflow -Wno-stringop-overread
409 -Wno-stringop-truncation  -Wstrict-flex-arrays
410 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]}
411 -Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum
412 -Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand
413 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs
414 -Wtrivial-auto-var-init  -Wno-tsan  -Wtype-limits  -Wundef
415 -Wuninitialized  -Wunknown-pragmas
416 -Wunsuffixed-float-constants  -Wunused
417 -Wunused-but-set-parameter  -Wunused-but-set-variable
418 -Wunused-const-variable  -Wunused-const-variable=@var{n}
419 -Wunused-function  -Wunused-label  -Wunused-local-typedefs
420 -Wunused-macros
421 -Wunused-parameter  -Wno-unused-result
422 -Wunused-value  -Wunused-variable
423 -Wuse-after-free  -Wuse-after-free=@var{n}  -Wuseless-cast
424 -Wno-varargs  -Wvariadic-macros
425 -Wvector-operation-performance
426 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than
427 -Wvolatile-register-var  -Wwrite-strings
428 -Wno-xor-used-as-pow
429 -Wzero-length-bounds}
431 @item Static Analyzer Options
432 @gccoptlist{
433 -fanalyzer
434 -fanalyzer-call-summaries
435 -fanalyzer-checker=@var{name}
436 -fno-analyzer-feasibility
437 -fanalyzer-fine-grained
438 -fanalyzer-show-events-in-system-headers
439 -fno-analyzer-state-merge
440 -fno-analyzer-state-purge
441 -fno-analyzer-suppress-followups
442 -fanalyzer-transitivity
443 -fno-analyzer-undo-inlining
444 -fanalyzer-verbose-edges
445 -fanalyzer-verbose-state-changes
446 -fanalyzer-verbosity=@var{level}
447 -fdump-analyzer
448 -fdump-analyzer-callgraph
449 -fdump-analyzer-exploded-graph
450 -fdump-analyzer-exploded-nodes
451 -fdump-analyzer-exploded-nodes-2
452 -fdump-analyzer-exploded-nodes-3
453 -fdump-analyzer-exploded-paths
454 -fdump-analyzer-feasibility
455 -fdump-analyzer-infinite-loop
456 -fdump-analyzer-json
457 -fdump-analyzer-state-purge
458 -fdump-analyzer-stderr
459 -fdump-analyzer-supergraph
460 -fdump-analyzer-untracked
461 -Wno-analyzer-double-fclose
462 -Wno-analyzer-double-free
463 -Wno-analyzer-exposure-through-output-file
464 -Wno-analyzer-exposure-through-uninit-copy
465 -Wno-analyzer-fd-access-mode-mismatch
466 -Wno-analyzer-fd-double-close
467 -Wno-analyzer-fd-leak
468 -Wno-analyzer-fd-phase-mismatch
469 -Wno-analyzer-fd-type-mismatch
470 -Wno-analyzer-fd-use-after-close
471 -Wno-analyzer-fd-use-without-check
472 -Wno-analyzer-file-leak
473 -Wno-analyzer-free-of-non-heap
474 -Wno-analyzer-imprecise-fp-arithmetic
475 -Wno-analyzer-infinite-loop
476 -Wno-analyzer-infinite-recursion
477 -Wno-analyzer-jump-through-null
478 -Wno-analyzer-malloc-leak
479 -Wno-analyzer-mismatching-deallocation
480 -Wno-analyzer-null-argument
481 -Wno-analyzer-null-dereference
482 -Wno-analyzer-out-of-bounds
483 -Wno-analyzer-overlapping-buffers
484 -Wno-analyzer-possible-null-argument
485 -Wno-analyzer-possible-null-dereference
486 -Wno-analyzer-putenv-of-auto-var
487 -Wno-analyzer-shift-count-negative
488 -Wno-analyzer-shift-count-overflow
489 -Wno-analyzer-stale-setjmp-buffer
490 -Wno-analyzer-tainted-allocation-size
491 -Wno-analyzer-tainted-assertion
492 -Wno-analyzer-tainted-array-index
493 -Wno-analyzer-tainted-divisor
494 -Wno-analyzer-tainted-offset
495 -Wno-analyzer-tainted-size
496 -Wanalyzer-symbol-too-complex
497 -Wanalyzer-too-complex
498 -Wno-analyzer-undefined-behavior-strtok
499 -Wno-analyzer-unsafe-call-within-signal-handler
500 -Wno-analyzer-use-after-free
501 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
502 -Wno-analyzer-use-of-uninitialized-value
503 -Wno-analyzer-va-arg-type-mismatch
504 -Wno-analyzer-va-list-exhausted
505 -Wno-analyzer-va-list-leak
506 -Wno-analyzer-va-list-use-after-va-end
507 -Wno-analyzer-write-to-const
508 -Wno-analyzer-write-to-string-literal
511 @item C and Objective-C-only Warning Options
512 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations
513 -Wmissing-parameter-type -Wdeclaration-missing-parameter-type
514 -Wmissing-prototypes -Wmissing-variable-declarations
515 -Wnested-externs -Wold-style-declaration  -Wold-style-definition
516 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion
517 -Wdeclaration-after-statement  -Wpointer-sign}
519 @item Debugging Options
520 @xref{Debugging Options,,Options for Debugging Your Program}.
521 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version}
522 -gbtf -gctf  -gctf@var{level}
523 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches
524 -gstrict-dwarf  -gno-strict-dwarf
525 -gas-loc-support  -gno-as-loc-support
526 -gas-locview-support  -gno-as-locview-support
527 -gcodeview
528 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64
529 -gstatement-frontiers  -gno-statement-frontiers
530 -gvariable-location-views  -gno-variable-location-views
531 -ginternal-reset-location-views  -gno-internal-reset-location-views
532 -ginline-points  -gno-inline-points
533 -gvms -gz@r{[}=@var{type}@r{]}
534 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies
535 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section
536 -fno-eliminate-unused-debug-types
537 -femit-struct-debug-baseonly  -femit-struct-debug-reduced
538 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
539 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always
540 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm
541 -fvar-tracking  -fvar-tracking-assignments}
543 @item Optimization Options
544 @xref{Optimize Options,,Options that Control Optimization}.
545 @gccoptlist{-faggressive-loop-optimizations
546 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
547 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
548 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
549 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
550 -fmin-function-alignment=[@var{n}]
551 -fno-allocation-dce -fallow-store-data-races
552 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}]
553 -fauto-inc-dec  -fbranch-probabilities
554 -fcaller-saves
555 -fcombine-stack-adjustments  -fconserve-stack
556 -ffold-mem-offsets
557 -fcompare-elim  -fcprop-registers  -fcrossjumping
558 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules
559 -fcx-limited-range
560 -fdata-sections  -fdce  -fdelayed-branch
561 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively
562 -fdevirtualize-at-ltrans  -fdse
563 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects
564 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style}
565 -ffinite-loops
566 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections
567 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity
568 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion
569 -fif-conversion2  -findirect-inlining
570 -finline-stringops[=@var{fn}]
571 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n}
572 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone
573 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const
574 -fipa-reference  -fipa-reference-addressable
575 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm}
576 -flive-patching=@var{level}
577 -fira-region=@var{region}  -fira-hoist-pressure
578 -fira-loop-pressure  -fno-ira-share-save-slots
579 -fno-ira-share-spill-slots
580 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute
581 -fivopts  -fkeep-inline-functions  -fkeep-static-functions
582 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage
583 -floop-block  -floop-interchange  -floop-strip-mine
584 -floop-unroll-and-jam  -floop-nest-optimize
585 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level
586 -flto-partition=@var{alg}  -fmerge-all-constants
587 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves
588 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg
589 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse
590 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole
591 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock
592 -fno-sched-spec  -fno-signed-zeros
593 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss
594 -fomit-frame-pointer  -foptimize-sibling-calls
595 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning
596 -fprefetch-loop-arrays
597 -fprofile-correction
598 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training
599 -fprofile-values -fprofile-reorder-functions
600 -freciprocal-math  -free  -frename-registers  -freorder-blocks
601 -freorder-blocks-algorithm=@var{algorithm}
602 -freorder-blocks-and-partition  -freorder-functions
603 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops
604 -frounding-math  -fsave-optimization-record
605 -fsched2-use-superblocks  -fsched-pressure
606 -fsched-spec-load  -fsched-spec-load-dangerous
607 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}]
608 -fsched-group-heuristic  -fsched-critical-path-heuristic
609 -fsched-spec-insn-heuristic  -fsched-rank-heuristic
610 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic
611 -fschedule-fusion
612 -fschedule-insns  -fschedule-insns2  -fsection-anchors
613 -fselective-scheduling  -fselective-scheduling2
614 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops
615 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate
616 -fsignaling-nans
617 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops
618 -fsplit-paths
619 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
620 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
621 -fthread-jumps  -ftracer  -ftree-bit-ccp
622 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
623 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
624 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
625 -ftree-loop-if-convert  -ftree-loop-im
626 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
627 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize
628 -ftree-loop-vectorize
629 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta
630 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra
631 -ftree-switch-conversion  -ftree-tail-merge
632 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init
633 -funconstrained-commons -funit-at-a-time  -funroll-all-loops
634 -funroll-loops -funsafe-math-optimizations  -funswitch-loops
635 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt
636 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs
637 --param @var{name}=@var{value}
638 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
640 @item Program Instrumentation Options
641 @xref{Instrumentation Options,,Program Instrumentation Options}.
642 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage
643 -fcondition-coverage
644 -fprofile-abs-path
645 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path}
646 -fprofile-info-section  -fprofile-info-section=@var{name}
647 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
648 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
649 -fprofile-exclude-files=@var{regex}
650 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
651 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style}
652 -fsanitize-trap   -fsanitize-trap=@var{style}
653 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},...
654 -fsanitize-undefined-trap-on-error  -fbounds-check
655 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
656 -fharden-compares -fharden-conditional-branches  -fhardened
657 -fharden-control-flow-redundancy  -fhardcfr-skip-leaf
658 -fhardcfr-check-exceptions  -fhardcfr-check-returning-calls
659 -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
660 -fstack-protector  -fstack-protector-all  -fstack-protector-strong
661 -fstack-protector-explicit  -fstack-check
662 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym}
663 -fno-stack-limit  -fsplit-stack
664 -fstrub=disable  -fstrub=strict  -fstrub=relaxed
665 -fstrub=all  -fstrub=at-calls  -fstrub=internal
666 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
667 -fvtv-counts  -fvtv-debug
668 -finstrument-functions  -finstrument-functions-once
669 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
670 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
671 -fprofile-prefix-map=@var{old}=@var{new}
672 -fpatchable-function-entry=@var{N}@r{[},@var{M}@r{]}}
674 @item Preprocessor Options
675 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
676 @gccoptlist{-A@var{question}=@var{answer}
677 -A-@var{question}@r{[}=@var{answer}@r{]}
678 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]}
679 -dD  -dI  -dM  -dN  -dU
680 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers
681 -fexec-charset=@var{charset}  -fextended-identifiers
682 -finput-charset=@var{charset}  -flarge-source-files
683 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
684 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess
685 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion
686 -fwide-exec-charset=@var{charset}  -fworking-directory
687 -H  -imacros @var{file}  -include @var{file}
688 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules
689 -no-integrated-cpp  -P  -pthread  -remap
690 -traditional  -traditional-cpp  -trigraphs
691 -U@var{macro}  -undef
692 -Wp,@var{option}  -Xpreprocessor @var{option}}
694 @item Assembler Options
695 @xref{Assembler Options,,Passing Options to the Assembler}.
696 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
698 @item Linker Options
699 @xref{Link Options,,Options for Linking}.
700 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library}
701 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++
702 -e @var{entry}  --entry=@var{entry}
703 -pie  -pthread  -r  -rdynamic
704 -s  -static  -static-pie  -static-libgcc  -static-libstdc++
705 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan
706 -shared  -shared-libgcc  -symbolic
707 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option}
708 -u @var{symbol}  -z @var{keyword}}
710 @item Directory Options
711 @xref{Directory Options,,Options for Directory Search}.
712 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-
713 -idirafter @var{dir}
714 -imacros @var{file}  -imultilib @var{dir}
715 -iplugindir=@var{dir}  -iprefix @var{file}
716 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir}
717 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}
718 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix
719 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
721 @item Code Generation Options
722 @xref{Code Gen Options,,Options for Code Generation Conventions}.
723 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg}
724 -ffixed-@var{reg}  -fexceptions
725 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables
726 -fasynchronous-unwind-tables
727 -fno-gnu-unique
728 -finhibit-size-directive  -fcommon  -fno-ident
729 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt
730 -fno-jump-tables -fno-bit-tests
731 -frecord-gcc-switches
732 -freg-struct-return  -fshort-enums  -fshort-wchar
733 -fverbose-asm  -fpack-struct[=@var{n}]
734 -fleading-underscore  -ftls-model=@var{model}
735 -fstack-reuse=@var{reuse_level}
736 -ftrampolines -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
737 -ftrapv  -fwrapv
738 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
739 -fstrict-volatile-bitfields  -fsync-libcalls}
741 @item Developer Options
742 @xref{Developer Options,,GCC Developer Options}.
743 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion
744 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
745 -fchecking  -fchecking=@var{n}
746 -fdbg-cnt-list  -fdbg-cnt=@var{counter-value-list}
747 -fdisable-ipa-@var{pass_name}
748 -fdisable-rtl-@var{pass_name}
749 -fdisable-rtl-@var{pass-name}=@var{range-list}
750 -fdisable-tree-@var{pass_name}
751 -fdisable-tree-@var{pass-name}=@var{range-list}
752 -fdump-debug  -fdump-earlydebug
753 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links
754 -fdump-final-insns@r{[}=@var{file}@r{]}
755 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline
756 -fdump-lang-all
757 -fdump-lang-@var{switch}
758 -fdump-lang-@var{switch}-@var{options}
759 -fdump-lang-@var{switch}-@var{options}=@var{filename}
760 -fdump-passes
761 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename}
762 -fdump-statistics
763 -fdump-tree-all
764 -fdump-tree-@var{switch}
765 -fdump-tree-@var{switch}-@var{options}
766 -fdump-tree-@var{switch}-@var{options}=@var{filename}
767 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second
768 -fenable-@var{kind}-@var{pass}
769 -fenable-@var{kind}-@var{pass}=@var{range-list}
770 -fira-verbose=@var{n}
771 -flto-report  -flto-report-wpa  -fmem-report-wpa
772 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report
773 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]}
774 -fmultiflags  -fprofile-report
775 -frandom-seed=@var{string}  -fsched-verbose=@var{n}
776 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose
777 -fstats  -fstack-usage  -ftime-report  -ftime-report-details
778 -fvar-tracking-assignments-toggle  -gtoggle
779 -print-file-name=@var{library}  -print-libgcc-file-name
780 -print-multi-directory  -print-multi-lib  -print-multi-os-directory
781 -print-prog-name=@var{program}  -print-search-dirs  -Q
782 -print-sysroot  -print-sysroot-headers-suffix
783 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
785 @item Machine-Dependent Options
786 @xref{Submodel Options,,Machine-Dependent Options}.
787 @c This list is ordered alphanumerically by subsection name.
788 @c Try and put the significant identifier (CPU or system) first,
789 @c so users have a clue at guessing where the ones they want will be.
791 @emph{AArch64 Options}
792 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian
793 -mgeneral-regs-only
794 -mcmodel=tiny  -mcmodel=small  -mcmodel=large
795 -mstrict-align  -mno-strict-align
796 -momit-leaf-frame-pointer
797 -mtls-dialect=desc  -mtls-dialect=traditional
798 -mtls-size=@var{size}
799 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419
800 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div
801 -mpc-relative-literal-loads
802 -msign-return-address=@var{scope}
803 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
804 +@var{b-key}]|@var{bti}
805 -mharden-sls=@var{opts}
806 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}
807 -moverride=@var{string}  -mverbose-cost-dump
808 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
809 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
810 -moutline-atomics -mearly-ldp-fusion -mlate-ldp-fusion}
812 @emph{Adapteva Epiphany Options}
813 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs
814 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf
815 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num}
816 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16
817 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num}
818 -msplit-vecmove-early  -m1reg-@var{reg}}
820 @emph{AMD GCN Options}
821 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
823 @emph{ARC Options}
824 @gccoptlist{-mbarrel-shifter  -mjli-always
825 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700
826 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr
827 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic
828 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap
829 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape
830 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof
831 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved
832 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num}
833 -mvolatile-cache  -mtp-regno=@var{regno}
834 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc
835 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi
836 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none
837 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode
838 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level}
839 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame
840 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo}
841 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
843 @emph{ARM Options}
844 @gccoptlist{-mapcs-frame  -mno-apcs-frame
845 -mabi=@var{name}
846 -mapcs-stack-check  -mno-apcs-stack-check
847 -mapcs-reentrant  -mno-apcs-reentrant
848 -mgeneral-regs-only
849 -msched-prolog  -mno-sched-prolog
850 -mlittle-endian  -mbig-endian
851 -mbe8  -mbe32
852 -mfloat-abi=@var{name}
853 -mfp16-format=@var{name}
854 -mthumb-interwork  -mno-thumb-interwork
855 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}
856 -mtune=@var{name}  -mprint-tune-info
857 -mstructure-size-boundary=@var{n}
858 -mabort-on-noreturn
859 -mlong-calls  -mno-long-calls
860 -msingle-pic-base  -mno-single-pic-base
861 -mpic-register=@var{reg}
862 -mnop-fun-dllimport
863 -mpoke-function-name
864 -mthumb  -marm  -mflip-thumb
865 -mtpcs-frame  -mtpcs-leaf-frame
866 -mcaller-super-interworking  -mcallee-super-interworking
867 -mtp=@var{name}  -mtls-dialect=@var{dialect}
868 -mword-relocations
869 -mfix-cortex-m3-ldrd
870 -mfix-cortex-a57-aes-1742098
871 -mfix-cortex-a72-aes-1655431
872 -munaligned-access
873 -mneon-for-64bits
874 -mslow-flash-data
875 -masm-syntax-unified
876 -mrestrict-it
877 -mverbose-cost-dump
878 -mpure-code
879 -mcmse
880 -mfix-cmse-cve-2021-35465
881 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
882 -mfdpic
883 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
884 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
886 @emph{AVR Options}
887 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args
888 -mbranch-cost=@var{cost}  -mfuse-add=@var{level}
889 -mcall-prologues  -mgas-isr-prologues  -mint8  -mflmap
890 -mdouble=@var{bits}  -mlong-double=@var{bits}
891 -mn_flash=@var{size}  -mno-interrupts
892 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack
893 -mrodata-in-ram  -mfract-convert-truncate
894 -mshort-calls  -mskip-bug  -nodevicelib  -nodevicespecs
895 -Waddr-space-convert  -Wmisspelled-isr}
897 @emph{Blackfin Options}
898 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
899 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer
900 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly
901 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library
902 -mno-id-shared-library  -mshared-library-id=@var{n}
903 -mleaf-id-shared-library  -mno-leaf-id-shared-library
904 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls
905 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram
906 -micplb}
908 @emph{C6X Options}
909 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu}
910 -msim  -msdata=@var{sdata-type}}
912 @emph{CRIS Options}
913 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
914 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
915 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects
916 -mstack-align  -mdata-align  -mconst-align
917 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue
918 -melf  -maout  -sim  -sim2
919 -mmul-bug-workaround  -mno-mul-bug-workaround}
921 @emph{C-SKY Options}
922 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}
923 -mbig-endian  -EB  -mlittle-endian  -EL
924 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu
925 -mfloat-abi=@var{name}
926 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust
927 -mdsp  -medsp  -mvdsp
928 -mdiv  -msmart  -mhigh-registers  -manchor
929 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt
930 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
932 @emph{Darwin Options}
933 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal
934 -arch_only  -bind_at_load  -bundle  -bundle_loader
935 -client_name  -compatibility_version  -current_version
936 -dead_strip
937 -dependency-file  -dylib_file  -dylinker_install_name
938 -dynamic  -dynamiclib  -exported_symbols_list
939 -filelist  -flat_namespace  -force_cpusubtype_ALL
940 -force_flat_namespace  -headerpad_max_install_names
941 -iframework
942 -image_base  -init  -install_name  -keep_private_externs
943 -multi_module  -multiply_defined  -multiply_defined_unused
944 -noall_load   -no_dead_strip_inits_and_terms -nodefaultrpaths
945 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit
946 -pagezero_size  -prebind  -prebind_all_twolevel_modules
947 -private_bundle  -read_only_relocs  -sectalign
948 -sectobjectsymbols  -whyload  -seg1addr
949 -sectcreate  -sectobjectsymbols  -sectorder
950 -segaddr  -segs_read_only_addr  -segs_read_write_addr
951 -seg_addr_table  -seg_addr_table_filename  -seglinkedit
952 -segprot  -segs_read_only_addr  -segs_read_write_addr
953 -single_module  -static  -sub_library  -sub_umbrella
954 -twolevel_namespace  -umbrella  -undefined
955 -unexported_symbols_list  -weak_reference_mismatches
956 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version}
957 -mkernel  -mone-byte-bool}
959 @emph{DEC Alpha Options}
960 @gccoptlist{-mno-fp-regs  -msoft-float
961 -mieee  -mieee-with-inexact  -mieee-conformant
962 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
963 -mtrap-precision=@var{mode}  -mbuild-constants
964 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}
965 -mbwx  -mmax  -mfix  -mcix
966 -mfloat-vax  -mfloat-ieee
967 -mexplicit-relocs  -msmall-data  -mlarge-data
968 -msmall-text  -mlarge-text
969 -mmemory-latency=@var{time}}
971 @emph{eBPF Options}
972 @gccoptlist{-mbig-endian -mlittle-endian
973 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
974 -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
975 -masm=@var{dialect} -minline-memops-threshold=@var{bytes}}
977 @emph{FR30 Options}
978 @gccoptlist{-msmall-model  -mno-lsim}
980 @emph{FT32 Options}
981 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
983 @emph{FRV Options}
984 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64
985 -mhard-float  -msoft-float
986 -malloc-cc  -mfixed-cc  -mdword  -mno-dword
987 -mdouble  -mno-double
988 -mmedia  -mno-media  -mmuladd  -mno-muladd
989 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic
990 -mlinked-fp  -mlong-calls  -malign-labels
991 -mlibrary-pic  -macc-4  -macc-8
992 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move
993 -moptimize-membar  -mno-optimize-membar
994 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec
995 -mvliw-branch  -mno-vliw-branch
996 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec
997 -mno-nested-cond-exec  -mtomcat-stats
998 -mTLS  -mtls
999 -mcpu=@var{cpu}}
1001 @emph{GNU/Linux Options}
1002 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid
1003 -tno-android-cc  -tno-android-ld}
1005 @emph{H8/300 Options}
1006 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
1008 @emph{HPPA Options}
1009 @gccoptlist{-march=@var{architecture-type}
1010 -matomic-libcalls  -mbig-switch
1011 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing
1012 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld
1013 -mfixed-range=@var{register-range}
1014 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls
1015 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs
1016 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
1017 -mno-jump-in-delay  -mno-long-load-store
1018 -mno-portable-runtime  -mno-soft-float
1019 -mno-space-regs  -msoft-float  -mpa-risc-1-0
1020 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime
1021 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio
1022 -munix=@var{unix-std}  -nolibdld  -static  -threads}
1024 @emph{IA-64 Options}
1025 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic
1026 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata
1027 -mconstant-gp  -mauto-pic  -mfused-madd
1028 -minline-float-divide-min-latency
1029 -minline-float-divide-max-throughput
1030 -mno-inline-float-divide
1031 -minline-int-divide-min-latency
1032 -minline-int-divide-max-throughput
1033 -mno-inline-int-divide
1034 -minline-sqrt-min-latency  -minline-sqrt-max-throughput
1035 -mno-inline-sqrt
1036 -mdwarf2-asm  -mearly-stop-bits
1037 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size}
1038 -mtune=@var{cpu-type}  -milp32  -mlp64
1039 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec
1040 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec
1041 -msched-spec-ldc  -msched-spec-control-ldc
1042 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns
1043 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path
1044 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost
1045 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1047 @emph{LM32 Options}
1048 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled
1049 -msign-extend-enabled  -muser-enabled}
1051 @emph{LoongArch Options}
1052 @gccoptlist{-march=@var{arch-type}  -mtune=@var{tune-type} -mabi=@var{base-abi-type}
1053 -mfpu=@var{fpu-type} -msimd=@var{simd-type}
1054 -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx
1055 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1056 -mcond-move-int  -mno-cond-move-int
1057 -mcond-move-float  -mno-cond-move-float
1058 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1059 -mmax-inline-memcpy-size=@var{n}
1060 -mexplicit-relocs=@var{style} -mexplicit-relocs -mno-explicit-relocs
1061 -mdirect-extern-access -mno-direct-extern-access
1062 -mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as
1063 -mrecip  -mrecip=@var{opt} -mfrecipe -mno-frecipe -mdiv32 -mno-div32
1064 -mlam-bh -mno-lam-bh -mlamcas -mno-lamcas -mld-seq-sa -mno-ld-seq-sa
1065 -mtls-dialect=@var{opt}}
1067 @emph{M32R/D Options}
1068 @gccoptlist{-m32r2  -m32rx  -m32r
1069 -mdebug
1070 -malign-loops  -mno-align-loops
1071 -missue-rate=@var{number}
1072 -mbranch-cost=@var{number}
1073 -mmodel=@var{code-size-model-type}
1074 -msdata=@var{sdata-type}
1075 -mno-flush-func  -mflush-func=@var{name}
1076 -mno-flush-trap  -mflush-trap=@var{number}
1077 -G @var{num}}
1079 @emph{M32C Options}
1080 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1082 @emph{M680x0 Options}
1083 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1084 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1085 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1086 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1087 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1088 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1089 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1090 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1091 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1093 @emph{MCore Options}
1094 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1095 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1096 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1097 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1098 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1100 @emph{MicroBlaze Options}
1101 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1102 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1103 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1104 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1105 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1106 -mpic-data-is-text-relative}
1108 @emph{MIPS Options}
1109 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1110 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1111 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1112 -mips16  -mno-mips16  -mflip-mips16
1113 -minterlink-compressed  -mno-interlink-compressed
1114 -minterlink-mips16  -mno-interlink-mips16
1115 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1116 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1117 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1118 -mno-float  -msingle-float  -mdouble-float
1119 -modd-spreg  -mno-odd-spreg
1120 -mabs=@var{mode}  -mnan=@var{encoding}
1121 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1122 -mmcu  -mmno-mcu
1123 -meva  -mno-eva
1124 -mvirt  -mno-virt
1125 -mxpa  -mno-xpa
1126 -mcrc  -mno-crc
1127 -mginv  -mno-ginv
1128 -mmicromips  -mno-micromips
1129 -mmsa  -mno-msa
1130 -mloongson-mmi  -mno-loongson-mmi
1131 -mloongson-ext  -mno-loongson-ext
1132 -mloongson-ext2  -mno-loongson-ext2
1133 -mfpu=@var{fpu-type}
1134 -msmartmips  -mno-smartmips
1135 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1136 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1137 -mlong64  -mlong32  -msym32  -mno-sym32
1138 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1139 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1140 -membedded-data  -mno-embedded-data
1141 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1142 -mcode-readable=@var{setting}
1143 -msplit-addresses  -mno-split-addresses
1144 -mexplicit-relocs  -mno-explicit-relocs
1145 -mexplicit-relocs=@var{release}
1146 -mcheck-zero-division  -mno-check-zero-division
1147 -mdivide-traps  -mdivide-breaks
1148 -mload-store-pairs  -mno-load-store-pairs
1149 -mstrict-align  -mno-strict-align
1150 -mno-unaligned-access  -munaligned-access
1151 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1152 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1153 -mfix-24k  -mno-fix-24k
1154 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1155 -mfix-r5900  -mno-fix-r5900
1156 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1157 -mfix-vr4120  -mno-fix-vr4120
1158 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1159 -mflush-func=@var{func}  -mno-flush-func
1160 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1161 -mcompact-branches=@var{policy}
1162 -mfp-exceptions  -mno-fp-exceptions
1163 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1164 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1165 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1166 -mframe-header-opt  -mno-frame-header-opt}
1168 @emph{MMIX Options}
1169 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1170 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1171 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1172 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1174 @emph{MN10300 Options}
1175 @gccoptlist{-mmult-bug  -mno-mult-bug
1176 -mno-am33  -mam33  -mam33-2  -mam34
1177 -mtune=@var{cpu-type}
1178 -mreturn-pointer-on-d0
1179 -mno-crt0  -mrelax  -mliw  -msetlb}
1181 @emph{Moxie Options}
1182 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1184 @emph{MSP430 Options}
1185 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1186 -mwarn-mcu
1187 -mcode-region=  -mdata-region=
1188 -msilicon-errata=  -msilicon-errata-warn=
1189 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1191 @emph{NDS32 Options}
1192 @gccoptlist{-mbig-endian  -mlittle-endian
1193 -mreduced-regs  -mfull-regs
1194 -mcmov  -mno-cmov
1195 -mext-perf  -mno-ext-perf
1196 -mext-perf2  -mno-ext-perf2
1197 -mext-string  -mno-ext-string
1198 -mv3push  -mno-v3push
1199 -m16bit  -mno-16bit
1200 -misr-vector-size=@var{num}
1201 -mcache-block-size=@var{num}
1202 -march=@var{arch}
1203 -mcmodel=@var{code-model}
1204 -mctor-dtor  -mrelax}
1206 @emph{Nios II Options}
1207 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1208 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1209 -mel  -meb
1210 -mno-bypass-cache  -mbypass-cache
1211 -mno-cache-volatile  -mcache-volatile
1212 -mno-fast-sw-div  -mfast-sw-div
1213 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1214 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1215 -mcustom-fpu-cfg=@var{name}
1216 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1217 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1219 @emph{Nvidia PTX Options}
1220 @gccoptlist{-m64  -mmainkernel  -moptimize}
1222 @emph{OpenRISC Options}
1223 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1224 -msoft-mul  -msoft-div
1225 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1226 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1227 -mcmodel=@var{code-model}}
1229 @emph{PDP-11 Options}
1230 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1231 -mint32  -mno-int16  -mint16  -mno-int32
1232 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1234 @emph{PowerPC Options}
1235 See RS/6000 and PowerPC Options.
1237 @emph{PRU Options}
1238 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1239 -mabi=@var{variant}}
1241 @emph{RISC-V Options}
1242 @gccoptlist{-mbranch-cost=@var{N-instruction}
1243 -mplt  -mno-plt
1244 -mabi=@var{ABI-string}
1245 -mfdiv  -mno-fdiv
1246 -mdiv  -mno-div
1247 -misa-spec=@var{ISA-spec-string}
1248 -march=@var{ISA-string}
1249 -mtune=@var{processor-string}
1250 -mpreferred-stack-boundary=@var{num}
1251 -msmall-data-limit=@var{N-bytes}
1252 -msave-restore  -mno-save-restore
1253 -mshorten-memrefs  -mno-shorten-memrefs
1254 -mstrict-align  -mno-strict-align
1255 -mcmodel=medlow  -mcmodel=medany -mcmodel=large
1256 -mexplicit-relocs  -mno-explicit-relocs
1257 -mrelax  -mno-relax
1258 -mriscv-attribute  -mno-riscv-attribute
1259 -malign-data=@var{type}
1260 -mbig-endian  -mlittle-endian
1261 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1262 -mstack-protector-guard-offset=@var{offset}
1263 -mcsr-check -mno-csr-check
1264 -mmovcc  -mno-movcc
1265 -minline-atomics  -mno-inline-atomics
1266 -minline-strlen  -mno-inline-strlen
1267 -minline-strcmp  -mno-inline-strcmp
1268 -minline-strncmp  -mno-inline-strncmp
1269 -mtls-dialect=desc  -mtls-dialect=trad}
1271 @emph{RL78 Options}
1272 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1273 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1274 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1276 @emph{RS/6000 and PowerPC Options}
1277 @gccoptlist{-mcpu=@var{cpu-type}
1278 -mtune=@var{cpu-type}
1279 -mcmodel=@var{code-model}
1280 -mpowerpc64
1281 -maltivec  -mno-altivec
1282 -mpowerpc-gpopt  -mno-powerpc-gpopt
1283 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1284 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1285 -mfprnd  -mno-fprnd
1286 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1287 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1288 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1289 -malign-power  -malign-natural
1290 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1291 -mupdate  -mno-update
1292 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1293 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1294 -mstrict-align  -mno-strict-align  -mrelocatable
1295 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1296 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1297 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1298 -mprioritize-restricted-insns=@var{priority}
1299 -msched-costly-dep=@var{dependence_type}
1300 -minsert-sched-nops=@var{scheme}
1301 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1302 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1303 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1304 -mtraceback=@var{traceback_type}
1305 -maix-struct-return  -msvr4-struct-return
1306 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1307 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1308 -mblock-move-inline-limit=@var{num}
1309 -mblock-compare-inline-limit=@var{num}
1310 -mblock-compare-inline-loop-limit=@var{num}
1311 -mno-block-ops-unaligned-vsx
1312 -mstring-compare-inline-limit=@var{num}
1313 -misel  -mno-isel
1314 -mvrsave  -mno-vrsave
1315 -mmulhw  -mno-mulhw
1316 -mdlmzb  -mno-dlmzb
1317 -mprototype  -mno-prototype
1318 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1319 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1320 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1321 -mno-recip-precision
1322 -mveclibabi=@var{type}  -mfriz  -mno-friz
1323 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1324 -msave-toc-indirect  -mno-save-toc-indirect
1325 -mpower8-fusion  -mno-mpower8-fusion
1326 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1327 -mquad-memory  -mno-quad-memory
1328 -mquad-memory-atomic  -mno-quad-memory-atomic
1329 -mcompat-align-parm  -mno-compat-align-parm
1330 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1331 -mgnu-attribute  -mno-gnu-attribute
1332 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1333 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1334 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1335 -mprivileged -mno-privileged}
1337 @emph{RX Options}
1338 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1339 -mcpu=
1340 -mbig-endian-data  -mlittle-endian-data
1341 -msmall-data
1342 -msim  -mno-sim
1343 -mas100-syntax  -mno-as100-syntax
1344 -mrelax
1345 -mmax-constant-size=
1346 -mint-register=
1347 -mpid
1348 -mallow-string-insns  -mno-allow-string-insns
1349 -mjsr
1350 -mno-warn-multiple-fast-interrupts
1351 -msave-acc-in-interrupts}
1353 @emph{S/390 and zSeries Options}
1354 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1355 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1356 -mlong-double-64  -mlong-double-128
1357 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1358 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1359 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1360 -mhtm  -mvx  -mzvector
1361 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1362 -mfused-madd  -mno-fused-madd
1363 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1364 -mhotpatch=@var{halfwords},@var{halfwords}}
1366 @emph{SH Options}
1367 @gccoptlist{-m1  -m2  -m2e
1368 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1369 -m3  -m3e
1370 -m4-nofpu  -m4-single-only  -m4-single  -m4
1371 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1372 -mb  -ml  -mdalign  -mrelax
1373 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1374 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1375 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1376 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1377 -maccumulate-outgoing-args
1378 -matomic-model=@var{atomic-model}
1379 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1380 -mcbranch-force-delay-slot
1381 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1382 -mpretend-cmove  -mtas}
1384 @emph{Solaris 2 Options}
1385 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1386 -pthreads}
1388 @emph{SPARC Options}
1389 @gccoptlist{-mcpu=@var{cpu-type}
1390 -mtune=@var{cpu-type}
1391 -mcmodel=@var{code-model}
1392 -mmemory-model=@var{mem-model}
1393 -m32  -m64  -mapp-regs  -mno-app-regs
1394 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1395 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1396 -mhard-quad-float  -msoft-quad-float
1397 -mstack-bias  -mno-stack-bias
1398 -mstd-struct-return  -mno-std-struct-return
1399 -munaligned-doubles  -mno-unaligned-doubles
1400 -muser-mode  -mno-user-mode
1401 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1402 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1403 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1404 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1405 -mpopc  -mno-popc  -msubxc  -mno-subxc
1406 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1407 -mlra  -mno-lra}
1409 @emph{System V Options}
1410 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1412 @emph{V850 Options}
1413 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1414 -mprolog-function  -mno-prolog-function  -mspace
1415 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1416 -mapp-regs  -mno-app-regs
1417 -mdisable-callt  -mno-disable-callt
1418 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1419 -mv850e  -mv850  -mv850e3v5
1420 -mloop
1421 -mrelax
1422 -mlong-jumps
1423 -msoft-float
1424 -mhard-float
1425 -mgcc-abi
1426 -mrh850-abi
1427 -mbig-switch}
1429 @emph{VAX Options}
1430 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1432 @emph{Visium Options}
1433 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1434 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1436 @emph{VMS Options}
1437 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1438 -mpointer-size=@var{size}}
1440 @emph{VxWorks Options}
1441 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1442 -Xbind-lazy  -Xbind-now}
1444 @emph{x86 Options}
1445 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1446 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1447 -mfpmath=@var{unit}
1448 -masm=@var{dialect}  -mno-fancy-math-387
1449 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1450 -mno-wide-multiply  -mrtd  -malign-double
1451 -mpreferred-stack-boundary=@var{num}
1452 -mincoming-stack-boundary=@var{num}
1453 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1454 -mrecip  -mrecip=@var{opt}
1455 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1456 -mpartial-vector-fp-math
1457 -mmove-max=@var{bits} -mstore-max=@var{bits}
1458 -mnoreturn-no-callee-saved-registers
1459 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1460 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1461 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1462 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1463 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1464 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1465 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1466 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1467 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1468 -mavx512vbmi2 -mavx512bf16 -menqcmd
1469 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1470 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1471 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1472 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1473 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1474 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mapxf
1475 -musermsr -mavx10.1 -mavx10.1-256 -mavx10.1-512 -mevex512
1476 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1477 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1478 -mkl -mwidekl
1479 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1480 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1481 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1482 -mregparm=@var{num}  -msseregparm
1483 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1484 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1485 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1486 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1487 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1488 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1489 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1490 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1491 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1492 -mstack-protector-guard-reg=@var{reg}
1493 -mstack-protector-guard-offset=@var{offset}
1494 -mstack-protector-guard-symbol=@var{symbol}
1495 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1496 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1497 -mindirect-branch-register -mharden-sls=@var{choice}
1498 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1499 -munroll-only-small-loops -mlam=@var{choice}}
1501 @emph{x86 Windows Options}
1502 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mdll
1503 -mnop-fun-dllimport  -mthread
1504 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1506 @emph{Xstormy16 Options}
1507 @gccoptlist{-msim}
1509 @emph{Xtensa Options}
1510 @gccoptlist{-mconst16  -mno-const16
1511 -mfused-madd  -mno-fused-madd
1512 -mforce-no-pic
1513 -mserialize-volatile  -mno-serialize-volatile
1514 -mtext-section-literals  -mno-text-section-literals
1515 -mauto-litpools  -mno-auto-litpools
1516 -mtarget-align  -mno-target-align
1517 -mlongcalls  -mno-longcalls
1518 -mabi=@var{abi-type}
1519 -mextra-l32r-costs=@var{cycles}
1520 -mstrict-align  -mno-strict-align}
1522 @emph{zSeries Options}
1523 See S/390 and zSeries Options.
1524 @end table
1527 @node Overall Options
1528 @section Options Controlling the Kind of Output
1530 Compilation can involve up to four stages: preprocessing, compilation
1531 proper, assembly and linking, always in that order.  GCC is capable of
1532 preprocessing and compiling several files either into several
1533 assembler input files, or into one assembler input file; then each
1534 assembler input file produces an object file, and linking combines all
1535 the object files (those newly compiled, and those specified as input)
1536 into an executable file.
1538 @cindex file name suffix
1539 For any given input file, the file name suffix determines what kind of
1540 compilation is done:
1542 @table @gcctabopt
1543 @item @var{file}.c
1544 C source code that must be preprocessed.
1546 @item @var{file}.i
1547 C source code that should not be preprocessed.
1549 @item @var{file}.ii
1550 C++ source code that should not be preprocessed.
1552 @item @var{file}.m
1553 Objective-C source code.  Note that you must link with the @file{libobjc}
1554 library to make an Objective-C program work.
1556 @item @var{file}.mi
1557 Objective-C source code that should not be preprocessed.
1559 @item @var{file}.mm
1560 @itemx @var{file}.M
1561 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1562 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1563 to a literal capital M@.
1565 @item @var{file}.mii
1566 Objective-C++ source code that should not be preprocessed.
1568 @item @var{file}.h
1569 C, C++, Objective-C or Objective-C++ header file to be turned into a
1570 precompiled header (default), or C, C++ header file to be turned into an
1571 Ada spec (via the @option{-fdump-ada-spec} switch).
1573 @item @var{file}.cc
1574 @itemx @var{file}.cp
1575 @itemx @var{file}.cxx
1576 @itemx @var{file}.cpp
1577 @itemx @var{file}.CPP
1578 @itemx @var{file}.c++
1579 @itemx @var{file}.C
1580 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1581 the last two letters must both be literally @samp{x}.  Likewise,
1582 @samp{.C} refers to a literal capital C@.
1584 @item @var{file}.mm
1585 @itemx @var{file}.M
1586 Objective-C++ source code that must be preprocessed.
1588 @item @var{file}.mii
1589 Objective-C++ source code that should not be preprocessed.
1591 @item @var{file}.hh
1592 @itemx @var{file}.H
1593 @itemx @var{file}.hp
1594 @itemx @var{file}.hxx
1595 @itemx @var{file}.hpp
1596 @itemx @var{file}.HPP
1597 @itemx @var{file}.h++
1598 @itemx @var{file}.tcc
1599 C++ header file to be turned into a precompiled header or Ada spec.
1601 @item @var{file}.f
1602 @itemx @var{file}.for
1603 @itemx @var{file}.ftn
1604 @itemx @var{file}.fi
1605 Fixed form Fortran source code that should not be preprocessed.
1607 @item @var{file}.F
1608 @itemx @var{file}.FOR
1609 @itemx @var{file}.fpp
1610 @itemx @var{file}.FPP
1611 @itemx @var{file}.FTN
1612 Fixed form Fortran source code that must be preprocessed (with the traditional
1613 preprocessor).
1615 @item @var{file}.f90
1616 @itemx @var{file}.f95
1617 @itemx @var{file}.f03
1618 @itemx @var{file}.f08
1619 @itemx @var{file}.fii
1620 Free form Fortran source code that should not be preprocessed.
1622 @item @var{file}.F90
1623 @itemx @var{file}.F95
1624 @itemx @var{file}.F03
1625 @itemx @var{file}.F08
1626 Free form Fortran source code that must be preprocessed (with the
1627 traditional preprocessor).
1629 @item @var{file}.go
1630 Go source code.
1632 @item @var{file}.d
1633 D source code.
1635 @item @var{file}.di
1636 D interface file.
1638 @item @var{file}.dd
1639 D documentation code (Ddoc).
1641 @item @var{file}.ads
1642 Ada source code file that contains a library unit declaration (a
1643 declaration of a package, subprogram, or generic, or a generic
1644 instantiation), or a library unit renaming declaration (a package,
1645 generic, or subprogram renaming declaration).  Such files are also
1646 called @dfn{specs}.
1648 @item @var{file}.adb
1649 Ada source code file containing a library unit body (a subprogram or
1650 package body).  Such files are also called @dfn{bodies}.
1652 @c GCC also knows about some suffixes for languages not yet included:
1653 @c Ratfor:
1654 @c @var{file}.r
1656 @item @var{file}.s
1657 Assembler code.
1659 @item @var{file}.S
1660 @itemx @var{file}.sx
1661 Assembler code that must be preprocessed.
1663 @item @var{other}
1664 An object file to be fed straight into linking.
1665 Any file name with no recognized suffix is treated this way.
1666 @end table
1668 @opindex x
1669 You can specify the input language explicitly with the @option{-x} option:
1671 @table @gcctabopt
1672 @item -x @var{language}
1673 Specify explicitly the @var{language} for the following input files
1674 (rather than letting the compiler choose a default based on the file
1675 name suffix).  This option applies to all following input files until
1676 the next @option{-x} option.  Possible values for @var{language} are:
1677 @smallexample
1678 c  c-header  cpp-output
1679 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1680 objective-c  objective-c-header  objective-c-cpp-output
1681 objective-c++ objective-c++-header objective-c++-cpp-output
1682 assembler  assembler-with-cpp
1685 f77  f77-cpp-input f95  f95-cpp-input
1687 @end smallexample
1689 @item -x none
1690 Turn off any specification of a language, so that subsequent files are
1691 handled according to their file name suffixes (as they are if @option{-x}
1692 has not been used at all).
1693 @end table
1695 If you only want some of the stages of compilation, you can use
1696 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1697 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1698 @command{gcc} is to stop.  Note that some combinations (for example,
1699 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1701 @table @gcctabopt
1702 @opindex c
1703 @item -c
1704 Compile or assemble the source files, but do not link.  The linking
1705 stage simply is not done.  The ultimate output is in the form of an
1706 object file for each source file.
1708 By default, the object file name for a source file is made by replacing
1709 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1711 Unrecognized input files, not requiring compilation or assembly, are
1712 ignored.
1714 @opindex S
1715 @item -S
1716 Stop after the stage of compilation proper; do not assemble.  The output
1717 is in the form of an assembler code file for each non-assembler input
1718 file specified.
1720 By default, the assembler file name for a source file is made by
1721 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1723 Input files that don't require compilation are ignored.
1725 @opindex E
1726 @item -E
1727 Stop after the preprocessing stage; do not run the compiler proper.  The
1728 output is in the form of preprocessed source code, which is sent to the
1729 standard output.
1731 Input files that don't require preprocessing are ignored.
1733 @cindex output file option
1734 @opindex o
1735 @item -o @var{file}
1736 Place the primary output in file @var{file}.  This applies to whatever
1737 sort of output is being produced, whether it be an executable file, an
1738 object file, an assembler file or preprocessed C code.
1740 If @option{-o} is not specified, the default is to put an executable
1741 file in @file{a.out}, the object file for
1742 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1743 assembler file in @file{@var{source}.s}, a precompiled header file in
1744 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1745 standard output.
1747 Though @option{-o} names only the primary output, it also affects the
1748 naming of auxiliary and dump outputs.  See the examples below.  Unless
1749 overridden, both auxiliary outputs and dump outputs are placed in the
1750 same directory as the primary output.  In auxiliary outputs, the suffix
1751 of the input file is replaced with that of the auxiliary output file
1752 type; in dump outputs, the suffix of the dump file is appended to the
1753 input file suffix.  In compilation commands, the base name of both
1754 auxiliary and dump outputs is that of the primary output; in compile and
1755 link commands, the primary output name, minus the executable suffix, is
1756 combined with the input file name.  If both share the same base name,
1757 disregarding the suffix, the result of the combination is that base
1758 name, otherwise, they are concatenated, separated by a dash.
1760 @smallexample
1761 gcc -c foo.c ...
1762 @end smallexample
1764 will use @file{foo.o} as the primary output, and place aux outputs and
1765 dumps next to it, e.g., aux file @file{foo.dwo} for
1766 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1767 @option{-fdump-rtl-final}.
1769 If a non-linker output file is explicitly specified, aux and dump files
1770 by default take the same base name:
1772 @smallexample
1773 gcc -c foo.c -o dir/foobar.o ...
1774 @end smallexample
1776 will name aux outputs @file{dir/foobar.*} and dump outputs
1777 @file{dir/foobar.c.*}.
1779 A linker output will instead prefix aux and dump outputs:
1781 @smallexample
1782 gcc foo.c bar.c -o dir/foobar ...
1783 @end smallexample
1785 will generally name aux outputs @file{dir/foobar-foo.*} and
1786 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1787 @file{dir/foobar-bar.c.*}.
1789 The one exception to the above is when the executable shares the base
1790 name with the single input:
1792 @smallexample
1793 gcc foo.c -o dir/foo ...
1794 @end smallexample
1796 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1797 named @file{dir/foo.c.*}.
1799 The location and the names of auxiliary and dump outputs can be adjusted
1800 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1801 @option{-dumpdir}, @option{-save-temps=cwd}, and
1802 @option{-save-temps=obj}.
1805 @opindex dumpbase
1806 @item -dumpbase @var{dumpbase}
1807 This option sets the base name for auxiliary and dump output files.  It
1808 does not affect the name of the primary output file.  Intermediate
1809 outputs, when preserved, are not regarded as primary outputs, but as
1810 auxiliary outputs:
1812 @smallexample
1813 gcc -save-temps -S foo.c
1814 @end smallexample
1816 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1817 then compiles to the (implied) output file @file{foo.s}, whereas:
1819 @smallexample
1820 gcc -save-temps -dumpbase save-foo -c foo.c
1821 @end smallexample
1823 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1824 an intermediate, thus auxiliary output), and then assembles to the
1825 (implied) output file @file{foo.o}.
1827 Absent this option, dump and aux files take their names from the input
1828 file, or from the (non-linker) output file, if one is explicitly
1829 specified: dump output files (e.g. those requested by @option{-fdump-*}
1830 options) with the input name suffix, and aux output files (those
1831 requested by other non-dump options, e.g. @code{-save-temps},
1832 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1834 Similar suffix differentiation of dump and aux outputs can be attained
1835 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1836 @option{-dumpbase-ext .suf}.
1838 If @var{dumpbase} is explicitly specified with any directory component,
1839 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1840 @option{-save-temps=*}) is ignored, and instead of appending to it,
1841 @var{dumpbase} fully overrides it:
1843 @smallexample
1844 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1845   -dumpdir pfx- -save-temps=cwd ...
1846 @end smallexample
1848 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1849 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1850 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1852 When @option{-dumpbase} is specified in a command that compiles multiple
1853 inputs, or that compiles and then links, it may be combined with
1854 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1855 file is compiled using the combined @var{dumppfx}, and default values
1856 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1857 file:
1859 @smallexample
1860 gcc foo.c bar.c -c -dumpbase main ...
1861 @end smallexample
1863 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1864 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1865 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1866 and @file{main-bar.*}.
1868 An empty string specified as @var{dumpbase} avoids the influence of the
1869 output basename in the naming of auxiliary and dump outputs during
1870 compilation, computing default values :
1872 @smallexample
1873 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1874 @end smallexample
1876 will name aux outputs @file{dir/foo.*} and dump outputs
1877 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1878 name, but the directory still defaults to that of the output.
1880 The empty-string dumpbase does not prevent the use of the output
1881 basename for outputs during linking:
1883 @smallexample
1884 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1885 @end smallexample
1887 The compilation of the source files will name auxiliary outputs
1888 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1889 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1890 linking will use @file{dir/foobar.} as the prefix for dumps and
1891 auxiliary files.
1894 @opindex dumpbase-ext
1895 @item -dumpbase-ext @var{auxdropsuf}
1896 When forming the name of an auxiliary (but not a dump) output file, drop
1897 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1898 suffixes.  If not specified, this option defaults to the suffix of a
1899 default @var{dumpbase}, i.e., the suffix of the input file when
1900 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1901 is combined with @var{dumppfx}.
1903 @smallexample
1904 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1905 @end smallexample
1907 creates @file{dir/foo.o} as the main output, and generates auxiliary
1908 outputs in @file{dir/x-foo.*}, taking the location of the primary
1909 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1910 outputs retain the suffix: @file{dir/x-foo.c.*}.
1912 This option is disregarded if it does not match the suffix of a
1913 specified @var{dumpbase}, except as an alternative to the executable
1914 suffix when appending the linker output base name to @var{dumppfx}, as
1915 specified below:
1917 @smallexample
1918 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1919 @end smallexample
1921 creates @file{main.out} as the primary output, and avoids overwriting
1922 the auxiliary and dump outputs by using the executable name minus
1923 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1924 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1925 @file{main-foo.c.*} and @file{main-bar.c.*}.
1928 @opindex dumpdir
1929 @item -dumpdir @var{dumppfx}
1930 When forming the name of an auxiliary or dump output file, use
1931 @var{dumppfx} as a prefix:
1933 @smallexample
1934 gcc -dumpdir pfx- -c foo.c ...
1935 @end smallexample
1937 creates @file{foo.o} as the primary output, and auxiliary outputs named
1938 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1939 @var{dumpbase} derived from the default primary output, derived in turn
1940 from the input name.  Dump outputs also take the input name suffix:
1941 @file{pfx-foo.c.*}.
1943 If @var{dumppfx} is to be used as a directory name, it must end with a
1944 directory separator:
1946 @smallexample
1947 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1948 @end smallexample
1950 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1951 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1952 default @var{dumpbase} derived from the primary output name.  Dump
1953 outputs also take the input name suffix: @file{dir/bar.c.*}.
1955 It defaults to the location of the output file, unless the output
1956 file is a special file like @code{/dev/null}. Options
1957 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1958 default, just like an explicit @option{-dumpdir} option.  In case
1959 multiple such options are given, the last one prevails:
1961 @smallexample
1962 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1963 @end smallexample
1965 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1966 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1967 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1968 default for @option{-save-temps}, nor that the output directory is
1969 implicitly the current directory.  Dump outputs are named
1970 @file{foo.c.*}.
1972 When compiling from multiple input files, if @option{-dumpbase} is
1973 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1974 are appended to (or override, if containing any directory components) an
1975 explicit or defaulted @var{dumppfx}, so that each of the multiple
1976 compilations gets differently-named aux and dump outputs.
1978 @smallexample
1979 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1980 @end smallexample
1982 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1983 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1984 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1985 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1986 single-input compilation:
1988 @smallexample
1989 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1990 @end smallexample
1992 that, applying @option{-dumpbase} to a single source, does not compute
1993 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1994 dump outputs go in @file{dir/pfx-main.*}.
1996 When compiling and then linking from multiple input files, a defaulted
1997 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1998 transformation above (e.g. the compilation of @file{foo.c} and
1999 @file{bar.c} above, but without @option{-c}).  If neither
2000 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
2001 base name, minus @var{auxdropsuf}, if specified, or the executable
2002 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
2003 instead.  Note, however, that unlike earlier cases of linking:
2005 @smallexample
2006 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
2007 @end smallexample
2009 does not append the output name @file{main} to @var{dumppfx}, because
2010 @option{-dumpdir} is explicitly specified.  The goal is that the
2011 explicitly-specified @var{dumppfx} may contain the specified output name
2012 as part of the prefix, if desired; only an explicitly-specified
2013 @option{-dumpbase} would be combined with it, in order to avoid simply
2014 discarding a meaningful option.
2016 When compiling and then linking from a single input file, the linker
2017 output base name will only be appended to the default @var{dumppfx} as
2018 above if it does not share the base name with the single input file
2019 name.  This has been covered in single-input linking cases above, but
2020 not with an explicit @option{-dumpdir} that inhibits the combination,
2021 even if overridden by @option{-save-temps=*}:
2023 @smallexample
2024 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
2025 @end smallexample
2027 Auxiliary outputs are named @file{foo.*}, and dump outputs
2028 @file{foo.c.*}, in the current working directory as ultimately requested
2029 by @option{-save-temps=cwd}.
2031 Summing it all up for an intuitive though slightly imprecise data flow:
2032 the primary output name is broken into a directory part and a basename
2033 part; @var{dumppfx} is set to the former, unless overridden by
2034 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2035 to the latter, unless overriden by @option{-dumpbase}.  If there are
2036 multiple inputs or linking, this @var{dumpbase} may be combined with
2037 @var{dumppfx} and taken from each input file.  Auxiliary output names
2038 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2039 minus suffix, and the auxiliary output suffix; dump output names are
2040 only different in that the suffix from @var{dumpbase} is retained.
2042 When it comes to auxiliary and dump outputs created during LTO
2043 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2044 given or as derived from the linker output name but not from inputs,
2045 even in cases in which this combination would not otherwise be used as
2046 such, is passed down with a trailing period replacing the compiler-added
2047 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2048 being involved in linking, this program does not normally get any
2049 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2051 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2052 names to the received @var{dumppfx}, ensures it contains a directory
2053 component so that it overrides any @option{-dumpdir}, and passes that as
2054 @option{-dumpbase} to sub-compilers.
2056 @opindex v
2057 @item -v
2058 Print (on standard error output) the commands executed to run the stages
2059 of compilation.  Also print the version number of the compiler driver
2060 program and of the preprocessor and the compiler proper.
2062 @opindex ###
2063 @item -###
2064 Like @option{-v} except the commands are not executed and arguments
2065 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2066 This is useful for shell scripts to capture the driver-generated command lines.
2068 @opindex help
2069 @item --help
2070 Print (on the standard output) a description of the command-line options
2071 understood by @command{gcc}.  If the @option{-v} option is also specified
2072 then @option{--help} is also passed on to the various processes
2073 invoked by @command{gcc}, so that they can display the command-line options
2074 they accept.  If the @option{-Wextra} option has also been specified
2075 (prior to the @option{--help} option), then command-line options that
2076 have no documentation associated with them are also displayed.
2078 @opindex target-help
2079 @item --target-help
2080 Print (on the standard output) a description of target-specific command-line
2081 options for each tool.  For some targets extra target-specific
2082 information may also be printed.
2084 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2085 Print (on the standard output) a description of the command-line
2086 options understood by the compiler that fit into all specified classes
2087 and qualifiers.  These are the supported classes:
2089 @table @asis
2090 @item @samp{optimizers}
2091 Display all of the optimization options supported by the
2092 compiler.
2094 @item @samp{warnings}
2095 Display all of the options controlling warning messages
2096 produced by the compiler.
2098 @item @samp{target}
2099 Display target-specific options.  Unlike the
2100 @option{--target-help} option however, target-specific options of the
2101 linker and assembler are not displayed.  This is because those
2102 tools do not currently support the extended @option{--help=} syntax.
2104 @item @samp{params}
2105 Display the values recognized by the @option{--param}
2106 option.
2108 @item @var{language}
2109 Display the options supported for @var{language}, where
2110 @var{language} is the name of one of the languages supported in this
2111 version of GCC@.  If an option is supported by all languages, one needs
2112 to select @samp{common} class.
2114 @item @samp{common}
2115 Display the options that are common to all languages.
2116 @end table
2118 These are the supported qualifiers:
2120 @table @asis
2121 @item @samp{undocumented}
2122 Display only those options that are undocumented.
2124 @item @samp{joined}
2125 Display options taking an argument that appears after an equal
2126 sign in the same continuous piece of text, such as:
2127 @samp{--help=target}.
2129 @item @samp{separate}
2130 Display options taking an argument that appears as a separate word
2131 following the original option, such as: @samp{-o output-file}.
2132 @end table
2134 Thus for example to display all the undocumented target-specific
2135 switches supported by the compiler, use:
2137 @smallexample
2138 --help=target,undocumented
2139 @end smallexample
2141 The sense of a qualifier can be inverted by prefixing it with the
2142 @samp{^} character, so for example to display all binary warning
2143 options (i.e., ones that are either on or off and that do not take an
2144 argument) that have a description, use:
2146 @smallexample
2147 --help=warnings,^joined,^undocumented
2148 @end smallexample
2150 The argument to @option{--help=} should not consist solely of inverted
2151 qualifiers.
2153 Combining several classes is possible, although this usually
2154 restricts the output so much that there is nothing to display.  One
2155 case where it does work, however, is when one of the classes is
2156 @var{target}.  For example, to display all the target-specific
2157 optimization options, use:
2159 @smallexample
2160 --help=target,optimizers
2161 @end smallexample
2163 The @option{--help=} option can be repeated on the command line.  Each
2164 successive use displays its requested class of options, skipping
2165 those that have already been displayed.  If @option{--help} is also
2166 specified anywhere on the command line then this takes precedence
2167 over any @option{--help=} option.
2169 If the @option{-Q} option appears on the command line before the
2170 @option{--help=} option, then the descriptive text displayed by
2171 @option{--help=} is changed.  Instead of describing the displayed
2172 options, an indication is given as to whether the option is enabled,
2173 disabled or set to a specific value (assuming that the compiler
2174 knows this at the point where the @option{--help=} option is used).
2176 Here is a truncated example from the ARM port of @command{gcc}:
2178 @smallexample
2179   % gcc -Q -mabi=2 --help=target -c
2180   The following options are target specific:
2181   -mabi=                                2
2182   -mabort-on-noreturn                   [disabled]
2183   -mapcs                                [disabled]
2184 @end smallexample
2186 The output is sensitive to the effects of previous command-line
2187 options, so for example it is possible to find out which optimizations
2188 are enabled at @option{-O2} by using:
2190 @smallexample
2191 -Q -O2 --help=optimizers
2192 @end smallexample
2194 Alternatively you can discover which binary optimizations are enabled
2195 by @option{-O3} by using:
2197 @smallexample
2198 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2199 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2200 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2201 @end smallexample
2203 @opindex version
2204 @item --version
2205 Display the version number and copyrights of the invoked GCC@.
2207 @opindex pass-exit-codes
2208 @item -pass-exit-codes
2209 Normally the @command{gcc} program exits with the code of 1 if any
2210 phase of the compiler returns a non-success return code.  If you specify
2211 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2212 the numerically highest error produced by any phase returning an error
2213 indication.  The C, C++, and Fortran front ends return 4 if an internal
2214 compiler error is encountered.
2216 @opindex pipe
2217 @item -pipe
2218 Use pipes rather than temporary files for communication between the
2219 various stages of compilation.  This fails to work on some systems where
2220 the assembler is unable to read from a pipe; but the GNU assembler has
2221 no trouble.
2223 @opindex specs
2224 @item -specs=@var{file}
2225 Process @var{file} after the compiler reads in the standard @file{specs}
2226 file, in order to override the defaults which the @command{gcc} driver
2227 program uses when determining what switches to pass to @command{cc1},
2228 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2229 @option{-specs=@var{file}} can be specified on the command line, and they
2230 are processed in order, from left to right.  @xref{Spec Files}, for
2231 information about the format of the @var{file}.
2233 @opindex wrapper
2234 @item -wrapper
2235 Invoke all subcommands under a wrapper program.  The name of the
2236 wrapper program and its parameters are passed as a comma separated
2237 list.
2239 @smallexample
2240 gcc -c t.c -wrapper gdb,--args
2241 @end smallexample
2243 @noindent
2244 This invokes all subprograms of @command{gcc} under
2245 @samp{gdb --args}, thus the invocation of @command{cc1} is
2246 @samp{gdb --args cc1 @dots{}}.
2248 @opindex ffile-prefix-map
2249 @item -ffile-prefix-map=@var{old}=@var{new}
2250 When compiling files residing in directory @file{@var{old}}, record
2251 any references to them in the result of the compilation as if the
2252 files resided in directory @file{@var{new}} instead.  Specifying this
2253 option is equivalent to specifying all the individual
2254 @option{-f*-prefix-map} options.  This can be used to make reproducible
2255 builds that are location independent.  Directories referenced by
2256 directives are not affected by these options.  See also
2257 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2258 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2260 @opindex fcanon-prefix-map
2261 @item -fcanon-prefix-map
2262 For the @option{-f*-prefix-map} options normally comparison
2263 of @file{@var{old}} prefix against the filename that would be normally
2264 referenced in the result of the compilation is done using textual
2265 comparison of the prefixes, or ignoring character case for case insensitive
2266 filesystems and considering slashes and backslashes as equal on DOS based
2267 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2268 to be done on canonicalized paths of @file{@var{old}}
2269 and the referenced filename.
2271 @opindex fplugin
2272 @item -fplugin=@var{name}.so
2273 Load the plugin code in file @var{name}.so, assumed to be a
2274 shared object to be dlopen'd by the compiler.  The base name of
2275 the shared object file is used to identify the plugin for the
2276 purposes of argument parsing (See
2277 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2278 Each plugin should define the callback functions specified in the
2279 Plugins API.
2281 @opindex fplugin-arg
2282 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2283 Define an argument called @var{key} with a value of @var{value}
2284 for the plugin called @var{name}.
2286 @opindex fdump-ada-spec
2287 @item -fdump-ada-spec@r{[}-slim@r{]}
2288 For C and C++ source and include files, generate corresponding Ada specs.
2289 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2290 GNAT User's Guide}, which provides detailed documentation on this feature.
2292 @opindex fada-spec-parent
2293 @item -fada-spec-parent=@var{unit}
2294 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2295 Ada specs as child units of parent @var{unit}.
2297 @opindex fdump-go-spec
2298 @item -fdump-go-spec=@var{file}
2299 For input files in any language, generate corresponding Go
2300 declarations in @var{file}.  This generates Go @code{const},
2301 @code{type}, @code{var}, and @code{func} declarations which may be a
2302 useful way to start writing a Go interface to code written in some
2303 other language.
2305 @include @value{srcdir}/../libiberty/at-file.texi
2306 @end table
2308 @node Invoking G++
2309 @section Compiling C++ Programs
2311 @cindex suffixes for C++ source
2312 @cindex C++ source file suffixes
2313 C++ source files conventionally use one of the suffixes @samp{.C},
2314 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2315 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2316 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2317 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2318 files with these names and compiles them as C++ programs even if you
2319 call the compiler the same way as for compiling C programs (usually
2320 with the name @command{gcc}).
2322 @findex g++
2323 @findex c++
2324 However, the use of @command{gcc} does not add the C++ library.
2325 @command{g++} is a program that calls GCC and automatically specifies linking
2326 against the C++ library.  It treats @samp{.c},
2327 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2328 files unless @option{-x} is used.  This program is also useful when
2329 precompiling a C header file with a @samp{.h} extension for use in C++
2330 compilations.  On many systems, @command{g++} is also installed with
2331 the name @command{c++}.
2333 @cindex invoking @command{g++}
2334 When you compile C++ programs, you may specify many of the same
2335 command-line options that you use for compiling programs in any
2336 language; or command-line options meaningful for C and related
2337 languages; or options that are meaningful only for C++ programs.
2338 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2339 explanations of options for languages related to C@.
2340 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2341 explanations of options that are meaningful only for C++ programs.
2343 @node C Dialect Options
2344 @section Options Controlling C Dialect
2345 @cindex dialect options
2346 @cindex language dialect options
2347 @cindex options, dialect
2349 The following options control the dialect of C (or languages derived
2350 from C, such as C++, Objective-C and Objective-C++) that the compiler
2351 accepts:
2353 @table @gcctabopt
2354 @cindex ANSI support
2355 @cindex ISO support
2356 @opindex ansi
2357 @item -ansi
2358 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2359 equivalent to @option{-std=c++98}.
2361 This turns off certain features of GCC that are incompatible with ISO
2362 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2363 such as the @code{asm} and @code{typeof} keywords, and
2364 predefined macros such as @code{unix} and @code{vax} that identify the
2365 type of system you are using.  It also enables the undesirable and
2366 rarely used ISO trigraph feature.  For the C compiler,
2367 it disables recognition of C++ style @samp{//} comments as well as
2368 the @code{inline} keyword.
2370 The alternate keywords @code{__asm__}, @code{__extension__},
2371 @code{__inline__} and @code{__typeof__} continue to work despite
2372 @option{-ansi}.  You would not want to use them in an ISO C program, of
2373 course, but it is useful to put them in header files that might be included
2374 in compilations done with @option{-ansi}.  Alternate predefined macros
2375 such as @code{__unix__} and @code{__vax__} are also available, with or
2376 without @option{-ansi}.
2378 The @option{-ansi} option does not cause non-ISO programs to be
2379 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2380 addition to @option{-ansi}.  @xref{Warning Options}.
2382 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2383 option is used.  Some header files may notice this macro and refrain
2384 from declaring certain functions or defining certain macros that the
2385 ISO standard doesn't call for; this is to avoid interfering with any
2386 programs that might use these names for other things.
2388 Functions that are normally built in but do not have semantics
2389 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2390 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2391 built-in functions provided by GCC}, for details of the functions
2392 affected.
2394 @opindex std
2395 @item -std=
2396 Determine the language standard. @xref{Standards,,Language Standards
2397 Supported by GCC}, for details of these standard versions.  This option
2398 is currently only supported when compiling C or C++.
2400 The compiler can accept several base standards, such as @samp{c90} or
2401 @samp{c++98}, and GNU dialects of those standards, such as
2402 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2403 compiler accepts all programs following that standard plus those
2404 using GNU extensions that do not contradict it.  For example,
2405 @option{-std=c90} turns off certain features of GCC that are
2406 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2407 keywords, but not other GNU extensions that do not have a meaning in
2408 ISO C90, such as omitting the middle term of a @code{?:}
2409 expression. On the other hand, when a GNU dialect of a standard is
2410 specified, all features supported by the compiler are enabled, even when
2411 those features change the meaning of the base standard.  As a result, some
2412 strict-conforming programs may be rejected.  The particular standard
2413 is used by @option{-Wpedantic} to identify which features are GNU
2414 extensions given that version of the standard. For example
2415 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2416 comments, while @option{-std=gnu99 -Wpedantic} does not.
2418 A value for this option must be provided; possible values are
2420 @table @samp
2421 @item c90
2422 @itemx c89
2423 @itemx iso9899:1990
2424 Support all ISO C90 programs (certain GNU extensions that conflict
2425 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2427 @item iso9899:199409
2428 ISO C90 as modified in amendment 1.
2430 @item c99
2431 @itemx c9x
2432 @itemx iso9899:1999
2433 @itemx iso9899:199x
2434 ISO C99.  This standard is substantially completely supported, modulo
2435 bugs and floating-point issues
2436 (mainly but not entirely relating to optional C99 features from
2437 Annexes F and G).  See
2438 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2439 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2441 @item c11
2442 @itemx c1x
2443 @itemx iso9899:2011
2444 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2445 substantially completely supported, modulo bugs, floating-point issues
2446 (mainly but not entirely relating to optional C11 features from
2447 Annexes F and G) and the optional Annexes K (Bounds-checking
2448 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2450 @item c17
2451 @itemx c18
2452 @itemx iso9899:2017
2453 @itemx iso9899:2018
2454 ISO C17, the 2017 revision of the ISO C standard
2455 (published in 2018).  This standard is
2456 same as C11 except for corrections of defects (all of which are also
2457 applied with @option{-std=c11}) and a new value of
2458 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2460 @item c23
2461 @itemx c2x
2462 @itemx iso9899:2024
2463 ISO C23, the 2023 revision of the ISO C standard (expected to be
2464 published in 2024).  The support for this version is experimental and
2465 incomplete.  The name @samp{c2x} is deprecated.
2467 @item gnu90
2468 @itemx gnu89
2469 GNU dialect of ISO C90 (including some C99 features).
2471 @item gnu99
2472 @itemx gnu9x
2473 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2475 @item gnu11
2476 @itemx gnu1x
2477 GNU dialect of ISO C11.
2478 The name @samp{gnu1x} is deprecated.
2480 @item gnu17
2481 @itemx gnu18
2482 GNU dialect of ISO C17.  This is the default for C code.
2484 @item gnu23
2485 @itemx gnu2x
2486 The next version of the ISO C standard, still under development, plus
2487 GNU extensions.  The support for this version is experimental and
2488 incomplete.  The name @samp{gnu2x} is deprecated.
2490 @item c++98
2491 @itemx c++03
2492 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2493 additional defect reports. Same as @option{-ansi} for C++ code.
2495 @item gnu++98
2496 @itemx gnu++03
2497 GNU dialect of @option{-std=c++98}.
2499 @item c++11
2500 @itemx c++0x
2501 The 2011 ISO C++ standard plus amendments.
2502 The name @samp{c++0x} is deprecated.
2504 @item gnu++11
2505 @itemx gnu++0x
2506 GNU dialect of @option{-std=c++11}.
2507 The name @samp{gnu++0x} is deprecated.
2509 @item c++14
2510 @itemx c++1y
2511 The 2014 ISO C++ standard plus amendments.
2512 The name @samp{c++1y} is deprecated.
2514 @item gnu++14
2515 @itemx gnu++1y
2516 GNU dialect of @option{-std=c++14}.
2517 The name @samp{gnu++1y} is deprecated.
2519 @item c++17
2520 @itemx c++1z
2521 The 2017 ISO C++ standard plus amendments.
2522 The name @samp{c++1z} is deprecated.
2524 @item gnu++17
2525 @itemx gnu++1z
2526 GNU dialect of @option{-std=c++17}.
2527 This is the default for C++ code.
2528 The name @samp{gnu++1z} is deprecated.
2530 @item c++20
2531 @itemx c++2a
2532 The 2020 ISO C++ standard plus amendments.
2533 Support is experimental, and could change in incompatible ways in
2534 future releases.
2535 The name @samp{c++2a} is deprecated.
2537 @item gnu++20
2538 @itemx gnu++2a
2539 GNU dialect of @option{-std=c++20}.
2540 Support is experimental, and could change in incompatible ways in
2541 future releases.
2542 The name @samp{gnu++2a} is deprecated.
2544 @item c++2b
2545 @itemx c++23
2546 The next revision of the ISO C++ standard, planned for
2547 2023.  Support is highly experimental, and will almost certainly
2548 change in incompatible ways in future releases.
2550 @item gnu++2b
2551 @itemx gnu++23
2552 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2553 and will almost certainly change in incompatible ways in future
2554 releases.
2556 @item c++2c
2557 @itemx c++26
2558 The next revision of the ISO C++ standard, planned for
2559 2026.  Support is highly experimental, and will almost certainly
2560 change in incompatible ways in future releases.
2562 @item gnu++2c
2563 @itemx gnu++26
2564 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2565 and will almost certainly change in incompatible ways in future
2566 releases.
2567 @end table
2569 @opindex aux-info
2570 @item -aux-info @var{filename}
2571 Output to the given filename prototyped declarations for all functions
2572 declared and/or defined in a translation unit, including those in header
2573 files.  This option is silently ignored in any language other than C@.
2575 Besides declarations, the file indicates, in comments, the origin of
2576 each declaration (source file and line), whether the declaration was
2577 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2578 @samp{O} for old, respectively, in the first character after the line
2579 number and the colon), and whether it came from a declaration or a
2580 definition (@samp{C} or @samp{F}, respectively, in the following
2581 character).  In the case of function definitions, a K&R-style list of
2582 arguments followed by their declarations is also provided, inside
2583 comments, after the declaration.
2585 @opindex fno-asm
2586 @opindex fasm
2587 @item -fno-asm
2588 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2589 keyword, so that code can use these words as identifiers.  You can use
2590 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2591 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2593 In C++, @code{inline} is a standard keyword and is not affected by
2594 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2595 instead, which disables @code{typeof} but not @code{asm} and
2596 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2597 this switch only affects the @code{asm} and @code{typeof} keywords,
2598 since @code{inline} is a standard keyword in ISO C99.  In C23 mode
2599 (@option{-std=c23} or @option{-std=gnu23}), this switch only affects
2600 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2601 ISO C23.
2603 @opindex fno-builtin
2604 @opindex fbuiltin
2605 @cindex built-in functions
2606 @item -fno-builtin
2607 @itemx -fno-builtin-@var{function}
2608 Don't recognize built-in functions that do not begin with
2609 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2610 functions provided by GCC}, for details of the functions affected,
2611 including those which are not built-in functions when @option{-ansi} or
2612 @option{-std} options for strict ISO C conformance are used because they
2613 do not have an ISO standard meaning.
2615 GCC normally generates special code to handle certain built-in functions
2616 more efficiently; for instance, calls to @code{alloca} may become single
2617 instructions which adjust the stack directly, and calls to @code{memcpy}
2618 may become inline copy loops.  The resulting code is often both smaller
2619 and faster, but since the function calls no longer appear as such, you
2620 cannot set a breakpoint on those calls, nor can you change the behavior
2621 of the functions by linking with a different library.  In addition,
2622 when a function is recognized as a built-in function, GCC may use
2623 information about that function to warn about problems with calls to
2624 that function, or to generate more efficient code, even if the
2625 resulting code still contains calls to that function.  For example,
2626 warnings are given with @option{-Wformat} for bad calls to
2627 @code{printf} when @code{printf} is built in and @code{strlen} is
2628 known not to modify global memory.
2630 With the @option{-fno-builtin-@var{function}} option
2631 only the built-in function @var{function} is
2632 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2633 function is named that is not built-in in this version of GCC, this
2634 option is ignored.  There is no corresponding
2635 @option{-fbuiltin-@var{function}} option; if you wish to enable
2636 built-in functions selectively when using @option{-fno-builtin} or
2637 @option{-ffreestanding}, you may define macros such as:
2639 @smallexample
2640 #define abs(n)          __builtin_abs ((n))
2641 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2642 @end smallexample
2644 @opindex fcond-mismatch
2645 @item -fcond-mismatch
2646 Allow conditional expressions with mismatched types in the second and
2647 third arguments.  The value of such an expression is void.  This option
2648 is not supported for C++.
2650 @opindex ffreestanding
2651 @cindex hosted environment
2652 @item -ffreestanding
2654 Assert that compilation targets a freestanding environment.  This
2655 implies @option{-fno-builtin}.  A freestanding environment
2656 is one in which the standard library may not exist, and program startup may
2657 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2658 This is equivalent to @option{-fno-hosted}.
2660 @xref{Standards,,Language Standards Supported by GCC}, for details of
2661 freestanding and hosted environments.
2663 @opindex fgimple
2664 @item -fgimple
2666 Enable parsing of function definitions marked with @code{__GIMPLE}.
2667 This is an experimental feature that allows unit testing of GIMPLE
2668 passes.
2670 @opindex fgnu-tm
2671 @item -fgnu-tm
2672 When the option @option{-fgnu-tm} is specified, the compiler
2673 generates code for the Linux variant of Intel's current Transactional
2674 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2675 an experimental feature whose interface may change in future versions
2676 of GCC, as the official specification changes.  Please note that not
2677 all architectures are supported for this feature.
2679 For more information on GCC's support for transactional memory,
2680 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2681 Transactional Memory Library}.
2683 Note that the transactional memory feature is not supported with
2684 non-call exceptions (@option{-fnon-call-exceptions}).
2686 @opindex fgnu89-inline
2687 @item -fgnu89-inline
2688 The option @option{-fgnu89-inline} tells GCC to use the traditional
2689 GNU semantics for @code{inline} functions when in C99 mode.
2690 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2691 Using this option is roughly equivalent to adding the
2692 @code{gnu_inline} function attribute to all inline functions
2693 (@pxref{Function Attributes}).
2695 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2696 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2697 specifies the default behavior).
2698 This option is not supported in @option{-std=c90} or
2699 @option{-std=gnu90} mode.
2701 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2702 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2703 in effect for @code{inline} functions.  @xref{Common Predefined
2704 Macros,,,cpp,The C Preprocessor}.
2706 @opindex fhosted
2707 @cindex hosted environment
2708 @item -fhosted
2710 Assert that compilation targets a hosted environment.  This implies
2711 @option{-fbuiltin}.  A hosted environment is one in which the
2712 entire standard library is available, and in which @code{main} has a return
2713 type of @code{int}.  Examples are nearly everything except a kernel.
2714 This is equivalent to @option{-fno-freestanding}.
2716 @opindex flax-vector-conversions
2717 @item -flax-vector-conversions
2718 Allow implicit conversions between vectors with differing numbers of
2719 elements and/or incompatible element types.  This option should not be
2720 used for new code.
2722 @opindex fms-extensions
2723 @item -fms-extensions
2724 Accept some non-standard constructs used in Microsoft header files.
2726 In C++ code, this allows member names in structures to be similar
2727 to previous types declarations.
2729 @smallexample
2730 typedef int UOW;
2731 struct ABC @{
2732   UOW UOW;
2734 @end smallexample
2736 Some cases of unnamed fields in structures and unions are only
2737 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2738 fields within structs/unions}, for details.
2740 Note that this option is off for all targets except for x86
2741 targets using ms-abi.
2743 @opindex foffload
2744 @cindex Offloading targets
2745 @cindex OpenACC offloading targets
2746 @cindex OpenMP offloading targets
2747 @item -foffload=disable
2748 @itemx -foffload=default
2749 @itemx -foffload=@var{target-list}
2750 Specify for which OpenMP and OpenACC offload targets code should be generated.
2751 The default behavior, equivalent to @option{-foffload=default}, is to generate
2752 code for all supported offload targets.  The @option{-foffload=disable} form
2753 generates code only for the host fallback, while
2754 @option{-foffload=@var{target-list}} generates code only for the specified
2755 comma-separated list of offload targets.
2757 Offload targets are specified in GCC's internal target-triplet format. You can
2758 run the compiler with @option{-v} to show the list of configured offload targets
2759 under @code{OFFLOAD_TARGET_NAMES}.
2761 @opindex foffload-options
2762 @cindex Offloading options
2763 @cindex OpenACC offloading options
2764 @cindex OpenMP offloading options
2765 @item -foffload-options=@var{options}
2766 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2768 With @option{-foffload-options=@var{options}}, GCC passes the specified
2769 @var{options} to the compilers for all enabled offloading targets.  You can
2770 specify options that apply only to a specific target or targets by using
2771 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2772 @var{target-list} is a comma-separated list in the same format as for the
2773 @option{-foffload=} option.
2775 Typical command lines are
2777 @smallexample
2778 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2779 -foffload-options=amdgcn-amdhsa=-march=gfx906
2780 @end smallexample
2782 @opindex fopenacc
2783 @cindex OpenACC accelerator programming
2784 @item -fopenacc
2785 Enable handling of OpenACC directives @samp{#pragma acc} in C/C++ and
2786 @samp{!$acc} in free-form Fortran and @samp{!$acc}, @samp{c$acc} and
2787 @samp{*$acc} in fixed-form Fortran.  When @option{-fopenacc} is specified,
2788 the compiler generates accelerated code according to the OpenACC Application
2789 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2790 implies @option{-pthread}, and thus is only supported on targets that
2791 have support for @option{-pthread}.
2793 @opindex fopenacc-dim
2794 @cindex OpenACC accelerator programming
2795 @item -fopenacc-dim=@var{geom}
2796 Specify default compute dimensions for parallel offload regions that do
2797 not explicitly specify.  The @var{geom} value is a triple of
2798 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2799 can be omitted, to use a target-specific default value.
2801 @opindex fopenmp
2802 @cindex OpenMP parallel
2803 @item -fopenmp
2804 Enable handling of OpenMP directives @samp{#pragma omp},
2805 @samp{[[omp::directive(...)]]}, @samp{[[omp::sequence(...)]]} and
2806 @samp{[[omp::decl(...)]]} in C/C++ and @samp{!$omp} in Fortran.  It
2807 additionally enables the conditional compilation sentinel @samp{!$} in
2808 Fortran.  In fixed source form Fortran, the sentinels can also start with
2809 @samp{c} or @samp{*}.  When @option{-fopenmp} is specified, the
2810 compiler generates parallel code according to the OpenMP Application
2811 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2812 implies @option{-pthread}, and thus is only supported on targets that
2813 have support for @option{-pthread}. @option{-fopenmp} implies
2814 @option{-fopenmp-simd}.
2816 @opindex fopenmp-simd
2817 @cindex OpenMP SIMD
2818 @cindex SIMD
2819 @item -fopenmp-simd
2820 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2821 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan}
2822 and @code{loop} directive, and of combined or composite directives with
2823 @code{simd} as constituent with @code{#pragma omp},
2824 @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and
2825 @code{[[omp::decl(...)]]} in C/C++ and @code{!$omp} in Fortran.  It
2826 additionally enables the conditional compilation sentinel @samp{!$} in
2827 Fortran.  In fixed source form Fortran, the sentinels can also start with
2828 @samp{c} or @samp{*}.  Other OpenMP directives are ignored.  Unless
2829 @option{-fopenmp} is additionally specified, the @code{loop} region binds
2830 to the current task region, independent of the specified @code{bind} clause.
2832 @opindex fopenmp-target-simd-clone
2833 @cindex OpenMP target SIMD clone
2834 @item -fopenmp-target-simd-clone
2835 @item -fopenmp-target-simd-clone=@var{device-type}
2836 In addition to generating SIMD clones for functions marked with the
2837 @code{declare simd} directive, GCC also generates clones
2838 for functions marked with the OpenMP @code{declare target} directive
2839 that are suitable for vectorization when this option is in effect.  The
2840 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2841 and @code{any}, which correspond to keywords for the @code{device_type}
2842 clause of the @code{declare target} directive; clones are generated for
2843 the intersection of devices specified.
2844 @option{-fopenmp-target-simd-clone} is equivalent to
2845 @option{-fopenmp-target-simd-clone=any} and
2846 @option{-fno-openmp-target-simd-clone} is equivalent to
2847 @option{-fopenmp-target-simd-clone=none}.
2849 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2850 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2851 it is disabled by default.
2853 @opindex fpermitted-flt-eval-methods
2854 @opindex fpermitted-flt-eval-methods=c11
2855 @opindex fpermitted-flt-eval-methods=ts-18661-3
2856 @item -fpermitted-flt-eval-methods=@var{style}
2857 ISO/IEC TS 18661-3 defines new permissible values for
2858 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2859 a semantic type that is an interchange or extended format should be
2860 evaluated to the precision and range of that type.  These new values are
2861 a superset of those permitted under C99/C11, which does not specify the
2862 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2863 conforming to C11 may not have been written expecting the possibility of
2864 the new values.
2866 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2867 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2868 or the extended set of values specified in ISO/IEC TS 18661-3.
2870 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2872 The default when in a standards compliant mode (@option{-std=c11} or similar)
2873 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2874 dialect (@option{-std=gnu11} or similar) is
2875 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2877 @opindex fdeps-
2878 The @samp{-fdeps-*} options are used to extract structured dependency
2879 information for a source.  This involves determining what resources provided by
2880 other source files will be required to compile the source as well as what
2881 resources are provided by the source.  This information can be used to add
2882 required dependencies between compilation rules of dependent sources based on
2883 their contents rather than requiring such information be reflected within the
2884 build tools as well.
2886 @opindex fdeps-file
2887 @item -fdeps-file=@var{file}
2888 Where to write structured dependency information.
2890 @opindex fdeps-format
2891 @item -fdeps-format=@var{format}
2892 The format to use for structured dependency information. @samp{p1689r5} is the
2893 only supported format right now.  Note that when this argument is specified, the
2894 output of @samp{-MF} is stripped of some information (namely C++ modules) so
2895 that it does not use extended makefile syntax not understood by most tools.
2897 @opindex fdeps-target
2898 @item -fdeps-target=@var{file}
2899 Analogous to @option{-MT} but for structured dependency information.  This
2900 indicates the target which will ultimately need any required resources and
2901 provide any resources extracted from the source that may be required by other
2902 sources.
2904 @opindex fplan9-extensions
2905 @item -fplan9-extensions
2906 Accept some non-standard constructs used in Plan 9 code.
2908 This enables @option{-fms-extensions}, permits passing pointers to
2909 structures with anonymous fields to functions that expect pointers to
2910 elements of the type of the field, and permits referring to anonymous
2911 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2912 struct/union fields within structs/unions}, for details.  This is only
2913 supported for C, not C++.
2915 @opindex fsigned-bitfields
2916 @opindex funsigned-bitfields
2917 @opindex fno-signed-bitfields
2918 @opindex fno-unsigned-bitfields
2919 @item -fsigned-bitfields
2920 @itemx -funsigned-bitfields
2921 @itemx -fno-signed-bitfields
2922 @itemx -fno-unsigned-bitfields
2923 These options control whether a bit-field is signed or unsigned, when the
2924 declaration does not use either @code{signed} or @code{unsigned}.  By
2925 default, such a bit-field is signed, because this is consistent: the
2926 basic integer types such as @code{int} are signed types.
2928 @opindex fsigned-char
2929 @item -fsigned-char
2930 Let the type @code{char} be signed, like @code{signed char}.
2932 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2933 the negative form of @option{-funsigned-char}.  Likewise, the option
2934 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2936 @opindex funsigned-char
2937 @item -funsigned-char
2938 Let the type @code{char} be unsigned, like @code{unsigned char}.
2940 Each kind of machine has a default for what @code{char} should
2941 be.  It is either like @code{unsigned char} by default or like
2942 @code{signed char} by default.
2944 Ideally, a portable program should always use @code{signed char} or
2945 @code{unsigned char} when it depends on the signedness of an object.
2946 But many programs have been written to use plain @code{char} and
2947 expect it to be signed, or expect it to be unsigned, depending on the
2948 machines they were written for.  This option, and its inverse, let you
2949 make such a program work with the opposite default.
2951 The type @code{char} is always a distinct type from each of
2952 @code{signed char} or @code{unsigned char}, even though its behavior
2953 is always just like one of those two.
2955 @opindex fstrict-flex-arrays
2956 @opindex fno-strict-flex-arrays
2957 @opindex fstrict-flex-arrays=@var{level}
2958 @item -fstrict-flex-arrays @r{(C and C++ only)}
2959 @itemx -fstrict-flex-arrays=@var{level} @r{(C and C++ only)}
2960 Control when to treat the trailing array of a structure as a flexible array
2961 member for the purpose of accessing the elements of such an array.  The value
2962 of @var{level} controls the level of strictness.
2964 @option{-fstrict-flex-arrays} is equivalent to
2965 @option{-fstrict-flex-arrays=3}, which is the strictest; all
2966 trailing arrays of structures are treated as flexible array members.
2968 The negative form @option{-fno-strict-flex-arrays} is equivalent to
2969 @option{-fstrict-flex-arrays=0}, which is the least strict.  In this
2970 case a trailing array is treated as a flexible array member only when
2971 it is declared as a flexible array member per C99 standard onwards.
2973 The possible values of @var{level} are the same as for the
2974 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2976 You can control this behavior for a specific trailing array field of a
2977 structure by using the variable attribute @code{strict_flex_array} attribute
2978 (@pxref{Variable Attributes}).
2980 The @option{-fstrict_flex_arrays} option interacts with the
2981 @option{-Wstrict-flex-arrays} option.  @xref{Warning Options}, for more
2982 information.
2984 @opindex fsso-struct
2985 @item -fsso-struct=@var{endianness}
2986 Set the default scalar storage order of structures and unions to the
2987 specified endianness.  The accepted values are @samp{big-endian},
2988 @samp{little-endian} and @samp{native} for the native endianness of
2989 the target (the default).  This option is not supported for C++.
2991 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2992 code that is not binary compatible with code generated without it if the
2993 specified endianness is not the native endianness of the target.
2994 @end table
2996 @node C++ Dialect Options
2997 @section Options Controlling C++ Dialect
2999 @cindex compiler options, C++
3000 @cindex C++ options, command-line
3001 @cindex options, C++
3002 This section describes the command-line options that are only meaningful
3003 for C++ programs.  You can also use most of the GNU compiler options
3004 regardless of what language your program is in.  For example, you
3005 might compile a file @file{firstClass.C} like this:
3007 @smallexample
3008 g++ -g -fstrict-enums -O -c firstClass.C
3009 @end smallexample
3011 @noindent
3012 In this example, only @option{-fstrict-enums} is an option meant
3013 only for C++ programs; you can use the other options with any
3014 language supported by GCC@.
3016 Some options for compiling C programs, such as @option{-std}, are also
3017 relevant for C++ programs.
3018 @xref{C Dialect Options,,Options Controlling C Dialect}.
3020 Here is a list of options that are @emph{only} for compiling C++ programs:
3022 @table @gcctabopt
3024 @opindex fabi-version
3025 @item -fabi-version=@var{n}
3026 Use version @var{n} of the C++ ABI@.  The default is version 0.
3028 Version 0 refers to the version conforming most closely to
3029 the C++ ABI specification.  Therefore, the ABI obtained using version 0
3030 will change in different versions of G++ as ABI bugs are fixed.
3032 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
3034 Version 2 is the version of the C++ ABI that first appeared in G++
3035 3.4, and was the default through G++ 4.9.
3037 Version 3 corrects an error in mangling a constant address as a
3038 template argument.
3040 Version 4, which first appeared in G++ 4.5, implements a standard
3041 mangling for vector types.
3043 Version 5, which first appeared in G++ 4.6, corrects the mangling of
3044 attribute const/volatile on function pointer types, decltype of a
3045 plain decl, and use of a function parameter in the declaration of
3046 another parameter.
3048 Version 6, which first appeared in G++ 4.7, corrects the promotion
3049 behavior of C++11 scoped enums and the mangling of template argument
3050 packs, const/static_cast, prefix ++ and --, and a class scope function
3051 used as a template argument.
3053 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
3054 builtin type and corrects the mangling of lambdas in default argument
3055 scope.
3057 Version 8, which first appeared in G++ 4.9, corrects the substitution
3058 behavior of function types with function-cv-qualifiers.
3060 Version 9, which first appeared in G++ 5.2, corrects the alignment of
3061 @code{nullptr_t}.
3063 Version 10, which first appeared in G++ 6.1, adds mangling of
3064 attributes that affect type identity, such as ia32 calling convention
3065 attributes (e.g.@: @samp{stdcall}).
3067 Version 11, which first appeared in G++ 7, corrects the mangling of
3068 sizeof... expressions and operator names.  For multiple entities with
3069 the same name within a function, that are declared in different scopes,
3070 the mangling now changes starting with the twelfth occurrence.  It also
3071 implies @option{-fnew-inheriting-ctors}.
3073 Version 12, which first appeared in G++ 8, corrects the calling
3074 conventions for empty classes on the x86_64 target and for classes
3075 with only deleted copy/move constructors.  It accidentally changes the
3076 calling convention for classes with a deleted copy constructor and a
3077 trivial move constructor.
3079 Version 13, which first appeared in G++ 8.2, fixes the accidental
3080 change in version 12.
3082 Version 14, which first appeared in G++ 10, corrects the mangling of
3083 the nullptr expression.
3085 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3086 tag regression.
3088 Version 16, which first appeared in G++ 11, changes the mangling of
3089 @code{__alignof__} to be distinct from that of @code{alignof}, and
3090 dependent operator names.
3092 Version 17, which first appeared in G++ 12, fixes layout of classes
3093 that inherit from aggregate classes with default member initializers
3094 in C++14 and up.
3096 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3097 that have additional context.
3099 Version 19, which first appeard in G++ 14, fixes manglings of structured
3100 bindings to include ABI tags.
3102 See also @option{-Wabi}.
3104 @opindex fabi-compat-version
3105 @item -fabi-compat-version=@var{n}
3106 On targets that support strong aliases, G++
3107 works around mangling changes by creating an alias with the correct
3108 mangled name when defining a symbol with an incorrect mangled name.
3109 This switch specifies which ABI version to use for the alias.
3111 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3112 compatibility).  If another ABI version is explicitly selected, this
3113 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3114 use @option{-fabi-compat-version=2}.
3116 If this option is not provided but @option{-Wabi=@var{n}} is, that
3117 version is used for compatibility aliases.  If this option is provided
3118 along with @option{-Wabi} (without the version), the version from this
3119 option is used for the warning.
3121 @opindex fno-access-control
3122 @opindex faccess-control
3123 @item -fno-access-control
3124 Turn off all access checking.  This switch is mainly useful for working
3125 around bugs in the access control code.
3127 @opindex faligned-new
3128 @item -faligned-new
3129 Enable support for C++17 @code{new} of types that require more
3130 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3131 numeric argument such as @code{-faligned-new=32} can be used to
3132 specify how much alignment (in bytes) is provided by that function,
3133 but few users will need to override the default of
3134 @code{alignof(std::max_align_t)}.
3136 This flag is enabled by default for @option{-std=c++17}.
3138 @opindex fchar8_t
3139 @opindex fno-char8_t
3140 @item -fchar8_t
3141 @itemx -fno-char8_t
3142 Enable support for @code{char8_t} as adopted for C++20.  This includes
3143 the addition of a new @code{char8_t} fundamental type, changes to the
3144 types of UTF-8 string and character literals, new signatures for
3145 user-defined literals, associated standard library updates, and new
3146 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3148 This option enables functions to be overloaded for ordinary and UTF-8
3149 strings:
3151 @smallexample
3152 int f(const char *);    // #1
3153 int f(const char8_t *); // #2
3154 int v1 = f("text");     // Calls #1
3155 int v2 = f(u8"text");   // Calls #2
3156 @end smallexample
3158 @noindent
3159 and introduces new signatures for user-defined literals:
3161 @smallexample
3162 int operator""_udl1(char8_t);
3163 int v3 = u8'x'_udl1;
3164 int operator""_udl2(const char8_t*, std::size_t);
3165 int v4 = u8"text"_udl2;
3166 template<typename T, T...> int operator""_udl3();
3167 int v5 = u8"text"_udl3;
3168 @end smallexample
3170 @noindent
3171 The change to the types of UTF-8 string and character literals introduces
3172 incompatibilities with ISO C++11 and later standards.  For example, the
3173 following code is well-formed under ISO C++11, but is ill-formed when
3174 @option{-fchar8_t} is specified.
3176 @smallexample
3177 const char *cp = u8"xx";// error: invalid conversion from
3178                         //        `const char8_t*' to `const char*'
3179 int f(const char*);
3180 auto v = f(u8"xx");     // error: invalid conversion from
3181                         //        `const char8_t*' to `const char*'
3182 std::string s@{u8"xx"@};  // error: no matching function for call to
3183                         //        `std::basic_string<char>::basic_string()'
3184 using namespace std::literals;
3185 s = u8"xx"s;            // error: conversion from
3186                         //        `basic_string<char8_t>' to non-scalar
3187                         //        type `basic_string<char>' requested
3188 @end smallexample
3190 @opindex fcheck-new
3191 @item -fcheck-new
3192 Check that the pointer returned by @code{operator new} is non-null
3193 before attempting to modify the storage allocated.  This check is
3194 normally unnecessary because the C++ standard specifies that
3195 @code{operator new} only returns @code{0} if it is declared
3196 @code{throw()}, in which case the compiler always checks the
3197 return value even without this option.  In all other cases, when
3198 @code{operator new} has a non-empty exception specification, memory
3199 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3200 @samp{new (nothrow)}.
3202 @opindex fconcepts
3203 @opindex fconcepts-ts
3204 @item -fconcepts
3205 @itemx -fconcepts-ts
3206 Enable support for the C++ Concepts feature for constraining template
3207 arguments.  With @option{-std=c++20} and above, Concepts are part of
3208 the language standard, so @option{-fconcepts} defaults to on.
3210 Some constructs that were allowed by the earlier C++ Extensions for
3211 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3212 into the standard, can additionally be enabled by
3213 @option{-fconcepts-ts}.  The option @option{-fconcepts-ts} was deprecated
3214 in GCC 14 and may be removed in GCC 15; users are expected to convert
3215 their code to C++20 concepts.
3217 @opindex fconstexpr-depth
3218 @item -fconstexpr-depth=@var{n}
3219 Set the maximum nested evaluation depth for C++11 constexpr functions
3220 to @var{n}.  A limit is needed to detect endless recursion during
3221 constant expression evaluation.  The minimum specified by the standard
3222 is 512.
3224 @opindex fconstexpr-cache-depth
3225 @item -fconstexpr-cache-depth=@var{n}
3226 Set the maximum level of nested evaluation depth for C++11 constexpr
3227 functions that will be cached to @var{n}.  This is a heuristic that
3228 trades off compilation speed (when the cache avoids repeated
3229 calculations) against memory consumption (when the cache grows very
3230 large from highly recursive evaluations).  The default is 8.  Very few
3231 users are likely to want to adjust it, but if your code does heavy
3232 constexpr calculations you might want to experiment to find which
3233 value works best for you.
3235 @opindex fconstexpr-fp-except
3236 @item -fconstexpr-fp-except
3237 Annex F of the C standard specifies that IEC559 floating point
3238 exceptions encountered at compile time should not stop compilation.
3239 C++ compilers have historically not followed this guidance, instead
3240 treating floating point division by zero as non-constant even though
3241 it has a well defined value.  This flag tells the compiler to give
3242 Annex F priority over other rules saying that a particular operation
3243 is undefined.
3245 @smallexample
3246 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3247 @end smallexample
3249 @opindex fconstexpr-loop-limit
3250 @item -fconstexpr-loop-limit=@var{n}
3251 Set the maximum number of iterations for a loop in C++14 constexpr functions
3252 to @var{n}.  A limit is needed to detect infinite loops during
3253 constant expression evaluation.  The default is 262144 (1<<18).
3255 @opindex fconstexpr-ops-limit
3256 @item -fconstexpr-ops-limit=@var{n}
3257 Set the maximum number of operations during a single constexpr evaluation.
3258 Even when number of iterations of a single loop is limited with the above limit,
3259 if there are several nested loops and each of them has many iterations but still
3260 smaller than the above limit, or if in a body of some loop or even outside
3261 of a loop too many expressions need to be evaluated, the resulting constexpr
3262 evaluation might take too long.
3263 The default is 33554432 (1<<25).
3265 @opindex fcontracts
3266 @item -fcontracts
3267 Enable experimental support for the C++ Contracts feature, as briefly
3268 added to and then removed from the C++20 working paper (N4820).  The
3269 implementation also includes proposed enhancements from papers P1290,
3270 P1332, and P1429.  This functionality is intended mostly for those
3271 interested in experimentation towards refining the feature to get it
3272 into shape for a future C++ standard.
3274 On violation of a checked contract, the violation handler is called.
3275 Users can replace the violation handler by defining
3276 @smallexample
3277 void
3278 handle_contract_violation (const std::experimental::contract_violation&);
3279 @end smallexample
3281 There are different sets of additional flags that can be used together
3282 to specify which contracts will be checked and how, for N4820
3283 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3284 used together.
3286 @table @gcctabopt
3287 @opindex fcontract-mode
3288 @item -fcontract-mode=[on|off]
3289 Control whether any contracts have any semantics at all.  Defaults to on.
3291 @opindex fcontract-assumption-mode
3292 @item -fcontract-assumption-mode=[on|off]
3293 [N4820] Control whether contracts with level @samp{axiom}
3294 should have the assume semantic.  Defaults to on.
3296 @opindex fcontract-build-level
3297 @item -fcontract-build-level=[off|default|audit]
3298 [N4820] Specify which level of contracts to generate checks
3299 for.  Defaults to @samp{default}.
3301 @opindex fcontract-continuation-mode
3302 @item -fcontract-continuation-mode=[on|off]
3303 [N4820] Control whether to allow the program to continue executing
3304 after a contract violation.  That is, do checked contracts have the
3305 @samp{maybe} semantic described below rather than the @samp{never}
3306 semantic.  Defaults to off.
3308 @opindex fcontract-role
3309 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3310 [P1332] Specify the concrete semantics for each contract level
3311 of a particular contract role.
3313 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3314 [P1429] Specify the concrete semantic for a particular
3315 contract level.
3317 @opindex fcontract-strict-declarations
3318 @item -fcontract-strict-declarations=[on|off]
3319 Control whether to reject adding contracts to a function after its
3320 first declaration.  Defaults to off.
3321 @end table
3323 The possible concrete semantics for that can be specified with
3324 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3326 @table @code
3327 @item ignore
3328 This contract has no effect.
3330 @item assume
3331 This contract is treated like C++23 @code{[[assume]]}.
3333 @item check_never_continue
3334 @itemx never
3335 @itemx abort
3336 This contract is checked.  If it fails, the violation handler is
3337 called.  If the handler returns, @code{std::terminate} is called.
3339 @item check_maybe_continue
3340 @itemx maybe
3341 This contract is checked.  If it fails, the violation handler is
3342 called.  If the handler returns, execution continues normally.
3343 @end table
3345 @opindex fcoroutines
3346 @item -fcoroutines
3347 Enable support for the C++ coroutines extension (experimental).
3349 @opindex fdiagnostics-all-candidates
3350 @item -fdiagnostics-all-candidates
3351 Permit the C++ front end to note all candidates during overload resolution
3352 failure, including when a deleted function is selected.
3354 @opindex fno-elide-constructors
3355 @opindex felide-constructors
3356 @item -fno-elide-constructors
3357 The C++ standard allows an implementation to omit creating a temporary
3358 that is only used to initialize another object of the same type.
3359 Specifying this option disables that optimization, and forces G++ to
3360 call the copy constructor in all cases.  This option also causes G++
3361 to call trivial member functions which otherwise would be expanded inline.
3363 In C++17, the compiler is required to omit these temporaries, but this
3364 option still affects trivial member functions.
3366 @opindex fno-enforce-eh-specs
3367 @opindex fenforce-eh-specs
3368 @item -fno-enforce-eh-specs
3369 Don't generate code to check for violation of exception specifications
3370 at run time.  This option violates the C++ standard, but may be useful
3371 for reducing code size in production builds, much like defining
3372 @code{NDEBUG}.  This does not give user code permission to throw
3373 exceptions in violation of the exception specifications; the compiler
3374 still optimizes based on the specifications, so throwing an
3375 unexpected exception results in undefined behavior at run time.
3377 @opindex fextern-tls-init
3378 @opindex fno-extern-tls-init
3379 @item -fextern-tls-init
3380 @itemx -fno-extern-tls-init
3381 The C++11 and OpenMP standards allow @code{thread_local} and
3382 @code{threadprivate} variables to have dynamic (runtime)
3383 initialization.  To support this, any use of such a variable goes
3384 through a wrapper function that performs any necessary initialization.
3385 When the use and definition of the variable are in the same
3386 translation unit, this overhead can be optimized away, but when the
3387 use is in a different translation unit there is significant overhead
3388 even if the variable doesn't actually need dynamic initialization.  If
3389 the programmer can be sure that no use of the variable in a
3390 non-defining TU needs to trigger dynamic initialization (either
3391 because the variable is statically initialized, or a use of the
3392 variable in the defining TU will be executed before any uses in
3393 another TU), they can avoid this overhead with the
3394 @option{-fno-extern-tls-init} option.
3396 On targets that support symbol aliases, the default is
3397 @option{-fextern-tls-init}.  On targets that do not support symbol
3398 aliases, the default is @option{-fno-extern-tls-init}.
3400 @opindex ffold-simple-inlines
3401 @opindex fno-fold-simple-inlines
3402 @item -ffold-simple-inlines
3403 @itemx -fno-fold-simple-inlines
3404 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3405 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3406 means no debug information will be generated for such calls.  Since these
3407 functions are rarely interesting to debug, this flag is enabled by default
3408 unless @option{-fno-inline} is active.
3410 @opindex fno-gnu-keywords
3411 @opindex fgnu-keywords
3412 @item -fno-gnu-keywords
3413 Do not recognize @code{typeof} as a keyword, so that code can use this
3414 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3415 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3416 @option{-std=c++98}, @option{-std=c++11}, etc.
3418 @opindex fno-immediate-escalation
3419 @opindex fimmediate-escalation
3420 @item -fno-immediate-escalation
3421 Do not enable immediate function escalation whereby certain functions
3422 can be promoted to consteval, as specified in P2564R3.  For example:
3424 @example
3425 consteval int id(int i) @{ return i; @}
3427 constexpr int f(auto t)
3429   return t + id(t); // id causes f<int> to be promoted to consteval
3432 void g(int i)
3434   f (3);
3436 @end example
3438 compiles in C++20: @code{f} is an immediate-escalating function (due to
3439 the @code{auto} it is a function template and is declared @code{constexpr})
3440 and @code{id(t)} is an immediate-escalating expression, so @code{f} is
3441 promoted to @code{consteval}.  Consequently, the call to @code{id(t)}
3442 is in an immediate context, so doesn't have to produce a constant (that
3443 is the mechanism allowing consteval function composition).  However,
3444 with @option{-fno-immediate-escalation}, @code{f} is not promoted to
3445 @code{consteval}, and since the call to consteval function @code{id(t)}
3446 is not a constant expression, the compiler rejects the code.
3448 This option is turned on by default; it is only effective in C++20 mode
3449 or later.
3451 @opindex fimplicit-constexpr
3452 @item -fimplicit-constexpr
3453 Make inline functions implicitly constexpr, if they satisfy the
3454 requirements for a constexpr function.  This option can be used in
3455 C++14 mode or later.  This can result in initialization changing from
3456 dynamic to static and other optimizations.
3458 @opindex fno-implicit-templates
3459 @opindex fimplicit-templates
3460 @item -fno-implicit-templates
3461 Never emit code for non-inline templates that are instantiated
3462 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3463 If you use this option, you must take care to structure your code to
3464 include all the necessary explicit instantiations to avoid getting
3465 undefined symbols at link time.
3466 @xref{Template Instantiation}, for more information.
3468 @opindex fno-implicit-inline-templates
3469 @opindex fimplicit-inline-templates
3470 @item -fno-implicit-inline-templates
3471 Don't emit code for implicit instantiations of inline templates, either.
3472 The default is to handle inlines differently so that compiles with and
3473 without optimization need the same set of explicit instantiations.
3475 @opindex fno-implement-inlines
3476 @opindex fimplement-inlines
3477 @item -fno-implement-inlines
3478 To save space, do not emit out-of-line copies of inline functions
3479 controlled by @code{#pragma implementation}.  This causes linker
3480 errors if these functions are not inlined everywhere they are called.
3482 @opindex fmodules-ts
3483 @opindex fno-modules-ts
3484 @item -fmodules-ts
3485 @itemx -fno-modules-ts
3486 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3487 @option{-fno-modules-ts} is usually not needed, as that is the
3488 default.  Even though this is a C++20 feature, it is not currently
3489 implicitly enabled by selecting that standard version.
3491 @opindex fmodule-header
3492 @item -fmodule-header
3493 @itemx -fmodule-header=user
3494 @itemx -fmodule-header=system
3495 Compile a header file to create an importable header unit.
3497 @opindex fmodule-implicit-inline
3498 @item -fmodule-implicit-inline
3499 Member functions defined in their class definitions are not implicitly
3500 inline for modular code.  This is different to traditional C++
3501 behavior, for good reasons.  However, it may result in a difficulty
3502 during code porting.  This option makes such function definitions
3503 implicitly inline.  It does however generate an ABI incompatibility,
3504 so you must use it everywhere or nowhere.  (Such definitions outside
3505 of a named module remain implicitly inline, regardless.)
3507 @opindex fno-module-lazy
3508 @opindex fmodule-lazy
3509 @item -fno-module-lazy
3510 Disable lazy module importing and module mapper creation.
3512 @vindex CXX_MODULE_MAPPER @r{environment variable}
3513 @opindex fmodule-mapper
3514 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3515 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3516 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3517 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3518 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3519 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3520 An oracle to query for module name to filename mappings.  If
3521 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3522 and if that is unset, an in-process default is provided.
3524 @opindex fmodule-only
3525 @item -fmodule-only
3526 Only emit the Compiled Module Interface, inhibiting any object file.
3528 @opindex fms-extensions
3529 @item -fms-extensions
3530 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3531 int and getting a pointer to member function via non-standard syntax.
3533 @opindex fnew-inheriting-ctors
3534 @item -fnew-inheriting-ctors
3535 Enable the P0136 adjustment to the semantics of C++11 constructor
3536 inheritance.  This is part of C++17 but also considered to be a Defect
3537 Report against C++11 and C++14.  This flag is enabled by default
3538 unless @option{-fabi-version=10} or lower is specified.
3540 @opindex fnew-ttp-matching
3541 @item -fnew-ttp-matching
3542 Enable the P0522 resolution to Core issue 150, template template
3543 parameters and default arguments: this allows a template with default
3544 template arguments as an argument for a template template parameter
3545 with fewer template parameters.  This flag is enabled by default for
3546 @option{-std=c++17}.
3548 @opindex fno-nonansi-builtins
3549 @opindex fnonansi-builtins
3550 @item -fno-nonansi-builtins
3551 Disable built-in declarations of functions that are not mandated by
3552 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3553 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3555 @opindex fnothrow-opt
3556 @item -fnothrow-opt
3557 Treat a @code{throw()} exception specification as if it were a
3558 @code{noexcept} specification to reduce or eliminate the text size
3559 overhead relative to a function with no exception specification.  If
3560 the function has local variables of types with non-trivial
3561 destructors, the exception specification actually makes the
3562 function smaller because the EH cleanups for those variables can be
3563 optimized away.  The semantic effect is that an exception thrown out of
3564 a function with such an exception specification results in a call
3565 to @code{terminate} rather than @code{unexpected}.
3567 @opindex fno-operator-names
3568 @opindex foperator-names
3569 @item -fno-operator-names
3570 Do not treat the operator name keywords @code{and}, @code{bitand},
3571 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3572 synonyms as keywords.
3574 @opindex fno-optional-diags
3575 @opindex foptional-diags
3576 @item -fno-optional-diags
3577 Disable diagnostics that the standard says a compiler does not need to
3578 issue.  Currently, the only such diagnostic issued by G++ is the one for
3579 a name having multiple meanings within a class.
3581 @opindex fno-pretty-templates
3582 @opindex fpretty-templates
3583 @item -fno-pretty-templates
3584 When an error message refers to a specialization of a function
3585 template, the compiler normally prints the signature of the
3586 template followed by the template arguments and any typedefs or
3587 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3588 rather than @code{void f(int)}) so that it's clear which template is
3589 involved.  When an error message refers to a specialization of a class
3590 template, the compiler omits any template arguments that match
3591 the default template arguments for that template.  If either of these
3592 behaviors make it harder to understand the error message rather than
3593 easier, you can use @option{-fno-pretty-templates} to disable them.
3595 @opindex fno-rtti
3596 @opindex frtti
3597 @item -fno-rtti
3598 Disable generation of information about every class with virtual
3599 functions for use by the C++ run-time type identification features
3600 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3601 of the language, you can save some space by using this flag.  Note that
3602 exception handling uses the same information, but G++ generates it as
3603 needed. The @code{dynamic_cast} operator can still be used for casts that
3604 do not require run-time type information, i.e.@: casts to @code{void *} or to
3605 unambiguous base classes.
3607 Mixing code compiled with @option{-frtti} with that compiled with
3608 @option{-fno-rtti} may not work.  For example, programs may
3609 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3610 for a class compiled with @option{-frtti}.  
3612 @opindex fsized-deallocation
3613 @item -fsized-deallocation
3614 Enable the built-in global declarations
3615 @smallexample
3616 void operator delete (void *, std::size_t) noexcept;
3617 void operator delete[] (void *, std::size_t) noexcept;
3618 @end smallexample
3619 as introduced in C++14.  This is useful for user-defined replacement
3620 deallocation functions that, for example, use the size of the object
3621 to make deallocation faster.  Enabled by default under
3622 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3623 warns about places that might want to add a definition.
3625 @opindex fstrict-enums
3626 @item -fstrict-enums
3627 Allow the compiler to optimize using the assumption that a value of
3628 enumerated type can only be one of the values of the enumeration (as
3629 defined in the C++ standard; basically, a value that can be
3630 represented in the minimum number of bits needed to represent all the
3631 enumerators).  This assumption may not be valid if the program uses a
3632 cast to convert an arbitrary integer value to the enumerated type.
3633 This option has no effect for an enumeration type with a fixed underlying
3634 type.
3636 @opindex fstrong-eval-order
3637 @item -fstrong-eval-order
3638 Evaluate member access, array subscripting, and shift expressions in
3639 left-to-right order, and evaluate assignment in right-to-left order,
3640 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3641 @option{-fstrong-eval-order=some} enables just the ordering of member
3642 access and shift expressions, and is the default without
3643 @option{-std=c++17}.
3645 @opindex ftemplate-backtrace-limit
3646 @item -ftemplate-backtrace-limit=@var{n}
3647 Set the maximum number of template instantiation notes for a single
3648 warning or error to @var{n}.  The default value is 10.
3650 @opindex ftemplate-depth
3651 @item -ftemplate-depth=@var{n}
3652 Set the maximum instantiation depth for template classes to @var{n}.
3653 A limit on the template instantiation depth is needed to detect
3654 endless recursions during template class instantiation.  ANSI/ISO C++
3655 conforming programs must not rely on a maximum depth greater than 17
3656 (changed to 1024 in C++11).  The default value is 900, as the compiler
3657 can run out of stack space before hitting 1024 in some situations.
3659 @opindex fno-threadsafe-statics
3660 @opindex fthreadsafe-statics
3661 @item -fno-threadsafe-statics
3662 Do not emit the extra code to use the routines specified in the C++
3663 ABI for thread-safe initialization of local statics.  You can use this
3664 option to reduce code size slightly in code that doesn't need to be
3665 thread-safe.
3667 @opindex fuse-cxa-atexit
3668 @item -fuse-cxa-atexit
3669 Register destructors for objects with static storage duration with the
3670 @code{__cxa_atexit} function rather than the @code{atexit} function.
3671 This option is required for fully standards-compliant handling of static
3672 destructors, but only works if your C library supports
3673 @code{__cxa_atexit}.
3675 @opindex fno-use-cxa-get-exception-ptr
3676 @opindex fuse-cxa-get-exception-ptr
3677 @item -fno-use-cxa-get-exception-ptr
3678 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3679 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3680 if the runtime routine is not available.
3682 @opindex fvisibility-inlines-hidden
3683 @item -fvisibility-inlines-hidden
3684 This switch declares that the user does not attempt to compare
3685 pointers to inline functions or methods where the addresses of the two functions
3686 are taken in different shared objects.
3688 The effect of this is that GCC may, effectively, mark inline methods with
3689 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3690 appear in the export table of a DSO and do not require a PLT indirection
3691 when used within the DSO@.  Enabling this option can have a dramatic effect
3692 on load and link times of a DSO as it massively reduces the size of the
3693 dynamic export table when the library makes heavy use of templates.
3695 The behavior of this switch is not quite the same as marking the
3696 methods as hidden directly, because it does not affect static variables
3697 local to the function or cause the compiler to deduce that
3698 the function is defined in only one shared object.
3700 You may mark a method as having a visibility explicitly to negate the
3701 effect of the switch for that method.  For example, if you do want to
3702 compare pointers to a particular inline method, you might mark it as
3703 having default visibility.  Marking the enclosing class with explicit
3704 visibility has no effect.
3706 Explicitly instantiated inline methods are unaffected by this option
3707 as their linkage might otherwise cross a shared library boundary.
3708 @xref{Template Instantiation}.
3710 @opindex fvisibility-ms-compat
3711 @item -fvisibility-ms-compat
3712 This flag attempts to use visibility settings to make GCC's C++
3713 linkage model compatible with that of Microsoft Visual Studio.
3715 The flag makes these changes to GCC's linkage model:
3717 @enumerate
3718 @item
3719 It sets the default visibility to @code{hidden}, like
3720 @option{-fvisibility=hidden}.
3722 @item
3723 Types, but not their members, are not hidden by default.
3725 @item
3726 The One Definition Rule is relaxed for types without explicit
3727 visibility specifications that are defined in more than one
3728 shared object: those declarations are permitted if they are
3729 permitted when this option is not used.
3730 @end enumerate
3732 In new code it is better to use @option{-fvisibility=hidden} and
3733 export those classes that are intended to be externally visible.
3734 Unfortunately it is possible for code to rely, perhaps accidentally,
3735 on the Visual Studio behavior.
3737 Among the consequences of these changes are that static data members
3738 of the same type with the same name but defined in different shared
3739 objects are different, so changing one does not change the other;
3740 and that pointers to function members defined in different shared
3741 objects may not compare equal.  When this flag is given, it is a
3742 violation of the ODR to define types with the same name differently.
3744 @opindex fno-weak
3745 @opindex fweak
3746 @item -fno-weak
3747 Do not use weak symbol support, even if it is provided by the linker.
3748 By default, G++ uses weak symbols if they are available.  This
3749 option exists only for testing, and should not be used by end-users;
3750 it results in inferior code and has no benefits.  This option may
3751 be removed in a future release of G++.
3753 @opindex fext-numeric-literals
3754 @opindex fno-ext-numeric-literals
3755 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3756 Accept imaginary, fixed-point, or machine-defined
3757 literal number suffixes as GNU extensions.
3758 When this option is turned off these suffixes are treated
3759 as C++11 user-defined literal numeric suffixes.
3760 This is on by default for all pre-C++11 dialects and all GNU dialects:
3761 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3762 @option{-std=gnu++14}.
3763 This option is off by default
3764 for ISO C++11 onwards (@option{-std=c++11}, ...).
3766 @opindex nostdinc++
3767 @item -nostdinc++
3768 Do not search for header files in the standard directories specific to
3769 C++, but do still search the other standard directories.  (This option
3770 is used when building the C++ library.)
3772 @opindex flang-info-include-translate
3773 @opindex flang-info-include-translate-not
3774 @item -flang-info-include-translate
3775 @itemx -flang-info-include-translate-not
3776 @itemx -flang-info-include-translate=@var{header}
3777 Inform of include translation events.  The first will note accepted
3778 include translations, the second will note declined include
3779 translations.  The @var{header} form will inform of include
3780 translations relating to that specific header.  If @var{header} is of
3781 the form @code{"user"} or @code{<system>} it will be resolved to a
3782 specific user or system header using the include path.
3784 @opindex flang-info-module-cmi
3785 @item -flang-info-module-cmi
3786 @itemx -flang-info-module-cmi=@var{module}
3787 Inform of Compiled Module Interface pathnames.  The first will note
3788 all read CMI pathnames.  The @var{module} form will not reading a
3789 specific module's CMI.  @var{module} may be a named module or a
3790 header-unit (the latter indicated by either being a pathname containing
3791 directory separators or enclosed in @code{<>} or @code{""}).
3793 @opindex stdlib
3794 @item -stdlib=@var{libstdc++,libc++}
3795 When G++ is configured to support this option, it allows specification of
3796 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3797 (the default, native C++ runtime for G++) and @var{libc++} which is the
3798 C++ runtime installed on some operating systems (e.g. Darwin versions from
3799 Darwin11 onwards).  The option switches G++ to use the headers from the
3800 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3801 when a C++ runtime is required for linking.
3802 @end table
3804 In addition, these warning options have meanings only for C++ programs:
3806 @table @gcctabopt
3807 @opindex Wabi-tag
3808 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3809 Warn when a type with an ABI tag is used in a context that does not
3810 have that ABI tag.  See @ref{C++ Attributes} for more information
3811 about ABI tags.
3813 @opindex Wcomma-subscript
3814 @opindex Wno-comma-subscript
3815 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3816 Warn about uses of a comma expression within a subscripting expression.
3817 This usage was deprecated in C++20 and is going to be removed in C++23.
3818 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3820 @smallexample
3821 @group
3822 void f(int *a, int b, int c) @{
3823     a[b,c];     // deprecated in C++20, invalid in C++23
3824     a[(b,c)];   // OK
3826 @end group
3827 @end smallexample
3829 In C++23 it is valid to have comma separated expressions in a subscript
3830 when an overloaded subscript operator is found and supports the right
3831 number and types of arguments.  G++ will accept the formerly valid syntax
3832 for code that is not valid in C++23 but used to be valid but deprecated
3833 in C++20 with a pedantic warning that can be disabled with
3834 @option{-Wno-comma-subscript}.
3836 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3837 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3839 This warning is upgraded to an error by @option{-pedantic-errors} in
3840 C++23 mode or later.
3842 @opindex Wctad-maybe-unsupported
3843 @opindex Wno-ctad-maybe-unsupported
3844 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3845 Warn when performing class template argument deduction (CTAD) on a type with
3846 no explicitly written deduction guides.  This warning will point out cases
3847 where CTAD succeeded only because the compiler synthesized the implicit
3848 deduction guides, which might not be what the programmer intended.  Certain
3849 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3850 types that are designed to support CTAD.  This warning can be suppressed with
3851 the following pattern:
3853 @smallexample
3854 struct allow_ctad_t; // any name works
3855 template <typename T> struct S @{
3856   S(T) @{ @}
3858 // Guide with incomplete parameter type will never be considered.
3859 S(allow_ctad_t) -> S<void>;
3860 @end smallexample
3862 @opindex Wctor-dtor-privacy
3863 @opindex Wno-ctor-dtor-privacy
3864 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3865 Warn when a class seems unusable because all the constructors or
3866 destructors in that class are private, and it has neither friends nor
3867 public static member functions.  Also warn if there are no non-private
3868 methods, and there's at least one private member function that isn't
3869 a constructor or destructor.
3871 @opindex Wdangling-reference
3872 @opindex Wno-dangling-reference
3873 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3874 Warn when a reference is bound to a temporary whose lifetime has ended.
3875 For example:
3877 @smallexample
3878 int n = 1;
3879 const int& r = std::max(n - 1, n + 1); // r is dangling
3880 @end smallexample
3882 In the example above, two temporaries are created, one for each
3883 argument, and a reference to one of the temporaries is returned.
3884 However, both temporaries are destroyed at the end of the full
3885 expression, so the reference @code{r} is dangling.  This warning
3886 also detects dangling references in member initializer lists:
3888 @smallexample
3889 const int& f(const int& i) @{ return i; @}
3890 struct S @{
3891   const int &r; // r is dangling
3892   S() : r(f(10)) @{ @}
3894 @end smallexample
3896 Member functions are checked as well, but only their object argument:
3898 @smallexample
3899 struct S @{
3900    const S& self () @{ return *this; @}
3902 const S& s = S().self(); // s is dangling
3903 @end smallexample
3905 Certain functions are safe in this respect, for example @code{std::use_facet}:
3906 they take and return a reference, but they don't return one of its arguments,
3907 which can fool the warning.  Such functions can be excluded from the warning
3908 by wrapping them in a @code{#pragma}:
3910 @smallexample
3911 #pragma GCC diagnostic push
3912 #pragma GCC diagnostic ignored "-Wdangling-reference"
3913 const T& foo (const T&) @{ @dots{} @}
3914 #pragma GCC diagnostic pop
3915 @end smallexample
3917 The @code{#pragma} can also surround the class; in that case, the warning
3918 will be disabled for all the member functions.
3920 @option{-Wdangling-reference} also warns about code like
3922 @smallexample
3923 auto p = std::minmax(1, 2);
3924 @end smallexample
3926 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3927 both references dangle after the end of the full expression that contains
3928 the call to @code{std::minmax}.
3930 The warning does not warn for @code{std::span}-like classes.  We consider
3931 classes of the form:
3933 @smallexample
3934 template<typename T>
3935 struct Span @{
3936   T* data_;
3937   std::size len_;
3939 @end smallexample
3941 as @code{std::span}-like; that is, the class is a non-union class
3942 that has a pointer data member and a trivial destructor.
3944 The warning can be disabled by using the @code{gnu::no_dangling} attribute
3945 (@pxref{C++ Attributes}).
3947 This warning is enabled by @option{-Wall}.
3949 @opindex Wdelete-non-virtual-dtor
3950 @opindex Wno-delete-non-virtual-dtor
3951 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3952 Warn when @code{delete} is used to destroy an instance of a class that
3953 has virtual functions and non-virtual destructor. It is unsafe to delete
3954 an instance of a derived class through a pointer to a base class if the
3955 base class does not have a virtual destructor.  This warning is enabled
3956 by @option{-Wall}.
3958 @opindex Wdeprecated-copy
3959 @opindex Wno-deprecated-copy
3960 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3961 Warn that the implicit declaration of a copy constructor or copy
3962 assignment operator is deprecated if the class has a user-provided
3963 copy constructor or copy assignment operator, in C++11 and up.  This
3964 warning is enabled by @option{-Wextra}.  With
3965 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3966 user-provided destructor.
3968 @opindex Wdeprecated-enum-enum-conversion
3969 @opindex Wno-deprecated-enum-enum-conversion
3970 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3971 Disable the warning about the case when the usual arithmetic conversions
3972 are applied on operands where one is of enumeration type and the other is
3973 of a different enumeration type.  This conversion was deprecated in C++20.
3974 For example:
3976 @smallexample
3977 enum E1 @{ e @};
3978 enum E2 @{ f @};
3979 int k = f - e;
3980 @end smallexample
3982 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3983 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3984 by @option{-Wenum-conversion}.
3986 @opindex Wdeprecated-enum-float-conversion
3987 @opindex Wno-deprecated-enum-float-conversion
3988 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3989 Disable the warning about the case when the usual arithmetic conversions
3990 are applied on operands where one is of enumeration type and the other is
3991 of a floating-point type.  This conversion was deprecated in C++20.  For
3992 example:
3994 @smallexample
3995 enum E1 @{ e @};
3996 enum E2 @{ f @};
3997 bool b = e <= 3.7;
3998 @end smallexample
4000 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
4001 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
4002 by @option{-Wenum-conversion}.
4004 @opindex Welaborated-enum-base
4005 @opindex Wno-elaborated-enum-base
4006 @item -Wno-elaborated-enum-base
4007 For C++11 and above, warn if an (invalid) additional enum-base is used
4008 in an elaborated-type-specifier.  That is, if an enum with given
4009 underlying type and no enumerator list is used in a declaration other
4010 than just a standalone declaration of the enum.  Enabled by default.  This
4011 warning is upgraded to an error with -pedantic-errors.
4013 @opindex Winit-list-lifetime
4014 @opindex Wno-init-list-lifetime
4015 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
4016 Do not warn about uses of @code{std::initializer_list} that are likely
4017 to result in dangling pointers.  Since the underlying array for an
4018 @code{initializer_list} is handled like a normal C++ temporary object,
4019 it is easy to inadvertently keep a pointer to the array past the end
4020 of the array's lifetime.  For example:
4022 @itemize @bullet
4023 @item
4024 If a function returns a temporary @code{initializer_list}, or a local
4025 @code{initializer_list} variable, the array's lifetime ends at the end
4026 of the return statement, so the value returned has a dangling pointer.
4028 @item
4029 If a new-expression creates an @code{initializer_list}, the array only
4030 lives until the end of the enclosing full-expression, so the
4031 @code{initializer_list} in the heap has a dangling pointer.
4033 @item
4034 When an @code{initializer_list} variable is assigned from a
4035 brace-enclosed initializer list, the temporary array created for the
4036 right side of the assignment only lives until the end of the
4037 full-expression, so at the next statement the @code{initializer_list}
4038 variable has a dangling pointer.
4040 @smallexample
4041 // li's initial underlying array lives as long as li
4042 std::initializer_list<int> li = @{ 1,2,3 @};
4043 // assignment changes li to point to a temporary array
4044 li = @{ 4, 5 @};
4045 // now the temporary is gone and li has a dangling pointer
4046 int i = li.begin()[0] // undefined behavior
4047 @end smallexample
4049 @item
4050 When a list constructor stores the @code{begin} pointer from the
4051 @code{initializer_list} argument, this doesn't extend the lifetime of
4052 the array, so if a class variable is constructed from a temporary
4053 @code{initializer_list}, the pointer is left dangling by the end of
4054 the variable declaration statement.
4056 @end itemize
4058 @opindex Winvalid-constexpr
4059 @opindex Wno-invalid-constexpr
4060 @item -Winvalid-constexpr
4062 Warn when a function never produces a constant expression.  In C++20
4063 and earlier, for every @code{constexpr} function and function template,
4064 there must be at least one set of function arguments in at least one
4065 instantiation such that an invocation of the function or constructor
4066 could be an evaluated subexpression of a core constant expression.
4067 C++23 removed this restriction, so it's possible to have a function
4068 or a function template marked @code{constexpr} for which no invocation
4069 satisfies the requirements of a core constant expression.
4071 This warning is enabled as a pedantic warning by default in C++20 and
4072 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
4073 which case it will be an ordinary warning.  For example:
4075 @smallexample
4076 void f (int& i);
4077 constexpr void
4078 g (int& i)
4080   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
4081   f(i);
4083 @end smallexample
4085 @opindex Winvalid-imported-macros
4086 @opindex Wno-invalid-imported-macros
4087 @item -Winvalid-imported-macros
4088 Verify all imported macro definitions are valid at the end of
4089 compilation.  This is not enabled by default, as it requires
4090 additional processing to determine.  It may be useful when preparing
4091 sets of header-units to ensure consistent macros.
4093 @opindex Wliteral-suffix
4094 @opindex Wno-literal-suffix
4095 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
4096 Do not warn when a string or character literal is followed by a
4097 ud-suffix which does not begin with an underscore.  As a conforming
4098 extension, GCC treats such suffixes as separate preprocessing tokens
4099 in order to maintain backwards compatibility with code that uses
4100 formatting macros from @code{<inttypes.h>}.  For example:
4102 @smallexample
4103 #define __STDC_FORMAT_MACROS
4104 #include <inttypes.h>
4105 #include <stdio.h>
4107 int main() @{
4108   int64_t i64 = 123;
4109   printf("My int64: %" PRId64"\n", i64);
4111 @end smallexample
4113 In this case, @code{PRId64} is treated as a separate preprocessing token.
4115 This option also controls warnings when a user-defined literal
4116 operator is declared with a literal suffix identifier that doesn't
4117 begin with an underscore. Literal suffix identifiers that don't begin
4118 with an underscore are reserved for future standardization.
4120 These warnings are enabled by default.
4122 @opindex Wnarrowing
4123 @opindex Wno-narrowing
4124 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
4125 For C++11 and later standards, narrowing conversions are diagnosed by default,
4126 as required by the standard.  A narrowing conversion from a constant produces
4127 an error, and a narrowing conversion from a non-constant produces a warning,
4128 but @option{-Wno-narrowing} suppresses the diagnostic.
4129 Note that this does not affect the meaning of well-formed code;
4130 narrowing conversions are still considered ill-formed in SFINAE contexts.
4132 With @option{-Wnarrowing} in C++98, warn when a narrowing
4133 conversion prohibited by C++11 occurs within
4134 @samp{@{ @}}, e.g.
4136 @smallexample
4137 int i = @{ 2.2 @}; // error: narrowing from double to int
4138 @end smallexample
4140 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4142 @opindex Wnoexcept
4143 @opindex Wno-noexcept
4144 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4145 Warn when a noexcept-expression evaluates to false because of a call
4146 to a function that does not have a non-throwing exception
4147 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4148 the compiler to never throw an exception.
4150 @opindex Wnoexcept-type
4151 @opindex Wno-noexcept-type
4152 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4153 Warn if the C++17 feature making @code{noexcept} part of a function
4154 type changes the mangled name of a symbol relative to C++14.  Enabled
4155 by @option{-Wabi} and @option{-Wc++17-compat}.
4157 As an example:
4159 @smallexample
4160 template <class T> void f(T t) @{ t(); @};
4161 void g() noexcept;
4162 void h() @{ f(g); @} 
4163 @end smallexample
4165 @noindent
4166 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4167 C++17 it calls @code{f<void(*)()noexcept>}.
4169 @opindex Wclass-memaccess
4170 @opindex Wno-class-memaccess
4171 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4172 Warn when the destination of a call to a raw memory function such as
4173 @code{memset} or @code{memcpy} is an object of class type, and when writing
4174 into such an object might bypass the class non-trivial or deleted constructor
4175 or copy assignment, violate const-correctness or encapsulation, or corrupt
4176 virtual table pointers.  Modifying the representation of such objects may
4177 violate invariants maintained by member functions of the class.  For example,
4178 the call to @code{memset} below is undefined because it modifies a non-trivial
4179 class object and is, therefore, diagnosed.  The safe way to either initialize
4180 or clear the storage of objects of such types is by using the appropriate
4181 constructor or assignment operator, if one is available.
4182 @smallexample
4183 std::string str = "abc";
4184 memset (&str, 0, sizeof str);
4185 @end smallexample
4186 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4187 Explicitly casting the pointer to the class object to @code{void *} or
4188 to a type that can be safely accessed by the raw memory function suppresses
4189 the warning.
4191 @opindex Wnon-virtual-dtor
4192 @opindex Wno-non-virtual-dtor
4193 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4194 Warn when a class has virtual functions and an accessible non-virtual
4195 destructor itself or in an accessible polymorphic base class, in which
4196 case it is possible but unsafe to delete an instance of a derived
4197 class through a pointer to the class itself or base class.  This
4198 warning is automatically enabled if @option{-Weffc++} is specified.
4199 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4200 should be preferred because it warns about the unsafe cases without false
4201 positives.
4203 @opindex Wregister
4204 @opindex Wno-register
4205 @item -Wregister @r{(C++ and Objective-C++ only)}
4206 Warn on uses of the @code{register} storage class specifier, except
4207 when it is part of the GNU @ref{Explicit Register Variables} extension.
4208 The use of the @code{register} keyword as storage class specifier has
4209 been deprecated in C++11 and removed in C++17.
4210 Enabled by default with @option{-std=c++17}.
4212 @opindex Wreorder
4213 @opindex Wno-reorder
4214 @cindex reordering, warning
4215 @cindex warning for reordering of member initializers
4216 @item -Wreorder @r{(C++ and Objective-C++ only)}
4217 Warn when the order of member initializers given in the code does not
4218 match the order in which they must be executed.  For instance:
4220 @smallexample
4221 struct A @{
4222   int i;
4223   int j;
4224   A(): j (0), i (1) @{ @}
4226 @end smallexample
4228 @noindent
4229 The compiler rearranges the member initializers for @code{i}
4230 and @code{j} to match the declaration order of the members, emitting
4231 a warning to that effect.  This warning is enabled by @option{-Wall}.
4233 @opindex Wpessimizing-move
4234 @opindex Wno-pessimizing-move
4235 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4236 This warning warns when a call to @code{std::move} prevents copy
4237 elision.  A typical scenario when copy elision can occur is when returning in
4238 a function with a class return type, when the expression being returned is the
4239 name of a non-volatile automatic object, and is not a function parameter, and
4240 has the same type as the function return type.
4242 @smallexample
4243 struct T @{
4244 @dots{}
4246 T fn()
4248   T t;
4249   @dots{}
4250   return std::move (t);
4252 @end smallexample
4254 But in this example, the @code{std::move} call prevents copy elision.
4256 This warning is enabled by @option{-Wall}.
4258 @opindex Wredundant-move
4259 @opindex Wno-redundant-move
4260 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4261 This warning warns about redundant calls to @code{std::move}; that is, when
4262 a move operation would have been performed even without the @code{std::move}
4263 call.  This happens because the compiler is forced to treat the object as if
4264 it were an rvalue in certain situations such as returning a local variable,
4265 where copy elision isn't applicable.  Consider:
4267 @smallexample
4268 struct T @{
4269 @dots{}
4271 T fn(T t)
4273   @dots{}
4274   return std::move (t);
4276 @end smallexample
4278 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4279 Issue 1579, another example is:
4281 @smallexample
4282 struct T @{ // convertible to U
4283 @dots{}
4285 struct U @{
4286 @dots{}
4288 U fn()
4290   T t;
4291   @dots{}
4292   return std::move (t);
4294 @end smallexample
4295 In this example, copy elision isn't applicable because the type of the
4296 expression being returned and the function return type differ, yet G++
4297 treats the return value as if it were designated by an rvalue.
4299 This warning is enabled by @option{-Wextra}.
4301 @opindex Wrange-loop-construct
4302 @opindex Wno-range-loop-construct
4303 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4304 This warning warns when a C++ range-based for-loop is creating an unnecessary
4305 copy.  This can happen when the range declaration is not a reference, but
4306 probably should be.  For example:
4308 @smallexample
4309 struct S @{ char arr[128]; @};
4310 void fn () @{
4311   S arr[5];
4312   for (const auto x : arr) @{ @dots{} @}
4314 @end smallexample
4316 It does not warn when the type being copied is a trivially-copyable type whose
4317 size is less than 64 bytes.
4319 This warning also warns when a loop variable in a range-based for-loop is
4320 initialized with a value of a different type resulting in a copy.  For example:
4322 @smallexample
4323 void fn() @{
4324   int arr[10];
4325   for (const double &x : arr) @{ @dots{} @}
4327 @end smallexample
4329 In the example above, in every iteration of the loop a temporary value of
4330 type @code{double} is created and destroyed, to which the reference
4331 @code{const double &} is bound.
4333 This warning is enabled by @option{-Wall}.
4335 @opindex Wredundant-tags
4336 @opindex Wno-redundant-tags
4337 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4338 Warn about redundant class-key and enum-key in references to class types
4339 and enumerated types in contexts where the key can be eliminated without
4340 causing an ambiguity.  For example:
4342 @smallexample
4343 struct foo;
4344 struct foo *p;   // warn that keyword struct can be eliminated
4345 @end smallexample
4347 @noindent
4348 On the other hand, in this example there is no warning:
4350 @smallexample
4351 struct foo;
4352 void foo ();   // "hides" struct foo
4353 void bar (struct foo&);  // no warning, keyword struct is necessary
4354 @end smallexample
4356 @opindex Wsubobject-linkage
4357 @opindex Wno-subobject-linkage
4358 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4359 Do not warn
4360 if a class type has a base or a field whose type uses the anonymous
4361 namespace or depends on a type with no linkage.  If a type A depends on
4362 a type B with no or internal linkage, defining it in multiple
4363 translation units would be an ODR violation because the meaning of B
4364 is different in each translation unit.  If A only appears in a single
4365 translation unit, the best way to silence the warning is to give it
4366 internal linkage by putting it in an anonymous namespace as well.  The
4367 compiler doesn't give this warning for types defined in the main .C
4368 file, as those are unlikely to have multiple definitions.
4369 @option{-Wsubobject-linkage} is enabled by default.
4371 @opindex Weffc++
4372 @opindex Wno-effc++
4373 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4374 Warn about violations of the following style guidelines from Scott Meyers'
4375 @cite{Effective C++} series of books:
4377 @itemize @bullet
4378 @item
4379 Define a copy constructor and an assignment operator for classes
4380 with dynamically-allocated memory.
4382 @item
4383 Prefer initialization to assignment in constructors.
4385 @item
4386 Have @code{operator=} return a reference to @code{*this}.
4388 @item
4389 Don't try to return a reference when you must return an object.
4391 @item
4392 Distinguish between prefix and postfix forms of increment and
4393 decrement operators.
4395 @item
4396 Never overload @code{&&}, @code{||}, or @code{,}.
4398 @end itemize
4400 This option also enables @option{-Wnon-virtual-dtor}, which is also
4401 one of the effective C++ recommendations.  However, the check is
4402 extended to warn about the lack of virtual destructor in accessible
4403 non-polymorphic bases classes too.
4405 When selecting this option, be aware that the standard library
4406 headers do not obey all of these guidelines; use @samp{grep -v}
4407 to filter out those warnings.
4409 @opindex Wexceptions
4410 @opindex Wno-exceptions
4411 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4412 Disable the warning about the case when an exception handler is shadowed by
4413 another handler, which can point out a wrong ordering of exception handlers.
4415 @opindex Wstrict-null-sentinel
4416 @opindex Wno-strict-null-sentinel
4417 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4418 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4419 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4420 to @code{__null}.  Although it is a null pointer constant rather than a
4421 null pointer, it is guaranteed to be of the same size as a pointer.
4422 But this use is not portable across different compilers.
4424 @opindex Wno-non-template-friend
4425 @opindex Wnon-template-friend
4426 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4427 Disable warnings when non-template friend functions are declared
4428 within a template.  In very old versions of GCC that predate implementation
4429 of the ISO standard, declarations such as 
4430 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4431 could be interpreted as a particular specialization of a template
4432 function; the warning exists to diagnose compatibility problems, 
4433 and is enabled by default.
4435 @opindex Wold-style-cast
4436 @opindex Wno-old-style-cast
4437 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4438 Warn if an old-style (C-style) cast to a non-void type is used within
4439 a C++ program.  The new-style casts (@code{dynamic_cast},
4440 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4441 less vulnerable to unintended effects and much easier to search for.
4443 @opindex Woverloaded-virtual
4444 @opindex Wno-overloaded-virtual
4445 @cindex overloaded virtual function, warning
4446 @cindex warning for overloaded virtual function
4447 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4448 @itemx -Woverloaded-virtual=@var{n}
4449 Warn when a function declaration hides virtual functions from a
4450 base class.  For example, in:
4452 @smallexample
4453 struct A @{
4454   virtual void f();
4457 struct B: public A @{
4458   void f(int); // does not override
4460 @end smallexample
4462 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4463 like:
4465 @smallexample
4466 B* b;
4467 b->f();
4468 @end smallexample
4470 @noindent
4471 fails to compile.
4473 In cases where the different signatures are not an accident, the
4474 simplest solution is to add a using-declaration to the derived class
4475 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4477 The optional level suffix controls the behavior when all the
4478 declarations in the derived class override virtual functions in the
4479 base class, even if not all of the base functions are overridden:
4481 @smallexample
4482 struct C @{
4483   virtual void f();
4484   virtual void f(int);
4487 struct D: public C @{
4488   void f(int); // does override
4490 @end smallexample
4492 This pattern is less likely to be a mistake; if D is only used
4493 virtually, the user might have decided that the base class semantics
4494 for some of the overloads are fine.
4496 At level 1, this case does not warn; at level 2, it does.
4497 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4498 included in @option{-Wall}.
4500 @opindex Wno-pmf-conversions
4501 @opindex Wpmf-conversions
4502 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4503 Disable the diagnostic for converting a bound pointer to member function
4504 to a plain pointer.
4506 @opindex Wsign-promo
4507 @opindex Wno-sign-promo
4508 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4509 Warn when overload resolution chooses a promotion from unsigned or
4510 enumerated type to a signed type, over a conversion to an unsigned type of
4511 the same size.  Previous versions of G++ tried to preserve
4512 unsignedness, but the standard mandates the current behavior.
4514 @opindex Wtemplates
4515 @opindex Wno-templates
4516 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4517 Warn when a primary template declaration is encountered.  Some coding
4518 rules disallow templates, and this may be used to enforce that rule.
4519 The warning is inactive inside a system header file, such as the STL, so
4520 one can still use the STL.  One may also instantiate or specialize
4521 templates.
4523 @opindex Wmismatched-new-delete
4524 @opindex Wno-mismatched-new-delete
4525 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4526 Warn for mismatches between calls to @code{operator new} or @code{operator
4527 delete} and the corresponding call to the allocation or deallocation function.
4528 This includes invocations of C++ @code{operator delete} with pointers
4529 returned from either mismatched forms of @code{operator new}, or from other
4530 functions that allocate objects for which the @code{operator delete} isn't
4531 a suitable deallocator, as well as calls to other deallocation functions
4532 with pointers returned from @code{operator new} for which the deallocation
4533 function isn't suitable.
4535 For example, the @code{delete} expression in the function below is diagnosed
4536 because it doesn't match the array form of the @code{new} expression
4537 the pointer argument was returned from.  Similarly, the call to @code{free}
4538 is also diagnosed.
4540 @smallexample
4541 void f ()
4543   int *a = new int[n];
4544   delete a;   // warning: mismatch in array forms of expressions
4546   char *p = new char[n];
4547   free (p);   // warning: mismatch between new and free
4549 @end smallexample
4551 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4552 involving allocation and deallocation functions other than @code{operator
4553 new} and @code{operator delete}.
4555 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4557 @opindex Wmismatched-tags
4558 @opindex Wno-mismatched-tags
4559 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4560 Warn for declarations of structs, classes, and class templates and their
4561 specializations with a class-key that does not match either the definition
4562 or the first declaration if no definition is provided.
4564 For example, the declaration of @code{struct Object} in the argument list
4565 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4566 class-key @code{struct} or replace it with @code{class} to match its definition.
4567 @smallexample
4568 class Object @{
4569 public:
4570   virtual ~Object () = 0;
4572 void draw (struct Object*);
4573 @end smallexample
4575 It is not wrong to declare a class with the class-key @code{struct} as
4576 the example above shows.  The @option{-Wmismatched-tags} option is intended
4577 to help achieve a consistent style of class declarations.  In code that is
4578 intended to be portable to Windows-based compilers the warning helps prevent
4579 unresolved references due to the difference in the mangling of symbols
4580 declared with different class-keys.  The option can be used either on its
4581 own or in conjunction with @option{-Wredundant-tags}.
4583 @opindex Wmultiple-inheritance
4584 @opindex Wno-multiple-inheritance
4585 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4586 Warn when a class is defined with multiple direct base classes.  Some
4587 coding rules disallow multiple inheritance, and this may be used to
4588 enforce that rule.  The warning is inactive inside a system header file,
4589 such as the STL, so one can still use the STL.  One may also define
4590 classes that indirectly use multiple inheritance.
4592 @opindex Wvirtual-inheritance
4593 @opindex Wno-virtual-inheritance
4594 @item -Wvirtual-inheritance
4595 Warn when a class is defined with a virtual direct base class.  Some
4596 coding rules disallow multiple inheritance, and this may be used to
4597 enforce that rule.  The warning is inactive inside a system header file,
4598 such as the STL, so one can still use the STL.  One may also define
4599 classes that indirectly use virtual inheritance.
4601 @opindex Wvirtual-move-assign
4602 @opindex Wno-virtual-move-assign
4603 @item -Wno-virtual-move-assign
4604 Suppress warnings about inheriting from a virtual base with a
4605 non-trivial C++11 move assignment operator.  This is dangerous because
4606 if the virtual base is reachable along more than one path, it is
4607 moved multiple times, which can mean both objects end up in the
4608 moved-from state.  If the move assignment operator is written to avoid
4609 moving from a moved-from object, this warning can be disabled.
4611 @opindex Wnamespaces
4612 @opindex Wno-namespaces
4613 @item -Wnamespaces
4614 Warn when a namespace definition is opened.  Some coding rules disallow
4615 namespaces, and this may be used to enforce that rule.  The warning is
4616 inactive inside a system header file, such as the STL, so one can still
4617 use the STL.  One may also use using directives and qualified names.
4619 @opindex Wtemplate-id-cdtor
4620 @opindex Wno-template-id-cdtor
4621 @item -Wno-template-id-cdtor @r{(C++ and Objective-C++ only)}
4622 Disable the warning about the use of simple-template-id as the declarator-id
4623 of a constructor or destructor, which became invalid in C++20 via DR 2237.
4624 For example:
4626 @smallexample
4627 template<typename T> struct S @{
4628   S<T>(); // should be S();
4629   ~S<T>();  // should be ~S();
4631 @end smallexample
4633 @option{-Wtemplate-id-cdtor} is enabled by default with
4634 @option{-std=c++20}; it is also enabled by @option{-Wc++20-compat}.
4636 @opindex Wterminate
4637 @opindex Wno-terminate
4638 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4639 Disable the warning about a throw-expression that will immediately
4640 result in a call to @code{terminate}.
4642 @opindex Wvexing-parse
4643 @opindex Wno-vexing-parse
4644 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4645 Warn about the most vexing parse syntactic ambiguity.  This warns about
4646 the cases when a declaration looks like a variable definition, but the
4647 C++ language requires it to be interpreted as a function declaration.
4648 For instance:
4650 @smallexample
4651 void f(double a) @{
4652   int i();        // extern int i (void);
4653   int n(int(a));  // extern int n (int);
4655 @end smallexample
4657 Another example:
4659 @smallexample
4660 struct S @{ S(int); @};
4661 void f(double a) @{
4662   S x(int(a));   // extern struct S x (int);
4663   S y(int());    // extern struct S y (int (*) (void));
4664   S z();         // extern struct S z (void);
4666 @end smallexample
4668 The warning will suggest options how to deal with such an ambiguity; e.g.,
4669 it can suggest removing the parentheses or using braces instead.
4671 This warning is enabled by default.
4673 @opindex Wno-class-conversion
4674 @opindex Wclass-conversion
4675 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4676 Do not warn when a conversion function converts an
4677 object to the same type, to a base class of that type, or to void; such
4678 a conversion function will never be called.
4680 @opindex Wvolatile
4681 @opindex Wno-volatile
4682 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4683 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4684 postfix and prefix @code{++} and @code{--} expressions of
4685 @code{volatile}-qualified types, using simple assignments where the left
4686 operand is a @code{volatile}-qualified non-class type for their value,
4687 compound assignments where the left operand is a @code{volatile}-qualified
4688 non-class type, @code{volatile}-qualified function return type,
4689 @code{volatile}-qualified parameter type, and structured bindings of a
4690 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4692 Enabled by default with @option{-std=c++20}.
4694 @opindex Wzero-as-null-pointer-constant
4695 @opindex Wno-zero-as-null-pointer-constant
4696 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4697 Warn when a literal @samp{0} is used as null pointer constant.  This can
4698 be useful to facilitate the conversion to @code{nullptr} in C++11.
4700 @opindex Waligned-new
4701 @opindex Wno-aligned-new
4702 @item -Waligned-new
4703 Warn about a new-expression of a type that requires greater alignment
4704 than the @code{alignof(std::max_align_t)} but uses an allocation
4705 function without an explicit alignment parameter. This option is
4706 enabled by @option{-Wall}.
4708 Normally this only warns about global allocation functions, but
4709 @option{-Waligned-new=all} also warns about class member allocation
4710 functions.
4712 @opindex Wplacement-new
4713 @opindex Wno-placement-new
4714 @item -Wno-placement-new
4715 @itemx -Wplacement-new=@var{n}
4716 Warn about placement new expressions with undefined behavior, such as
4717 constructing an object in a buffer that is smaller than the type of
4718 the object.  For example, the placement new expression below is diagnosed
4719 because it attempts to construct an array of 64 integers in a buffer only
4720 64 bytes large.
4721 @smallexample
4722 char buf [64];
4723 new (buf) int[64];
4724 @end smallexample
4725 This warning is enabled by default.
4727 @table @gcctabopt
4728 @item -Wplacement-new=1
4729 This is the default warning level of @option{-Wplacement-new}.  At this
4730 level the warning is not issued for some strictly undefined constructs that
4731 GCC allows as extensions for compatibility with legacy code.  For example,
4732 the following @code{new} expression is not diagnosed at this level even
4733 though it has undefined behavior according to the C++ standard because
4734 it writes past the end of the one-element array.
4735 @smallexample
4736 struct S @{ int n, a[1]; @};
4737 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4738 new (s->a)int [32]();
4739 @end smallexample
4741 @item -Wplacement-new=2
4742 At this level, in addition to diagnosing all the same constructs as at level
4743 1, a diagnostic is also issued for placement new expressions that construct
4744 an object in the last member of structure whose type is an array of a single
4745 element and whose size is less than the size of the object being constructed.
4746 While the previous example would be diagnosed, the following construct makes
4747 use of the flexible member array extension to avoid the warning at level 2.
4748 @smallexample
4749 struct S @{ int n, a[]; @};
4750 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4751 new (s->a)int [32]();
4752 @end smallexample
4754 @end table
4756 @opindex Wcatch-value
4757 @opindex Wno-catch-value
4758 @item -Wcatch-value
4759 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4760 Warn about catch handlers that do not catch via reference.
4761 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4762 warn about polymorphic class types that are caught by value.
4763 With @option{-Wcatch-value=2} warn about all class types that are caught
4764 by value. With @option{-Wcatch-value=3} warn about all types that are
4765 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4767 @opindex Wconditionally-supported
4768 @opindex Wno-conditionally-supported
4769 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4770 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4772 @opindex Wdelete-incomplete
4773 @opindex Wno-delete-incomplete
4774 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4775 Do not warn when deleting a pointer to incomplete type, which may cause
4776 undefined behavior at runtime.  This warning is enabled by default.
4778 @opindex Wextra-semi
4779 @opindex Wno-extra-semi
4780 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4781 Warn about redundant semicolons after in-class function definitions.
4783 @opindex Wno-global-module
4784 @opindex Wglobal-module
4785 @item -Wno-global-module @r{(C++ and Objective-C++ only)}
4786 Disable the diagnostic for when the global module fragment of a module
4787 unit does not consist only of preprocessor directives.
4789 @opindex Winaccessible-base
4790 @opindex Wno-inaccessible-base
4791 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4792 This option controls warnings
4793 when a base class is inaccessible in a class derived from it due to
4794 ambiguity.  The warning is enabled by default.
4795 Note that the warning for ambiguous virtual
4796 bases is enabled by the @option{-Wextra} option.
4797 @smallexample
4798 @group
4799 struct A @{ int a; @};
4801 struct B : A @{ @};
4803 struct C : B, A @{ @};
4804 @end group
4805 @end smallexample
4807 @opindex Winherited-variadic-ctor
4808 @opindex Wno-inherited-variadic-ctor
4809 @item -Wno-inherited-variadic-ctor
4810 Suppress warnings about use of C++11 inheriting constructors when the
4811 base class inherited from has a C variadic constructor; the warning is
4812 on by default because the ellipsis is not inherited.
4814 @opindex Wno-invalid-offsetof
4815 @opindex Winvalid-offsetof
4816 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4817 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4818 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4819 to a non-standard-layout type is undefined.  In existing C++ implementations,
4820 however, @code{offsetof} typically gives meaningful results.
4821 This flag is for users who are aware that they are
4822 writing nonportable code and who have deliberately chosen to ignore the
4823 warning about it.
4825 The restrictions on @code{offsetof} may be relaxed in a future version
4826 of the C++ standard.
4828 @opindex Wsized-deallocation
4829 @opindex Wno-sized-deallocation
4830 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4831 Warn about a definition of an unsized deallocation function
4832 @smallexample
4833 void operator delete (void *) noexcept;
4834 void operator delete[] (void *) noexcept;
4835 @end smallexample
4836 without a definition of the corresponding sized deallocation function
4837 @smallexample
4838 void operator delete (void *, std::size_t) noexcept;
4839 void operator delete[] (void *, std::size_t) noexcept;
4840 @end smallexample
4841 or vice versa.  Enabled by @option{-Wextra} along with
4842 @option{-fsized-deallocation}.
4844 @opindex Wno-suggest-final-types
4845 @opindex Wsuggest-final-types
4846 @item -Wsuggest-final-types
4847 Warn about types with virtual methods where code quality would be improved
4848 if the type were declared with the C++11 @code{final} specifier,
4849 or, if possible,
4850 declared in an anonymous namespace. This allows GCC to more aggressively
4851 devirtualize the polymorphic calls. This warning is more effective with
4852 link-time optimization,
4853 where the information about the class hierarchy graph is
4854 more complete.
4856 @opindex Wno-suggest-final-methods
4857 @opindex Wsuggest-final-methods
4858 @item -Wsuggest-final-methods
4859 Warn about virtual methods where code quality would be improved if the method
4860 were declared with the C++11 @code{final} specifier,
4861 or, if possible, its type were
4862 declared in an anonymous namespace or with the @code{final} specifier.
4863 This warning is
4864 more effective with link-time optimization, where the information about the
4865 class hierarchy graph is more complete. It is recommended to first consider
4866 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4867 annotations.
4869 @opindex Wsuggest-override
4870 @opindex Wno-suggest-override
4871 @item -Wsuggest-override
4872 Warn about overriding virtual functions that are not marked with the
4873 @code{override} keyword.
4875 @opindex Wconversion-null
4876 @opindex Wno-conversion-null
4877 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4878 Do not warn for conversions between @code{NULL} and non-pointer
4879 types. @option{-Wconversion-null} is enabled by default.
4881 @end table
4883 @node Objective-C and Objective-C++ Dialect Options
4884 @section Options Controlling Objective-C and Objective-C++ Dialects
4886 @cindex compiler options, Objective-C and Objective-C++
4887 @cindex Objective-C and Objective-C++ options, command-line
4888 @cindex options, Objective-C and Objective-C++
4889 (NOTE: This manual does not describe the Objective-C and Objective-C++
4890 languages themselves.  @xref{Standards,,Language Standards
4891 Supported by GCC}, for references.)
4893 This section describes the command-line options that are only meaningful
4894 for Objective-C and Objective-C++ programs.  You can also use most of
4895 the language-independent GNU compiler options.
4896 For example, you might compile a file @file{some_class.m} like this:
4898 @smallexample
4899 gcc -g -fgnu-runtime -O -c some_class.m
4900 @end smallexample
4902 @noindent
4903 In this example, @option{-fgnu-runtime} is an option meant only for
4904 Objective-C and Objective-C++ programs; you can use the other options with
4905 any language supported by GCC@.
4907 Note that since Objective-C is an extension of the C language, Objective-C
4908 compilations may also use options specific to the C front-end (e.g.,
4909 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4910 C++-specific options (e.g., @option{-Wabi}).
4912 Here is a list of options that are @emph{only} for compiling Objective-C
4913 and Objective-C++ programs:
4915 @table @gcctabopt
4916 @opindex fconstant-string-class
4917 @item -fconstant-string-class=@var{class-name}
4918 Use @var{class-name} as the name of the class to instantiate for each
4919 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4920 class name is @code{NXConstantString} if the GNU runtime is being used, and
4921 @code{NSConstantString} if the NeXT runtime is being used (see below).  On
4922 Darwin / macOS platforms, the @option{-fconstant-cfstrings} option, if
4923 also present, overrides the @option{-fconstant-string-class} setting and cause
4924 @code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings.
4925 Note that @option{-fconstant-cfstrings} is an alias for the target-specific
4926 @option{-mconstant-cfstrings} equivalent.
4928 @opindex fgnu-runtime
4929 @item -fgnu-runtime
4930 Generate object code compatible with the standard GNU Objective-C
4931 runtime.  This is the default for most types of systems.
4933 @opindex fnext-runtime
4934 @item -fnext-runtime
4935 Generate output compatible with the NeXT runtime.  This is the default
4936 for NeXT-based systems, including Darwin / macOS.  The macro
4937 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4938 used.
4940 @opindex fno-nil-receivers
4941 @opindex fnil-receivers
4942 @item -fno-nil-receivers
4943 Assume that all Objective-C message dispatches (@code{[receiver
4944 message:arg]}) in this translation unit ensure that the receiver is
4945 not @code{nil}.  This allows for more efficient entry points in the
4946 runtime to be used.  This option is only available in conjunction with
4947 the NeXT runtime and ABI version 0 or 1.
4949 @opindex fobjc-abi-version
4950 @item -fobjc-abi-version=@var{n}
4951 Use version @var{n} of the Objective-C ABI for the selected runtime.
4952 This option is currently supported only for the NeXT runtime.  In that
4953 case, Version 0 is the traditional (32-bit) ABI without support for
4954 properties and other Objective-C 2.0 additions.  Version 1 is the
4955 traditional (32-bit) ABI with support for properties and other
4956 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4957 nothing is specified, the default is Version 0 on 32-bit target
4958 machines, and Version 2 on 64-bit target machines.
4960 @opindex fobjc-call-cxx-cdtors
4961 @item -fobjc-call-cxx-cdtors
4962 For each Objective-C class, check if any of its instance variables is a
4963 C++ object with a non-trivial default constructor.  If so, synthesize a
4964 special @code{- (id) .cxx_construct} instance method which runs
4965 non-trivial default constructors on any such instance variables, in order,
4966 and then return @code{self}.  Similarly, check if any instance variable
4967 is a C++ object with a non-trivial destructor, and if so, synthesize a
4968 special @code{- (void) .cxx_destruct} method which runs
4969 all such default destructors, in reverse order.
4971 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4972 methods thusly generated only operate on instance variables
4973 declared in the current Objective-C class, and not those inherited
4974 from superclasses.  It is the responsibility of the Objective-C
4975 runtime to invoke all such methods in an object's inheritance
4976 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4977 by the runtime immediately after a new object instance is allocated;
4978 the @code{- (void) .cxx_destruct} methods are invoked immediately
4979 before the runtime deallocates an object instance.
4981 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4982 support for invoking the @code{- (id) .cxx_construct} and
4983 @code{- (void) .cxx_destruct} methods.
4985 @opindex fobjc-direct-dispatch
4986 @item -fobjc-direct-dispatch
4987 Allow fast jumps to the message dispatcher.  On Darwin this is
4988 accomplished via the comm page.
4990 @opindex fobjc-exceptions
4991 @item -fobjc-exceptions
4992 Enable syntactic support for structured exception handling in
4993 Objective-C, similar to what is offered by C++.  This option
4994 is required to use the Objective-C keywords @code{@@try},
4995 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4996 @code{@@synchronized}.  This option is available with both the GNU
4997 runtime and the NeXT runtime (but not available in conjunction with
4998 the NeXT runtime on Mac OS X 10.2 and earlier).
5000 @opindex fobjc-gc
5001 @item -fobjc-gc
5002 Enable garbage collection (GC) in Objective-C and Objective-C++
5003 programs.  This option is only available with the NeXT runtime; the
5004 GNU runtime has a different garbage collection implementation that
5005 does not require special compiler flags.
5007 @opindex fobjc-nilcheck
5008 @item -fobjc-nilcheck
5009 For the NeXT runtime with version 2 of the ABI, check for a nil
5010 receiver in method invocations before doing the actual method call.
5011 This is the default and can be disabled using
5012 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
5013 checked for nil in this way no matter what this flag is set to.
5014 Currently this flag does nothing when the GNU runtime, or an older
5015 version of the NeXT runtime ABI, is used.
5017 @opindex fobjc-std
5018 @item -fobjc-std=objc1
5019 Conform to the language syntax of Objective-C 1.0, the language
5020 recognized by GCC 4.0.  This only affects the Objective-C additions to
5021 the C/C++ language; it does not affect conformance to C/C++ standards,
5022 which is controlled by the separate C/C++ dialect option flags.  When
5023 this option is used with the Objective-C or Objective-C++ compiler,
5024 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
5025 This is useful if you need to make sure that your Objective-C code can
5026 be compiled with older versions of GCC@.
5028 @opindex freplace-objc-classes
5029 @item -freplace-objc-classes
5030 Emit a special marker instructing @command{ld(1)} not to statically link in
5031 the resulting object file, and allow @command{dyld(1)} to load it in at
5032 run time instead.  This is used in conjunction with the Fix-and-Continue
5033 debugging mode, where the object file in question may be recompiled and
5034 dynamically reloaded in the course of program execution, without the need
5035 to restart the program itself.  Currently, Fix-and-Continue functionality
5036 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
5037 and later.
5039 @opindex fzero-link
5040 @item -fzero-link
5041 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
5042 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
5043 compile time) with static class references that get initialized at load time,
5044 which improves run-time performance.  Specifying the @option{-fzero-link} flag
5045 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
5046 to be retained.  This is useful in Zero-Link debugging mode, since it allows
5047 for individual class implementations to be modified during program execution.
5048 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
5049 regardless of command-line options.
5051 @opindex fno-local-ivars
5052 @opindex flocal-ivars
5053 @item -fno-local-ivars
5054 By default instance variables in Objective-C can be accessed as if
5055 they were local variables from within the methods of the class they're
5056 declared in.  This can lead to shadowing between instance variables
5057 and other variables declared either locally inside a class method or
5058 globally with the same name.  Specifying the @option{-fno-local-ivars}
5059 flag disables this behavior thus avoiding variable shadowing issues.
5061 @opindex fivar-visibility
5062 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
5063 Set the default instance variable visibility to the specified option
5064 so that instance variables declared outside the scope of any access
5065 modifier directives default to the specified visibility.
5067 @opindex gen-decls
5068 @item -gen-decls
5069 Dump interface declarations for all classes seen in the source file to a
5070 file named @file{@var{sourcename}.decl}.
5072 @opindex Wassign-intercept
5073 @opindex Wno-assign-intercept
5074 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
5075 Warn whenever an Objective-C assignment is being intercepted by the
5076 garbage collector.
5078 @opindex Wproperty-assign-default
5079 @opindex Wno-property-assign-default
5080 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
5081 Do not warn if a property for an Objective-C object has no assign
5082 semantics specified.
5084 @opindex Wno-protocol
5085 @opindex Wprotocol
5086 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
5087 If a class is declared to implement a protocol, a warning is issued for
5088 every method in the protocol that is not implemented by the class.  The
5089 default behavior is to issue a warning for every method not explicitly
5090 implemented in the class, even if a method implementation is inherited
5091 from the superclass.  If you use the @option{-Wno-protocol} option, then
5092 methods inherited from the superclass are considered to be implemented,
5093 and no warning is issued for them.
5095 @opindex Wobjc-root-class
5096 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
5097 Warn if a class interface lacks a superclass. Most classes will inherit
5098 from @code{NSObject} (or @code{Object}) for example.  When declaring
5099 classes intended to be root classes, the warning can be suppressed by
5100 marking their interfaces with @code{__attribute__((objc_root_class))}.
5102 @opindex Wselector
5103 @opindex Wno-selector
5104 @item -Wselector @r{(Objective-C and Objective-C++ only)}
5105 Warn if multiple methods of different types for the same selector are
5106 found during compilation.  The check is performed on the list of methods
5107 in the final stage of compilation.  Additionally, a check is performed
5108 for each selector appearing in a @code{@@selector(@dots{})}
5109 expression, and a corresponding method for that selector has been found
5110 during compilation.  Because these checks scan the method table only at
5111 the end of compilation, these warnings are not produced if the final
5112 stage of compilation is not reached, for example because an error is
5113 found during compilation, or because the @option{-fsyntax-only} option is
5114 being used.
5116 @opindex Wstrict-selector-match
5117 @opindex Wno-strict-selector-match
5118 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5119 Warn if multiple methods with differing argument and/or return types are
5120 found for a given selector when attempting to send a message using this
5121 selector to a receiver of type @code{id} or @code{Class}.  When this flag
5122 is off (which is the default behavior), the compiler omits such warnings
5123 if any differences found are confined to types that share the same size
5124 and alignment.
5126 @opindex Wundeclared-selector
5127 @opindex Wno-undeclared-selector
5128 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5129 Warn if a @code{@@selector(@dots{})} expression referring to an
5130 undeclared selector is found.  A selector is considered undeclared if no
5131 method with that name has been declared before the
5132 @code{@@selector(@dots{})} expression, either explicitly in an
5133 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5134 an @code{@@implementation} section.  This option always performs its
5135 checks as soon as a @code{@@selector(@dots{})} expression is found,
5136 while @option{-Wselector} only performs its checks in the final stage of
5137 compilation.  This also enforces the coding style convention
5138 that methods and selectors must be declared before being used.
5140 @opindex print-objc-runtime-info
5141 @item -print-objc-runtime-info
5142 Generate C header describing the largest structure that is passed by
5143 value, if any.
5145 @end table
5147 @node Diagnostic Message Formatting Options
5148 @section Options to Control Diagnostic Messages Formatting
5149 @cindex options to control diagnostics formatting
5150 @cindex diagnostic messages
5151 @cindex message formatting
5153 Traditionally, diagnostic messages have been formatted irrespective of
5154 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5155 options described below
5156 to control the formatting algorithm for diagnostic messages, 
5157 e.g.@: how many characters per line, how often source location
5158 information should be reported.  Note that some language front ends may not
5159 honor these options.
5161 @table @gcctabopt
5162 @opindex fmessage-length
5163 @item -fmessage-length=@var{n}
5164 Try to format error messages so that they fit on lines of about
5165 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5166 done; each error message appears on a single line.  This is the
5167 default for all front ends.
5169 Note - this option also affects the display of the @samp{#error} and
5170 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5171 function/type/variable attribute.  It does not however affect the
5172 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5174 @item -fdiagnostics-plain-output
5175 This option requests that diagnostic output look as plain as possible, which
5176 may be useful when running @command{dejagnu} or other utilities that need to
5177 parse diagnostics output and prefer that it remain more stable over time.
5178 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5179 options:
5180 @gccoptlist{-fno-diagnostics-show-caret
5181 -fno-diagnostics-show-line-numbers
5182 -fdiagnostics-color=never
5183 -fdiagnostics-urls=never
5184 -fdiagnostics-path-format=separate-events
5185 -fdiagnostics-text-art-charset=none}
5186 In the future, if GCC changes the default appearance of its diagnostics, the
5187 corresponding option to disable the new behavior will be added to this list.
5189 @opindex fdiagnostics-show-location
5190 @item -fdiagnostics-show-location=once
5191 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5192 reporter to emit source location information @emph{once}; that is, in
5193 case the message is too long to fit on a single physical line and has to
5194 be wrapped, the source location won't be emitted (as prefix) again,
5195 over and over, in subsequent continuation lines.  This is the default
5196 behavior.
5198 @item -fdiagnostics-show-location=every-line
5199 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5200 messages reporter to emit the same source location information (as
5201 prefix) for physical lines that result from the process of breaking
5202 a message which is too long to fit on a single line.
5204 @opindex fdiagnostics-color
5205 @cindex highlight, color
5206 @vindex GCC_COLORS @r{environment variable}
5207 @item -fdiagnostics-color[=@var{WHEN}]
5208 @itemx -fno-diagnostics-color
5209 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5210 or @samp{auto}.  The default depends on how the compiler has been configured,
5211 it can be any of the above @var{WHEN} options or also @samp{never}
5212 if @env{GCC_COLORS} environment variable isn't present in the environment,
5213 and @samp{auto} otherwise.
5214 @samp{auto} makes GCC use color only when the standard error is a terminal,
5215 and when not executing in an emacs shell.
5216 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5217 aliases for @option{-fdiagnostics-color=always} and
5218 @option{-fdiagnostics-color=never}, respectively.
5220 The colors are defined by the environment variable @env{GCC_COLORS}.
5221 Its value is a colon-separated list of capabilities and Select Graphic
5222 Rendition (SGR) substrings. SGR commands are interpreted by the
5223 terminal or terminal emulator.  (See the section in the documentation
5224 of your text terminal for permitted values and their meanings as
5225 character attributes.)  These substring values are integers in decimal
5226 representation and can be concatenated with semicolons.
5227 Common values to concatenate include
5228 @samp{1} for bold,
5229 @samp{4} for underline,
5230 @samp{5} for blink,
5231 @samp{7} for inverse,
5232 @samp{39} for default foreground color,
5233 @samp{30} to @samp{37} for foreground colors,
5234 @samp{90} to @samp{97} for 16-color mode foreground colors,
5235 @samp{38;5;0} to @samp{38;5;255}
5236 for 88-color and 256-color modes foreground colors,
5237 @samp{49} for default background color,
5238 @samp{40} to @samp{47} for background colors,
5239 @samp{100} to @samp{107} for 16-color mode background colors,
5240 and @samp{48;5;0} to @samp{48;5;255}
5241 for 88-color and 256-color modes background colors.
5243 The default @env{GCC_COLORS} is
5244 @smallexample
5245 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5246 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5247 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5248 type-diff=01;32:fnname=01;32:targs=35:valid=01;31:invalid=01;32
5249 @end smallexample
5250 @noindent
5251 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5252 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5253 @samp{01} is bold, and @samp{31} is red.
5254 Setting @env{GCC_COLORS} to the empty string disables colors.
5255 Supported capabilities are as follows.
5257 @table @code
5258 @vindex error GCC_COLORS @r{capability}
5259 @item error=
5260 SGR substring for error: markers.
5262 @vindex warning GCC_COLORS @r{capability}
5263 @item warning=
5264 SGR substring for warning: markers.
5266 @vindex note GCC_COLORS @r{capability}
5267 @item note=
5268 SGR substring for note: markers.
5270 @vindex path GCC_COLORS @r{capability}
5271 @item path=
5272 SGR substring for colorizing paths of control-flow events as printed
5273 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5274 individual events and lines indicating interprocedural calls and returns.
5276 @vindex range1 GCC_COLORS @r{capability}
5277 @item range1=
5278 SGR substring for first additional range.
5280 @vindex range2 GCC_COLORS @r{capability}
5281 @item range2=
5282 SGR substring for second additional range.
5284 @vindex locus GCC_COLORS @r{capability}
5285 @item locus=
5286 SGR substring for location information, @samp{file:line} or
5287 @samp{file:line:column} etc.
5289 @vindex quote GCC_COLORS @r{capability}
5290 @item quote=
5291 SGR substring for information printed within quotes.
5293 @vindex fnname GCC_COLORS @r{capability}
5294 @item fnname=
5295 SGR substring for names of C++ functions.
5297 @vindex targs GCC_COLORS @r{capability}
5298 @item targs=
5299 SGR substring for C++ function template parameter bindings.
5301 @vindex fixit-insert GCC_COLORS @r{capability}
5302 @item fixit-insert=
5303 SGR substring for fix-it hints suggesting text to
5304 be inserted or replaced.
5306 @vindex fixit-delete GCC_COLORS @r{capability}
5307 @item fixit-delete=
5308 SGR substring for fix-it hints suggesting text to
5309 be deleted.
5311 @vindex diff-filename GCC_COLORS @r{capability}
5312 @item diff-filename=
5313 SGR substring for filename headers within generated patches.
5315 @vindex diff-hunk GCC_COLORS @r{capability}
5316 @item diff-hunk=
5317 SGR substring for the starts of hunks within generated patches.
5319 @vindex diff-delete GCC_COLORS @r{capability}
5320 @item diff-delete=
5321 SGR substring for deleted lines within generated patches.
5323 @vindex diff-insert GCC_COLORS @r{capability}
5324 @item diff-insert=
5325 SGR substring for inserted lines within generated patches.
5327 @vindex type-diff GCC_COLORS @r{capability}
5328 @item type-diff=
5329 SGR substring for highlighting mismatching types within template
5330 arguments in the C++ frontend.
5332 @vindex valid GCC_COLORS @r{capability}
5333 @item valid=
5334 SGR substring for highlighting valid elements within text art diagrams.
5336 @vindex invalid GCC_COLORS @r{capability}
5337 @item invalid=
5338 SGR substring for highlighting invalid elements within text art diagrams.
5339 @end table
5341 @opindex fdiagnostics-urls
5342 @cindex urls
5343 @vindex GCC_URLS @r{environment variable}
5344 @vindex TERM_URLS @r{environment variable}
5345 @item -fdiagnostics-urls[=@var{WHEN}]
5346 Use escape sequences to embed URLs in diagnostics.  For example, when
5347 @option{-fdiagnostics-show-option} emits text showing the command-line
5348 option controlling a diagnostic, embed a URL for documentation of that
5349 option.
5351 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5352 @samp{auto} makes GCC use URL escape sequences only when the standard error
5353 is a terminal, and when not executing in an emacs shell or any graphical
5354 terminal which is known to be incompatible with this feature, see below.
5356 The default depends on how the compiler has been configured.
5357 It can be any of the above @var{WHEN} options.
5359 GCC can also be configured (via the
5360 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5361 so that the default is affected by environment variables.
5362 Under such a configuration, GCC defaults to using @samp{auto}
5363 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5364 present and non-empty in the environment of the compiler, or @samp{never}
5365 if neither are.
5367 However, even with @option{-fdiagnostics-urls=always} the behavior is
5368 dependent on those environment variables:
5369 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5370 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5371 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5372 Any other non-empty value enables the feature.
5373 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5374 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5375 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5377 At this time GCC tries to detect also a few terminals that are known to
5378 not implement the URL feature, and have bugs or at least had bugs in
5379 some versions that are still in use, where the URL escapes are likely
5380 to misbehave, i.e. print garbage on the screen.
5381 That list is currently xfce4-terminal, certain known to be buggy
5382 gnome-terminal versions, the linux console, and mingw.
5383 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5385 @opindex fno-diagnostics-show-option
5386 @opindex fdiagnostics-show-option
5387 @item -fno-diagnostics-show-option
5388 By default, each diagnostic emitted includes text indicating the
5389 command-line option that directly controls the diagnostic (if such an
5390 option is known to the diagnostic machinery).  Specifying the
5391 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5393 @opindex fno-diagnostics-show-caret
5394 @opindex fdiagnostics-show-caret
5395 @item -fno-diagnostics-show-caret
5396 By default, each diagnostic emitted includes the original source line
5397 and a caret @samp{^} indicating the column.  This option suppresses this
5398 information.  The source line is truncated to @var{n} characters, if
5399 the @option{-fmessage-length=n} option is given.  When the output is done
5400 to the terminal, the width is limited to the width given by the
5401 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5403 @opindex fno-diagnostics-show-labels
5404 @opindex fdiagnostics-show-labels
5405 @item -fno-diagnostics-show-labels
5406 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5407 diagnostics can label ranges of source code with pertinent information, such
5408 as the types of expressions:
5410 @smallexample
5411     printf ("foo %s bar", long_i + long_j);
5412                  ~^       ~~~~~~~~~~~~~~~
5413                   |              |
5414                   char *         long int
5415 @end smallexample
5417 This option suppresses the printing of these labels (in the example above,
5418 the vertical bars and the ``char *'' and ``long int'' text).
5420 @opindex fno-diagnostics-show-cwe
5421 @opindex fdiagnostics-show-cwe
5422 @item -fno-diagnostics-show-cwe
5423 Diagnostic messages can optionally have an associated
5424 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5425 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5426 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5427 By default, if this information is present, it will be printed with
5428 the diagnostic.  This option suppresses the printing of this metadata.
5430 @opindex fno-diagnostics-show-rules
5431 @opindex fdiagnostics-show-rules
5432 @item -fno-diagnostics-show-rules
5433 Diagnostic messages can optionally have rules associated with them, such
5434 as from a coding standard, or a specification.
5435 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5436 By default, if this information is present, it will be printed with
5437 the diagnostic.  This option suppresses the printing of this metadata.
5439 @opindex fno-diagnostics-show-line-numbers
5440 @opindex fdiagnostics-show-line-numbers
5441 @item -fno-diagnostics-show-line-numbers
5442 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5443 a left margin is printed, showing line numbers.  This option suppresses this
5444 left margin.
5446 @opindex fdiagnostics-minimum-margin-width
5447 @item -fdiagnostics-minimum-margin-width=@var{width}
5448 This option controls the minimum width of the left margin printed by
5449 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5451 @opindex fdiagnostics-parseable-fixits
5452 @item -fdiagnostics-parseable-fixits
5453 Emit fix-it hints in a machine-parseable format, suitable for consumption
5454 by IDEs.  For each fix-it, a line will be printed after the relevant
5455 diagnostic, starting with the string ``fix-it:''.  For example:
5457 @smallexample
5458 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5459 @end smallexample
5461 The location is expressed as a half-open range, expressed as a count of
5462 bytes, starting at byte 1 for the initial column.  In the above example,
5463 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5464 given string:
5466 @smallexample
5467 00000000011111111112222222222
5468 12345678901234567890123456789
5469   gtk_widget_showall (dlg);
5470   ^^^^^^^^^^^^^^^^^^
5471   gtk_widget_show_all
5472 @end smallexample
5474 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5475 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5476 (e.g. vertical tab as ``\013'').
5478 An empty replacement string indicates that the given range is to be removed.
5479 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5480 be inserted at the given position.
5482 @opindex fdiagnostics-generate-patch
5483 @item -fdiagnostics-generate-patch
5484 Print fix-it hints to stderr in unified diff format, after any diagnostics
5485 are printed.  For example:
5487 @smallexample
5488 --- test.c
5489 +++ test.c
5490 @@ -42,5 +42,5 @@
5492  void show_cb(GtkDialog *dlg)
5493  @{
5494 -  gtk_widget_showall(dlg);
5495 +  gtk_widget_show_all(dlg);
5496  @}
5498 @end smallexample
5500 The diff may or may not be colorized, following the same rules
5501 as for diagnostics (see @option{-fdiagnostics-color}).
5503 @opindex fdiagnostics-show-template-tree
5504 @item -fdiagnostics-show-template-tree
5506 In the C++ frontend, when printing diagnostics showing mismatching
5507 template types, such as:
5509 @smallexample
5510   could not convert 'std::map<int, std::vector<double> >()'
5511     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5512 @end smallexample
5514 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5515 tree-like structure showing the common and differing parts of the types,
5516 such as:
5518 @smallexample
5519   map<
5520     [...],
5521     vector<
5522       [double != float]>>
5523 @end smallexample
5525 The parts that differ are highlighted with color (``double'' and
5526 ``float'' in this case).
5528 @opindex fno-elide-type
5529 @opindex felide-type
5530 @item -fno-elide-type
5531 By default when the C++ frontend prints diagnostics showing mismatching
5532 template types, common parts of the types are printed as ``[...]'' to
5533 simplify the error message.  For example:
5535 @smallexample
5536   could not convert 'std::map<int, std::vector<double> >()'
5537     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5538 @end smallexample
5540 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5541 This flag also affects the output of the
5542 @option{-fdiagnostics-show-template-tree} flag.
5544 @opindex fdiagnostics-path-format
5545 @item -fdiagnostics-path-format=@var{KIND}
5546 Specify how to print paths of control-flow events for diagnostics that
5547 have such a path associated with them.
5549 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5550 the default.
5552 @samp{none} means to not print diagnostic paths.
5554 @samp{separate-events} means to print a separate ``note'' diagnostic for
5555 each event within the diagnostic.  For example:
5557 @smallexample
5558 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5559 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5560 test.c:27:3: note: (2) when 'i < count'
5561 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5562 @end smallexample
5564 @samp{inline-events} means to print the events ``inline'' within the source
5565 code.  This view attempts to consolidate the events into runs of
5566 sufficiently-close events, printing them as labelled ranges within the source.
5568 For example, the same events as above might be printed as:
5570 @smallexample
5571   'test': events 1-3
5572     |
5573     |   25 |   list = PyList_New(0);
5574     |      |          ^~~~~~~~~~~~~
5575     |      |          |
5576     |      |          (1) when 'PyList_New' fails, returning NULL
5577     |   26 |
5578     |   27 |   for (i = 0; i < count; i++) @{
5579     |      |   ~~~
5580     |      |   |
5581     |      |   (2) when 'i < count'
5582     |   28 |     item = PyLong_FromLong(random());
5583     |   29 |     PyList_Append(list, item);
5584     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5585     |      |     |
5586     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5587     |
5588 @end smallexample
5590 Interprocedural control flow is shown by grouping the events by stack frame,
5591 and using indentation to show how stack frames are nested, pushed, and popped.
5593 For example:
5595 @smallexample
5596   'test': events 1-2
5597     |
5598     |  133 | @{
5599     |      | ^
5600     |      | |
5601     |      | (1) entering 'test'
5602     |  134 |   boxed_int *obj = make_boxed_int (i);
5603     |      |                    ~~~~~~~~~~~~~~~~~~
5604     |      |                    |
5605     |      |                    (2) calling 'make_boxed_int'
5606     |
5607     +--> 'make_boxed_int': events 3-4
5608            |
5609            |  120 | @{
5610            |      | ^
5611            |      | |
5612            |      | (3) entering 'make_boxed_int'
5613            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5614            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5615            |      |                                    |
5616            |      |                                    (4) calling 'wrapped_malloc'
5617            |
5618            +--> 'wrapped_malloc': events 5-6
5619                   |
5620                   |    7 | @{
5621                   |      | ^
5622                   |      | |
5623                   |      | (5) entering 'wrapped_malloc'
5624                   |    8 |   return malloc (size);
5625                   |      |          ~~~~~~~~~~~~~
5626                   |      |          |
5627                   |      |          (6) calling 'malloc'
5628                   |
5629     <-------------+
5630     |
5631  'test': event 7
5632     |
5633     |  138 |   free_boxed_int (obj);
5634     |      |   ^~~~~~~~~~~~~~~~~~~~
5635     |      |   |
5636     |      |   (7) calling 'free_boxed_int'
5637     |
5638 (etc)
5639 @end smallexample
5641 @opindex fdiagnostics-show-path-depths
5642 @item -fdiagnostics-show-path-depths
5643 This option provides additional information when printing control-flow paths
5644 associated with a diagnostic.
5646 If this is option is provided then the stack depth will be printed for
5647 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5648 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5649 the stack depth and function declaration will be appended when printing
5650 each event.
5652 This is intended for use by GCC developers and plugin developers when
5653 debugging diagnostics that report interprocedural control flow.
5655 @opindex fno-show-column
5656 @opindex fshow-column
5657 @item -fno-show-column
5658 Do not print column numbers in diagnostics.  This may be necessary if
5659 diagnostics are being scanned by a program that does not understand the
5660 column numbers, such as @command{dejagnu}.
5662 @opindex fdiagnostics-column-unit
5663 @item -fdiagnostics-column-unit=@var{UNIT}
5664 Select the units for the column number.  This affects traditional diagnostics
5665 (in the absence of @option{-fno-show-column}), as well as JSON format
5666 diagnostics if requested.
5668 The default @var{UNIT}, @samp{display}, considers the number of display
5669 columns occupied by each character.  This may be larger than the number
5670 of bytes required to encode the character, in the case of tab
5671 characters, or it may be smaller, in the case of multibyte characters.
5672 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5673 display column, and its UTF-8 encoding requires two bytes; the character
5674 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5675 its UTF-8 encoding requires four bytes.
5677 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5678 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5680 @opindex fdiagnostics-column-origin
5681 @item -fdiagnostics-column-origin=@var{ORIGIN}
5682 Select the origin for column numbers, i.e. the column number assigned to the
5683 first column.  The default value of 1 corresponds to traditional GCC
5684 behavior and to the GNU style guide.  Some utilities may perform better with an
5685 origin of 0; any non-negative value may be specified.
5687 @opindex fdiagnostics-escape-format
5688 @item -fdiagnostics-escape-format=@var{FORMAT}
5689 When GCC prints pertinent source lines for a diagnostic it normally attempts
5690 to print the source bytes directly.  However, some diagnostics relate to encoding
5691 issues in the source file, such as malformed UTF-8, or issues with Unicode
5692 normalization.  These diagnostics are flagged so that GCC will escape bytes
5693 that are not printable ASCII when printing their pertinent source lines.
5695 This option controls how such bytes should be escaped.
5697 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5698 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5699 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5700 displayed as hexadecimal in the form @samp{<XX>}.
5702 For example, a source line containing the string @samp{before} followed by the
5703 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5704 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5705 the string @samp{after} will be printed for such a diagnostic as:
5707 @smallexample
5708  before<U+03C0><BF>after
5709 @end smallexample
5711 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5712 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5713 Unicode characters.  For the example above, the following will be printed:
5715 @smallexample
5716  before<CF><80><BF>after
5717 @end smallexample
5719 @opindex fdiagnostics-text-art-charset
5720 @item -fdiagnostics-text-art-charset=@var{CHARSET}
5721 Some diagnostics can contain ``text art'' diagrams: visualizations created
5722 from text, intended to be viewed in a monospaced font.
5724 This option selects which characters should be used for printing such
5725 diagrams, if any.  @var{CHARSET} is @samp{none}, @samp{ascii}, @samp{unicode},
5726 or @samp{emoji}.
5728 The @samp{none} value suppresses the printing of such diagrams.
5729 The @samp{ascii} value will ensure that such diagrams are pure ASCII
5730 (``ASCII art'').  The @samp{unicode} value will allow for conservative use of
5731 unicode drawing characters (such as box-drawing characters).  The @samp{emoji}
5732 value further adds the possibility of emoji in the output (such as emitting
5733 U+26A0 WARNING SIGN followed by U+FE0F VARIATION SELECTOR-16 to select the
5734 emoji variant of the character).
5736 The default is @samp{emoji}, except when the environment variable @env{LANG}
5737 is set to @samp{C}, in which case the default is @samp{ascii}.
5739 @opindex fdiagnostics-format
5740 @item -fdiagnostics-format=@var{FORMAT}
5741 Select a different format for printing diagnostics.
5742 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5743 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5745 The default is @samp{text}.
5747 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5748 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5749 named @file{@var{source}.sarif}, respectively.
5751 The @samp{json} format is a synonym for @samp{json-stderr}.
5752 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5753 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5754 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5756 The emitted JSON consists of a top-level JSON array containing JSON objects
5757 representing the diagnostics.
5759 Diagnostics can have child diagnostics.  For example, this error and note:
5761 @smallexample
5762 misleading-indentation.c:15:3: warning: this 'if' clause does not
5763   guard... [-Wmisleading-indentation]
5764    15 |   if (flag)
5765       |   ^~
5766 misleading-indentation.c:17:5: note: ...this statement, but the latter
5767   is misleadingly indented as if it were guarded by the 'if'
5768    17 |     y = 2;
5769       |     ^
5770 @end smallexample
5772 @noindent
5773 might be printed in JSON form (after formatting) like this:
5775 @smallexample
5777     @{
5778         "kind": "warning",
5779         "locations": [
5780             @{
5781                 "caret": @{
5782                     "display-column": 3,
5783                     "byte-column": 3,
5784                     "column": 3,
5785                     "file": "misleading-indentation.c",
5786                     "line": 15
5787                 @},
5788                 "finish": @{
5789                     "display-column": 4,
5790                     "byte-column": 4,
5791                     "column": 4,
5792                     "file": "misleading-indentation.c",
5793                     "line": 15
5794                 @}
5795             @}
5796         ],
5797         "message": "this \u2018if\u2019 clause does not guard...",
5798         "option": "-Wmisleading-indentation",
5799         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5800         "children": [
5801             @{
5802                 "kind": "note",
5803                 "locations": [
5804                     @{
5805                         "caret": @{
5806                             "display-column": 5,
5807                             "byte-column": 5,
5808                             "column": 5,
5809                             "file": "misleading-indentation.c",
5810                             "line": 17
5811                         @}
5812                     @}
5813                 ],
5814                 "escape-source": false,
5815                 "message": "...this statement, but the latter is @dots{}"
5816             @}
5817         ]
5818         "escape-source": false,
5819         "column-origin": 1,
5820     @}
5822 @end smallexample
5824 @noindent
5825 where the @code{note} is a child of the @code{warning}.
5827 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5828 an @code{option} key describing the command-line option controlling the
5829 warning.
5831 A diagnostic can contain zero or more locations.  Each location has an
5832 optional @code{label} string and up to three positions within it: a
5833 @code{caret} position and optional @code{start} and @code{finish} positions.
5834 A position is described by a @code{file} name, a @code{line} number, and
5835 three numbers indicating a column position:
5836 @itemize @bullet
5838 @item
5839 @code{display-column} counts display columns, accounting for tabs and
5840 multibyte characters.
5842 @item
5843 @code{byte-column} counts raw bytes.
5845 @item
5846 @code{column} is equal to one of
5847 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5848 option.
5850 @end itemize
5851 All three columns are relative to the origin specified by
5852 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5853 be set, for instance, to 0 for compatibility with other utilities that
5854 number columns from 0.  The column origin is recorded in the JSON output in
5855 the @code{column-origin} tag.  In the remaining examples below, the extra
5856 column number outputs have been omitted for brevity.
5858 For example, this error:
5860 @smallexample
5861 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5862    'struct s'@} and 'T' @{aka 'struct t'@})
5863    64 |   return callee_4a () + callee_4b ();
5864       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5865       |          |              |
5866       |          |              T @{aka struct t@}
5867       |          S @{aka struct s@}
5868 @end smallexample
5870 @noindent
5871 has three locations.  Its primary location is at the ``+'' token at column
5872 23.  It has two secondary locations, describing the left and right-hand sides
5873 of the expression, which have labels.  It might be printed in JSON form as:
5875 @smallexample
5876     @{
5877         "children": [],
5878         "kind": "error",
5879         "locations": [
5880             @{
5881                 "caret": @{
5882                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5883                 @}
5884             @},
5885             @{
5886                 "caret": @{
5887                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5888                 @},
5889                 "finish": @{
5890                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5891                 @},
5892                 "label": "S @{aka struct s@}"
5893             @},
5894             @{
5895                 "caret": @{
5896                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5897                 @},
5898                 "finish": @{
5899                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5900                 @},
5901                 "label": "T @{aka struct t@}"
5902             @}
5903         ],
5904         "escape-source": false,
5905         "message": "invalid operands to binary + @dots{}"
5906     @}
5907 @end smallexample
5909 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5910 consisting of half-open intervals, similar to the output of
5911 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5912 with a replacement fix-it hint:
5914 @smallexample
5915 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5916   mean 'color'?
5917     8 |   return ptr->colour;
5918       |               ^~~~~~
5919       |               color
5920 @end smallexample
5922 @noindent
5923 might be printed in JSON form as:
5925 @smallexample
5926     @{
5927         "children": [],
5928         "fixits": [
5929             @{
5930                 "next": @{
5931                     "column": 21,
5932                     "file": "demo.c",
5933                     "line": 8
5934                 @},
5935                 "start": @{
5936                     "column": 15,
5937                     "file": "demo.c",
5938                     "line": 8
5939                 @},
5940                 "string": "color"
5941             @}
5942         ],
5943         "kind": "error",
5944         "locations": [
5945             @{
5946                 "caret": @{
5947                     "column": 15,
5948                     "file": "demo.c",
5949                     "line": 8
5950                 @},
5951                 "finish": @{
5952                     "column": 20,
5953                     "file": "demo.c",
5954                     "line": 8
5955                 @}
5956             @}
5957         ],
5958         "escape-source": false,
5959         "message": "\u2018struct s\u2019 has no member named @dots{}"
5960     @}
5961 @end smallexample
5963 @noindent
5964 where the fix-it hint suggests replacing the text from @code{start} up
5965 to but not including @code{next} with @code{string}'s value.  Deletions
5966 are expressed via an empty value for @code{string}, insertions by
5967 having @code{start} equal @code{next}.
5969 If the diagnostic has a path of control-flow events associated with it,
5970 it has a @code{path} array of objects representing the events.  Each
5971 event object has a @code{description} string, a @code{location} object,
5972 along with a @code{function} string and a @code{depth} number for
5973 representing interprocedural paths.  The @code{function} represents the
5974 current function at that event, and the @code{depth} represents the
5975 stack depth relative to some baseline: the higher, the more frames are
5976 within the stack.
5978 For example, the intraprocedural example shown for
5979 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5981 @smallexample
5982     "path": [
5983         @{
5984             "depth": 0,
5985             "description": "when 'PyList_New' fails, returning NULL",
5986             "function": "test",
5987             "location": @{
5988                 "column": 10,
5989                 "file": "test.c",
5990                 "line": 25
5991             @}
5992         @},
5993         @{
5994             "depth": 0,
5995             "description": "when 'i < count'",
5996             "function": "test",
5997             "location": @{
5998                 "column": 3,
5999                 "file": "test.c",
6000                 "line": 27
6001             @}
6002         @},
6003         @{
6004             "depth": 0,
6005             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
6006             "function": "test",
6007             "location": @{
6008                 "column": 5,
6009                 "file": "test.c",
6010                 "line": 29
6011             @}
6012         @}
6013     ]
6014 @end smallexample
6016 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
6017 non-ASCII bytes should be escaped when printing the pertinent lines of
6018 source code (@code{true} for diagnostics involving source encoding issues).
6020 @opindex fno-diagnostics-json-formatting
6021 @opindex fdiagnostics-json-formatting
6022 @item -fno-diagnostics-json-formatting
6023 By default, when JSON is emitted for diagnostics (via
6024 @option{-fdiagnostics-format=sarif-stderr},
6025 @option{-fdiagnostics-format=sarif-file},
6026 @option{-fdiagnostics-format=json},
6027 @option{-fdiagnostics-format=json-stderr},
6028 @option{-fdiagnostics-format=json-file}),
6029 GCC will add newlines and indentation to visually emphasize the
6030 hierarchical structure of the JSON.
6032 Use @option{-fno-diagnostics-json-formatting} to suppress this whitespace.
6033 It must be passed before the option it is to affect.
6035 This is intended for compatibility with tools that do not expect the output
6036 to contain newlines, such as that emitted by older GCC releases.
6038 @end table
6040 @node Warning Options
6041 @section Options to Request or Suppress Warnings
6042 @cindex options to control warnings
6043 @cindex warning messages
6044 @cindex messages, warning
6045 @cindex suppressing warnings
6047 Warnings are diagnostic messages that report constructions that
6048 are not inherently erroneous but that are risky or suggest there
6049 may have been an error.
6051 The following language-independent options do not enable specific
6052 warnings but control the kinds of diagnostics produced by GCC@.
6054 @table @gcctabopt
6055 @cindex syntax checking
6056 @opindex fsyntax-only
6057 @item -fsyntax-only
6058 Check the code for syntax errors, but don't do anything beyond that.
6060 @opindex fmax-errors
6061 @item -fmax-errors=@var{n}
6062 Limits the maximum number of error messages to @var{n}, at which point
6063 GCC bails out rather than attempting to continue processing the source
6064 code.  If @var{n} is 0 (the default), there is no limit on the number
6065 of error messages produced.  If @option{-Wfatal-errors} is also
6066 specified, then @option{-Wfatal-errors} takes precedence over this
6067 option.
6069 @opindex w
6070 @item -w
6071 Inhibit all warning messages.
6073 @opindex Werror
6074 @opindex Wno-error
6075 @item -Werror
6076 Make all warnings into errors.
6078 @opindex Werror=
6079 @opindex Wno-error=
6080 @item -Werror=
6081 Make the specified warning into an error.  The specifier for a warning
6082 is appended; for example @option{-Werror=switch} turns the warnings
6083 controlled by @option{-Wswitch} into errors.  This switch takes a
6084 negative form, to be used to negate @option{-Werror} for specific
6085 warnings; for example @option{-Wno-error=switch} makes
6086 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
6087 is in effect.
6089 The warning message for each controllable warning includes the
6090 option that controls the warning.  That option can then be used with
6091 @option{-Werror=} and @option{-Wno-error=} as described above.
6092 (Printing of the option in the warning message can be disabled using the
6093 @option{-fno-diagnostics-show-option} flag.)
6095 Note that specifying @option{-Werror=}@var{foo} automatically implies
6096 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
6097 imply anything.
6099 @opindex Wfatal-errors
6100 @opindex Wno-fatal-errors
6101 @item -Wfatal-errors
6102 This option causes the compiler to abort compilation on the first error
6103 occurred rather than trying to keep going and printing further error
6104 messages.
6106 @end table
6108 You can request many specific warnings with options beginning with
6109 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6110 implicit declarations.  Each of these specific warning options also
6111 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6112 example, @option{-Wno-implicit}.  This manual lists only one of the
6113 two forms, whichever is not the default.  For further
6114 language-specific options also refer to @ref{C++ Dialect Options} and
6115 @ref{Objective-C and Objective-C++ Dialect Options}.
6116 Additional warnings can be produced by enabling the static analyzer;
6117 @xref{Static Analyzer Options}.
6119 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6120 options, such as @option{-Wunused}, which may turn on further options,
6121 such as @option{-Wunused-value}. The combined effect of positive and
6122 negative forms is that more specific options have priority over less
6123 specific ones, independently of their position in the command-line. For
6124 options of the same specificity, the last one takes effect. Options
6125 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6126 as if they appeared at the end of the command-line.
6128 When an unrecognized warning option is requested (e.g.,
6129 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6130 that the option is not recognized.  However, if the @option{-Wno-} form
6131 is used, the behavior is slightly different: no diagnostic is
6132 produced for @option{-Wno-unknown-warning} unless other diagnostics
6133 are being produced.  This allows the use of new @option{-Wno-} options
6134 with old compilers, but if something goes wrong, the compiler
6135 warns that an unrecognized option is present.
6137 The effectiveness of some warnings depends on optimizations also being
6138 enabled. For example @option{-Wsuggest-final-types} is more effective
6139 with link-time optimization and some instances of other warnings may
6140 not be issued at all unless optimization is enabled.  While optimization
6141 in general improves the efficacy of control and data flow sensitive
6142 warnings, in some cases it may also cause false positives.
6144 @table @gcctabopt
6145 @opindex pedantic
6146 @opindex Wpedantic
6147 @opindex Wno-pedantic
6148 @item -Wpedantic
6149 @itemx -pedantic
6150 Issue all the warnings demanded by strict ISO C and ISO C++;
6151 diagnose all programs that use forbidden extensions, and some other
6152 programs that do not follow ISO C and ISO C++.  This follows the version
6153 of the ISO C or C++ standard specified by any @option{-std} option used.
6155 Valid ISO C and ISO C++ programs should compile properly with or without
6156 this option (though a rare few require @option{-ansi} or a
6157 @option{-std} option specifying the version of the standard)@.  However,
6158 without this option, certain GNU extensions and traditional C and C++
6159 features are supported as well.  With this option, they are diagnosed
6160 (or rejected with @option{-pedantic-errors}).
6162 @option{-Wpedantic} does not cause warning messages for use of the
6163 alternate keywords whose names begin and end with @samp{__}.  This alternate
6164 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6165 i.e. @samp{__intN__}.
6166 Pedantic warnings are also disabled in the expression that follows
6167 @code{__extension__}.  However, only system header files should use
6168 these escape routes; application programs should avoid them.
6169 @xref{Alternate Keywords}.
6171 Some warnings about non-conforming programs are controlled by options
6172 other than @option{-Wpedantic}; in many cases they are implied by
6173 @option{-Wpedantic} but can be disabled separately by their specific
6174 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6176 Where the standard specified with @option{-std} represents a GNU
6177 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6178 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6179 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6180 where they are required by the base standard.  (It does not make sense
6181 for such warnings to be given only for features not in the specified GNU
6182 C dialect, since by definition the GNU dialects of C include all
6183 features the compiler supports with the given option, and there would be
6184 nothing to warn about.)
6186 @opindex pedantic-errors
6187 @item -pedantic-errors
6188 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6189 requires a diagnostic, in some cases where there is undefined behavior
6190 at compile-time and in some other cases that do not prevent compilation
6191 of programs that are valid according to the standard. This is not
6192 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6193 useful, as it only makes errors of the diagnostics that are controlled by
6194 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6195 are always enabled or controlled by options other than @option{-Wpedantic}.
6197 If you want the required diagnostics that are warnings by default to
6198 be errors instead, but don't also want to enable the @option{-Wpedantic}
6199 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6200 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6201 only as warnings).
6203 Some required diagnostics are errors by default, but can be reduced to
6204 warnings using @option{-fpermissive} or their specific warning option,
6205 e.g. @option{-Wno-error=narrowing}.
6207 Some diagnostics for non-ISO practices are controlled by specific
6208 warning options other than @option{-Wpedantic}, but are also made
6209 errors by @option{-pedantic-errors}.  For instance:
6211 @gccoptlist{
6212 -Wattributes @r{(for standard attributes)}
6213 -Wchanges-meaning @r{(C++)}
6214 -Wcomma-subscript @r{(C++23 or later)}
6215 -Wdeclaration-after-statement @r{(C90 or earlier)}
6216 -Welaborated-enum-base @r{(C++11 or later)}
6217 -Wimplicit-int @r{(C99 or later)}
6218 -Wimplicit-function-declaration @r{(C99 or later)}
6219 -Wincompatible-pointer-types
6220 -Wint-conversion
6221 -Wlong-long @r{(C90 or earlier)}
6222 -Wmain
6223 -Wnarrowing @r{(C++11 or later)}
6224 -Wpointer-arith
6225 -Wpointer-sign
6226 -Wincompatible-pointer-types
6227 -Wregister @r{(C++17 or later)}
6228 -Wvla @r{(C90 or earlier)}
6229 -Wwrite-strings @r{(C++11 or later)}
6232 @opindex fpermissive
6233 @item -fpermissive
6234 Downgrade some required diagnostics about nonconformant code from
6235 errors to warnings.  Thus, using @option{-fpermissive} allows some
6236 nonconforming code to compile.  Some C++ diagnostics are controlled
6237 only by this flag, but it also downgrades some C and C++ diagnostics
6238 that have their own flag:
6240 @gccoptlist{
6241 -Wdeclaration-missing-parameter-type @r{(C and Objective-C only)}
6242 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6243 -Wimplicit-int @r{(C and Objective-C only)}
6244 -Wincompatible-pointer-types @r{(C and Objective-C only)}
6245 -Wint-conversion @r{(C and Objective-C only)}
6246 -Wnarrowing @r{(C++ and Objective-C++ only)}
6247 -Wreturn-mismatch @r{(C and Objective-C only)}
6250 The @option{-fpermissive} option is the default for historic C language
6251 modes (@option{-std=c89}, @option{-std=gnu89}, @option{-std=c90},
6252 @option{-std=gnu90}).
6254 @opindex Wall
6255 @opindex Wno-all
6256 @item -Wall
6257 This enables all the warnings about constructions that some users
6258 consider questionable, and that are easy to avoid (or modify to
6259 prevent the warning), even in conjunction with macros.  This also
6260 enables some language-specific warnings described in @ref{C++ Dialect
6261 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6263 @option{-Wall} turns on the following warning flags:
6265 @gccoptlist{-Waddress
6266 -Waligned-new @r{(C++ and Objective-C++ only)}
6267 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6268 -Warray-compare
6269 -Warray-parameter=2
6270 -Wbool-compare
6271 -Wbool-operation
6272 -Wc++11-compat  -Wc++14-compat  -Wc++17compat  -Wc++20compat
6273 -Wcatch-value @r{(C++ and Objective-C++ only)}
6274 -Wchar-subscripts
6275 -Wclass-memaccess @r{(C++ and Objective-C++ only)}
6276 -Wcomment
6277 -Wdangling-else
6278 -Wdangling-pointer=2
6279 -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
6280 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6281 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6282 -Wenum-int-mismatch @r{(C and Objective-C only)}
6283 -Wformat=1
6284 -Wformat-contains-nul
6285 -Wformat-diag
6286 -Wformat-extra-args
6287 -Wformat-overflow=1
6288 -Wformat-truncation=1
6289 -Wformat-zero-length
6290 -Wframe-address
6291 -Wimplicit @r{(C and Objective-C only)}
6292 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6293 -Wimplicit-int @r{(C and Objective-C only)}
6294 -Winfinite-recursion
6295 -Winit-self @r{(C++ and Objective-C++ only)}
6296 -Wint-in-bool-context
6297 -Wlogical-not-parentheses
6298 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6299 -Wmaybe-uninitialized
6300 -Wmemset-elt-size
6301 -Wmemset-transposed-args
6302 -Wmisleading-indentation @r{(only for C/C++)}
6303 -Wmismatched-dealloc
6304 -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
6305 -Wmissing-attributes
6306 -Wmissing-braces @r{(only for C/ObjC)}
6307 -Wmultistatement-macros
6308 -Wnarrowing  @r{(C++ and Objective-C++ only)}
6309 -Wnonnull
6310 -Wnonnull-compare
6311 -Wopenmp-simd @r{(C and C++ only)}
6312 -Woverloaded-virtual=1 @r{(C++ and Objective-C++ only)}
6313 -Wpacked-not-aligned
6314 -Wparentheses
6315 -Wpessimizing-move @r{(C++ and Objective-C++ only)}
6316 -Wpointer-sign @r{(only for C/ObjC)}
6317 -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
6318 -Wreorder @r{(C++ and Objective-C++ only)}
6319 -Wrestrict
6320 -Wreturn-type
6321 -Wself-move @r{(C++ and Objective-C++ only)}
6322 -Wsequence-point
6323 -Wsign-compare @r{(C++ and Objective-C++ only)}
6324 -Wsizeof-array-div
6325 -Wsizeof-pointer-div
6326 -Wsizeof-pointer-memaccess
6327 -Wstrict-aliasing
6328 -Wstrict-overflow=1
6329 -Wswitch
6330 -Wtautological-compare
6331 -Wtrigraphs
6332 -Wuninitialized
6333 -Wunknown-pragmas
6334 -Wunused
6335 -Wunused-but-set-variable
6336 -Wunused-const-variable=1 @r{(only for C/ObjC)}
6337 -Wunused-function
6338 -Wunused-label
6339 -Wunused-local-typedefs
6340 -Wunused-value
6341 -Wunused-variable
6342 -Wuse-after-free=2
6343 -Wvla-parameter
6344 -Wvolatile-register-var
6345 -Wzero-length-bounds}
6347 Note that some warning flags are not implied by @option{-Wall}.  Some of
6348 them warn about constructions that users generally do not consider
6349 questionable, but which occasionally you might wish to check for;
6350 others warn about constructions that are necessary or hard to avoid in
6351 some cases, and there is no simple way to modify the code to suppress
6352 the warning. Some of them are enabled by @option{-Wextra} but many of
6353 them must be enabled individually.
6355 @opindex W
6356 @opindex Wextra
6357 @opindex Wno-extra
6358 @item -Wextra
6359 This enables some extra warning flags that are not enabled by
6360 @option{-Wall}. (This option used to be called @option{-W}.  The older
6361 name is still supported, but the newer name is more descriptive.)
6363 @gccoptlist{-Wabsolute-value @r{(only for C/ObjC)}
6364 -Walloc-size
6365 -Wcalloc-transposed-args
6366 -Wcast-function-type
6367 -Wclobbered
6368 -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
6369 -Wempty-body
6370 -Wenum-conversion @r{(only for C/ObjC)}
6371 -Wexpansion-to-defined
6372 -Wignored-qualifiers  @r{(only for C/C++)}
6373 -Wimplicit-fallthrough=3
6374 -Wmaybe-uninitialized
6375 -Wmissing-field-initializers
6376 -Wmissing-parameter-type @r{(C/ObjC only)}
6377 -Wold-style-declaration @r{(C/ObjC only)}
6378 -Woverride-init @r{(C/ObjC only)}
6379 -Wredundant-move @r{(C++ and Objective-C++ only)}
6380 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6381 -Wsign-compare @r{(C++ and Objective-C++ only)}
6382 -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6383 -Wstring-compare
6384 -Wtype-limits
6385 -Wuninitialized
6386 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6387 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6389 The option @option{-Wextra} also prints warning messages for the
6390 following cases:
6392 @itemize @bullet
6394 @item
6395 A pointer is compared against integer zero with @code{<}, @code{<=},
6396 @code{>}, or @code{>=}.
6398 @item
6399 (C++ only) An enumerator and a non-enumerator both appear in a
6400 conditional expression.
6402 @item
6403 (C++ only) Ambiguous virtual bases.
6405 @item
6406 (C++ only) Subscripting an array that has been declared @code{register}.
6408 @item
6409 (C++ only) Taking the address of a variable that has been declared
6410 @code{register}.
6412 @item
6413 (C++ only) A base class is not initialized in the copy constructor
6414 of a derived class.
6416 @end itemize
6418 @opindex Wabi
6419 @opindex Wno-abi
6420 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6422 Warn about code affected by ABI changes.  This includes code that may
6423 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6424 for the particular target.
6426 Since G++ now defaults to updating the ABI with each major release,
6427 normally @option{-Wabi} warns only about C++ ABI compatibility
6428 problems if there is a check added later in a release series for an
6429 ABI issue discovered since the initial release.  @option{-Wabi} warns
6430 about more things if an older ABI version is selected (with
6431 @option{-fabi-version=@var{n}}).
6433 @option{-Wabi} can also be used with an explicit version number to
6434 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6435 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6436 @option{-fabi-version=2}.
6438 If an explicit version number is provided and
6439 @option{-fabi-compat-version} is not specified, the version number
6440 from this option is used for compatibility aliases.  If no explicit
6441 version number is provided with this option, but
6442 @option{-fabi-compat-version} is specified, that version number is
6443 used for C++ ABI warnings.
6445 Although an effort has been made to warn about
6446 all such cases, there are probably some cases that are not warned about,
6447 even though G++ is generating incompatible code.  There may also be
6448 cases where warnings are emitted even though the code that is generated
6449 is compatible.
6451 You should rewrite your code to avoid these warnings if you are
6452 concerned about the fact that code generated by G++ may not be binary
6453 compatible with code generated by other compilers.
6455 Known incompatibilities in @option{-fabi-version=2} (which was the
6456 default from GCC 3.4 to 4.9) include:
6458 @itemize @bullet
6460 @item
6461 A template with a non-type template parameter of reference type was
6462 mangled incorrectly:
6463 @smallexample
6464 extern int N;
6465 template <int &> struct S @{@};
6466 void n (S<N>) @{2@}
6467 @end smallexample
6469 This was fixed in @option{-fabi-version=3}.
6471 @item
6472 SIMD vector types declared using @code{__attribute ((vector_size))} were
6473 mangled in a non-standard way that does not allow for overloading of
6474 functions taking vectors of different sizes.
6476 The mangling was changed in @option{-fabi-version=4}.
6478 @item
6479 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6480 qualifiers, and @code{decltype} of a plain declaration was folded away.
6482 These mangling issues were fixed in @option{-fabi-version=5}.
6484 @item
6485 Scoped enumerators passed as arguments to a variadic function are
6486 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6487 On most targets this does not actually affect the parameter passing
6488 ABI, as there is no way to pass an argument smaller than @code{int}.
6490 Also, the ABI changed the mangling of template argument packs,
6491 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6492 a class scope function used as a template argument.
6494 These issues were corrected in @option{-fabi-version=6}.
6496 @item
6497 Lambdas in default argument scope were mangled incorrectly, and the
6498 ABI changed the mangling of @code{nullptr_t}.
6500 These issues were corrected in @option{-fabi-version=7}.
6502 @item
6503 When mangling a function type with function-cv-qualifiers, the
6504 un-qualified function type was incorrectly treated as a substitution
6505 candidate.
6507 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6509 @item
6510 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6511 unaligned accesses.  Note that this did not affect the ABI of a
6512 function with a @code{nullptr_t} parameter, as parameters have a
6513 minimum alignment.
6515 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6517 @item
6518 Target-specific attributes that affect the identity of a type, such as
6519 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6520 did not affect the mangled name, leading to name collisions when
6521 function pointers were used as template arguments.
6523 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6525 @end itemize
6527 This option also enables warnings about psABI-related changes.
6528 The known psABI changes at this point include:
6530 @itemize @bullet
6532 @item
6533 For SysV/x86-64, unions with @code{long double} members are
6534 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6535 the case.  For example:
6537 @smallexample
6538 union U @{
6539   long double ld;
6540   int i;
6542 @end smallexample
6544 @noindent
6545 @code{union U} is now always passed in memory.
6547 @end itemize
6549 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6550 C++ requires that unqualified uses of a name within a class have the
6551 same meaning in the complete scope of the class, so declaring the name
6552 after using it is ill-formed:
6553 @smallexample
6554 struct A;
6555 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6556 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6557 @end smallexample
6558 By default, the B1 case is only a warning because the two declarations
6559 have the same type, while the B2 case is an error.  Both diagnostics
6560 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6561 error case can be reduced to a warning with
6562 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6564 Both diagnostics are also suppressed by @option{-fms-extensions}.
6566 @opindex Wchar-subscripts
6567 @opindex Wno-char-subscripts
6568 @item -Wchar-subscripts
6569 Warn if an array subscript has type @code{char}.  This is a common cause
6570 of error, as programmers often forget that this type is signed on some
6571 machines.
6572 This warning is enabled by @option{-Wall}.
6574 @opindex Wno-coverage-mismatch
6575 @opindex Wcoverage-mismatch
6576 @item -Wno-coverage-mismatch
6577 Warn if feedback profiles do not match when using the
6578 @option{-fprofile-use} option.
6579 If a source file is changed between compiling with @option{-fprofile-generate}
6580 and with @option{-fprofile-use}, the files with the profile feedback can fail
6581 to match the source file and GCC cannot use the profile feedback
6582 information.  By default, this warning is enabled and is treated as an
6583 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6584 warning or @option{-Wno-error=coverage-mismatch} can be used to
6585 disable the error.  Disabling the error for this warning can result in
6586 poorly optimized code and is useful only in the
6587 case of very minor changes such as bug fixes to an existing code-base.
6588 Completely disabling the warning is not recommended.
6590 @opindex Wno-coverage-too-many-conditions
6591 @opindex Wcoverage-too-many-conditions
6592 @item -Wno-coverage-too-many-conditions
6593 Warn if @option{-fcondition-coverage} is used and an expression have too many
6594 terms and GCC gives up coverage.  Coverage is given up when there are more
6595 terms in the conditional than there are bits in a @code{gcov_type_unsigned}.
6596 This warning is enabled by default.
6598 @opindex Wno-coverage-invalid-line-number
6599 @opindex Wcoverage-invalid-line-number
6600 @item -Wno-coverage-invalid-line-number
6601 Warn in case a function ends earlier than it begins due
6602 to an invalid linenum macros.  The warning is emitted only
6603 with @option{--coverage} enabled.
6605 By default, this warning is enabled and is treated as an
6606 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6607 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6608 disable the error.
6610 @opindex Wno-cpp
6611 @opindex Wcpp
6612 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6613 Suppress warning messages emitted by @code{#warning} directives.
6615 @opindex Wdouble-promotion
6616 @opindex Wno-double-promotion
6617 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6618 Give a warning when a value of type @code{float} is implicitly
6619 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6620 floating-point unit implement @code{float} in hardware, but emulate
6621 @code{double} in software.  On such a machine, doing computations
6622 using @code{double} values is much more expensive because of the
6623 overhead required for software emulation.
6625 It is easy to accidentally do computations with @code{double} because
6626 floating-point literals are implicitly of type @code{double}.  For
6627 example, in:
6628 @smallexample
6629 @group
6630 float area(float radius)
6632    return 3.14159 * radius * radius;
6634 @end group
6635 @end smallexample
6636 the compiler performs the entire computation with @code{double}
6637 because the floating-point literal is a @code{double}.
6639 @opindex Wduplicate-decl-specifier
6640 @opindex Wno-duplicate-decl-specifier
6641 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6642 Warn if a declaration has duplicate @code{const}, @code{volatile},
6643 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6644 @option{-Wall}.
6646 @opindex Wformat
6647 @opindex Wno-format
6648 @opindex ffreestanding
6649 @opindex fno-builtin
6650 @opindex Wformat=
6651 @item -Wformat
6652 @itemx -Wformat=@var{n}
6653 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6654 the arguments supplied have types appropriate to the format string
6655 specified, and that the conversions specified in the format string make
6656 sense.  This includes standard functions, and others specified by format
6657 attributes (@pxref{Function Attributes}), in the @code{printf},
6658 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6659 not in the C standard) families (or other target-specific families).
6660 Which functions are checked without format attributes having been
6661 specified depends on the standard version selected, and such checks of
6662 functions without the attribute specified are disabled by
6663 @option{-ffreestanding} or @option{-fno-builtin}.
6665 The formats are checked against the format features supported by GNU
6666 libc version 2.2.  These include all ISO C90 and C99 features, as well
6667 as features from the Single Unix Specification and some BSD and GNU
6668 extensions.  Other library implementations may not support all these
6669 features; GCC does not support warning about features that go beyond a
6670 particular library's limitations.  However, if @option{-Wpedantic} is used
6671 with @option{-Wformat}, warnings are given about format features not
6672 in the selected standard version (but not for @code{strfmon} formats,
6673 since those are not in any version of the C standard).  @xref{C Dialect
6674 Options,,Options Controlling C Dialect}.
6676 @table @gcctabopt
6677 @opindex Wformat
6678 @opindex Wformat=1
6679 @item -Wformat=1
6680 @itemx -Wformat
6681 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6682 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6683 @option{-Wformat} also checks for null format arguments for several
6684 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6685 aspects of this level of format checking can be disabled by the
6686 options: @option{-Wno-format-contains-nul},
6687 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6688 @option{-Wformat} is enabled by @option{-Wall}.
6690 @opindex Wformat=2
6691 @item -Wformat=2
6692 Enable @option{-Wformat} plus additional format checks.  Currently
6693 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6694 -Wformat-y2k}.
6695 @end table
6697 @opindex Wno-format-contains-nul
6698 @opindex Wformat-contains-nul
6699 @item -Wno-format-contains-nul
6700 If @option{-Wformat} is specified, do not warn about format strings that
6701 contain NUL bytes.
6703 @opindex Wno-format-extra-args
6704 @opindex Wformat-extra-args
6705 @item -Wno-format-extra-args
6706 If @option{-Wformat} is specified, do not warn about excess arguments to a
6707 @code{printf} or @code{scanf} format function.  The C standard specifies
6708 that such arguments are ignored.
6710 Where the unused arguments lie between used arguments that are
6711 specified with @samp{$} operand number specifications, normally
6712 warnings are still given, since the implementation could not know what
6713 type to pass to @code{va_arg} to skip the unused arguments.  However,
6714 in the case of @code{scanf} formats, this option suppresses the
6715 warning if the unused arguments are all pointers, since the Single
6716 Unix Specification says that such unused arguments are allowed.
6718 @opindex Wformat-overflow
6719 @opindex Wno-format-overflow
6720 @item -Wformat-overflow
6721 @itemx -Wformat-overflow=@var{level}
6722 Warn about calls to formatted input/output functions such as @code{sprintf}
6723 and @code{vsprintf} that might overflow the destination buffer.  When the
6724 exact number of bytes written by a format directive cannot be determined
6725 at compile-time it is estimated based on heuristics that depend on the
6726 @var{level} argument and on optimization.  While enabling optimization
6727 will in most cases improve the accuracy of the warning, it may also
6728 result in false positives.
6730 @table @gcctabopt
6731 @opindex Wformat-overflow
6732 @opindex Wno-format-overflow
6733 @item -Wformat-overflow
6734 @itemx -Wformat-overflow=1
6735 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6736 employs a conservative approach that warns only about calls that most
6737 likely overflow the buffer.  At this level, numeric arguments to format
6738 directives with unknown values are assumed to have the value of one, and
6739 strings of unknown length to be empty.  Numeric arguments that are known
6740 to be bounded to a subrange of their type, or string arguments whose output
6741 is bounded either by their directive's precision or by a finite set of
6742 string literals, are assumed to take on the value within the range that
6743 results in the most bytes on output.  For example, the call to @code{sprintf}
6744 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6745 the terminating NUL character (@code{'\0'}) appended by the function
6746 to the destination buffer will be written past its end.  Increasing
6747 the size of the buffer by a single byte is sufficient to avoid the
6748 warning, though it may not be sufficient to avoid the overflow.
6750 @smallexample
6751 void f (int a, int b)
6753   char buf [13];
6754   sprintf (buf, "a = %i, b = %i\n", a, b);
6756 @end smallexample
6758 @item -Wformat-overflow=2
6759 Level @var{2} warns also about calls that might overflow the destination
6760 buffer given an argument of sufficient length or magnitude.  At level
6761 @var{2}, unknown numeric arguments are assumed to have the minimum
6762 representable value for signed types with a precision greater than 1, and
6763 the maximum representable value otherwise.  Unknown string arguments whose
6764 length cannot be assumed to be bounded either by the directive's precision,
6765 or by a finite set of string literals they may evaluate to, or the character
6766 array they may point to, are assumed to be 1 character long.
6768 At level @var{2}, the call in the example above is again diagnosed, but
6769 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6770 @code{%i} directive will write some of its digits beyond the end of
6771 the destination buffer.  To make the call safe regardless of the values
6772 of the two variables, the size of the destination buffer must be increased
6773 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6774 an informational note following the warning.
6776 An alternative to increasing the size of the destination buffer is to
6777 constrain the range of formatted values.  The maximum length of string
6778 arguments can be bounded by specifying the precision in the format
6779 directive.  When numeric arguments of format directives can be assumed
6780 to be bounded by less than the precision of their type, choosing
6781 an appropriate length modifier to the format specifier will reduce
6782 the required buffer size.  For example, if @var{a} and @var{b} in the
6783 example above can be assumed to be within the precision of
6784 the @code{short int} type then using either the @code{%hi} format
6785 directive or casting the argument to @code{short} reduces the maximum
6786 required size of the buffer to 24 bytes.
6788 @smallexample
6789 void f (int a, int b)
6791   char buf [23];
6792   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6794 @end smallexample
6795 @end table
6797 @opindex Wno-format-zero-length
6798 @opindex Wformat-zero-length
6799 @item -Wno-format-zero-length
6800 If @option{-Wformat} is specified, do not warn about zero-length formats.
6801 The C standard specifies that zero-length formats are allowed.
6803 @opindex Wformat-nonliteral
6804 @opindex Wno-format-nonliteral
6805 @item -Wformat-nonliteral
6806 If @option{-Wformat} is specified, also warn if the format string is not a
6807 string literal and so cannot be checked, unless the format function
6808 takes its format arguments as a @code{va_list}.
6810 @opindex Wformat-security
6811 @opindex Wno-format-security
6812 @item -Wformat-security
6813 If @option{-Wformat} is specified, also warn about uses of format
6814 functions that represent possible security problems.  At present, this
6815 warns about calls to @code{printf} and @code{scanf} functions where the
6816 format string is not a string literal and there are no format arguments,
6817 as in @code{printf (foo);}.  This may be a security hole if the format
6818 string came from untrusted input and contains @samp{%n}.  (This is
6819 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6820 in future warnings may be added to @option{-Wformat-security} that are not
6821 included in @option{-Wformat-nonliteral}.)
6823 @opindex Wformat-signedness
6824 @opindex Wno-format-signedness
6825 @item -Wformat-signedness
6826 If @option{-Wformat} is specified, also warn if the format string
6827 requires an unsigned argument and the argument is signed and vice versa.
6829 @opindex Wformat-truncation
6830 @opindex Wno-format-truncation
6831 @item -Wformat-truncation
6832 @itemx -Wformat-truncation=@var{level}
6833 Warn about calls to formatted input/output functions such as @code{snprintf}
6834 and @code{vsnprintf} that might result in output truncation.  When the exact
6835 number of bytes written by a format directive cannot be determined at
6836 compile-time it is estimated based on heuristics that depend on
6837 the @var{level} argument and on optimization.  While enabling optimization
6838 will in most cases improve the accuracy of the warning, it may also result
6839 in false positives.  Except as noted otherwise, the option uses the same
6840 logic @option{-Wformat-overflow}.
6842 @table @gcctabopt
6843 @opindex Wformat-truncation
6844 @opindex Wno-format-truncation
6845 @item -Wformat-truncation
6846 @itemx -Wformat-truncation=1
6847 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6848 employs a conservative approach that warns only about calls to bounded
6849 functions whose return value is unused and that will most likely result
6850 in output truncation.
6852 @item -Wformat-truncation=2
6853 Level @var{2} warns also about calls to bounded functions whose return
6854 value is used and that might result in truncation given an argument of
6855 sufficient length or magnitude.
6856 @end table
6858 @opindex Wformat-y2k
6859 @opindex Wno-format-y2k
6860 @item -Wformat-y2k
6861 If @option{-Wformat} is specified, also warn about @code{strftime}
6862 formats that may yield only a two-digit year.
6864 @opindex Wnonnull
6865 @opindex Wno-nonnull
6866 @item -Wnonnull
6867 Warn about passing a null pointer for arguments marked as
6868 requiring a non-null value by the @code{nonnull} function attribute.
6870 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6871 can be disabled with the @option{-Wno-nonnull} option.
6873 @opindex Wnonnull-compare
6874 @opindex Wno-nonnull-compare
6875 @item -Wnonnull-compare
6876 Warn when comparing an argument marked with the @code{nonnull}
6877 function attribute against null inside the function.
6879 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6880 can be disabled with the @option{-Wno-nonnull-compare} option.
6882 @opindex Wnull-dereference
6883 @opindex Wno-null-dereference
6884 @item -Wnull-dereference
6885 Warn if the compiler detects paths that trigger erroneous or
6886 undefined behavior due to dereferencing a null pointer.  This option
6887 is only active when @option{-fdelete-null-pointer-checks} is active,
6888 which is enabled by optimizations in most targets.  The precision of
6889 the warnings depends on the optimization options used.
6891 @opindex Wnrvo
6892 @opindex Wno-nrvo
6893 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6894 Warn if the compiler does not elide the copy from a local variable to
6895 the return value of a function in a context where it is allowed by
6896 [class.copy.elision].  This elision is commonly known as the Named
6897 Return Value Optimization.  For instance, in the example below the
6898 compiler cannot elide copies from both v1 and v2, so it elides neither.
6900 @smallexample
6901 std::vector<int> f()
6903   std::vector<int> v1, v2;
6904   // ...
6905   if (cond) return v1;
6906   else return v2; // warning: not eliding copy
6908 @end smallexample
6910 @opindex Winfinite-recursion
6911 @opindex Wno-infinite-recursion
6912 @item -Winfinite-recursion
6913 Warn about infinitely recursive calls.  The warning is effective at all
6914 optimization levels but requires optimization in order to detect infinite
6915 recursion in calls between two or more functions.
6916 @option{-Winfinite-recursion} is included in @option{-Wall}.
6918 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6919 similar diagnostic, but is implemented in a different way (as part of
6920 @option{-fanalyzer}).
6922 @opindex Winit-self
6923 @opindex Wno-init-self
6924 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6925 Warn about uninitialized variables that are initialized with themselves.
6926 Note this option can only be used with the @option{-Wuninitialized} option.
6928 For example, GCC warns about @code{i} being uninitialized in the
6929 following snippet only when @option{-Winit-self} has been specified:
6930 @smallexample
6931 @group
6932 int f()
6934   int i = i;
6935   return i;
6937 @end group
6938 @end smallexample
6940 This warning is enabled by @option{-Wall} in C++.
6942 @opindex Wimplicit-int
6943 @opindex Wno-implicit-int
6944 @item -Wno-implicit-int @r{(C and Objective-C only)}
6945 This option controls warnings when a declaration does not specify a type.
6946 This warning is enabled by default, as an error, in C99 and later
6947 dialects of C, and also by @option{-Wall}.  The error can be downgraded
6948 to a warning using @option{-fpermissive} (along with certain other
6949 errors), or for this error alone, with @option{-Wno-error=implicit-int}.
6951 This warning is upgraded to an error by @option{-pedantic-errors}.
6953 @opindex Wimplicit-function-declaration
6954 @opindex Wno-implicit-function-declaration
6955 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6956 This option controls warnings when a function is used before being declared.
6957 This warning is enabled by default, as an error, in C99 and later
6958 dialects of C, and also by @option{-Wall}.  The error can be downgraded
6959 to a warning using @option{-fpermissive} (along with certain other
6960 errors), or for this error alone, with
6961 @option{-Wno-error=implicit-function-declaration}.
6963 This warning is upgraded to an error by @option{-pedantic-errors}.
6965 @opindex Wimplicit
6966 @opindex Wno-implicit
6967 @item -Wimplicit @r{(C and Objective-C only)}
6968 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6969 This warning is enabled by @option{-Wall}.
6971 @opindex Whardened
6972 @opindex Wno-hardened
6973 @item -Whardened
6974 Warn when @option{-fhardened} did not enable an option from its set (for
6975 which see @option{-fhardened}).  For instance, using @option{-fhardened}
6976 and @option{-fstack-protector} at the same time on the command line causes
6977 @option{-Whardened} to warn because @option{-fstack-protector-strong} is
6978 not enabled by @option{-fhardened}.
6980 This warning is enabled by default and has effect only when @option{-fhardened}
6981 is enabled.
6983 @opindex Wimplicit-fallthrough
6984 @opindex Wno-implicit-fallthrough
6985 @item -Wimplicit-fallthrough
6986 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6987 and @option{-Wno-implicit-fallthrough} is the same as
6988 @option{-Wimplicit-fallthrough=0}.
6990 @opindex Wimplicit-fallthrough=
6991 @item -Wimplicit-fallthrough=@var{n}
6992 Warn when a switch case falls through.  For example:
6994 @smallexample
6995 @group
6996 switch (cond)
6997   @{
6998   case 1:
6999     a = 1;
7000     break;
7001   case 2:
7002     a = 2;
7003   case 3:
7004     a = 3;
7005     break;
7006   @}
7007 @end group
7008 @end smallexample
7010 This warning does not warn when the last statement of a case cannot
7011 fall through, e.g. when there is a return statement or a call to function
7012 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
7013 also takes into account control flow statements, such as ifs, and only
7014 warns when appropriate.  E.g.@:
7016 @smallexample
7017 @group
7018 switch (cond)
7019   @{
7020   case 1:
7021     if (i > 3) @{
7022       bar (5);
7023       break;
7024     @} else if (i < 1) @{
7025       bar (0);
7026     @} else
7027       return;
7028   default:
7029     @dots{}
7030   @}
7031 @end group
7032 @end smallexample
7034 Since there are occasions where a switch case fall through is desirable,
7035 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
7036 to be used along with a null statement to suppress this warning that
7037 would normally occur:
7039 @smallexample
7040 @group
7041 switch (cond)
7042   @{
7043   case 1:
7044     bar (0);
7045     __attribute__ ((fallthrough));
7046   default:
7047     @dots{}
7048   @}
7049 @end group
7050 @end smallexample
7052 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
7053 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
7054 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
7055 Instead of these attributes, it is also possible to add a fallthrough comment
7056 to silence the warning.  The whole body of the C or C++ style comment should
7057 match the given regular expressions listed below.  The option argument @var{n}
7058 specifies what kind of comments are accepted:
7060 @itemize @bullet
7062 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
7064 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
7065 expression, any comment is used as fallthrough comment.
7067 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
7068 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
7070 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
7071 following regular expressions:
7073 @itemize @bullet
7075 @item @code{-fallthrough}
7077 @item @code{@@fallthrough@@}
7079 @item @code{lint -fallthrough[ \t]*}
7081 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
7083 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
7085 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
7087 @end itemize
7089 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
7090 following regular expressions:
7092 @itemize @bullet
7094 @item @code{-fallthrough}
7096 @item @code{@@fallthrough@@}
7098 @item @code{lint -fallthrough[ \t]*}
7100 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
7102 @end itemize
7104 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
7105 fallthrough comments, only attributes disable the warning.
7107 @end itemize
7109 The comment needs to be followed after optional whitespace and other comments
7110 by @code{case} or @code{default} keywords or by a user label that precedes some
7111 @code{case} or @code{default} label.
7113 @smallexample
7114 @group
7115 switch (cond)
7116   @{
7117   case 1:
7118     bar (0);
7119     /* FALLTHRU */
7120   default:
7121     @dots{}
7122   @}
7123 @end group
7124 @end smallexample
7126 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
7128 @opindex Wif-not-aligned
7129 @opindex Wno-if-not-aligned
7130 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7131 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
7132 should be issued.  These warnings are enabled by default.
7134 @opindex Wignored-qualifiers
7135 @opindex Wno-ignored-qualifiers
7136 @item -Wignored-qualifiers @r{(C and C++ only)}
7137 Warn if the return type of a function has a type qualifier
7138 such as @code{const}.  For ISO C such a type qualifier has no effect,
7139 since the value returned by a function is not an lvalue.
7140 For C++, the warning is only emitted for scalar types or @code{void}.
7141 ISO C prohibits qualified @code{void} return types on function
7142 definitions, so such return types always receive a warning
7143 even without this option.
7145 This warning is also enabled by @option{-Wextra}.
7147 @opindex Wignored-attributes
7148 @opindex Wno-ignored-attributes
7149 @item -Wno-ignored-attributes @r{(C and C++ only)}
7150 This option controls warnings when an attribute is ignored.
7151 This is different from the
7152 @option{-Wattributes} option in that it warns whenever the compiler decides
7153 to drop an attribute, not that the attribute is either unknown, used in a
7154 wrong place, etc.  This warning is enabled by default.
7156 @opindex Wmain
7157 @opindex Wno-main
7158 @item -Wmain
7159 Warn if the type of @code{main} is suspicious.  @code{main} should be
7160 a function with external linkage, returning int, taking either zero
7161 arguments, two, or three arguments of appropriate types.  This warning
7162 is enabled by default in C++ and is enabled by either @option{-Wall}
7163 or @option{-Wpedantic}.
7165 This warning is upgraded to an error by @option{-pedantic-errors}.
7167 @opindex Wmisleading-indentation
7168 @opindex Wno-misleading-indentation
7169 @item -Wmisleading-indentation @r{(C and C++ only)}
7170 Warn when the indentation of the code does not reflect the block structure.
7171 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
7172 @code{for} clauses with a guarded statement that does not use braces,
7173 followed by an unguarded statement with the same indentation.
7175 In the following example, the call to ``bar'' is misleadingly indented as
7176 if it were guarded by the ``if'' conditional.
7178 @smallexample
7179   if (some_condition ())
7180     foo ();
7181     bar ();  /* Gotcha: this is not guarded by the "if".  */
7182 @end smallexample
7184 In the case of mixed tabs and spaces, the warning uses the
7185 @option{-ftabstop=} option to determine if the statements line up
7186 (defaulting to 8).
7188 The warning is not issued for code involving multiline preprocessor logic
7189 such as the following example.
7191 @smallexample
7192   if (flagA)
7193     foo (0);
7194 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7195   if (flagB)
7196 #endif
7197     foo (1);
7198 @end smallexample
7200 The warning is not issued after a @code{#line} directive, since this
7201 typically indicates autogenerated code, and no assumptions can be made
7202 about the layout of the file that the directive references.
7204 This warning is enabled by @option{-Wall} in C and C++.
7206 @opindex Wmissing-attributes
7207 @opindex Wno-missing-attributes
7208 @item -Wmissing-attributes
7209 Warn when a declaration of a function is missing one or more attributes
7210 that a related function is declared with and whose absence may adversely
7211 affect the correctness or efficiency of generated code.  For example,
7212 the warning is issued for declarations of aliases that use attributes
7213 to specify less restrictive requirements than those of their targets.
7214 This typically represents a potential optimization opportunity.
7215 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7216 issued when the alias is more restrictive than the target, which could
7217 lead to incorrect code generation.
7218 Attributes considered include @code{alloc_align}, @code{alloc_size},
7219 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7220 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7221 @code{returns_nonnull}, and @code{returns_twice}.
7223 In C++, the warning is issued when an explicit specialization of a primary
7224 template declared with attribute @code{alloc_align}, @code{alloc_size},
7225 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7226 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7227 @code{error}, and @code{warning} suppress the warning.
7228 (@pxref{Function Attributes}).
7230 You can use the @code{copy} attribute to apply the same
7231 set of attributes to a declaration as that on another declaration without
7232 explicitly enumerating the attributes. This attribute can be applied
7233 to declarations of functions (@pxref{Common Function Attributes}),
7234 variables (@pxref{Common Variable Attributes}), or types
7235 (@pxref{Common Type Attributes}).
7237 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7239 For example, since the declaration of the primary function template
7240 below makes use of both attribute @code{malloc} and @code{alloc_size}
7241 the declaration of the explicit specialization of the template is
7242 diagnosed because it is missing one of the attributes.
7244 @smallexample
7245 template <class T>
7246 T* __attribute__ ((malloc, alloc_size (1)))
7247 allocate (size_t);
7249 template <>
7250 void* __attribute__ ((malloc))   // missing alloc_size
7251 allocate<void> (size_t);
7252 @end smallexample
7254 @opindex Wmissing-braces
7255 @opindex Wno-missing-braces
7256 @item -Wmissing-braces
7257 Warn if an aggregate or union initializer is not fully bracketed.  In
7258 the following example, the initializer for @code{a} is not fully
7259 bracketed, but that for @code{b} is fully bracketed.
7261 @smallexample
7262 int a[2][2] = @{ 0, 1, 2, 3 @};
7263 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7264 @end smallexample
7266 This warning is enabled by @option{-Wall}.
7268 @opindex Wmissing-include-dirs
7269 @opindex Wno-missing-include-dirs
7270 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7271 Warn if a user-supplied include directory does not exist. This option is disabled
7272 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7273 enabled by default by warning for -I and -J, only.
7275 @opindex Wmissing-profile
7276 @opindex Wno-missing-profile
7277 @item -Wno-missing-profile
7278 This option controls warnings if feedback profiles are missing when using the
7279 @option{-fprofile-use} option.
7280 This option diagnoses those cases where a new function or a new file is added
7281 between compiling with @option{-fprofile-generate} and with
7282 @option{-fprofile-use}, without regenerating the profiles.
7283 In these cases, the profile feedback data files do not contain any
7284 profile feedback information for
7285 the newly added function or file respectively.  Also, in the case when profile
7286 count data (.gcda) files are removed, GCC cannot use any profile feedback
7287 information.  In all these cases, warnings are issued to inform you that a
7288 profile generation step is due.
7289 Ignoring the warning can result in poorly optimized code.
7290 @option{-Wno-missing-profile} can be used to
7291 disable the warning, but this is not recommended and should be done only
7292 when non-existent profile data is justified.
7294 @opindex Wmismatched-dealloc
7295 @opindex Wno-mismatched-dealloc
7296 @item -Wmismatched-dealloc
7298 Warn for calls to deallocation functions with pointer arguments returned
7299 from allocation functions for which the former isn't a suitable
7300 deallocator.  A pair of functions can be associated as matching allocators
7301 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7302 the @option{-fno-builtin} option the standard functions @code{calloc},
7303 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7304 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7305 associated as matching allocators and deallocators.  In the following
7306 example @code{mydealloc} is the deallocator for pointers returned from
7307 @code{myalloc}.
7309 @smallexample
7310 void mydealloc (void*);
7312 __attribute__ ((malloc (mydealloc, 1))) void*
7313 myalloc (size_t);
7315 void f (void)
7317   void *p = myalloc (32);
7318   // @dots{}use p@dots{}
7319   free (p);   // warning: not a matching deallocator for myalloc
7320   mydealloc (p);   // ok
7322 @end smallexample
7324 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7325 mismatches involving either @code{operator new} or @code{operator delete}.
7327 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7329 @opindex Wmultistatement-macros
7330 @opindex Wno-multistatement-macros
7331 @item -Wmultistatement-macros
7332 Warn about unsafe multiple statement macros that appear to be guarded
7333 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7334 @code{while}, in which only the first statement is actually guarded after
7335 the macro is expanded.
7337 For example:
7339 @smallexample
7340 #define DOIT x++; y++
7341 if (c)
7342   DOIT;
7343 @end smallexample
7345 will increment @code{y} unconditionally, not just when @code{c} holds.
7346 The can usually be fixed by wrapping the macro in a do-while loop:
7347 @smallexample
7348 #define DOIT do @{ x++; y++; @} while (0)
7349 if (c)
7350   DOIT;
7351 @end smallexample
7353 This warning is enabled by @option{-Wall} in C and C++.
7355 @opindex Wparentheses
7356 @opindex Wno-parentheses
7357 @item -Wparentheses
7358 Warn if parentheses are omitted in certain contexts, such
7359 as when there is an assignment in a context where a truth value
7360 is expected, or when operators are nested whose precedence people
7361 often get confused about.
7363 Also warn if a comparison like @code{x<=y<=z} appears; this is
7364 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7365 interpretation from that of ordinary mathematical notation.
7367 Also warn for dangerous uses of the GNU extension to
7368 @code{?:} with omitted middle operand. When the condition
7369 in the @code{?}: operator is a boolean expression, the omitted value is
7370 always 1.  Often programmers expect it to be a value computed
7371 inside the conditional expression instead.
7373 For C++ this also warns for some cases of unnecessary parentheses in
7374 declarations, which can indicate an attempt at a function call instead
7375 of a declaration:
7376 @smallexample
7378   // Declares a local variable called mymutex.
7379   std::unique_lock<std::mutex> (mymutex);
7380   // User meant std::unique_lock<std::mutex> lock (mymutex);
7382 @end smallexample
7384 This warning is enabled by @option{-Wall}.
7386 @opindex Wself-move
7387 @opindex Wno-self-move
7388 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7389 This warning warns when a value is moved to itself with @code{std::move}.
7390 Such a @code{std::move} typically has no effect.
7392 @smallexample
7393 struct T @{
7394 @dots{}
7396 void fn()
7398   T t;
7399   @dots{}
7400   t = std::move (t);
7402 @end smallexample
7404 This warning is enabled by @option{-Wall}.
7406 @opindex Wsequence-point
7407 @opindex Wno-sequence-point
7408 @item -Wsequence-point
7409 Warn about code that may have undefined semantics because of violations
7410 of sequence point rules in the C and C++ standards.
7412 The C and C++ standards define the order in which expressions in a C/C++
7413 program are evaluated in terms of @dfn{sequence points}, which represent
7414 a partial ordering between the execution of parts of the program: those
7415 executed before the sequence point, and those executed after it.  These
7416 occur after the evaluation of a full expression (one which is not part
7417 of a larger expression), after the evaluation of the first operand of a
7418 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7419 function is called (but after the evaluation of its arguments and the
7420 expression denoting the called function), and in certain other places.
7421 Other than as expressed by the sequence point rules, the order of
7422 evaluation of subexpressions of an expression is not specified.  All
7423 these rules describe only a partial order rather than a total order,
7424 since, for example, if two functions are called within one expression
7425 with no sequence point between them, the order in which the functions
7426 are called is not specified.  However, the standards committee have
7427 ruled that function calls do not overlap.
7429 It is not specified when between sequence points modifications to the
7430 values of objects take effect.  Programs whose behavior depends on this
7431 have undefined behavior; the C and C++ standards specify that ``Between
7432 the previous and next sequence point an object shall have its stored
7433 value modified at most once by the evaluation of an expression.
7434 Furthermore, the prior value shall be read only to determine the value
7435 to be stored.''.  If a program breaks these rules, the results on any
7436 particular implementation are entirely unpredictable.
7438 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7439 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7440 diagnosed by this option, and it may give an occasional false positive
7441 result, but in general it has been found fairly effective at detecting
7442 this sort of problem in programs.
7444 The C++17 standard will define the order of evaluation of operands in
7445 more cases: in particular it requires that the right-hand side of an
7446 assignment be evaluated before the left-hand side, so the above
7447 examples are no longer undefined.  But this option will still warn
7448 about them, to help people avoid writing code that is undefined in C
7449 and earlier revisions of C++.
7451 The standard is worded confusingly, therefore there is some debate
7452 over the precise meaning of the sequence point rules in subtle cases.
7453 Links to discussions of the problem, including proposed formal
7454 definitions, may be found on the GCC readings page, at
7455 @uref{https://gcc.gnu.org/@/readings.html}.
7457 This warning is enabled by @option{-Wall} for C and C++.
7459 @opindex Wno-return-local-addr
7460 @opindex Wreturn-local-addr
7461 @item -Wno-return-local-addr
7462 Do not warn about returning a pointer (or in C++, a reference) to a
7463 variable that goes out of scope after the function returns.
7465 @opindex Wreturn-mismatch
7466 @opindex Wno-return-mismatch
7467 @item -Wreturn-mismatch
7468 Warn about return statements without an expressions in functions which
7469 do not return @code{void}.  Also warn about a @code{return} statement
7470 with an expression in a function whose return type is @code{void},
7471 unless the expression type is also @code{void}.  As a GNU extension, the
7472 latter case is accepted without a warning unless @option{-Wpedantic} is
7473 used.
7475 Attempting to use the return value of a non-@code{void} function other
7476 than @code{main} that flows off the end by reaching the closing curly
7477 brace that terminates the function is undefined.
7479 This warning is specific to C and enabled by default.  In C99 and later
7480 language dialects, it is treated as an error.  It can be downgraded
7481 to a warning using @option{-fpermissive} (along with other warnings),
7482 or for just this warning, with @option{-Wno-error=return-mismatch}.
7484 @opindex Wreturn-type
7485 @opindex Wno-return-type
7486 @item -Wreturn-type
7487 Warn whenever a function is defined with a return type that defaults to
7488 @code{int} (unless @option{-Wimplicit-int} is active, which takes
7489 precedence).  Also warn if execution may reach the end of the function
7490 body, or if the function does not contain any return statement at all.
7492 Attempting to use the return value of a non-@code{void} function other
7493 than @code{main} that flows off the end by reaching the closing curly
7494 brace that terminates the function is undefined.
7496 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7497 than @code{main} results in undefined behavior even when the value of
7498 the function is not used.
7500 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7502 @opindex Wshift-count-negative
7503 @opindex Wno-shift-count-negative
7504 @item -Wno-shift-count-negative
7505 Controls warnings if a shift count is negative.
7506 This warning is enabled by default.
7508 @opindex Wshift-count-overflow
7509 @opindex Wno-shift-count-overflow
7510 @item -Wno-shift-count-overflow
7511 Controls warnings if a shift count is greater than or equal to the bit width
7512 of the type.  This warning is enabled by default.
7514 @opindex Wshift-negative-value
7515 @opindex Wno-shift-negative-value
7516 @item -Wshift-negative-value
7517 Warn if left shifting a negative value.  This warning is enabled by
7518 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7520 @opindex Wshift-overflow
7521 @opindex Wno-shift-overflow
7522 @item -Wno-shift-overflow
7523 @itemx -Wshift-overflow=@var{n}
7524 These options control warnings about left shift overflows.
7526 @table @gcctabopt
7527 @item -Wshift-overflow=1
7528 This is the warning level of @option{-Wshift-overflow} and is enabled
7529 by default in C99 and C++11 modes (and newer).  This warning level does
7530 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7531 an overflow is still rejected in contexts where an integer constant expression
7532 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7533 shifts always wrap.
7535 @item -Wshift-overflow=2
7536 This warning level also warns about left-shifting 1 into the sign bit,
7537 unless C++14 mode (or newer) is active.
7538 @end table
7540 @opindex Wswitch
7541 @opindex Wno-switch
7542 @item -Wswitch
7543 Warn whenever a @code{switch} statement has an index of enumerated type
7544 and lacks a @code{case} for one or more of the named codes of that
7545 enumeration.  (The presence of a @code{default} label prevents this
7546 warning.)  @code{case} labels outside the enumeration range also
7547 provoke warnings when this option is used (even if there is a
7548 @code{default} label).
7549 This warning is enabled by @option{-Wall}.
7551 @opindex Wswitch-default
7552 @opindex Wno-switch-default
7553 @item -Wswitch-default
7554 Warn whenever a @code{switch} statement does not have a @code{default}
7555 case.
7557 @opindex Wswitch-enum
7558 @opindex Wno-switch-enum
7559 @item -Wswitch-enum
7560 Warn whenever a @code{switch} statement has an index of enumerated type
7561 and lacks a @code{case} for one or more of the named codes of that
7562 enumeration.  @code{case} labels outside the enumeration range also
7563 provoke warnings when this option is used.  The only difference
7564 between @option{-Wswitch} and this option is that this option gives a
7565 warning about an omitted enumeration code even if there is a
7566 @code{default} label.
7568 @opindex Wswitch-bool
7569 @opindex Wno-switch-bool
7570 @item -Wno-switch-bool
7571 Do not warn when a @code{switch} statement has an index of boolean type
7572 and the case values are outside the range of a boolean type.
7573 It is possible to suppress this warning by casting the controlling
7574 expression to a type other than @code{bool}.  For example:
7575 @smallexample
7576 @group
7577 switch ((int) (a == 4))
7578   @{
7579   @dots{}
7580   @}
7581 @end group
7582 @end smallexample
7583 This warning is enabled by default for C and C++ programs.
7585 @opindex Wswitch-outside-range
7586 @opindex Wno-switch-outside-range
7587 @item -Wno-switch-outside-range
7588 This option controls warnings when a @code{switch} case has a value
7589 that is outside of its
7590 respective type range.  This warning is enabled by default for
7591 C and C++ programs.
7593 @opindex Wswitch-unreachable
7594 @opindex Wno-switch-unreachable
7595 @item -Wno-switch-unreachable
7596 Do not warn when a @code{switch} statement contains statements between the
7597 controlling expression and the first case label, which will never be
7598 executed.  For example:
7599 @smallexample
7600 @group
7601 switch (cond)
7602   @{
7603    i = 15;
7604   @dots{}
7605    case 5:
7606   @dots{}
7607   @}
7608 @end group
7609 @end smallexample
7610 @option{-Wswitch-unreachable} does not warn if the statement between the
7611 controlling expression and the first case label is just a declaration:
7612 @smallexample
7613 @group
7614 switch (cond)
7615   @{
7616    int i;
7617   @dots{}
7618    case 5:
7619    i = 5;
7620   @dots{}
7621   @}
7622 @end group
7623 @end smallexample
7624 This warning is enabled by default for C and C++ programs.
7626 @opindex Wsync-nand
7627 @opindex Wno-sync-nand
7628 @item -Wsync-nand @r{(C and C++ only)}
7629 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7630 built-in functions are used.  These functions changed semantics in GCC 4.4.
7632 @opindex Wtrivial-auto-var-init
7633 @opindex Wno-trivial-auto-var-init
7634 @item -Wtrivial-auto-var-init
7635 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7636 variable.  A common situation is an automatic variable that is declared
7637 between the controlling expression and the first case label of a @code{switch}
7638 statement.
7640 @opindex Wunused-but-set-parameter
7641 @opindex Wno-unused-but-set-parameter
7642 @item -Wunused-but-set-parameter
7643 Warn whenever a function parameter is assigned to, but otherwise unused
7644 (aside from its declaration).
7646 To suppress this warning use the @code{unused} attribute
7647 (@pxref{Variable Attributes}).
7649 This warning is also enabled by @option{-Wunused} together with
7650 @option{-Wextra}.
7652 @opindex Wunused-but-set-variable
7653 @opindex Wno-unused-but-set-variable
7654 @item -Wunused-but-set-variable
7655 Warn whenever a local variable is assigned to, but otherwise unused
7656 (aside from its declaration).
7657 This warning is enabled by @option{-Wall}.
7659 To suppress this warning use the @code{unused} attribute
7660 (@pxref{Variable Attributes}).
7662 This warning is also enabled by @option{-Wunused}, which is enabled
7663 by @option{-Wall}.
7665 @opindex Wunused-function
7666 @opindex Wno-unused-function
7667 @item -Wunused-function
7668 Warn whenever a static function is declared but not defined or a
7669 non-inline static function is unused.
7670 This warning is enabled by @option{-Wall}.
7672 @opindex Wunused-label
7673 @opindex Wno-unused-label
7674 @item -Wunused-label
7675 Warn whenever a label is declared but not used.
7676 This warning is enabled by @option{-Wall}.
7678 To suppress this warning use the @code{unused} attribute
7679 (@pxref{Variable Attributes}).
7681 @opindex Wunused-local-typedefs
7682 @opindex Wno-unused-local-typedefs
7683 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7684 Warn when a typedef locally defined in a function is not used.
7685 This warning is enabled by @option{-Wall}.
7687 @opindex Wunused-parameter
7688 @opindex Wno-unused-parameter
7689 @item -Wunused-parameter
7690 Warn whenever a function parameter is unused aside from its declaration.
7691 This option is not enabled by @code{-Wunused} unless @code{-Wextra} is also
7692 specified.
7694 To suppress this warning use the @code{unused} attribute
7695 (@pxref{Variable Attributes}).
7697 @opindex Wunused-result
7698 @opindex Wno-unused-result
7699 @item -Wno-unused-result
7700 Do not warn if a caller of a function marked with attribute
7701 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7702 its return value. The default is @option{-Wunused-result}.
7704 @opindex Wunused-variable
7705 @opindex Wno-unused-variable
7706 @item -Wunused-variable
7707 Warn whenever a local or static variable is unused aside from its
7708 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7709 but not for C++. This warning is enabled by @option{-Wall}.
7711 To suppress this warning use the @code{unused} attribute
7712 (@pxref{Variable Attributes}).
7714 @opindex Wunused-const-variable
7715 @opindex Wno-unused-const-variable
7716 @item -Wunused-const-variable
7717 @itemx -Wunused-const-variable=@var{n}
7718 Warn whenever a constant static variable is unused aside from its declaration.
7720 To suppress this warning use the @code{unused} attribute
7721 (@pxref{Variable Attributes}).
7723 @table @gcctabopt
7724 @item -Wunused-const-variable=1
7725 Warn about unused static const variables defined in the main
7726 compilation unit, but not about static const variables declared in any
7727 header included.
7729 @option{-Wunused-const-variable=1} is enabled by either
7730 @option{-Wunused-variable} or @option{-Wunused} for C, but not for
7731 C++. In C this declares variable storage, but in C++ this is not an
7732 error since const variables take the place of @code{#define}s.
7734 @item -Wunused-const-variable=2
7735 This warning level also warns for unused constant static variables in
7736 headers (excluding system headers).  It is equivalent to the short form
7737 @option{-Wunused-const-variable}.  This level must be explicitly
7738 requested in both C and C++ because it might be hard to clean up all
7739 headers included.
7740 @end table
7742 @opindex Wunused-value
7743 @opindex Wno-unused-value
7744 @item -Wunused-value
7745 Warn whenever a statement computes a result that is explicitly not
7746 used. To suppress this warning cast the unused expression to
7747 @code{void}. This includes an expression-statement or the left-hand
7748 side of a comma expression that contains no side effects. For example,
7749 an expression such as @code{x[i,j]} causes a warning, while
7750 @code{x[(void)i,j]} does not.
7752 This warning is enabled by @option{-Wall}.
7754 @opindex Wunused
7755 @opindex Wno-unused
7756 @item -Wunused
7757 All the above @option{-Wunused} options combined, except those documented
7758 as needing to be specified explicitly.
7760 In order to get a warning about an unused function parameter, you must
7761 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7762 @option{-Wunused}), or separately specify @option{-Wunused-parameter} and/or
7763 @option{-Wunused-but-set-parameter}.
7765 @option{-Wunused} enables only @option{-Wunused-const-variable=1} rather than
7766 @option{-Wunused-const-variable}, and only for C, not C++.
7768 @opindex Wuse-after-free
7769 @opindex Wno-use-after-free
7770 @item -Wuse-after-free @r{(C, Objective-C, C++ and Objective-C++ only)}
7771 @itemx -Wuse-after-free=@var{n}
7772 Warn about uses of pointers to dynamically allocated objects that have
7773 been rendered indeterminate by a call to a deallocation function.
7774 The warning is enabled at all optimization levels but may yield different
7775 results with optimization than without.
7777 @table @gcctabopt
7778 @item -Wuse-after-free=1
7779 At level 1 the warning attempts to diagnose only unconditional uses
7780 of pointers made indeterminate by a deallocation call or a successful
7781 call to @code{realloc}, regardless of whether or not the call resulted
7782 in an actual reallocation of memory.  This includes double-@code{free}
7783 calls as well as uses in arithmetic and relational expressions.  Although
7784 undefined, uses of indeterminate pointers in equality (or inequality)
7785 expressions are not diagnosed at this level.
7786 @item -Wuse-after-free=2
7787 At level 2, in addition to unconditional uses, the warning also diagnoses
7788 conditional uses of pointers made indeterminate by a deallocation call.
7789 As at level 2, uses in equality (or inequality) expressions are not
7790 diagnosed.  For example, the second call to @code{free} in the following
7791 function is diagnosed at this level:
7792 @smallexample
7793 struct A @{ int refcount; void *data; @};
7795 void release (struct A *p)
7797   int refcount = --p->refcount;
7798   free (p);
7799   if (refcount == 0)
7800     free (p->data);   // warning: p may be used after free
7802 @end smallexample
7803 @item -Wuse-after-free=3
7804 At level 3, the warning also diagnoses uses of indeterminate pointers in
7805 equality expressions.  All uses of indeterminate pointers are undefined
7806 but equality tests sometimes appear after calls to @code{realloc} as
7807 an attempt to determine whether the call resulted in relocating the object
7808 to a different address.  They are diagnosed at a separate level to aid
7809 gradually transitioning legacy code to safe alternatives.  For example,
7810 the equality test in the function below is diagnosed at this level:
7811 @smallexample
7812 void adjust_pointers (int**, int);
7814 void grow (int **p, int n)
7816   int **q = (int**)realloc (p, n *= 2);
7817   if (q == p)
7818     return;
7819   adjust_pointers ((int**)q, n);
7821 @end smallexample
7822 To avoid the warning at this level, store offsets into allocated memory
7823 instead of pointers.  This approach obviates needing to adjust the stored
7824 pointers after reallocation.
7825 @end table
7827 @option{-Wuse-after-free=2} is included in @option{-Wall}.
7829 @opindex Wuseless-cast
7830 @opindex Wno-useless-cast
7831 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
7832 Warn when an expression is cast to its own type.  This warning does not
7833 occur when a class object is converted to a non-reference type as that
7834 is a way to create a temporary:
7836 @smallexample
7837 struct S @{ @};
7838 void g (S&&);
7839 void f (S&& arg)
7841   g (S(arg)); // make arg prvalue so that it can bind to S&&
7843 @end smallexample
7845 @opindex Wuninitialized
7846 @opindex Wno-uninitialized
7847 @item -Wuninitialized
7848 Warn if an object with automatic or allocated storage duration is used
7849 without having been initialized.  In C++, also warn if a non-static
7850 reference or non-static @code{const} member appears in a class without
7851 constructors.
7853 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7854 object to a @code{const}-qualified argument of a built-in function known to
7855 read the object is also diagnosed by this warning.
7856 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7858 If you want to warn about code that uses the uninitialized value of the
7859 variable in its own initializer, use the @option{-Winit-self} option.
7861 These warnings occur for individual uninitialized elements of
7862 structure, union or array variables as well as for variables that are
7863 uninitialized as a whole.  They do not occur for variables or elements
7864 declared @code{volatile}.  Because these warnings depend on
7865 optimization, the exact variables or elements for which there are
7866 warnings depend on the precise optimization options and version of GCC
7867 used.
7869 Note that there may be no warning about a variable that is used only
7870 to compute a value that itself is never used, because such
7871 computations may be deleted by data flow analysis before the warnings
7872 are printed.
7874 In C++, this warning also warns about using uninitialized objects in
7875 member-initializer-lists.  For example, GCC warns about @code{b} being
7876 uninitialized in the following snippet:
7878 @smallexample
7879 struct A @{
7880   int a;
7881   int b;
7882   A() : a(b) @{ @}
7884 @end smallexample
7886 @opindex Winvalid-memory-model
7887 @opindex Wno-invalid-memory-model
7888 @item -Wno-invalid-memory-model
7889 This option controls warnings
7890 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7891 and the C11 atomic generic functions with a memory consistency argument
7892 that is either invalid for the operation or outside the range of values
7893 of the @code{memory_order} enumeration.  For example, since the
7894 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7895 defined for the relaxed, release, and sequentially consistent memory
7896 orders the following code is diagnosed:
7898 @smallexample
7899 void store (int *i)
7901   __atomic_store_n (i, 0, memory_order_consume);
7903 @end smallexample
7905 @option{-Winvalid-memory-model} is enabled by default.
7907 @opindex Wmaybe-uninitialized
7908 @opindex Wno-maybe-uninitialized
7909 @item -Wmaybe-uninitialized
7910 For an object with automatic or allocated storage duration, if there exists
7911 a path from the function entry to a use of the object that is initialized,
7912 but there exist some other paths for which the object is not initialized,
7913 the compiler emits a warning if it cannot prove the uninitialized paths
7914 are not executed at run time.
7916 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7917 object to a @code{const}-qualified function argument is also diagnosed by
7918 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7919 known to read the object.)  Annotating the function with attribute
7920 @code{access (none)} indicates that the argument isn't used to access
7921 the object and avoids the warning (@pxref{Common Function Attributes}).
7923 These warnings are only possible in optimizing compilation, because otherwise
7924 GCC does not keep track of the state of variables.
7926 These warnings are made optional because GCC may not be able to determine when
7927 the code is correct in spite of appearing to have an error.  Here is one
7928 example of how this can happen:
7930 @smallexample
7931 @group
7933   int x;
7934   switch (y)
7935     @{
7936     case 1: x = 1;
7937       break;
7938     case 2: x = 4;
7939       break;
7940     case 3: x = 5;
7941     @}
7942   foo (x);
7944 @end group
7945 @end smallexample
7947 @noindent
7948 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7949 always initialized, but GCC doesn't know this. To suppress the
7950 warning, you need to provide a default case with assert(0) or
7951 similar code.
7953 @cindex @code{longjmp} warnings
7954 This option also warns when a non-volatile automatic variable might be
7955 changed by a call to @code{longjmp}.
7956 The compiler sees only the calls to @code{setjmp}.  It cannot know
7957 where @code{longjmp} will be called; in fact, a signal handler could
7958 call it at any point in the code.  As a result, you may get a warning
7959 even when there is in fact no problem because @code{longjmp} cannot
7960 in fact be called at the place that would cause a problem.
7962 Some spurious warnings can be avoided if you declare all the functions
7963 you use that never return as @code{noreturn}.  @xref{Function
7964 Attributes}.
7966 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7968 @opindex Wunknown-pragmas
7969 @opindex Wno-unknown-pragmas
7970 @cindex warning for unknown pragmas
7971 @cindex unknown pragmas, warning
7972 @cindex pragmas, warning of unknown
7973 @item -Wunknown-pragmas
7974 Warn when a @code{#pragma} directive is encountered that is not understood by 
7975 GCC@.  If this command-line option is used, warnings are even issued
7976 for unknown pragmas in system header files.  This is not the case if
7977 the warnings are only enabled by the @option{-Wall} command-line option.
7979 @opindex Wno-pragmas
7980 @opindex Wpragmas
7981 @item -Wno-pragmas
7982 Do not warn about misuses of pragmas, such as incorrect parameters,
7983 invalid syntax, or conflicts between pragmas.  See also
7984 @option{-Wunknown-pragmas}.
7986 @opindex Wno-prio-ctor-dtor
7987 @opindex Wprio-ctor-dtor
7988 @item -Wno-prio-ctor-dtor
7989 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7990 The use of constructor and destructor attributes allow you to assign a
7991 priority to the constructor/destructor to control its order of execution
7992 before @code{main} is called or after it returns.  The priority values must be
7993 greater than 100 as the compiler reserves priority values between 0--100 for
7994 the implementation.
7996 @opindex Wstrict-aliasing
7997 @opindex Wno-strict-aliasing
7998 @item -Wstrict-aliasing
7999 This option is only active when @option{-fstrict-aliasing} is active.
8000 It warns about code that might break the strict aliasing rules that the
8001 compiler is using for optimization.  The warning does not catch all
8002 cases, but does attempt to catch the more common pitfalls.  It is
8003 included in @option{-Wall}.
8004 It is equivalent to @option{-Wstrict-aliasing=3}
8006 @opindex Wstrict-aliasing=n
8007 @item -Wstrict-aliasing=n
8008 This option is only active when @option{-fstrict-aliasing} is active.
8009 It warns about code that might break the strict aliasing rules that the
8010 compiler is using for optimization.
8011 Higher levels correspond to higher accuracy (fewer false positives).
8012 Higher levels also correspond to more effort, similar to the way @option{-O} 
8013 works.
8014 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
8016 Level 1: Most aggressive, quick, least accurate.
8017 Possibly useful when higher levels
8018 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
8019 false negatives.  However, it has many false positives.
8020 Warns for all pointer conversions between possibly incompatible types,
8021 even if never dereferenced.  Runs in the front end only.
8023 Level 2: Aggressive, quick, not too precise.
8024 May still have many false positives (not as many as level 1 though),
8025 and few false negatives (but possibly more than level 1).
8026 Unlike level 1, it only warns when an address is taken.  Warns about
8027 incomplete types.  Runs in the front end only.
8029 Level 3 (default for @option{-Wstrict-aliasing}):
8030 Should have very few false positives and few false
8031 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
8032 Takes care of the common pun+dereference pattern in the front end:
8033 @code{*(int*)&some_float}.
8034 If optimization is enabled, it also runs in the back end, where it deals
8035 with multiple statement cases using flow-sensitive points-to information.
8036 Only warns when the converted pointer is dereferenced.
8037 Does not warn about incomplete types.
8039 @opindex Wstrict-overflow
8040 @opindex Wno-strict-overflow
8041 @item -Wstrict-overflow
8042 @itemx -Wstrict-overflow=@var{n}
8043 This option is only active when signed overflow is undefined.
8044 It warns about cases where the compiler optimizes based on the
8045 assumption that signed overflow does not occur.  Note that it does not
8046 warn about all cases where the code might overflow: it only warns
8047 about cases where the compiler implements some optimization.  Thus
8048 this warning depends on the optimization level.
8050 An optimization that assumes that signed overflow does not occur is
8051 perfectly safe if the values of the variables involved are such that
8052 overflow never does, in fact, occur.  Therefore this warning can
8053 easily give a false positive: a warning about code that is not
8054 actually a problem.  To help focus on important issues, several
8055 warning levels are defined.  No warnings are issued for the use of
8056 undefined signed overflow when estimating how many iterations a loop
8057 requires, in particular when determining whether a loop will be
8058 executed at all.
8060 @table @gcctabopt
8061 @item -Wstrict-overflow=1
8062 Warn about cases that are both questionable and easy to avoid.  For
8063 example the compiler simplifies
8064 @code{x + 1 > x} to @code{1}.  This level of
8065 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
8066 are not, and must be explicitly requested.
8068 @item -Wstrict-overflow=2
8069 Also warn about other cases where a comparison is simplified to a
8070 constant.  For example: @code{abs (x) >= 0}.  This can only be
8071 simplified when signed integer overflow is undefined, because
8072 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
8073 zero.  @option{-Wstrict-overflow} (with no level) is the same as
8074 @option{-Wstrict-overflow=2}.
8076 @item -Wstrict-overflow=3
8077 Also warn about other cases where a comparison is simplified.  For
8078 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
8080 @item -Wstrict-overflow=4
8081 Also warn about other simplifications not covered by the above cases.
8082 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
8084 @item -Wstrict-overflow=5
8085 Also warn about cases where the compiler reduces the magnitude of a
8086 constant involved in a comparison.  For example: @code{x + 2 > y} is
8087 simplified to @code{x + 1 >= y}.  This is reported only at the
8088 highest warning level because this simplification applies to many
8089 comparisons, so this warning level gives a very large number of
8090 false positives.
8091 @end table
8093 @opindex Wstring-compare
8094 @opindex Wno-string-compare
8095 @item -Wstring-compare
8096 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
8097 determined to be either zero or non-zero in tests for such equality
8098 owing to the length of one argument being greater than the size of
8099 the array the other argument is stored in (or the bound in the case
8100 of @code{strncmp}).  Such calls could be mistakes.  For example,
8101 the call to @code{strcmp} below is diagnosed because its result is
8102 necessarily non-zero irrespective of the contents of the array @code{a}.
8104 @smallexample
8105 extern char a[4];
8106 void f (char *d)
8108   strcpy (d, "string");
8109   @dots{}
8110   if (0 == strcmp (a, d))   // cannot be true
8111     puts ("a and d are the same");
8113 @end smallexample
8115 @option{-Wstring-compare} is enabled by @option{-Wextra}.
8117 @opindex Wstringop-overflow
8118 @opindex Wno-stringop-overflow
8119 @item -Wno-stringop-overflow
8120 @item -Wstringop-overflow
8121 @itemx -Wstringop-overflow=@var{type}
8122 Warn for calls to string manipulation functions such as @code{memcpy} and
8123 @code{strcpy} that are determined to overflow the destination buffer.  The
8124 optional argument is one greater than the type of Object Size Checking to
8125 perform to determine the size of the destination.  @xref{Object Size Checking}.
8126 The argument is meaningful only for functions that operate on character arrays
8127 but not for raw memory functions like @code{memcpy} which always make use
8128 of Object Size type-0.  The option also warns for calls that specify a size
8129 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
8130 The option produces the best results with optimization enabled but can detect
8131 a small subset of simple buffer overflows even without optimization in
8132 calls to the GCC built-in functions like @code{__builtin_memcpy} that
8133 correspond to the standard functions.  In any case, the option warns about
8134 just a subset of buffer overflows detected by the corresponding overflow
8135 checking built-ins.  For example, the option issues a warning for
8136 the @code{strcpy} call below because it copies at least 5 characters
8137 (the string @code{"blue"} including the terminating NUL) into the buffer
8138 of size 4.
8140 @smallexample
8141 enum Color @{ blue, purple, yellow @};
8142 const char* f (enum Color clr)
8144   static char buf [4];
8145   const char *str;
8146   switch (clr)
8147     @{
8148       case blue: str = "blue"; break;
8149       case purple: str = "purple"; break;
8150       case yellow: str = "yellow"; break;
8151     @}
8153   return strcpy (buf, str);   // warning here
8155 @end smallexample
8157 Option @option{-Wstringop-overflow=2} is enabled by default.
8159 @table @gcctabopt
8160 @opindex Wstringop-overflow
8161 @opindex Wno-stringop-overflow
8162 @item -Wstringop-overflow
8163 @itemx -Wstringop-overflow=1
8164 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
8165 to determine the sizes of destination objects.  At this setting the option
8166 does not warn for writes past the end of subobjects of larger objects accessed
8167 by pointers unless the size of the largest surrounding object is known.  When
8168 the destination may be one of several objects it is assumed to be the largest
8169 one of them.  On Linux systems, when optimization is enabled at this setting
8170 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
8171 is defined to a non-zero value.
8173 @item -Wstringop-overflow=2
8174 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
8175 to determine the sizes of destination objects.  At this setting the option
8176 warns about overflows when writing to members of the largest complete
8177 objects whose exact size is known.  However, it does not warn for excessive
8178 writes to the same members of unknown objects referenced by pointers since
8179 they may point to arrays containing unknown numbers of elements.  This is
8180 the default setting of the option.
8182 @item -Wstringop-overflow=3
8183 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
8184 to determine the sizes of destination objects.  At this setting the option
8185 warns about overflowing the smallest object or data member.  This is the
8186 most restrictive setting of the option that may result in warnings for safe
8187 code.
8189 @item -Wstringop-overflow=4
8190 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
8191 to determine the sizes of destination objects.  At this setting the option
8192 warns about overflowing any data members, and when the destination is
8193 one of several objects it uses the size of the largest of them to decide
8194 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
8195 setting of the option may result in warnings for benign code.
8196 @end table
8198 @opindex Wstringop-overread
8199 @opindex Wno-stringop-overread
8200 @item -Wno-stringop-overread
8201 Warn for calls to string manipulation functions such as @code{memchr}, or
8202 @code{strcpy} that are determined to read past the end of the source
8203 sequence.
8205 Option @option{-Wstringop-overread} is enabled by default.
8207 @opindex Wstringop-truncation
8208 @opindex Wno-stringop-truncation
8209 @item -Wno-stringop-truncation
8210 Do not warn for calls to bounded string manipulation functions
8211 such as @code{strncat},
8212 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
8213 or leave the destination unchanged.
8215 In the following example, the call to @code{strncat} specifies a bound that
8216 is less than the length of the source string.  As a result, the copy of
8217 the source will be truncated and so the call is diagnosed.  To avoid the
8218 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
8220 @smallexample
8221 void append (char *buf, size_t bufsize)
8223   strncat (buf, ".txt", 3);
8225 @end smallexample
8227 As another example, the following call to @code{strncpy} results in copying
8228 to @code{d} just the characters preceding the terminating NUL, without
8229 appending the NUL to the end.  Assuming the result of @code{strncpy} is
8230 necessarily a NUL-terminated string is a common mistake, and so the call
8231 is diagnosed.  To avoid the warning when the result is not expected to be
8232 NUL-terminated, call @code{memcpy} instead.
8234 @smallexample
8235 void copy (char *d, const char *s)
8237   strncpy (d, s, strlen (s));
8239 @end smallexample
8241 In the following example, the call to @code{strncpy} specifies the size
8242 of the destination buffer as the bound.  If the length of the source
8243 string is equal to or greater than this size the result of the copy will
8244 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
8245 the warning, specify @code{sizeof buf - 1} as the bound and set the last
8246 element of the buffer to @code{NUL}.
8248 @smallexample
8249 void copy (const char *s)
8251   char buf[80];
8252   strncpy (buf, s, sizeof buf);
8253   @dots{}
8255 @end smallexample
8257 In situations where a character array is intended to store a sequence
8258 of bytes with no terminating @code{NUL} such an array may be annotated
8259 with attribute @code{nonstring} to avoid this warning.  Such arrays,
8260 however, are not suitable arguments to functions that expect
8261 @code{NUL}-terminated strings.  To help detect accidental misuses of
8262 such arrays GCC issues warnings unless it can prove that the use is
8263 safe.  @xref{Common Variable Attributes}.
8265 @opindex Wstrict-flex-arrays
8266 @opindex Wno-strict-flex-arrays
8267 @item -Wstrict-flex-arrays @r{(C and C++ only)}
8268 Warn about improper usages of flexible array members
8269 according to the @var{level} of the @code{strict_flex_array (@var{level})}
8270 attribute attached to the trailing array field of a structure if it's
8271 available, otherwise according to the @var{level} of the option
8272 @option{-fstrict-flex-arrays=@var{level}}.  @xref{Common Variable Attributes},
8273 for more information about the attribute, and @ref{C Dialect Options} for
8274 more information about the option.  @code{-Wstrict-flex-arrays}
8275 is effective only when @var{level} is greater than 0.
8277 When @var{level}=1, warnings are issued for a trailing array reference
8278 of a structure that have 2 or more elements if the trailing array is referenced
8279 as a flexible array member.
8281 When @var{level}=2, in addition to @var{level}=1, additional warnings are
8282 issued for a trailing one-element array reference of a structure
8283 if the array is referenced as a flexible array member.
8285 When @var{level}=3, in addition to @var{level}=2, additional warnings are
8286 issued for a trailing zero-length array reference of a structure
8287 if the array is referenced as a flexible array member.
8289 This option is more effective when @option{-ftree-vrp} is active (the
8290 default for @option{-O2} and above) but some warnings may be diagnosed
8291 even without optimization.
8293 @opindex Wsuggest-attribute=
8294 @opindex Wno-suggest-attribute=
8295 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}returns_nonnull@r{|}
8296 Warn for cases where adding an attribute may be beneficial. The
8297 attributes currently supported are listed below.
8299 @table @gcctabopt
8300 @opindex Wsuggest-attribute=pure
8301 @opindex Wno-suggest-attribute=pure
8302 @opindex Wsuggest-attribute=const
8303 @opindex Wno-suggest-attribute=const
8304 @opindex Wsuggest-attribute=noreturn
8305 @opindex Wno-suggest-attribute=noreturn
8306 @opindex Wmissing-noreturn
8307 @opindex Wno-missing-noreturn
8308 @opindex Wsuggest-attribute=malloc
8309 @opindex Wno-suggest-attribute=malloc
8310 @item -Wsuggest-attribute=pure
8311 @itemx -Wsuggest-attribute=const
8312 @itemx -Wsuggest-attribute=noreturn
8313 @itemx -Wmissing-noreturn
8314 @itemx -Wsuggest-attribute=malloc
8315 @itemx -Wsuggest-attribute=returns_nonnull
8316 @itemx -Wno-suggest-attribute=returns_nonnull
8318 Warn about functions that might be candidates for attributes
8319 @code{pure}, @code{const}, @code{noreturn}, @code{malloc} or @code{returns_nonnull}. The compiler
8320 only warns for functions visible in other compilation units or (in the case of
8321 @code{pure} and @code{const}) if it cannot prove that the function returns
8322 normally. A function returns normally if it doesn't contain an infinite loop or
8323 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8324 requires option @option{-fipa-pure-const}, which is enabled by default at
8325 @option{-O} and higher.  Higher optimization levels improve the accuracy
8326 of the analysis.
8328 @opindex Wsuggest-attribute=format
8329 @opindex Wmissing-format-attribute
8330 @opindex Wno-suggest-attribute=format
8331 @opindex Wno-missing-format-attribute
8332 @opindex Wformat
8333 @opindex Wno-format
8334 @item -Wsuggest-attribute=format
8335 @itemx -Wmissing-format-attribute
8337 Warn about function pointers that might be candidates for @code{format}
8338 attributes.  Note these are only possible candidates, not absolute ones.
8339 GCC guesses that function pointers with @code{format} attributes that
8340 are used in assignment, initialization, parameter passing or return
8341 statements should have a corresponding @code{format} attribute in the
8342 resulting type.  I.e.@: the left-hand side of the assignment or
8343 initialization, the type of the parameter variable, or the return type
8344 of the containing function respectively should also have a @code{format}
8345 attribute to avoid the warning.
8347 GCC also warns about function definitions that might be
8348 candidates for @code{format} attributes.  Again, these are only
8349 possible candidates.  GCC guesses that @code{format} attributes
8350 might be appropriate for any function that calls a function like
8351 @code{vprintf} or @code{vscanf}, but this might not always be the
8352 case, and some functions for which @code{format} attributes are
8353 appropriate may not be detected.
8355 @opindex Wsuggest-attribute=cold
8356 @opindex Wno-suggest-attribute=cold
8357 @item -Wsuggest-attribute=cold
8359 Warn about functions that might be candidates for @code{cold} attribute.  This
8360 is based on static detection and generally only warns about functions which
8361 always leads to a call to another @code{cold} function such as wrappers of
8362 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8363 @end table
8365 @opindex Wno-alloc-size
8366 @opindex Walloc-size
8367 @item -Walloc-size
8368 Warn about calls to allocation functions decorated with attribute
8369 @code{alloc_size} that specify insufficient size for the target type of
8370 the pointer the result is assigned to, including those to the built-in
8371 forms of the functions @code{aligned_alloc}, @code{alloca},
8372 @code{calloc}, @code{malloc}, and @code{realloc}.
8374 @opindex Wno-alloc-zero
8375 @opindex Walloc-zero
8376 @item -Walloc-zero
8377 Warn about calls to allocation functions decorated with attribute
8378 @code{alloc_size} that specify zero bytes, including those to the built-in
8379 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8380 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8381 when called with a zero size differs among implementations (and in the case
8382 of @code{realloc} has been deprecated) relying on it may result in subtle
8383 portability bugs and should be avoided.
8385 @opindex Wcalloc-transposed-args
8386 @opindex Wno-calloc-transposed-args
8387 @item -Wcalloc-transposed-args
8388 Warn about calls to allocation functions decorated with attribute
8389 @code{alloc_size} with two arguments, which use @code{sizeof} operator
8390 as the earlier size argument and don't use it as the later size argument.
8391 This is a coding style warning.  The first argument to @code{calloc} is
8392 documented to be number of elements in array, while the second argument
8393 is size of each element, so @code{calloc (@var{n}, sizeof (int))} is preferred
8394 over @code{calloc (sizeof (int), @var{n})}.  If @code{sizeof} in the earlier
8395 argument and not the latter is intentional, the warning can be suppressed
8396 by using @code{calloc (sizeof (struct @var{S}) + 0, n)} or
8397 @code{calloc (1 * sizeof (struct @var{S}), 4)} or using @code{sizeof} in the
8398 later argument as well.
8400 @opindex Walloc-size-larger-than=
8401 @opindex Wno-alloc-size-larger-than
8402 @item -Walloc-size-larger-than=@var{byte-size}
8403 Warn about calls to functions decorated with attribute @code{alloc_size}
8404 that attempt to allocate objects larger than the specified number of bytes,
8405 or where the result of the size computation in an integer type with infinite
8406 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8407 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8408 Warnings controlled by the option can be disabled either by specifying
8409 @var{byte-size} of @samp{SIZE_MAX} or more or by
8410 @option{-Wno-alloc-size-larger-than}.
8411 @xref{Function Attributes}.
8413 @opindex Wno-alloc-size-larger-than
8414 @item -Wno-alloc-size-larger-than
8415 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8416 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8417 larger.
8419 @opindex Wno-alloca
8420 @opindex Walloca
8421 @item -Walloca
8422 This option warns on all uses of @code{alloca} in the source.
8424 @opindex Walloca-larger-than=
8425 @opindex Wno-alloca-larger-than
8426 @item -Walloca-larger-than=@var{byte-size}
8427 This option warns on calls to @code{alloca} with an integer argument whose
8428 value is either zero, or that is not bounded by a controlling predicate
8429 that limits its value to at most @var{byte-size}.  It also warns for calls
8430 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8431 types are considered unbounded even if they appear to be constrained to
8432 the expected range.
8434 For example, a bounded case of @code{alloca} could be:
8436 @smallexample
8437 void func (size_t n)
8439   void *p;
8440   if (n <= 1000)
8441     p = alloca (n);
8442   else
8443     p = malloc (n);
8444   f (p);
8446 @end smallexample
8448 In the above example, passing @code{-Walloca-larger-than=1000} would not
8449 issue a warning because the call to @code{alloca} is known to be at most
8450 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8451 the compiler would emit a warning.
8453 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8454 controlling predicate constraining its integer argument.  For example:
8456 @smallexample
8457 void func ()
8459   void *p = alloca (n);
8460   f (p);
8462 @end smallexample
8464 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8465 a warning, but this time because of the lack of bounds checking.
8467 Note, that even seemingly correct code involving signed integers could
8468 cause a warning:
8470 @smallexample
8471 void func (signed int n)
8473   if (n < 500)
8474     @{
8475       p = alloca (n);
8476       f (p);
8477     @}
8479 @end smallexample
8481 In the above example, @var{n} could be negative, causing a larger than
8482 expected argument to be implicitly cast into the @code{alloca} call.
8484 This option also warns when @code{alloca} is used in a loop.
8486 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8487 but is usually only effective  when @option{-ftree-vrp} is active (default
8488 for @option{-O2} and above).
8490 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8492 @opindex Wno-alloca-larger-than
8493 @item -Wno-alloca-larger-than
8494 Disable @option{-Walloca-larger-than=} warnings.  The option is
8495 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8497 @opindex Warith-conversion
8498 @opindex Wno-arith-conversion
8499 @item -Warith-conversion
8500 Do warn about implicit conversions from arithmetic operations even
8501 when conversion of the operands to the same type cannot change their
8502 values.  This affects warnings from @option{-Wconversion},
8503 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8505 @smallexample
8506 @group
8507 void f (char c, int i)
8509   c = c + i; // warns with @option{-Wconversion}
8510   c = c + 1; // only warns with @option{-Warith-conversion}
8512 @end group
8513 @end smallexample
8515 @opindex Wno-array-bounds
8516 @opindex Warray-bounds
8517 @item -Warray-bounds
8518 @itemx -Warray-bounds=@var{n}
8519 Warn about out of bounds subscripts or offsets into arrays.  This warning
8520 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8521 is active (the default for @option{-O2} and above) but a subset of instances
8522 are issued even without optimization.
8524 By default, the trailing array of a structure will be treated as a flexible
8525 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8526 if it is declared as either a flexible array member per C99 standard onwards
8527 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8528 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8529 zero-length arrays or one-element arrays are not warned by default.
8531 You can add the option @option{-fstrict-flex-arrays} or
8532 @option{-fstrict-flex-arrays=@var{level}} to control how this
8533 option treat trailing array of a structure as a flexible array member:
8535 when @var{level}<=1, no change to the default behavior.
8537 when @var{level}=2, additional warnings will be issued for out of bounds
8538 subscripts or offsets into one-element arrays;
8540 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8541 issued for out of bounds subscripts or offsets into zero-length arrays.
8543 @table @gcctabopt
8544 @item -Warray-bounds=1
8545 This is the default warning level of @option{-Warray-bounds} and is enabled
8546 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8548 @item -Warray-bounds=2
8549 This warning level also warns about the intermediate results of pointer
8550 arithmetic that may yield out of bounds values. This warning level may
8551 give a larger number of false positives and is deactivated by default.
8552 @end table
8554 @opindex Warray-compare
8555 @opindex Wno-array-compare
8556 @item -Warray-compare
8557 Warn about equality and relational comparisons between two operands of array
8558 type.  This comparison was deprecated in C++20.  For example:
8560 @smallexample
8561 int arr1[5];
8562 int arr2[5];
8563 bool same = arr1 == arr2;
8564 @end smallexample
8566 @option{-Warray-compare} is enabled by @option{-Wall}.
8568 @opindex Wno-array-parameter
8569 @opindex Warray-parameter
8570 @item -Warray-parameter
8571 @itemx -Warray-parameter=@var{n}
8572 Warn about redeclarations of functions involving parameters of array or
8573 pointer types of inconsistent kinds or forms, and enable the detection
8574 of out-of-bounds accesses to such parameters by warnings such as
8575 @option{-Warray-bounds}.
8577 If the first function declaration uses the array form for a parameter
8578 declaration, the bound specified
8579 in the array is assumed to be the minimum number of elements expected to
8580 be provided in calls to the function and the maximum number of elements
8581 accessed by it.  Failing to provide arguments of sufficient size or accessing
8582 more than the maximum number of elements may be diagnosed by warnings such
8583 as @option{-Warray-bounds} or @option{-Wstringop-overflow}.
8584 At level 1, the warning diagnoses inconsistencies
8585 involving array parameters declared using the @code{T[static N]} form.
8587 For example, the warning triggers for the second declaration of @code{f}
8588 because the first one with the keyword @code{static} specifies that
8589 the array argument must have at least four elements, while the second
8590 allows an array of any size to be passed to @code{f}.
8592 @smallexample
8593 void f (int[static 4]);
8594 void f (int[]);           // warning (inconsistent array form)
8596 void g (void)
8598   int *p = (int *)malloc (1 * sizeof (int));
8599   f (p);                  // warning (array too small)
8600   @dots{}
8602 @end smallexample
8604 At level 2 the warning also triggers for redeclarations involving any other
8605 inconsistency in array or pointer argument forms denoting array sizes.
8606 Pointers and arrays of unspecified bound are considered equivalent and do
8607 not trigger a warning.
8609 @smallexample
8610 void g (int*);
8611 void g (int[]);     // no warning
8612 void g (int[8]);    // warning (inconsistent array bound)
8613 @end smallexample
8615 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8616 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8617 involving Variable Length Array arguments.
8619 The short form of the option @option{-Warray-parameter} is equivalent to
8620 @option{-Warray-parameter=2}.  The negative form @option{-Wno-array-parameter}
8621 is equivalent to @option{-Warray-parameter=0}.
8623 @opindex Wattribute-alias
8624 @opindex Wno-attribute-alias
8625 @item -Wattribute-alias=@var{n}
8626 @itemx -Wno-attribute-alias
8627 Warn about declarations using the @code{alias} and similar attributes whose
8628 target is incompatible with the type of the alias.
8629 @xref{Function Attributes,,Declaring Attributes of Functions}.
8631 @table @gcctabopt
8632 @item -Wattribute-alias=1
8633 The default warning level of the @option{-Wattribute-alias} option diagnoses
8634 incompatibilities between the type of the alias declaration and that of its
8635 target.  Such incompatibilities are typically indicative of bugs.
8637 @item -Wattribute-alias=2
8639 At this level @option{-Wattribute-alias} also diagnoses cases where
8640 the attributes of the alias declaration are more restrictive than the
8641 attributes applied to its target.  These mismatches can potentially
8642 result in incorrect code generation.  In other cases they may be
8643 benign and could be resolved simply by adding the missing attribute to
8644 the target.  For comparison, see the @option{-Wmissing-attributes}
8645 option, which controls diagnostics when the alias declaration is less
8646 restrictive than the target, rather than more restrictive.
8648 Attributes considered include @code{alloc_align}, @code{alloc_size},
8649 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8650 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8651 @code{returns_nonnull}, and @code{returns_twice}.
8652 @end table
8654 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8655 This is the default.  You can disable these warnings with either
8656 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8658 @opindex Wbidi-chars=
8659 @opindex Wbidi-chars
8660 @opindex Wno-bidi-chars
8661 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8662 Warn about possibly misleading UTF-8 bidirectional control characters in
8663 comments, string literals, character constants, and identifiers.  Such
8664 characters can change left-to-right writing direction into right-to-left
8665 (and vice versa), which can cause confusion between the logical order and
8666 visual order.  This may be dangerous; for instance, it may seem that a piece
8667 of code is not commented out, whereas it in fact is.
8669 There are three levels of warning supported by GCC@.  The default is
8670 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8671 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8672 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8673 characters.
8675 By default, this warning does not warn about UCNs.  It is, however, possible
8676 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8677 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8678 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8679 @option{-Wbidi-chars=any} was specified.
8681 @opindex Wno-bool-compare
8682 @opindex Wbool-compare
8683 @item -Wbool-compare
8684 Warn about boolean expression compared with an integer value different from
8685 @code{true}/@code{false}.  For instance, the following comparison is
8686 always false:
8687 @smallexample
8688 int n = 5;
8689 @dots{}
8690 if ((n > 1) == 2) @{ @dots{} @}
8691 @end smallexample
8692 This warning is enabled by @option{-Wall}.
8694 @opindex Wno-bool-operation
8695 @opindex Wbool-operation
8696 @item -Wbool-operation
8697 Warn about suspicious operations on expressions of a boolean type.  For
8698 instance, bitwise negation of a boolean is very likely a bug in the program.
8699 For C, this warning also warns about incrementing or decrementing a boolean,
8700 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8701 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8703 This warning is enabled by @option{-Wall}.
8705 @opindex Wno-duplicated-branches
8706 @opindex Wduplicated-branches
8707 @item -Wduplicated-branches
8708 Warn when an if-else has identical branches.  This warning detects cases like
8709 @smallexample
8710 if (p != NULL)
8711   return 0;
8712 else
8713   return 0;
8714 @end smallexample
8715 It doesn't warn when both branches contain just a null statement.  This warning
8716 also warn for conditional operators:
8717 @smallexample
8718   int i = x ? *p : *p;
8719 @end smallexample
8721 @opindex Wno-duplicated-cond
8722 @opindex Wduplicated-cond
8723 @item -Wduplicated-cond
8724 Warn about duplicated conditions in an if-else-if chain.  For instance,
8725 warn for the following code:
8726 @smallexample
8727 if (p->q != NULL) @{ @dots{} @}
8728 else if (p->q != NULL) @{ @dots{} @}
8729 @end smallexample
8731 @opindex Wno-frame-address
8732 @opindex Wframe-address
8733 @item -Wframe-address
8734 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8735 is called with an argument greater than 0.  Such calls may return indeterminate
8736 values or crash the program.  The warning is included in @option{-Wall}.
8738 @opindex Wno-discarded-qualifiers
8739 @opindex Wdiscarded-qualifiers
8740 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8741 Do not warn if type qualifiers on pointers are being discarded.
8742 Typically, the compiler warns if a @code{const char *} variable is
8743 passed to a function that takes a @code{char *} parameter.  This option
8744 can be used to suppress such a warning.
8746 @opindex Wno-discarded-array-qualifiers
8747 @opindex Wdiscarded-array-qualifiers
8748 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8749 Do not warn if type qualifiers on arrays which are pointer targets
8750 are being discarded.  Typically, the compiler warns if a
8751 @code{const int (*)[]} variable is passed to a function that
8752 takes a @code{int (*)[]} parameter.  This option can be used to
8753 suppress such a warning.
8755 @opindex Wno-incompatible-pointer-types
8756 @opindex Wincompatible-pointer-types
8757 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8758 Do not warn when there is a conversion between pointers that have incompatible
8759 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8760 which warns for pointer argument passing or assignment with different
8761 signedness.
8763 By default, in C99 and later dialects of C, GCC treats this issue as an
8764 error.  The error can be downgraded to a warning using
8765 @option{-fpermissive} (along with certain other errors), or for this
8766 error alone, with @option{-Wno-error=incompatible-pointer-types}.
8768 This warning is upgraded to an error by @option{-pedantic-errors}.
8770 @opindex Wno-int-conversion
8771 @opindex Wint-conversion
8772 @item -Wno-int-conversion @r{(C and Objective-C only)}
8773 Do not warn about incompatible integer to pointer and pointer to integer
8774 conversions.  This warning is about implicit conversions; for explicit
8775 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8776 @option{-Wno-pointer-to-int-cast} may be used.
8778 By default, in C99 and later dialects of C, GCC treats this issue as an
8779 error.  The error can be downgraded to a warning using
8780 @option{-fpermissive} (along with certain other errors), or for this
8781 error alone, with @option{-Wno-error=int-conversion}.
8783 This warning is upgraded to an error by @option{-pedantic-errors}.
8785 @opindex Wzero-length-bounds
8786 @opindex Wzero-length-bounds
8787 @item -Wzero-length-bounds
8788 Warn about accesses to elements of zero-length array members that might
8789 overlap other members of the same object.  Declaring interior zero-length
8790 arrays is discouraged because accesses to them are undefined.
8791 @xref{Zero Length}.
8793 For example, the first two stores in function @code{bad} are diagnosed
8794 because the array elements overlap the subsequent members @code{b} and
8795 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8796 because it is beyond the bounds of the enclosing object.
8798 @smallexample
8799 struct X @{ int a[0]; int b, c; @};
8800 struct X x;
8802 void bad (void)
8804   x.a[0] = 0;   // -Wzero-length-bounds
8805   x.a[1] = 1;   // -Wzero-length-bounds
8806   x.a[2] = 2;   // -Warray-bounds
8808 @end smallexample
8810 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8812 @opindex Wno-div-by-zero
8813 @opindex Wdiv-by-zero
8814 @item -Wno-div-by-zero
8815 Do not warn about compile-time integer division by zero.  Floating-point
8816 division by zero is not warned about, as it can be a legitimate way of
8817 obtaining infinities and NaNs.
8819 @opindex Wsystem-headers
8820 @opindex Wno-system-headers
8821 @cindex warnings from system headers
8822 @cindex system headers, warnings from
8823 @item -Wsystem-headers
8824 Print warning messages for constructs found in system header files.
8825 Warnings from system headers are normally suppressed, on the assumption
8826 that they usually do not indicate real problems and would only make the
8827 compiler output harder to read.  Using this command-line option tells
8828 GCC to emit warnings from system headers as if they occurred in user
8829 code.  However, note that using @option{-Wall} in conjunction with this
8830 option does @emph{not} warn about unknown pragmas in system
8831 headers---for that, @option{-Wunknown-pragmas} must also be used.
8833 @opindex Wtautological-compare
8834 @opindex Wno-tautological-compare
8835 @item -Wtautological-compare
8836 Warn if a self-comparison always evaluates to true or false.  This
8837 warning detects various mistakes such as:
8838 @smallexample
8839 int i = 1;
8840 @dots{}
8841 if (i > i) @{ @dots{} @}
8842 @end smallexample
8844 This warning also warns about bitwise comparisons that always evaluate
8845 to true or false, for instance:
8846 @smallexample
8847 if ((a & 16) == 10) @{ @dots{} @}
8848 @end smallexample
8849 will always be false.
8851 This warning is enabled by @option{-Wall}.
8853 @opindex Wtrampolines
8854 @opindex Wno-trampolines
8855 @item -Wtrampolines
8856 Warn about trampolines generated for pointers to nested functions.
8857 A trampoline is a small piece of data or code that is created at run
8858 time on the stack when the address of a nested function is taken, and is
8859 used to call the nested function indirectly.  For some targets, it is
8860 made up of data only and thus requires no special treatment.  But, for
8861 most targets, it is made up of code and thus requires the stack to be
8862 made executable in order for the program to work properly.
8864 @opindex Wfloat-equal
8865 @opindex Wno-float-equal
8866 @item -Wfloat-equal
8867 Warn if floating-point values are used in equality comparisons.
8869 The idea behind this is that sometimes it is convenient (for the
8870 programmer) to consider floating-point values as approximations to
8871 infinitely precise real numbers.  If you are doing this, then you need
8872 to compute (by analyzing the code, or in some other way) the maximum or
8873 likely maximum error that the computation introduces, and allow for it
8874 when performing comparisons (and when producing output, but that's a
8875 different problem).  In particular, instead of testing for equality, you
8876 should check to see whether the two values have ranges that overlap; and
8877 this is done with the relational operators, so equality comparisons are
8878 probably mistaken.
8880 @opindex Wtraditional
8881 @opindex Wno-traditional
8882 @item -Wtraditional @r{(C and Objective-C only)}
8883 Warn about certain constructs that behave differently in traditional and
8884 ISO C@.  Also warn about ISO C constructs that have no traditional C
8885 equivalent, and/or problematic constructs that should be avoided.
8887 @itemize @bullet
8888 @item
8889 Macro parameters that appear within string literals in the macro body.
8890 In traditional C macro replacement takes place within string literals,
8891 but in ISO C it does not.
8893 @item
8894 In traditional C, some preprocessor directives did not exist.
8895 Traditional preprocessors only considered a line to be a directive
8896 if the @samp{#} appeared in column 1 on the line.  Therefore
8897 @option{-Wtraditional} warns about directives that traditional C
8898 understands but ignores because the @samp{#} does not appear as the
8899 first character on the line.  It also suggests you hide directives like
8900 @code{#pragma} not understood by traditional C by indenting them.  Some
8901 traditional implementations do not recognize @code{#elif}, so this option
8902 suggests avoiding it altogether.
8904 @item
8905 A function-like macro that appears without arguments.
8907 @item
8908 The unary plus operator.
8910 @item
8911 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8912 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8913 constants.)  Note, these suffixes appear in macros defined in the system
8914 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8915 Use of these macros in user code might normally lead to spurious
8916 warnings, however GCC's integrated preprocessor has enough context to
8917 avoid warning in these cases.
8919 @item
8920 A function declared external in one block and then used after the end of
8921 the block.
8923 @item
8924 A @code{switch} statement has an operand of type @code{long}.
8926 @item
8927 A non-@code{static} function declaration follows a @code{static} one.
8928 This construct is not accepted by some traditional C compilers.
8930 @item
8931 The ISO type of an integer constant has a different width or
8932 signedness from its traditional type.  This warning is only issued if
8933 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8934 typically represent bit patterns, are not warned about.
8936 @item
8937 Usage of ISO string concatenation is detected.
8939 @item
8940 Initialization of automatic aggregates.
8942 @item
8943 Identifier conflicts with labels.  Traditional C lacks a separate
8944 namespace for labels.
8946 @item
8947 Initialization of unions.  If the initializer is zero, the warning is
8948 omitted.  This is done under the assumption that the zero initializer in
8949 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8950 initializer warnings and relies on default initialization to zero in the
8951 traditional C case.
8953 @item
8954 Conversions by prototypes between fixed/floating-point values and vice
8955 versa.  The absence of these prototypes when compiling with traditional
8956 C causes serious problems.  This is a subset of the possible
8957 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8959 @item
8960 Use of ISO C style function definitions.  This warning intentionally is
8961 @emph{not} issued for prototype declarations or variadic functions
8962 because these ISO C features appear in your code when using
8963 libiberty's traditional C compatibility macros, @code{PARAMS} and
8964 @code{VPARAMS}.  This warning is also bypassed for nested functions
8965 because that feature is already a GCC extension and thus not relevant to
8966 traditional C compatibility.
8967 @end itemize
8969 @opindex Wtraditional-conversion
8970 @opindex Wno-traditional-conversion
8971 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8972 Warn if a prototype causes a type conversion that is different from what
8973 would happen to the same argument in the absence of a prototype.  This
8974 includes conversions of fixed point to floating and vice versa, and
8975 conversions changing the width or signedness of a fixed-point argument
8976 except when the same as the default promotion.
8978 @opindex Wdeclaration-after-statement
8979 @opindex Wno-declaration-after-statement
8980 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8981 Warn when a declaration is found after a statement in a block.  This
8982 construct, known from C++, was introduced with ISO C99 and is by default
8983 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8985 This warning is upgraded to an error by @option{-pedantic-errors}.
8987 @opindex Wshadow
8988 @opindex Wno-shadow
8989 @item -Wshadow
8990 Warn whenever a local variable or type declaration shadows another
8991 variable, parameter, type, class member (in C++), or instance variable
8992 (in Objective-C) or whenever a built-in function is shadowed.  Note
8993 that in C++, the compiler warns if a local variable shadows an
8994 explicit typedef, but not if it shadows a struct/class/enum.
8995 If this warning is enabled, it includes also all instances of
8996 local shadowing.  This means that @option{-Wno-shadow=local}
8997 and @option{-Wno-shadow=compatible-local} are ignored when
8998 @option{-Wshadow} is used.
8999 Same as @option{-Wshadow=global}.
9001 @opindex Wno-shadow-ivar
9002 @opindex Wshadow-ivar
9003 @item -Wno-shadow-ivar @r{(Objective-C only)}
9004 Do not warn whenever a local variable shadows an instance variable in an
9005 Objective-C method.
9007 @opindex Wshadow=global
9008 @item -Wshadow=global
9009 Warn for any shadowing.
9010 Same as @option{-Wshadow}.
9012 @opindex Wshadow=local
9013 @item -Wshadow=local
9014 Warn when a local variable shadows another local variable or parameter.
9016 @opindex Wshadow=compatible-local
9017 @item -Wshadow=compatible-local
9018 Warn when a local variable shadows another local variable or parameter
9019 whose type is compatible with that of the shadowing variable.  In C++,
9020 type compatibility here means the type of the shadowing variable can be
9021 converted to that of the shadowed variable.  The creation of this flag
9022 (in addition to @option{-Wshadow=local}) is based on the idea that when
9023 a local variable shadows another one of incompatible type, it is most
9024 likely intentional, not a bug or typo, as shown in the following example:
9026 @smallexample
9027 @group
9028 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
9030   for (int i = 0; i < N; ++i)
9031   @{
9032     ...
9033   @}
9034   ...
9036 @end group
9037 @end smallexample
9039 Since the two variable @code{i} in the example above have incompatible types,
9040 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
9041 Because their types are incompatible, if a programmer accidentally uses one
9042 in place of the other, type checking is expected to catch that and emit an
9043 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
9044 possibly reduce the number of warnings triggered by intentional shadowing.
9045 Note that this also means that shadowing @code{const char *i} by
9046 @code{char *i} does not emit a warning.
9048 This warning is also enabled by @option{-Wshadow=local}.
9050 @opindex Wlarger-than=
9051 @opindex Wlarger-than-@var{byte-size}
9052 @item -Wlarger-than=@var{byte-size}
9053 Warn whenever an object is defined whose size exceeds @var{byte-size}.
9054 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
9055 Warnings controlled by the option can be disabled either by specifying
9056 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
9058 Also warn for calls to bounded functions such as @code{memchr} or
9059 @code{strnlen} that specify a bound greater than the largest possible
9060 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
9061 can only be disabled by @option{-Wno-larger-than}.
9063 @opindex Wno-larger-than
9064 @item -Wno-larger-than
9065 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
9066 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
9068 @opindex Wframe-larger-than=
9069 @opindex Wno-frame-larger-than
9070 @item -Wframe-larger-than=@var{byte-size}
9071 Warn if the size of a function frame exceeds @var{byte-size}.
9072 The computation done to determine the stack frame size is approximate
9073 and not conservative.
9074 The actual requirements may be somewhat greater than @var{byte-size}
9075 even if you do not get a warning.  In addition, any space allocated
9076 via @code{alloca}, variable-length arrays, or related constructs
9077 is not included by the compiler when determining
9078 whether or not to issue a warning.
9079 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
9080 Warnings controlled by the option can be disabled either by specifying
9081 @var{byte-size} of @samp{SIZE_MAX} or more or by
9082 @option{-Wno-frame-larger-than}.
9084 @opindex Wno-frame-larger-than
9085 @item -Wno-frame-larger-than
9086 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
9087 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
9089 @opindex Wfree-nonheap-object
9090 @opindex Wno-free-nonheap-object
9091 @item -Wfree-nonheap-object
9092 Warn when attempting to deallocate an object that was either not allocated
9093 on the heap, or by using a pointer that was not returned from a prior call
9094 to the corresponding allocation function.  For example, because the call
9095 to @code{stpcpy} returns a pointer to the terminating nul character and
9096 not to the beginning of the object, the call to @code{free} below is
9097 diagnosed.
9099 @smallexample
9100 void f (char *p)
9102   p = stpcpy (p, "abc");
9103   // ...
9104   free (p);   // warning
9106 @end smallexample
9108 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
9110 @opindex Wstack-usage
9111 @opindex Wno-stack-usage
9112 @item -Wstack-usage=@var{byte-size}
9113 Warn if the stack usage of a function might exceed @var{byte-size}.
9114 The computation done to determine the stack usage is conservative.
9115 Any space allocated via @code{alloca}, variable-length arrays, or related
9116 constructs is included by the compiler when determining whether or not to
9117 issue a warning.
9119 The message is in keeping with the output of @option{-fstack-usage}.
9121 @itemize
9122 @item
9123 If the stack usage is fully static but exceeds the specified amount, it's:
9125 @smallexample
9126   warning: stack usage is 1120 bytes
9127 @end smallexample
9128 @item
9129 If the stack usage is (partly) dynamic but bounded, it's:
9131 @smallexample
9132   warning: stack usage might be 1648 bytes
9133 @end smallexample
9134 @item
9135 If the stack usage is (partly) dynamic and not bounded, it's:
9137 @smallexample
9138   warning: stack usage might be unbounded
9139 @end smallexample
9140 @end itemize
9142 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
9143 Warnings controlled by the option can be disabled either by specifying
9144 @var{byte-size} of @samp{SIZE_MAX} or more or by
9145 @option{-Wno-stack-usage}.
9147 @opindex Wno-stack-usage
9148 @item -Wno-stack-usage
9149 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
9150 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
9152 @opindex Wunsafe-loop-optimizations
9153 @opindex Wno-unsafe-loop-optimizations
9154 @item -Wunsafe-loop-optimizations
9155 Warn if the loop cannot be optimized because the compiler cannot
9156 assume anything on the bounds of the loop indices.  With
9157 @option{-funsafe-loop-optimizations} warn if the compiler makes
9158 such assumptions.
9160 @opindex Wno-pedantic-ms-format
9161 @opindex Wpedantic-ms-format
9162 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
9163 When used in combination with @option{-Wformat}
9164 and @option{-pedantic} without GNU extensions, this option
9165 disables the warnings about non-ISO @code{printf} / @code{scanf} format
9166 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
9167 which depend on the MS runtime.
9169 @opindex Wpointer-arith
9170 @opindex Wno-pointer-arith
9171 @item -Wpointer-arith
9172 Warn about anything that depends on the ``size of'' a function type or
9173 of @code{void}.  GNU C assigns these types a size of 1, for
9174 convenience in calculations with @code{void *} pointers and pointers
9175 to functions.  In C++, warn also when an arithmetic operation involves
9176 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
9178 This warning is upgraded to an error by @option{-pedantic-errors}.
9180 @opindex Wpointer-compare
9181 @opindex Wno-pointer-compare
9182 @item -Wno-pointer-compare
9183 Do not warn if a pointer is compared with a zero character constant.
9184 This usually
9185 means that the pointer was meant to be dereferenced.  For example:
9187 @smallexample
9188 const char *p = foo ();
9189 if (p == '\0')
9190   return 42;
9191 @end smallexample
9193 Note that the code above is invalid in C++11.
9195 This warning is enabled by default.
9197 @opindex Wtsan
9198 @opindex Wno-tsan
9199 @item -Wno-tsan
9201 Disable warnings about unsupported features in ThreadSanitizer.
9203 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
9204 can report false positives.
9206 @opindex Wtype-limits
9207 @opindex Wno-type-limits
9208 @item -Wtype-limits
9209 Warn if a comparison is always true or always false due to the limited
9210 range of the data type, but do not warn for constant expressions.  For
9211 example, warn if an unsigned variable is compared against zero with
9212 @code{<} or @code{>=}.  This warning is also enabled by
9213 @option{-Wextra}.
9215 @opindex Wabsolute-value
9216 @opindex Wno-absolute-value
9217 @item -Wabsolute-value @r{(C and Objective-C only)}
9218 Warn for calls to standard functions that compute the absolute value
9219 of an argument when a more appropriate standard function is available.
9220 For example, calling @code{abs(3.14)} triggers the warning because the
9221 appropriate function to call to compute the absolute value of a double
9222 argument is @code{fabs}.  The option also triggers warnings when the
9223 argument in a call to such a function has an unsigned type.  This
9224 warning can be suppressed with an explicit type cast and it is also
9225 enabled by @option{-Wextra}.
9227 @include cppwarnopts.texi
9229 @opindex Wbad-function-cast
9230 @opindex Wno-bad-function-cast
9231 @item -Wbad-function-cast @r{(C and Objective-C only)}
9232 Warn when a function call is cast to a non-matching type.
9233 For example, warn if a call to a function returning an integer type 
9234 is cast to a pointer type.
9236 @opindex Wc90-c99-compat
9237 @opindex Wno-c90-c99-compat
9238 @item -Wc90-c99-compat @r{(C and Objective-C only)}
9239 Warn about features not present in ISO C90, but present in ISO C99.
9240 For instance, warn about use of variable length arrays, @code{long long}
9241 type, @code{bool} type, compound literals, designated initializers, and so
9242 on.  This option is independent of the standards mode.  Warnings are disabled
9243 in the expression that follows @code{__extension__}.
9245 @opindex Wc99-c11-compat
9246 @opindex Wno-c99-c11-compat
9247 @item -Wc99-c11-compat @r{(C and Objective-C only)}
9248 Warn about features not present in ISO C99, but present in ISO C11.
9249 For instance, warn about use of anonymous structures and unions,
9250 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
9251 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
9252 and so on.  This option is independent of the standards mode.  Warnings are
9253 disabled in the expression that follows @code{__extension__}.
9255 @opindex Wc11-c23-compat
9256 @opindex Wno-c11-c23-compat
9257 @item -Wc11-c23-compat @r{(C and Objective-C only)}
9258 @itemx -Wc11-c2x-compat @r{(C and Objective-C only)}
9259 Warn about features not present in ISO C11, but present in ISO C23.
9260 For instance, warn about omitting the string in @code{_Static_assert},
9261 use of @samp{[[]]} syntax for attributes, use of decimal
9262 floating-point types, and so on.  This option is independent of the
9263 standards mode.  Warnings are disabled in the expression that follows
9264 @code{__extension__}.  The name @option{-Wc11-c2x-compat} is
9265 deprecated.
9267 When not compiling in C23 mode, these warnings are upgraded to errors
9268 by @option{-pedantic-errors}.
9270 @opindex Wc++-compat
9271 @opindex Wno-c++-compat
9272 @item -Wc++-compat @r{(C and Objective-C only)}
9273 Warn about ISO C constructs that are outside of the common subset of
9274 ISO C and ISO C++, e.g.@: request for implicit conversion from
9275 @code{void *} to a pointer to non-@code{void} type.
9277 @opindex Wc++11-compat
9278 @opindex Wno-c++11-compat
9279 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
9280 Warn about C++ constructs whose meaning differs between ISO C++ 1998
9281 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
9282 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
9283 enabled by @option{-Wall}.
9285 @opindex Wc++14-compat
9286 @opindex Wno-c++14-compat
9287 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
9288 Warn about C++ constructs whose meaning differs between ISO C++ 2011
9289 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
9291 @opindex Wc++17-compat
9292 @opindex Wno-c++17-compat
9293 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
9294 Warn about C++ constructs whose meaning differs between ISO C++ 2014
9295 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
9297 @opindex Wc++20-compat
9298 @opindex Wno-c++20-compat
9299 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
9300 Warn about C++ constructs whose meaning differs between ISO C++ 2017
9301 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
9303 @opindex Wc++11-extensions
9304 @opindex Wno-c++11-extensions
9305 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
9306 Do not warn about C++11 constructs in code being compiled using
9307 an older C++ standard.  Even without this option, some C++11 constructs
9308 will only be diagnosed if @option{-Wpedantic} is used.
9310 @opindex Wc++14-extensions
9311 @opindex Wno-c++14-extensions
9312 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
9313 Do not warn about C++14 constructs in code being compiled using
9314 an older C++ standard.  Even without this option, some C++14 constructs
9315 will only be diagnosed if @option{-Wpedantic} is used.
9317 @opindex Wc++17-extensions
9318 @opindex Wno-c++17-extensions
9319 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9320 Do not warn about C++17 constructs in code being compiled using
9321 an older C++ standard.  Even without this option, some C++17 constructs
9322 will only be diagnosed if @option{-Wpedantic} is used.
9324 @opindex Wc++20-extensions
9325 @opindex Wno-c++20-extensions
9326 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9327 Do not warn about C++20 constructs in code being compiled using
9328 an older C++ standard.  Even without this option, some C++20 constructs
9329 will only be diagnosed if @option{-Wpedantic} is used.
9331 @opindex Wc++23-extensions
9332 @opindex Wno-c++23-extensions
9333 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9334 Do not warn about C++23 constructs in code being compiled using
9335 an older C++ standard.  Even without this option, some C++23 constructs
9336 will only be diagnosed if @option{-Wpedantic} is used.
9338 @opindex Wc++26-extensions
9339 @opindex Wno-c++26-extensions
9340 @item -Wno-c++26-extensions @r{(C++ and Objective-C++ only)}
9341 Do not warn about C++26 constructs in code being compiled using
9342 an older C++ standard.  Even without this option, some C++26 constructs
9343 will only be diagnosed if @option{-Wpedantic} is used.
9345 @opindex Wcast-qual
9346 @opindex Wno-cast-qual
9347 @item -Wcast-qual
9348 Warn whenever a pointer is cast so as to remove a type qualifier from
9349 the target type.  For example, warn if a @code{const char *} is cast
9350 to an ordinary @code{char *}.
9352 Also warn when making a cast that introduces a type qualifier in an
9353 unsafe way.  For example, casting @code{char **} to @code{const char **}
9354 is unsafe, as in this example:
9356 @smallexample
9357   /* p is char ** value.  */
9358   const char **q = (const char **) p;
9359   /* Assignment of readonly string to const char * is OK.  */
9360   *q = "string";
9361   /* Now char** pointer points to read-only memory.  */
9362   **p = 'b';
9363 @end smallexample
9365 @opindex Wcast-align
9366 @opindex Wno-cast-align
9367 @item -Wcast-align
9368 Warn whenever a pointer is cast such that the required alignment of the
9369 target is increased.  For example, warn if a @code{char *} is cast to
9370 an @code{int *} on machines where integers can only be accessed at
9371 two- or four-byte boundaries.
9373 @opindex Wcast-align=strict
9374 @item -Wcast-align=strict
9375 Warn whenever a pointer is cast such that the required alignment of the
9376 target is increased.  For example, warn if a @code{char *} is cast to
9377 an @code{int *} regardless of the target machine.
9379 @opindex Wcast-function-type
9380 @opindex Wno-cast-function-type
9381 @item -Wcast-function-type
9382 Warn when a function pointer is cast to an incompatible function pointer.
9383 In a cast involving function types with a variable argument list only
9384 the types of initial arguments that are provided are considered.
9385 Any parameter of pointer-type matches any other pointer-type.  Any benign
9386 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9387 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9388 type @code{void (*) (void)} is special and matches everything, which can
9389 be used to suppress this warning.
9390 In a cast involving pointer to member types this warning warns whenever
9391 the type cast is changing the pointer to member type.
9392 This warning is enabled by @option{-Wextra}.
9394 @opindex Wcast-user-defined
9395 @opindex Wno-cast-user-defined
9396 @item -Wcast-user-defined
9397 Warn when a cast to reference type does not involve a user-defined
9398 conversion that the programmer might expect to be called.
9400 @smallexample
9401 struct A @{ operator const int&(); @} a;
9402 auto r = (int&)a; // warning
9403 @end smallexample
9405 This warning is enabled by default.
9407 @opindex Wwrite-strings
9408 @opindex Wno-write-strings
9409 @item -Wwrite-strings
9410 When compiling C, give string constants the type @code{const
9411 char[@var{length}]} so that copying the address of one into a
9412 non-@code{const} @code{char *} pointer produces a warning.  These
9413 warnings help you find at compile time code that can try to write
9414 into a string constant, but only if you have been very careful about
9415 using @code{const} in declarations and prototypes.  Otherwise, it is
9416 just a nuisance. This is why we did not make @option{-Wall} request
9417 these warnings.
9419 When compiling C++, warn about the deprecated conversion from string
9420 literals to @code{char *}.  This warning is enabled by default for C++
9421 programs.
9423 This warning is upgraded to an error by @option{-pedantic-errors} in
9424 C++11 mode or later.
9426 @opindex Wclobbered
9427 @opindex Wno-clobbered
9428 @item -Wclobbered
9429 Warn for variables that might be changed by @code{longjmp} or
9430 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9432 @opindex Wcomplain-wrong-lang
9433 @opindex Wno-complain-wrong-lang
9434 @item -Wno-complain-wrong-lang
9435 By default, language front ends complain when a command-line option is
9436 valid, but not applicable to that front end.
9437 This may be disabled with @option{-Wno-complain-wrong-lang},
9438 which is mostly useful when invoking a single compiler driver for
9439 multiple source files written in different languages, for example:
9441 @smallexample
9442 $ g++ -fno-rtti a.cc b.f90
9443 @end smallexample
9445 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9446 and the Fortran front end to compile @file{b.f90}.
9447 The latter front end diagnoses
9448 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9449 which may be disabled with @option{-Wno-complain-wrong-lang}.
9451 @opindex Wcompare-distinct-pointer-types
9452 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9453 Warn if pointers of distinct types are compared without a cast.  This
9454 warning is enabled by default.
9456 @opindex Wconversion
9457 @opindex Wno-conversion
9458 @item -Wconversion
9459 Warn for implicit conversions that may alter a value. This includes
9460 conversions between real and integer, like @code{abs (x)} when
9461 @code{x} is @code{double}; conversions between signed and unsigned,
9462 like @code{unsigned ui = -1}; and conversions to smaller types, like
9463 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9464 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9465 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9466 conversions between signed and unsigned integers can be disabled by
9467 using @option{-Wno-sign-conversion}.
9469 For C++, also warn for confusing overload resolution for user-defined
9470 conversions; and conversions that never use a type conversion
9471 operator: conversions to @code{void}, the same type, a base class or a
9472 reference to them. Warnings about conversions between signed and
9473 unsigned integers are disabled by default in C++ unless
9474 @option{-Wsign-conversion} is explicitly enabled.
9476 Warnings about conversion from arithmetic on a small type back to that
9477 type are only given with @option{-Warith-conversion}.
9479 @opindex Wdangling-else
9480 @opindex Wno-dangling-else
9481 @item -Wdangling-else
9482 Warn about constructions where there may be confusion to which
9483 @code{if} statement an @code{else} branch belongs.  Here is an example of
9484 such a case:
9486 @smallexample
9487 @group
9489   if (a)
9490     if (b)
9491       foo ();
9492   else
9493     bar ();
9495 @end group
9496 @end smallexample
9498 In C/C++, every @code{else} branch belongs to the innermost possible
9499 @code{if} statement, which in this example is @code{if (b)}.  This is
9500 often not what the programmer expected, as illustrated in the above
9501 example by indentation the programmer chose.  When there is the
9502 potential for this confusion, GCC issues a warning when this flag
9503 is specified.  To eliminate the warning, add explicit braces around
9504 the innermost @code{if} statement so there is no way the @code{else}
9505 can belong to the enclosing @code{if}.  The resulting code
9506 looks like this:
9508 @smallexample
9509 @group
9511   if (a)
9512     @{
9513       if (b)
9514         foo ();
9515       else
9516         bar ();
9517     @}
9519 @end group
9520 @end smallexample
9522 This warning is enabled by @option{-Wparentheses}.
9524 @opindex Wdangling-pointer
9525 @opindex Wno-dangling-pointer
9526 @item -Wdangling-pointer
9527 @itemx -Wdangling-pointer=@var{n}
9528 Warn about uses of pointers (or C++ references) to objects with automatic
9529 storage duration after their lifetime has ended.  This includes local
9530 variables declared in nested blocks, compound literals and other unnamed
9531 temporary objects.  In addition, warn about storing the address of such
9532 objects in escaped pointers.  The warning is enabled at all optimization
9533 levels but may yield different results with optimization than without.
9535 @table @gcctabopt
9536 @item -Wdangling-pointer=1
9537 At level 1, the warning diagnoses only unconditional uses of dangling pointers.
9539 @item -Wdangling-pointer=2
9540 At level 2, in addition to unconditional uses the warning also diagnoses
9541 conditional uses of dangling pointers.
9542 @end table
9544 The short form @option{-Wdangling-pointer} is equivalent to
9545 @option{-Wdangling-pointer=2}, while @option{-Wno-dangling-pointer} and
9546 @option{-Wdangling-pointer=0} have the same effect of disabling the warnings.
9547 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9549 This example triggers the warning at level 1; the address of the unnamed
9550 temporary is unconditionally referenced outside of its scope.
9552 @smallexample
9553 char f (char c1, char c2, char c3)
9555   char *p;
9556   @{
9557     p = (char[]) @{ c1, c2, c3 @};
9558   @}
9559   // warning: using dangling pointer 'p' to an unnamed temporary
9560   return *p;
9562 @end smallexample
9564 In the following function the store of the address of the local variable
9565 @code{x} in the escaped pointer @code{*p} triggers the warning at
9566 level 1.
9568 @smallexample
9569 void g (int **p)
9571   int x = 7;
9572   // warning: storing the address of local variable 'x' in '*p'
9573   *p = &x;
9575 @end smallexample
9577 In this example, the array @var{a} is out of
9578 scope when the pointer @var{s} is used.  Since the code that sets @code{s}
9579 is conditional, the warning triggers at level 2.
9581 @smallexample
9582 extern void frob (const char *);
9583 void h (char *s)
9585   if (!s)
9586     @{
9587       char a[12] = "tmpname";
9588       s = a;
9589     @}
9590   // warning: dangling pointer 's' to 'a' may be used
9591   frob (s);
9593 @end smallexample
9595 @opindex Wdate-time
9596 @opindex Wno-date-time
9597 @item -Wdate-time
9598 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9599 are encountered as they might prevent bit-wise-identical reproducible
9600 compilations.
9602 @opindex Wempty-body
9603 @opindex Wno-empty-body
9604 @item -Wempty-body
9605 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9606 while} statement.  This warning is also enabled by @option{-Wextra}.
9608 @opindex Wendif-labels
9609 @opindex Wno-endif-labels
9610 @item -Wno-endif-labels
9611 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9613 @opindex Wenum-compare
9614 @opindex Wno-enum-compare
9615 @item -Wenum-compare
9616 Warn about a comparison between values of different enumerated types.
9617 In C++ enumerated type mismatches in conditional expressions are also
9618 diagnosed and the warning is enabled by default.  In C this warning is 
9619 enabled by @option{-Wall}.
9621 @opindex Wenum-conversion
9622 @opindex Wno-enum-conversion
9623 @item -Wenum-conversion
9624 Warn when a value of enumerated type is implicitly converted to a 
9625 different enumerated type.  This warning is enabled by @option{-Wextra}
9626 in C@.
9628 @opindex Wenum-int-mismatch
9629 @opindex Wno-enum-int-mismatch
9630 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9631 Warn about mismatches between an enumerated type and an integer type in
9632 declarations.  For example:
9634 @smallexample
9635 enum E @{ l = -1, z = 0, g = 1 @};
9636 int foo(void);
9637 enum E foo(void);
9638 @end smallexample
9640 In C, an enumerated type is compatible with @code{char}, a signed
9641 integer type, or an unsigned integer type.  However, since the choice
9642 of the underlying type of an enumerated type is implementation-defined,
9643 such mismatches may cause portability issues.  In C++, such mismatches
9644 are an error.  In C, this warning is enabled by @option{-Wall} and
9645 @option{-Wc++-compat}.
9647 @opindex Wjump-misses-init
9648 @opindex Wno-jump-misses-init
9649 @item -Wjump-misses-init @r{(C, Objective-C only)}
9650 Warn if a @code{goto} statement or a @code{switch} statement jumps
9651 forward across the initialization of a variable, or jumps backward to a
9652 label after the variable has been initialized.  This only warns about
9653 variables that are initialized when they are declared.  This warning is
9654 only supported for C and Objective-C; in C++ this sort of branch is an
9655 error in any case.
9657 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9658 can be disabled with the @option{-Wno-jump-misses-init} option.
9660 @opindex Wsign-compare
9661 @opindex Wno-sign-compare
9662 @cindex warning for comparison of signed and unsigned values
9663 @cindex comparison of signed and unsigned values, warning
9664 @cindex signed and unsigned values, comparison warning
9665 @item -Wsign-compare
9666 Warn when a comparison between signed and unsigned values could produce
9667 an incorrect result when the signed value is converted to unsigned.
9668 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9669 also enabled by @option{-Wextra}.
9671 @opindex Wsign-conversion
9672 @opindex Wno-sign-conversion
9673 @item -Wsign-conversion
9674 Warn for implicit conversions that may change the sign of an integer
9675 value, like assigning a signed integer expression to an unsigned
9676 integer variable. An explicit cast silences the warning. In C, this
9677 option is enabled also by @option{-Wconversion}.
9679 @opindex Wflex-array-member-not-at-end
9680 @opindex Wno-flex-array-member-not-at-end
9681 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9682 Warn when a structure containing a C99 flexible array member as the last
9683 field is not at the end of another structure.
9684 This warning warns e.g. about
9686 @smallexample
9687 struct flex  @{ int length; char data[]; @};
9688 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9689 @end smallexample
9691 @opindex Wfloat-conversion
9692 @opindex Wno-float-conversion
9693 @item -Wfloat-conversion
9694 Warn for implicit conversions that reduce the precision of a real value.
9695 This includes conversions from real to integer, and from higher precision
9696 real to lower precision real values.  This option is also enabled by
9697 @option{-Wconversion}.
9699 @opindex Wno-scalar-storage-order
9700 @opindex Wscalar-storage-order
9701 @item -Wno-scalar-storage-order
9702 Do not warn on suspicious constructs involving reverse scalar storage order.
9704 @opindex Wsizeof-array-div
9705 @opindex Wno-sizeof-array-div
9706 @item -Wsizeof-array-div
9707 Warn about divisions of two sizeof operators when the first one is applied
9708 to an array and the divisor does not equal the size of the array element.
9709 In such a case, the computation will not yield the number of elements in the
9710 array, which is likely what the user intended.  This warning warns e.g. about
9711 @smallexample
9712 int fn ()
9714   int arr[10];
9715   return sizeof (arr) / sizeof (short);
9717 @end smallexample
9719 This warning is enabled by @option{-Wall}.
9721 @opindex Wsizeof-pointer-div
9722 @opindex Wno-sizeof-pointer-div
9723 @item -Wsizeof-pointer-div
9724 Warn for suspicious divisions of two sizeof expressions that divide
9725 the pointer size by the element size, which is the usual way to compute
9726 the array size but won't work out correctly with pointers.  This warning
9727 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9728 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9730 @opindex Wsizeof-pointer-memaccess
9731 @opindex Wno-sizeof-pointer-memaccess
9732 @item -Wsizeof-pointer-memaccess
9733 Warn for suspicious length parameters to certain string and memory built-in
9734 functions if the argument uses @code{sizeof}.  This warning triggers for
9735 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9736 an array, but a pointer, and suggests a possible fix, or about
9737 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9738 also warns about calls to bounded string copy functions like @code{strncat}
9739 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9740 the source array.  For example, in the following function the call to
9741 @code{strncat} specifies the size of the source string as the bound.  That
9742 is almost certainly a mistake and so the call is diagnosed.
9743 @smallexample
9744 void make_file (const char *name)
9746   char path[PATH_MAX];
9747   strncpy (path, name, sizeof path - 1);
9748   strncat (path, ".text", sizeof ".text");
9749   @dots{}
9751 @end smallexample
9753 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9755 @opindex Wsizeof-array-argument
9756 @opindex Wno-sizeof-array-argument
9757 @item -Wno-sizeof-array-argument
9758 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9759 declared as an array in a function definition.  This warning is enabled by
9760 default for C and C++ programs.
9762 @opindex Wmemset-elt-size
9763 @opindex Wno-memset-elt-size
9764 @item -Wmemset-elt-size
9765 Warn for suspicious calls to the @code{memset} built-in function, if the
9766 first argument references an array, and the third argument is a number
9767 equal to the number of elements, but not equal to the size of the array
9768 in memory.  This indicates that the user has omitted a multiplication by
9769 the element size.  This warning is enabled by @option{-Wall}.
9771 @opindex Wmemset-transposed-args
9772 @opindex Wno-memset-transposed-args
9773 @item -Wmemset-transposed-args
9774 Warn for suspicious calls to the @code{memset} built-in function where
9775 the second argument is not zero and the third argument is zero.  For
9776 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9777 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9778 is only emitted if the third argument is a literal zero.  Otherwise, if
9779 it is an expression that is folded to zero, or a cast of zero to some
9780 type, it is far less likely that the arguments have been mistakenly
9781 transposed and no warning is emitted.  This warning is enabled
9782 by @option{-Wall}.
9784 @opindex Waddress
9785 @opindex Wno-address
9786 @item -Waddress
9787 Warn about suspicious uses of address expressions. These include comparing
9788 the address of a function or a declared object to the null pointer constant
9789 such as in
9790 @smallexample
9791 void f (void);
9792 void g (void)
9794   if (!f)   // warning: expression evaluates to false
9795     abort ();
9797 @end smallexample
9798 comparisons of a pointer to a string literal, such as in
9799 @smallexample
9800 void f (const char *x)
9802   if (x == "abc")   // warning: expression evaluates to false
9803     puts ("equal");
9805 @end smallexample
9806 and tests of the results of pointer addition or subtraction for equality
9807 to null, such as in
9808 @smallexample
9809 void f (const int *p, int i)
9811   return p + i == NULL;
9813 @end smallexample
9814 Such uses typically indicate a programmer error: the address of most
9815 functions and objects necessarily evaluates to true (the exception are
9816 weak symbols), so their use in a conditional might indicate missing
9817 parentheses in a function call or a missing dereference in an array
9818 expression.  The subset of the warning for object pointers can be
9819 suppressed by casting the pointer operand to an integer type such
9820 as @code{intptr_t} or @code{uintptr_t}.
9821 Comparisons against string literals result in unspecified behavior
9822 and are not portable, and suggest the intent was to call @code{strcmp}.
9823 The warning is suppressed if the suspicious expression is the result
9824 of macro expansion.
9825 @option{-Waddress} warning is enabled by @option{-Wall}.
9827 @opindex Waddress-of-packed-member
9828 @opindex Wno-address-of-packed-member
9829 @item -Wno-address-of-packed-member
9830 Do not warn when the address of packed member of struct or union is taken,
9831 which usually results in an unaligned pointer value.  This is
9832 enabled by default.
9834 @opindex Wlogical-op
9835 @opindex Wno-logical-op
9836 @item -Wlogical-op
9837 Warn about suspicious uses of logical operators in expressions.
9838 This includes using logical operators in contexts where a
9839 bit-wise operator is likely to be expected.  Also warns when
9840 the operands of a logical operator are the same:
9841 @smallexample
9842 extern int a;
9843 if (a < 0 && a < 0) @{ @dots{} @}
9844 @end smallexample
9846 @opindex Wlogical-not-parentheses
9847 @opindex Wno-logical-not-parentheses
9848 @item -Wlogical-not-parentheses
9849 Warn about logical not used on the left hand side operand of a comparison.
9850 This option does not warn if the right operand is considered to be a boolean
9851 expression.  Its purpose is to detect suspicious code like the following:
9852 @smallexample
9853 int a;
9854 @dots{}
9855 if (!a > 1) @{ @dots{} @}
9856 @end smallexample
9858 It is possible to suppress the warning by wrapping the LHS into
9859 parentheses:
9860 @smallexample
9861 if ((!a) > 1) @{ @dots{} @}
9862 @end smallexample
9864 This warning is enabled by @option{-Wall}.
9866 @opindex Waggregate-return
9867 @opindex Wno-aggregate-return
9868 @item -Waggregate-return
9869 Warn if any functions that return structures or unions are defined or
9870 called.  (In languages where you can return an array, this also elicits
9871 a warning.)
9873 @opindex Wno-aggressive-loop-optimizations
9874 @opindex Waggressive-loop-optimizations
9875 @item -Wno-aggressive-loop-optimizations
9876 Warn if in a loop with constant number of iterations the compiler detects
9877 undefined behavior in some statement during one or more of the iterations.
9879 @opindex Wno-attributes
9880 @opindex Wattributes
9881 @item -Wno-attributes
9882 Do not warn if an unexpected @code{__attribute__} is used, such as
9883 unrecognized attributes, function attributes applied to variables,
9884 etc.  This does not stop errors for incorrect use of supported
9885 attributes.
9887 Warnings about ill-formed uses of standard attributes are upgraded to
9888 errors by @option{-pedantic-errors}.
9890 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9891 warnings about unknown scoped attributes (in C++11 and C23).  For example,
9892 @option{-Wno-attributes=vendor::attr} disables warning about the following
9893 declaration:
9895 @smallexample
9896 [[vendor::attr]] void f();
9897 @end smallexample
9899 It is also possible to disable warning about all attributes in a namespace
9900 using @option{-Wno-attributes=vendor::} which prevents warning about both
9901 of these declarations:
9903 @smallexample
9904 [[vendor::safe]] void f();
9905 [[vendor::unsafe]] void f2();
9906 @end smallexample
9908 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9910 @opindex Wno-builtin-declaration-mismatch
9911 @opindex Wbuiltin-declaration-mismatch
9912 @item -Wno-builtin-declaration-mismatch
9913 Warn if a built-in function is declared with an incompatible signature
9914 or as a non-function, or when a built-in function declared with a type
9915 that does not include a prototype is called with arguments whose promoted
9916 types do not match those expected by the function.  When @option{-Wextra}
9917 is specified, also warn when a built-in function that takes arguments is
9918 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9919 warning is enabled by default.  To avoid the warning include the appropriate
9920 header to bring the prototypes of built-in functions into scope.
9922 For example, the call to @code{memset} below is diagnosed by the warning
9923 because the function expects a value of type @code{size_t} as its argument
9924 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9925 the declaration of the function is diagnosed as well.
9926 @smallexample
9927 extern void* memset ();
9928 void f (void *d)
9930   memset (d, '\0', 32);
9932 @end smallexample
9934 @opindex Wno-builtin-macro-redefined
9935 @opindex Wbuiltin-macro-redefined
9936 @item -Wno-builtin-macro-redefined
9937 Do not warn if certain built-in macros are redefined.  This suppresses
9938 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9939 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9941 @opindex Wstrict-prototypes
9942 @opindex Wno-strict-prototypes
9943 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9944 Warn if a function is declared or defined without specifying the
9945 argument types.  (An old-style function definition is permitted without
9946 a warning if preceded by a declaration that specifies the argument
9947 types.)
9949 @opindex Wold-style-declaration
9950 @opindex Wno-old-style-declaration
9951 @item -Wold-style-declaration @r{(C and Objective-C only)}
9952 Warn for obsolescent usages, according to the C Standard, in a
9953 declaration. For example, warn if storage-class specifiers like
9954 @code{static} are not the first things in a declaration.  This warning
9955 is also enabled by @option{-Wextra}.
9957 @opindex Wold-style-definition
9958 @opindex Wno-old-style-definition
9959 @item -Wold-style-definition @r{(C and Objective-C only)}
9960 Warn if an old-style function definition is used.  A warning is given
9961 even if there is a previous prototype.  A definition using @samp{()}
9962 is not considered an old-style definition in C23 mode, because it is
9963 equivalent to @samp{(void)} in that case, but is considered an
9964 old-style definition for older standards.
9966 @opindex Wmissing-parameter-type
9967 @opindex Wno-missing-parameter-type
9968 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9969 A function parameter is declared without a type specifier in K&R-style
9970 functions:
9972 @smallexample
9973 void foo(bar) @{ @}
9974 @end smallexample
9976 This warning is also enabled by @option{-Wextra}.
9978 @opindex Wno-declaration-missing-parameter-type
9979 @opindex Wdeclaration-missing-parameter-type
9980 @item -Wno-declaration-missing-parameter-type @r{(C and Objective-C only)}
9981 Do not warn if a function declaration contains a parameter name without
9982 a type.  Such function declarations do not provide a function prototype
9983 and prevent most type checking in function calls.
9985 This warning is enabled by default.  In C99 and later dialects of C, it
9986 is treated as an error.  The error can be downgraded to a warning using
9987 @option{-fpermissive} (along with certain other errors), or for this
9988 error alone, with @option{-Wno-error=declaration-missing-parameter-type}.
9990 This warning is upgraded to an error by @option{-pedantic-errors}.
9992 @opindex Wmissing-prototypes
9993 @opindex Wno-missing-prototypes
9994 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9995 Warn if a global function is defined without a previous prototype
9996 declaration.  This warning is issued even if the definition itself
9997 provides a prototype.  Use this option to detect global functions
9998 that do not have a matching prototype declaration in a header file.
9999 This option is not valid for C++ because all function declarations
10000 provide prototypes and a non-matching declaration declares an
10001 overload rather than conflict with an earlier declaration.
10002 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
10004 @opindex Wmissing-variable-declarations
10005 @opindex Wno-missing-variable-declarations
10006 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
10007 Warn if a global variable is defined without a previous declaration.
10008 Use this option to detect global variables that do not have a matching
10009 extern declaration in a header file.
10011 @opindex Wmissing-declarations
10012 @opindex Wno-missing-declarations
10013 @item -Wmissing-declarations
10014 Warn if a global function is defined without a previous declaration.
10015 Do so even if the definition itself provides a prototype.
10016 Use this option to detect global functions that are not declared in
10017 header files.  In C, no warnings are issued for functions with previous
10018 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
10019 missing prototypes.  In C++, no warnings are issued for function templates,
10020 or for inline functions, or for functions in anonymous namespaces.
10022 @opindex Wmissing-field-initializers
10023 @opindex Wno-missing-field-initializers
10024 @opindex W
10025 @opindex Wextra
10026 @opindex Wno-extra
10027 @item -Wmissing-field-initializers
10028 Warn if a structure's initializer has some fields missing.  For
10029 example, the following code causes such a warning, because
10030 @code{x.h} is implicitly zero:
10032 @smallexample
10033 struct s @{ int f, g, h; @};
10034 struct s x = @{ 3, 4 @};
10035 @end smallexample
10037 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
10038 In C this option does not warn about designated initializers, so the
10039 following modification does not trigger a warning:
10041 @smallexample
10042 struct s @{ int f, g, h; @};
10043 struct s x = @{ .f = 3, .g = 4 @};
10044 @end smallexample
10046 In C this option does not warn about the universal zero initializer
10047 @samp{@{ 0 @}}:
10049 @smallexample
10050 struct s @{ int f, g, h; @};
10051 struct s x = @{ 0 @};
10052 @end smallexample
10054 Likewise, in C++ this option does not warn about the empty @{ @}
10055 initializer, for example:
10057 @smallexample
10058 struct s @{ int f, g, h; @};
10059 s x = @{ @};
10060 @end smallexample
10062 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
10063 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
10065 @opindex Wmissing-requires
10066 @opindex Wno-missing-requires
10067 @item -Wno-missing-requires
10069 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
10071 @smallexample
10072 bool satisfied = requires @{ C<T> @};
10073 @end smallexample
10075 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
10076 expression, which it is for all T.  Presumably the user meant to write
10078 @smallexample
10079 bool satisfied = requires @{ requires C<T> @};
10080 @end smallexample
10082 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
10083 type @samp{T}.
10085 This warning can be disabled with @option{-Wno-missing-requires}.
10087 @opindex Wmissing-template-keyword
10088 @opindex Wno-missing-template-keyword
10089 @item -Wno-missing-template-keyword
10091 The member access tokens ., -> and :: must be followed by the @code{template}
10092 keyword if the parent object is dependent and the member being named is a
10093 template.
10095 @smallexample
10096 template <class X>
10097 void DoStuff (X x)
10099   x.template DoSomeOtherStuff<X>(); // Good.
10100   x.DoMoreStuff<X>(); // Warning, x is dependent.
10102 @end smallexample
10104 In rare cases it is possible to get false positives. To silence this, wrap
10105 the expression in parentheses. For example, the following is treated as a
10106 template, even where m and N are integers:
10108 @smallexample
10109 void NotATemplate (my_class t)
10111   int N = 5;
10113   bool test = t.m < N > (0); // Treated as a template.
10114   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
10116 @end smallexample
10118 This warning can be disabled with @option{-Wno-missing-template-keyword}.
10120 @opindex Wno-multichar
10121 @opindex Wmultichar
10122 @item -Wno-multichar
10123 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
10124 Usually they indicate a typo in the user's code, as they have
10125 implementation-defined values, and should not be used in portable code.
10127 @opindex Wnormalized=
10128 @opindex Wnormalized
10129 @opindex Wno-normalized
10130 @cindex NFC
10131 @cindex NFKC
10132 @cindex character set, input normalization
10133 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
10134 In ISO C and ISO C++, two identifiers are different if they are
10135 different sequences of characters.  However, sometimes when characters
10136 outside the basic ASCII character set are used, you can have two
10137 different character sequences that look the same.  To avoid confusion,
10138 the ISO 10646 standard sets out some @dfn{normalization rules} which
10139 when applied ensure that two sequences that look the same are turned into
10140 the same sequence.  GCC can warn you if you are using identifiers that
10141 have not been normalized; this option controls that warning.
10143 There are four levels of warning supported by GCC@.  The default is
10144 @option{-Wnormalized=nfc}, which warns about any identifier that is
10145 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
10146 recommended form for most uses.  It is equivalent to
10147 @option{-Wnormalized}.
10149 Unfortunately, there are some characters allowed in identifiers by
10150 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
10151 identifiers.  That is, there's no way to use these symbols in portable
10152 ISO C or C++ and have all your identifiers in NFC@.
10153 @option{-Wnormalized=id} suppresses the warning for these characters.
10154 It is hoped that future versions of the standards involved will correct
10155 this, which is why this option is not the default.
10157 You can switch the warning off for all characters by writing
10158 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
10159 only do this if you are using some other normalization scheme (like
10160 ``D''), because otherwise you can easily create bugs that are
10161 literally impossible to see.
10163 Some characters in ISO 10646 have distinct meanings but look identical
10164 in some fonts or display methodologies, especially once formatting has
10165 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
10166 LETTER N'', displays just like a regular @code{n} that has been
10167 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
10168 normalization scheme to convert all these into a standard form as
10169 well, and GCC warns if your code is not in NFKC if you use
10170 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
10171 about every identifier that contains the letter O because it might be
10172 confused with the digit 0, and so is not the default, but may be
10173 useful as a local coding convention if the programming environment 
10174 cannot be fixed to display these characters distinctly.
10176 @opindex Wno-attribute-warning
10177 @opindex Wattribute-warning
10178 @item -Wno-attribute-warning
10179 Do not warn about usage of functions (@pxref{Function Attributes})
10180 declared with @code{warning} attribute.  By default, this warning is
10181 enabled.  @option{-Wno-attribute-warning} can be used to disable the
10182 warning or @option{-Wno-error=attribute-warning} can be used to
10183 disable the error when compiled with @option{-Werror} flag.
10185 @opindex Wno-deprecated
10186 @opindex Wdeprecated
10187 @item -Wno-deprecated
10188 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
10190 @opindex Wno-deprecated-declarations
10191 @opindex Wdeprecated-declarations
10192 @item -Wno-deprecated-declarations
10193 Do not warn about uses of functions (@pxref{Function Attributes}),
10194 variables (@pxref{Variable Attributes}), and types (@pxref{Type
10195 Attributes}) marked as deprecated by using the @code{deprecated}
10196 attribute.
10198 @opindex Wno-overflow
10199 @opindex Woverflow
10200 @item -Wno-overflow
10201 Do not warn about compile-time overflow in constant expressions.
10203 @opindex Wno-odr
10204 @opindex Wodr
10205 @item -Wno-odr
10206 Warn about One Definition Rule violations during link-time optimization.
10207 Enabled by default.
10209 @opindex Wopenacc-parallelism
10210 @opindex Wno-openacc-parallelism
10211 @cindex OpenACC accelerator programming
10212 @item -Wopenacc-parallelism
10213 Warn about potentially suboptimal choices related to OpenACC parallelism.
10215 @opindex Wopenmp
10216 @opindex Wno-openmp
10217 @item -Wno-openmp
10218 Warn about suspicious OpenMP code.
10220 @opindex Wopenmp-simd
10221 @opindex Wno-openmp-simd
10222 @item -Wopenmp-simd
10223 Warn if the vectorizer cost model overrides the OpenMP
10224 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
10225 option can be used to relax the cost model.
10227 @opindex Woverride-init
10228 @opindex Wno-override-init
10229 @opindex W
10230 @opindex Wextra
10231 @opindex Wno-extra
10232 @item -Woverride-init @r{(C and Objective-C only)}
10233 Warn if an initialized field without side effects is overridden when
10234 using designated initializers (@pxref{Designated Inits, , Designated
10235 Initializers}).
10237 This warning is included in @option{-Wextra}.  To get other
10238 @option{-Wextra} warnings without this one, use @option{-Wextra
10239 -Wno-override-init}.
10241 @opindex Woverride-init-side-effects
10242 @opindex Wno-override-init-side-effects
10243 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
10244 Do not warn if an initialized field with side effects is overridden when
10245 using designated initializers (@pxref{Designated Inits, , Designated
10246 Initializers}).  This warning is enabled by default.
10248 @opindex Wpacked
10249 @opindex Wno-packed
10250 @item -Wpacked
10251 Warn if a structure is given the packed attribute, but the packed
10252 attribute has no effect on the layout or size of the structure.
10253 Such structures may be mis-aligned for little benefit.  For
10254 instance, in this code, the variable @code{f.x} in @code{struct bar}
10255 is misaligned even though @code{struct bar} does not itself
10256 have the packed attribute:
10258 @smallexample
10259 @group
10260 struct foo @{
10261   int x;
10262   char a, b, c, d;
10263 @} __attribute__((packed));
10264 struct bar @{
10265   char z;
10266   struct foo f;
10268 @end group
10269 @end smallexample
10271 @opindex Wpacked-bitfield-compat
10272 @opindex Wno-packed-bitfield-compat
10273 @item -Wnopacked-bitfield-compat
10274 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
10275 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
10276 the change can lead to differences in the structure layout.  GCC
10277 informs you when the offset of such a field has changed in GCC 4.4.
10278 For example there is no longer a 4-bit padding between field @code{a}
10279 and @code{b} in this structure:
10281 @smallexample
10282 struct foo
10284   char a:4;
10285   char b:8;
10286 @} __attribute__ ((packed));
10287 @end smallexample
10289 This warning is enabled by default.  Use
10290 @option{-Wno-packed-bitfield-compat} to disable this warning.
10292 @opindex Wpacked-not-aligned
10293 @opindex Wno-packed-not-aligned
10294 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
10295 Warn if a structure field with explicitly specified alignment in a
10296 packed struct or union is misaligned.  For example, a warning will
10297 be issued on @code{struct S}, like, @code{warning: alignment 1 of
10298 'struct S' is less than 8}, in this code:
10300 @smallexample
10301 @group
10302 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
10303 struct __attribute__ ((packed)) S @{
10304   struct S8 s8;
10306 @end group
10307 @end smallexample
10309 This warning is enabled by @option{-Wall}.
10311 @opindex Wpadded
10312 @opindex Wno-padded
10313 @item -Wpadded
10314 Warn if padding is included in a structure, either to align an element
10315 of the structure or to align the whole structure.  Sometimes when this
10316 happens it is possible to rearrange the fields of the structure to
10317 reduce the padding and so make the structure smaller.
10319 @opindex Wredundant-decls
10320 @opindex Wno-redundant-decls
10321 @item -Wredundant-decls
10322 Warn if anything is declared more than once in the same scope, even in
10323 cases where multiple declaration is valid and changes nothing.
10325 @opindex Wrestrict
10326 @opindex Wno-restrict
10327 @item -Wrestrict
10328 Warn when an object referenced by a @code{restrict}-qualified parameter
10329 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
10330 argument, or when copies between such objects overlap.  For example,
10331 the call to the @code{strcpy} function below attempts to truncate the string
10332 by replacing its initial characters with the last four.  However, because
10333 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
10334 the call is diagnosed.
10336 @smallexample
10337 void foo (void)
10339   char a[] = "abcd1234";
10340   strcpy (a, a + 4);
10341   @dots{}
10343 @end smallexample
10344 The @option{-Wrestrict} option detects some instances of simple overlap
10345 even without optimization but works best at @option{-O2} and above.  It
10346 is included in @option{-Wall}.
10348 @opindex Wnested-externs
10349 @opindex Wno-nested-externs
10350 @item -Wnested-externs @r{(C and Objective-C only)}
10351 Warn if an @code{extern} declaration is encountered within a function.
10353 @opindex Winline
10354 @opindex Wno-inline
10355 @item -Winline
10356 Warn if a function that is declared as inline cannot be inlined.
10357 Even with this option, the compiler does not warn about failures to
10358 inline functions declared in system headers.
10360 The compiler uses a variety of heuristics to determine whether or not
10361 to inline a function.  For example, the compiler takes into account
10362 the size of the function being inlined and the amount of inlining
10363 that has already been done in the current function.  Therefore,
10364 seemingly insignificant changes in the source program can cause the
10365 warnings produced by @option{-Winline} to appear or disappear.
10367 @opindex Winterference-size
10368 @item -Winterference-size
10369 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10370 without specifying its value with @option{--param destructive-interference-size}.
10371 Also warn about questionable values for that option.
10373 This variable is intended to be used for controlling class layout, to
10374 avoid false sharing in concurrent code:
10376 @smallexample
10377 struct independent_fields @{
10378   alignas(std::hardware_destructive_interference_size)
10379     std::atomic<int> one;
10380   alignas(std::hardware_destructive_interference_size)
10381     std::atomic<int> two;
10383 @end smallexample
10385 Here @samp{one} and @samp{two} are intended to be far enough apart
10386 that stores to one won't require accesses to the other to reload the
10387 cache line.
10389 By default, @option{--param destructive-interference-size} and
10390 @option{--param constructive-interference-size} are set based on the
10391 current @option{-mtune} option, typically to the L1 cache line size
10392 for the particular target CPU, sometimes to a range if tuning for a
10393 generic target.  So all translation units that depend on ABI
10394 compatibility for the use of these variables must be compiled with
10395 the same @option{-mtune} (or @option{-mcpu}).
10397 If ABI stability is important, such as if the use is in a header for a
10398 library, you should probably not use the hardware interference size
10399 variables at all.  Alternatively, you can force a particular value
10400 with @option{--param}.
10402 If you are confident that your use of the variable does not affect ABI
10403 outside a single build of your project, you can turn off the warning
10404 with @option{-Wno-interference-size}.
10406 @opindex Wint-in-bool-context
10407 @opindex Wno-int-in-bool-context
10408 @item -Wint-in-bool-context
10409 Warn for suspicious use of integer values where boolean values are expected,
10410 such as conditional expressions (?:) using non-boolean integer constants in
10411 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10412 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10413 for all kinds of multiplications regardless of the data type.
10414 This warning is enabled by @option{-Wall}.
10416 @opindex Wno-int-to-pointer-cast
10417 @opindex Wint-to-pointer-cast
10418 @item -Wno-int-to-pointer-cast
10419 Suppress warnings from casts to pointer type of an integer of a
10420 different size. In C++, casting to a pointer type of smaller size is
10421 an error. @option{Wint-to-pointer-cast} is enabled by default.
10424 @opindex Wno-pointer-to-int-cast
10425 @opindex Wpointer-to-int-cast
10426 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10427 Suppress warnings from casts from a pointer to an integer type of a
10428 different size.
10430 @opindex Winvalid-pch
10431 @opindex Wno-invalid-pch
10432 @item -Winvalid-pch
10433 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10434 the search path but cannot be used.
10436 @opindex Winvalid-utf8
10437 @opindex Wno-invalid-utf8
10438 @item -Winvalid-utf8
10439 Warn if an invalid UTF-8 character is found.
10440 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10441 is used and turned into error with @option{-pedantic-errors}.
10443 @opindex Wunicode
10444 @opindex Wno-unicode
10445 @item -Wno-unicode
10446 Don't diagnose invalid forms of delimited or named escape sequences which are
10447 treated as separate tokens.  @option{Wunicode} is enabled by default.
10449 @opindex Wlong-long
10450 @opindex Wno-long-long
10451 @item -Wlong-long
10452 Warn if @code{long long} type is used.  This is enabled by either
10453 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10454 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10456 This warning is upgraded to an error by @option{-pedantic-errors}.
10458 @opindex Wvariadic-macros
10459 @opindex Wno-variadic-macros
10460 @item -Wvariadic-macros
10461 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10462 alternate syntax is used in ISO C99 mode.  This is enabled by either
10463 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10464 messages, use @option{-Wno-variadic-macros}.
10466 @opindex Wvarargs
10467 @opindex Wno-varargs
10468 @item -Wno-varargs
10469 Do not warn upon questionable usage of the macros used to handle variable
10470 arguments like @code{va_start}.  These warnings are enabled by default.
10472 @opindex Wvector-operation-performance
10473 @opindex Wno-vector-operation-performance
10474 @item -Wvector-operation-performance
10475 Warn if vector operation is not implemented via SIMD capabilities of the
10476 architecture.  Mainly useful for the performance tuning.
10477 Vector operation can be implemented @code{piecewise}, which means that the
10478 scalar operation is performed on every vector element; 
10479 @code{in parallel}, which means that the vector operation is implemented
10480 using scalars of wider type, which normally is more performance efficient;
10481 and @code{as a single scalar}, which means that vector fits into a
10482 scalar type.
10484 @opindex Wvla
10485 @opindex Wno-vla
10486 @item -Wvla
10487 Warn if a variable-length array is used in the code.
10488 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10489 the variable-length array.
10491 This warning is upgraded to an error by @option{-pedantic-errors}.
10493 @opindex Wvla-larger-than=
10494 @opindex Wno-vla-larger-than
10495 @item -Wvla-larger-than=@var{byte-size}
10496 If this option is used, the compiler warns for declarations of
10497 variable-length arrays whose size is either unbounded, or bounded
10498 by an argument that allows the array size to exceed @var{byte-size}
10499 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10500 works, but with variable-length arrays.
10502 Note that GCC may optimize small variable-length arrays of a known
10503 value into plain arrays, so this warning may not get triggered for
10504 such arrays.
10506 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10507 is typically only effective when @option{-ftree-vrp} is active (default
10508 for @option{-O2} and above).
10510 See also @option{-Walloca-larger-than=@var{byte-size}}.
10512 @opindex Wno-vla-larger-than
10513 @item -Wno-vla-larger-than
10514 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10515 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10517 @opindex Wno-vla-parameter
10518 @item -Wvla-parameter
10519 Warn about redeclarations of functions involving arguments of Variable
10520 Length Array types of inconsistent kinds or forms, and enable the detection
10521 of out-of-bounds accesses to such parameters by warnings such as
10522 @option{-Warray-bounds}.
10524 If the first function declaration uses the VLA form the bound specified
10525 in the array is assumed to be the minimum number of elements expected to
10526 be provided in calls to the function and the maximum number of elements
10527 accessed by it.  Failing to provide arguments of sufficient size or
10528 accessing more than the maximum number of elements may be diagnosed.
10530 For example, the warning triggers for the following redeclarations because
10531 the first one allows an array of any size to be passed to @code{f} while
10532 the second one specifies that the array argument must have at least @code{n}
10533 elements.  In addition, calling @code{f} with the associated VLA bound
10534 parameter in excess of the actual VLA bound triggers a warning as well.
10536 @smallexample
10537 void f (int n, int[n]);
10538 // warning: argument 2 previously declared as a VLA
10539 void f (int, int[]);
10541 void g (int n)
10543     if (n > 4)
10544       return;
10545     int a[n];
10546     // warning: access to a by f may be out of bounds
10547     f (sizeof a, a);
10548   @dots{}
10551 @end smallexample
10553 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10554 @option{-Warray-parameter} option triggers warnings for similar problems
10555 involving ordinary array arguments.
10557 @opindex Wvolatile-register-var
10558 @opindex Wno-volatile-register-var
10559 @item -Wvolatile-register-var
10560 Warn if a register variable is declared volatile.  The volatile
10561 modifier does not inhibit all optimizations that may eliminate reads
10562 and/or writes to register variables.  This warning is enabled by
10563 @option{-Wall}.
10565 @opindex Wxor-used-as-pow
10566 @opindex Wno-xor-used-as-pow
10567 @item -Wno-xor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10568 Disable warnings about uses of @code{^}, the exclusive or operator,
10569 where it appears the code meant exponentiation.
10570 Specifically, the warning occurs when the
10571 left-hand side is the decimal constant 2 or 10 and the right-hand side
10572 is also a decimal constant.
10574 In C and C++, @code{^} means exclusive or, whereas in some other languages
10575 (e.g. TeX and some versions of BASIC) it means exponentiation.
10577 This warning can be silenced by converting one of the operands to
10578 hexadecimal as well as by compiling with @option{-Wno-xor-used-as-pow}.
10580 @opindex Wdisabled-optimization
10581 @opindex Wno-disabled-optimization
10582 @item -Wdisabled-optimization
10583 Warn if a requested optimization pass is disabled.  This warning does
10584 not generally indicate that there is anything wrong with your code; it
10585 merely indicates that GCC's optimizers are unable to handle the code
10586 effectively.  Often, the problem is that your code is too big or too
10587 complex; GCC refuses to optimize programs when the optimization
10588 itself is likely to take inordinate amounts of time.
10590 @opindex Wpointer-sign
10591 @opindex Wno-pointer-sign
10592 @item -Wpointer-sign @r{(C and Objective-C only)}
10593 Warn for pointer argument passing or assignment with different signedness.
10594 This option is only supported for C and Objective-C@.  It is implied by
10595 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10596 @option{-Wno-pointer-sign}.
10598 This warning is upgraded to an error by @option{-pedantic-errors}.
10600 @opindex Wstack-protector
10601 @opindex Wno-stack-protector
10602 @item -Wstack-protector
10603 This option is only active when @option{-fstack-protector} is active.  It
10604 warns about functions that are not protected against stack smashing.
10606 @opindex Woverlength-strings
10607 @opindex Wno-overlength-strings
10608 @item -Woverlength-strings
10609 Warn about string constants that are longer than the ``minimum
10610 maximum'' length specified in the C standard.  Modern compilers
10611 generally allow string constants that are much longer than the
10612 standard's minimum limit, but very portable programs should avoid
10613 using longer strings.
10615 The limit applies @emph{after} string constant concatenation, and does
10616 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10617 C99, it was raised to 4095.  C++98 does not specify a normative
10618 minimum maximum, so we do not diagnose overlength strings in C++@.
10620 This option is implied by @option{-Wpedantic}, and can be disabled with
10621 @option{-Wno-overlength-strings}.
10623 @opindex Wunsuffixed-float-constants
10624 @opindex Wno-unsuffixed-float-constants
10625 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10627 Issue a warning for any floating constant that does not have
10628 a suffix.  When used together with @option{-Wsystem-headers} it
10629 warns about such constants in system header files.  This can be useful
10630 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10631 from the decimal floating-point extension to C99.
10633 @opindex Wlto-type-mismatch
10634 @opindex Wno-lto-type-mismatch
10635 @item -Wno-lto-type-mismatch
10637 During the link-time optimization, do not warn about type mismatches in
10638 global declarations from different compilation units.
10639 Requires @option{-flto} to be enabled.  Enabled by default.
10641 @opindex Wdesignated-init
10642 @opindex Wno-designated-init
10643 @item -Wno-designated-init @r{(C and Objective-C only)}
10644 Suppress warnings when a positional initializer is used to initialize
10645 a structure that has been marked with the @code{designated_init}
10646 attribute.
10648 @end table
10650 @node Static Analyzer Options
10651 @section Options That Control Static Analysis
10653 @table @gcctabopt
10654 @opindex analyzer
10655 @opindex fanalyzer
10656 @opindex fno-analyzer
10657 @item -fanalyzer
10658 This option enables an static analysis of program flow which looks
10659 for ``interesting'' interprocedural paths through the
10660 code, and issues warnings for problems found on them.
10662 This analysis is much more expensive than other GCC warnings.
10664 In technical terms, it performs coverage-guided symbolic execution of
10665 the code being compiled.  It is neither sound nor complete: it can
10666 have false positives and false negatives.  It is a bug-finding tool,
10667 rather than a tool for proving program correctness.
10669 The analyzer is only suitable for use on C code in this release.
10671 Enabling this option effectively enables the following warnings:
10673 @gccoptlist{
10674 -Wanalyzer-allocation-size
10675 -Wanalyzer-deref-before-check
10676 -Wanalyzer-double-fclose
10677 -Wanalyzer-double-free
10678 -Wanalyzer-exposure-through-output-file
10679 -Wanalyzer-exposure-through-uninit-copy
10680 -Wanalyzer-fd-access-mode-mismatch
10681 -Wanalyzer-fd-double-close
10682 -Wanalyzer-fd-leak
10683 -Wanalyzer-fd-phase-mismatch
10684 -Wanalyzer-fd-type-mismatch
10685 -Wanalyzer-fd-use-after-close
10686 -Wanalyzer-fd-use-without-check
10687 -Wanalyzer-file-leak
10688 -Wanalyzer-free-of-non-heap
10689 -Wanalyzer-imprecise-fp-arithmetic
10690 -Wanalyzer-infinite-loop
10691 -Wanalyzer-infinite-recursion
10692 -Wanalyzer-jump-through-null
10693 -Wanalyzer-malloc-leak
10694 -Wanalyzer-mismatching-deallocation
10695 -Wanalyzer-null-argument
10696 -Wanalyzer-null-dereference
10697 -Wanalyzer-out-of-bounds
10698 -Wanalyzer-overlapping-buffers
10699 -Wanalyzer-possible-null-argument
10700 -Wanalyzer-possible-null-dereference
10701 -Wanalyzer-putenv-of-auto-var
10702 -Wanalyzer-shift-count-negative
10703 -Wanalyzer-shift-count-overflow
10704 -Wanalyzer-stale-setjmp-buffer
10705 -Wanalyzer-tainted-allocation-size
10706 -Wanalyzer-tainted-array-index
10707 -Wanalyzer-tainted-assertion
10708 -Wanalyzer-tainted-divisor
10709 -Wanalyzer-tainted-offset
10710 -Wanalyzer-tainted-size
10711 -Wanalyzer-undefined-behavior-strtok
10712 -Wanalyzer-unsafe-call-within-signal-handler
10713 -Wanalyzer-use-after-free
10714 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10715 -Wanalyzer-use-of-uninitialized-value
10716 -Wanalyzer-va-arg-type-mismatch
10717 -Wanalyzer-va-list-exhausted
10718 -Wanalyzer-va-list-leak
10719 -Wanalyzer-va-list-use-after-va-end
10720 -Wanalyzer-write-to-const
10721 -Wanalyzer-write-to-string-literal
10724 This option is only available if GCC was configured with analyzer
10725 support enabled.
10727 @opindex Wanalyzer-symbol-too-complex
10728 @opindex Wno-analyzer-symbol-too-complex
10729 @item -Wanalyzer-symbol-too-complex
10730 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10731 to attempt to track the state of memory, but these can be defeated by
10732 sufficiently complicated code.
10734 By default, the analysis silently stops tracking values of expressions
10735 if they exceed the threshold defined by
10736 @option{--param analyzer-max-svalue-depth=@var{value}}, and falls back
10737 to an imprecise representation for such expressions.
10738 The @option{-Wanalyzer-symbol-too-complex} option warns if this occurs.
10740 @opindex Wanalyzer-too-complex
10741 @opindex Wno-analyzer-too-complex
10742 @item -Wanalyzer-too-complex
10743 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10744 to attempt to explore the control flow and data flow in the program,
10745 but these can be defeated by sufficiently complicated code.
10747 By default, the analysis silently stops if the code is too
10748 complicated for the analyzer to fully explore and it reaches an internal
10749 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10751 @opindex Wanalyzer-allocation-size
10752 @opindex Wno-analyzer-allocation-size
10753 @item -Wno-analyzer-allocation-size
10754 This warning requires @option{-fanalyzer}, which enables it;
10755 to disable it, use @option{-Wno-analyzer-allocation-size}.
10757 This diagnostic warns for paths through the code in which a pointer to
10758 a buffer is assigned to point at a buffer with a size that is not a
10759 multiple of @code{sizeof (*pointer)}.
10761 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10763 @opindex Wanalyzer-deref-before-check
10764 @opindex Wno-analyzer-deref-before-check
10765 @item -Wno-analyzer-deref-before-check
10766 This warning requires @option{-fanalyzer}, which enables it; use
10767 @option{-Wno-analyzer-deref-before-check}
10768 to disable it.
10770 This diagnostic warns for paths through the code in which a pointer
10771 is checked for @code{NULL} *after* it has already been
10772 dereferenced, suggesting that the pointer could have been NULL.
10773 Such cases suggest that the check for NULL is either redundant,
10774 or that it needs to be moved to before the pointer is dereferenced.
10776 This diagnostic also considers values passed to a function argument
10777 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10778 value, and thus will complain if such values are checked for @code{NULL}
10779 after returning from such a function call.
10781 This diagnostic is unlikely to be reported when any level of optimization
10782 is enabled, as GCC's optimization logic will typically consider such
10783 checks for NULL as being redundant, and optimize them away before the
10784 analyzer "sees" them.  Hence optimization should be disabled when
10785 attempting to trigger this diagnostic.
10787 @opindex Wanalyzer-double-fclose
10788 @opindex Wno-analyzer-double-fclose
10789 @item -Wno-analyzer-double-fclose
10790 This warning requires @option{-fanalyzer}, which enables it; use
10791 @option{-Wno-analyzer-double-fclose} to disable it.
10793 This diagnostic warns for paths through the code in which a @code{FILE *}
10794 can have @code{fclose} called on it more than once.
10796 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10798 @opindex Wanalyzer-double-free
10799 @opindex Wno-analyzer-double-free
10800 @item -Wno-analyzer-double-free
10801 This warning requires @option{-fanalyzer}, which enables it; use
10802 @option{-Wno-analyzer-double-free} to disable it.
10804 This diagnostic warns for paths through the code in which a pointer
10805 can have a deallocator called on it more than once, either @code{free},
10806 or a deallocator referenced by attribute @code{malloc}.
10808 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10810 @opindex Wanalyzer-exposure-through-output-file
10811 @opindex Wno-analyzer-exposure-through-output-file
10812 @item -Wno-analyzer-exposure-through-output-file
10813 This warning requires @option{-fanalyzer}, which enables it; use
10814 @option{-Wno-analyzer-exposure-through-output-file}
10815 to disable it.
10817 This diagnostic warns for paths through the code in which a
10818 security-sensitive value is written to an output file
10819 (such as writing a password to a log file).
10821 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10823 @opindex Wanalyzer-exposure-through-uninit-copy
10824 @opindex Wno-analyzer-exposure-through-uninit-copy
10825 @item -Wanalyzer-exposure-through-uninit-copy
10826 This warning requires both @option{-fanalyzer} and the use of a plugin
10827 to specify a function that copies across a ``trust boundary''.  Use
10828 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10830 This diagnostic warns for ``infoleaks'' - paths through the code in which
10831 uninitialized values are copied across a security boundary
10832 (such as code within an OS kernel that copies a partially-initialized
10833 struct on the stack to user space).
10835 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10837 @opindex Wanalyzer-fd-access-mode-mismatch
10838 @opindex Wno-analyzer-fd-access-mode-mismatch
10839 @item -Wno-analyzer-fd-access-mode-mismatch
10840 This warning requires @option{-fanalyzer}, which enables it; use
10841 @option{-Wno-analyzer-fd-access-mode-mismatch}
10842 to disable it.
10844 This diagnostic warns for paths through code in which a
10845 @code{read} on a write-only file descriptor is attempted, or vice versa.
10847 This diagnostic also warns for code paths in a which a function with attribute
10848 @code{fd_arg_read (N)} is called with a file descriptor opened with
10849 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10850 @code{fd_arg_write (N)} is called with a file descriptor opened with
10851 @code{O_RDONLY} at referenced argument @var{N}.
10853 @opindex Wanalyzer-fd-double-close
10854 @opindex Wno-analyzer-fd-double-close
10855 @item -Wno-analyzer-fd-double-close
10856 This warning requires @option{-fanalyzer}, which enables it; use
10857 @option{-Wno-analyzer-fd-double-close}
10858 to disable it.
10860 This diagnostic warns for paths through code in which a
10861 file descriptor can be closed more than once.
10863 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10865 @opindex Wanalyzer-fd-leak
10866 @opindex Wno-analyzer-fd-leak
10867 @item -Wno-analyzer-fd-leak
10868 This warning requires @option{-fanalyzer}, which enables it; use
10869 @option{-Wno-analyzer-fd-leak}
10870 to disable it.
10872 This diagnostic warns for paths through code in which an
10873 open file descriptor is leaked.
10875 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10877 @opindex Wanalyzer-fd-phase-mismatch
10878 @opindex Wno-analyzer-fd-phase-mismatch
10879 @item -Wno-analyzer-fd-phase-mismatch
10880 This warning requires @option{-fanalyzer}, which enables it; use
10881 @option{-Wno-analyzer-fd-phase-mismatch}
10882 to disable it.
10884 This diagnostic warns for paths through code in which an operation is
10885 attempted in the wrong phase of a file descriptor's lifetime.
10886 For example, it will warn on attempts to call @code{accept} on a stream
10887 socket that has not yet had @code{listen} successfully called on it.
10889 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10891 @opindex Wanalyzer-fd-type-mismatch
10892 @opindex Wno-analyzer-fd-type-mismatch
10893 @item -Wno-analyzer-fd-type-mismatch
10894 This warning requires @option{-fanalyzer}, which enables it; use
10895 @option{-Wno-analyzer-fd-type-mismatch}
10896 to disable it.
10898 This diagnostic warns for paths through code in which an
10899 operation is attempted on the wrong type of file descriptor.
10900 For example, it will warn on attempts to use socket operations
10901 on a file descriptor obtained via @code{open}, or when attempting
10902 to use a stream socket operation on a datagram socket.
10904 @opindex Wanalyzer-fd-use-after-close
10905 @opindex Wno-analyzer-fd-use-after-close
10906 @item -Wno-analyzer-fd-use-after-close
10907 This warning requires @option{-fanalyzer}, which enables it; use
10908 @option{-Wno-analyzer-fd-use-after-close}
10909 to disable it.
10911 This diagnostic warns for paths through code in which a
10912 read or write is called on a closed file descriptor.
10914 This diagnostic also warns for paths through code in which
10915 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10916 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10917 referenced argument @code{N}.
10919 @opindex Wanalyzer-fd-use-without-check
10920 @opindex Wno-analyzer-fd-use-without-check
10921 @item -Wno-analyzer-fd-use-without-check
10922 This warning requires @option{-fanalyzer}, which enables it; use
10923 @option{-Wno-analyzer-fd-use-without-check}
10924 to disable it.
10926 This diagnostic warns for paths through code in which a
10927 file descriptor is used without being checked for validity.
10929 This diagnostic also warns for paths through code in which
10930 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10931 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10932 argument @code{N}, without being checked for validity.
10934 @opindex Wanalyzer-file-leak
10935 @opindex Wno-analyzer-file-leak
10936 @item -Wno-analyzer-file-leak
10937 This warning requires @option{-fanalyzer}, which enables it; use
10938 @option{-Wno-analyzer-file-leak}
10939 to disable it.
10941 This diagnostic warns for paths through the code in which a
10942 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10944 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10946 @opindex Wanalyzer-free-of-non-heap
10947 @opindex Wno-analyzer-free-of-non-heap
10948 @item -Wno-analyzer-free-of-non-heap
10949 This warning requires @option{-fanalyzer}, which enables it; use
10950 @option{-Wno-analyzer-free-of-non-heap}
10951 to disable it.
10953 This diagnostic warns for paths through the code in which @code{free}
10954 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10956 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10958 @opindex Wanalyzer-imprecise-fp-arithmetic
10959 @opindex Wno-analyzer-imprecise-fp-arithmetic
10960 @item -Wno-analyzer-imprecise-fp-arithmetic
10961 This warning requires @option{-fanalyzer}, which enables it; use
10962 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10963 to disable it.
10965 This diagnostic warns for paths through the code in which floating-point
10966 arithmetic is used in locations where precise computation is needed.  This
10967 diagnostic only warns on use of floating-point operands inside the
10968 calculation of an allocation size at the moment.
10970 @opindex Wanalyzer-infinite-loop
10971 @opindex Wno-analyzer-infinite-loop
10972 @item -Wno-analyzer-infinite-loop
10973 This warning requires @option{-fanalyzer}, which enables it; use
10974 @option{-Wno-analyzer-infinite-loop} to disable it.
10976 This diagnostics warns for paths through the code which appear to
10977 lead to an infinite loop.
10979 Specifically, the analyzer will issue this warning when it "sees" a loop
10980 in which:
10981 @itemize @bullet
10982 @item
10983 no externally-visible work could be being done within the loop
10984 @item
10985 there is no way to escape from the loop
10986 @item
10987 the analyzer is sufficiently confident about the program state
10988 throughout the loop to know that the above are true
10989 @end itemize
10991 One way for this warning to be emitted is when there is an execution
10992 path through a loop for which taking the path on one iteration implies
10993 that the same path will be taken on all subsequent iterations.
10995 For example, consider:
10997 @smallexample
10998   while (1)
10999     @{
11000       char opcode = *cpu_state.pc;
11001       switch (opcode)
11002        @{
11003        case OPCODE_FOO:
11004          handle_opcode_foo (&cpu_state);
11005          break;
11006        case OPCODE_BAR:
11007          handle_opcode_bar (&cpu_state);
11008          break;
11009        @}
11010     @}
11011 @end smallexample
11013 The analyzer will complain for the above case because if @code{opcode}
11014 ever matches none of the cases, the @code{switch} will follow the
11015 implicit @code{default} case, making the body of the loop be a ``no-op''
11016 with @code{cpu_state.pc} unchanged, and thus using the same value of
11017 @code{opcode} on all subseqent iterations, leading to an infinite loop.
11019 See @uref{https://cwe.mitre.org/data/definitions/835.html, CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')}.
11021 @opindex Wanalyzer-infinite-recursion
11022 @opindex Wno-analyzer-infinite-recursion
11023 @item -Wno-analyzer-infinite-recursion
11024 This warning requires @option{-fanalyzer}, which enables it; use
11025 @option{-Wno-analyzer-infinite-recursion} to disable it.
11027 This diagnostics warns for paths through the code which appear to
11028 lead to infinite recursion.
11030 Specifically, when the analyzer "sees" a recursive call, it will compare
11031 the state of memory at the entry to the new frame with that at the entry
11032 to the previous frame of that function on the stack.  The warning is
11033 issued if nothing in memory appears to be changing; any changes observed
11034 to parameters or globals are assumed to lead to termination of the
11035 recursion and thus suppress the warning.
11037 This diagnostic is likely to miss cases of infinite recursion that
11038 are convered to iteration by the optimizer before the analyzer "sees"
11039 them.  Hence optimization should be disabled when attempting to trigger
11040 this diagnostic.
11042 Compare with @option{-Winfinite-recursion}, which provides a similar
11043 diagnostic, but is implemented in a different way.
11045 See @uref{https://cwe.mitre.org/data/definitions/674.html, CWE-674: Uncontrolled Recursion}.
11047 @opindex Wanalyzer-jump-through-null
11048 @opindex Wno-analyzer-jump-through-null
11049 @item -Wno-analyzer-jump-through-null
11050 This warning requires @option{-fanalyzer}, which enables it; use
11051 @option{-Wno-analyzer-jump-through-null}
11052 to disable it.
11054 This diagnostic warns for paths through the code in which a @code{NULL}
11055 function pointer is called.
11057 @opindex Wanalyzer-malloc-leak
11058 @opindex Wno-analyzer-malloc-leak
11059 @item -Wno-analyzer-malloc-leak
11060 This warning requires @option{-fanalyzer}, which enables it; use
11061 @option{-Wno-analyzer-malloc-leak}
11062 to disable it.
11064 This diagnostic warns for paths through the code in which a
11065 pointer allocated via an allocator is leaked: either @code{malloc},
11066 or a function marked with attribute @code{malloc}.
11068 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
11070 @opindex Wanalyzer-mismatching-deallocation
11071 @opindex Wno-analyzer-mismatching-deallocation
11072 @item -Wno-analyzer-mismatching-deallocation
11073 This warning requires @option{-fanalyzer}, which enables it; use
11074 @option{-Wno-analyzer-mismatching-deallocation}
11075 to disable it.
11077 This diagnostic warns for paths through the code in which the
11078 wrong deallocation function is called on a pointer value, based on
11079 which function was used to allocate the pointer value.  The diagnostic
11080 will warn about mismatches between @code{free}, scalar @code{delete}
11081 and vector @code{delete[]}, and those marked as allocator/deallocator
11082 pairs using attribute @code{malloc}.
11084 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
11086 @opindex Wanalyzer-out-of-bounds
11087 @opindex Wno-analyzer-out-of-bounds
11088 @item -Wno-analyzer-out-of-bounds
11089 This warning requires @option{-fanalyzer}, which enables it; use
11090 @option{-Wno-analyzer-out-of-bounds} to disable it.
11092 This diagnostic warns for paths through the code in which a buffer is
11093 definitely read or written out-of-bounds.  The diagnostic applies for
11094 cases where the analyzer is able to determine a constant offset and for
11095 accesses past the end of a buffer, also a constant capacity.  Further,
11096 the diagnostic does limited checking for accesses past the end when the
11097 offset as well as the capacity is symbolic.
11099 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
11101 For cases where the analyzer is able, it will emit a text art diagram
11102 visualizing the spatial relationship between the memory region that the
11103 analyzer predicts would be accessed, versus the range of memory that is
11104 valid to access: whether they overlap, are touching, are close or far
11105 apart; which one is before or after in memory, the relative sizes
11106 involved, the direction of the access (read vs write), and, in some
11107 cases, the values of data involved.  This diagram can be suppressed
11108 using @option{-fdiagnostics-text-art-charset=none}.
11110 @opindex Wanalyzer-overlapping-buffers
11111 @opindex Wno-analyzer-overlapping-buffers
11112 @item -Wno-analyzer-overlapping-buffers
11113 This warning requires @option{-fanalyzer}, which enables it; use
11114 @option{-Wno-analyzer-overlapping-buffers} to disable it.
11116 This diagnostic warns for paths through the code in which overlapping
11117 buffers are passed to an API for which the behavior on such buffers
11118 is undefined.
11120 Specifically, the diagnostic occurs on calls to the following functions
11121 @itemize @bullet
11122 @item @code{memcpy}
11123 @item @code{strcat}
11124 @item @code{strcpy}
11125 @end itemize
11126 for cases where the buffers are known to overlap.
11128 @opindex Wanalyzer-possible-null-argument
11129 @opindex Wno-analyzer-possible-null-argument
11130 @item -Wno-analyzer-possible-null-argument
11131 This warning requires @option{-fanalyzer}, which enables it; use
11132 @option{-Wno-analyzer-possible-null-argument} to disable it.
11134 This diagnostic warns for paths through the code in which a
11135 possibly-NULL value is passed to a function argument marked
11136 with @code{__attribute__((nonnull))} as requiring a non-NULL
11137 value.
11139 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
11141 @opindex Wanalyzer-possible-null-dereference
11142 @opindex Wno-analyzer-possible-null-dereference
11143 @item -Wno-analyzer-possible-null-dereference
11144 This warning requires @option{-fanalyzer}, which enables it; use
11145 @option{-Wno-analyzer-possible-null-dereference} to disable it.
11147 This diagnostic warns for paths through the code in which a
11148 possibly-NULL value is dereferenced.
11150 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
11152 @opindex Wanalyzer-null-argument
11153 @opindex Wno-analyzer-null-argument
11154 @item -Wno-analyzer-null-argument
11155 This warning requires @option{-fanalyzer}, which enables it; use
11156 @option{-Wno-analyzer-null-argument} to disable it.
11158 This diagnostic warns for paths through the code in which a
11159 value known to be NULL is passed to a function argument marked
11160 with @code{__attribute__((nonnull))} as requiring a non-NULL
11161 value.
11163 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
11165 @opindex Wanalyzer-null-dereference
11166 @opindex Wno-analyzer-null-dereference
11167 @item -Wno-analyzer-null-dereference
11168 This warning requires @option{-fanalyzer}, which enables it; use
11169 @option{-Wno-analyzer-null-dereference} to disable it.
11171 This diagnostic warns for paths through the code in which a
11172 value known to be NULL is dereferenced.
11174 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
11176 @opindex Wanalyzer-putenv-of-auto-var
11177 @opindex Wno-analyzer-putenv-of-auto-var
11178 @item -Wno-analyzer-putenv-of-auto-var
11179 This warning requires @option{-fanalyzer}, which enables it; use
11180 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
11182 This diagnostic warns for paths through the code in which a
11183 call to @code{putenv} is passed a pointer to an automatic variable
11184 or an on-stack buffer.
11186 See @uref{https://wiki.sei.cmu.edu/confluence/x/6NYxBQ, POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument}.
11188 @opindex Wanalyzer-shift-count-negative
11189 @opindex Wno-analyzer-shift-count-negative
11190 @item -Wno-analyzer-shift-count-negative
11191 This warning requires @option{-fanalyzer}, which enables it; use
11192 @option{-Wno-analyzer-shift-count-negative} to disable it.
11194 This diagnostic warns for paths through the code in which a
11195 shift is attempted with a negative count.  It is analogous to
11196 the @option{-Wshift-count-negative} diagnostic implemented in
11197 the C/C++ front ends, but is implemented based on analyzing
11198 interprocedural paths, rather than merely parsing the syntax tree.
11199 However, the analyzer does not prioritize detection of such paths, so
11200 false negatives are more likely relative to other warnings.
11202 @opindex Wanalyzer-shift-count-overflow
11203 @opindex Wno-analyzer-shift-count-overflow
11204 @item -Wno-analyzer-shift-count-overflow
11205 This warning requires @option{-fanalyzer}, which enables it; use
11206 @option{-Wno-analyzer-shift-count-overflow} to disable it.
11208 This diagnostic warns for paths through the code in which a
11209 shift is attempted with a count greater than or equal to the
11210 precision of the operand's type.  It is analogous to
11211 the @option{-Wshift-count-overflow} diagnostic implemented in
11212 the C/C++ front ends, but is implemented based on analyzing
11213 interprocedural paths, rather than merely parsing the syntax tree.
11214 However, the analyzer does not prioritize detection of such paths, so
11215 false negatives are more likely relative to other warnings.
11217 @opindex Wanalyzer-stale-setjmp-buffer
11218 @opindex Wno-analyzer-stale-setjmp-buffer
11219 @item -Wno-analyzer-stale-setjmp-buffer
11220 This warning requires @option{-fanalyzer}, which enables it; use
11221 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
11223 This diagnostic warns for paths through the code in which
11224 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
11225 to a @code{setjmp} call in a function that has returned.
11227 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
11228 location, it records the stack frame.  The stack frame becomes invalid
11229 when the function containing the @code{setjmp} call returns.  Attempting
11230 to rewind to it via @code{longjmp} would reference a stack frame that
11231 no longer exists, and likely lead to a crash (or worse).
11233 @opindex Wanalyzer-tainted-allocation-size
11234 @opindex Wno-analyzer-tainted-allocation-size
11235 @item -Wno-analyzer-tainted-allocation-size
11236 This warning requires @option{-fanalyzer} which enables it;
11237 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
11239 This diagnostic warns for paths through the code in which a value
11240 that could be under an attacker's control is used as the size
11241 of an allocation without being sanitized, so that an attacker could
11242 inject an excessively large allocation and potentially cause a denial
11243 of service attack.
11245 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
11247 @opindex Wanalyzer-tainted-assertion
11248 @opindex Wno-analyzer-tainted-assertion
11249 @item -Wno-analyzer-tainted-assertion
11251 This warning requires @option{-fanalyzer} which enables it;
11252 use @option{-Wno-analyzer-tainted-assertion} to disable it.
11254 This diagnostic warns for paths through the code in which a value
11255 that could be under an attacker's control is used as part of a
11256 condition without being first sanitized, and that condition guards a
11257 call to a function marked with attribute @code{noreturn}
11258 (such as the function @code{__builtin_unreachable}).  Such functions
11259 typically indicate abnormal termination of the program, such as for
11260 assertion failure handlers.  For example:
11262 @smallexample
11263 assert (some_tainted_value < SOME_LIMIT);
11264 @end smallexample
11266 In such cases:
11268 @itemize
11269 @item
11270 when assertion-checking is enabled: an attacker could trigger
11271 a denial of service by injecting an assertion failure
11273 @item
11274 when assertion-checking is disabled, such as by defining @code{NDEBUG},
11275 an attacker could inject data that subverts the process, since it
11276 presumably violates a precondition that is being assumed by the code.
11278 @end itemize
11280 Note that when assertion-checking is disabled, the assertions are
11281 typically removed by the preprocessor before the analyzer has a chance
11282 to "see" them, so this diagnostic can only generate warnings on builds
11283 in which assertion-checking is enabled.
11285 For the purpose of this warning, any function marked with attribute
11286 @code{noreturn} is considered as a possible assertion failure
11287 handler, including @code{__builtin_unreachable}.  Note that these functions
11288 are sometimes removed by the optimizer before the analyzer "sees" them.
11289 Hence optimization should be disabled when attempting to trigger this
11290 diagnostic.
11292 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
11294 The warning can also report problematic constructions such as
11296 @smallexample
11297 switch (some_tainted_value) @{
11298 case 0:
11299   /* [...etc; various valid cases omitted...] */
11300   break;
11302 default:
11303   __builtin_unreachable (); /* BUG: attacker can trigger this  */
11305 @end smallexample
11307 despite the above not being an assertion failure, strictly speaking.
11309 @opindex Wanalyzer-tainted-array-index
11310 @opindex Wno-analyzer-tainted-array-index
11311 @item -Wno-analyzer-tainted-array-index
11312 This warning requires @option{-fanalyzer} which enables it;
11313 use @option{-Wno-analyzer-tainted-array-index} to disable it.
11315 This diagnostic warns for paths through the code in which a value
11316 that could be under an attacker's control is used as the index
11317 of an array access without being sanitized, so that an attacker
11318 could inject an out-of-bounds access.
11320 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11322 @opindex Wanalyzer-tainted-divisor
11323 @opindex Wno-analyzer-tainted-divisor
11324 @item -Wno-analyzer-tainted-divisor
11325 This warning requires @option{-fanalyzer} which enables it;
11326 use @option{-Wno-analyzer-tainted-divisor} to disable it.
11328 This diagnostic warns for paths through the code in which a value
11329 that could be under an attacker's control is used as the divisor
11330 in a division or modulus operation without being sanitized, so that
11331 an attacker could inject a division-by-zero.
11333 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
11335 @opindex Wanalyzer-tainted-offset
11336 @opindex Wno-analyzer-tainted-offset
11337 @item -Wno-analyzer-tainted-offset
11338 This warning requires @option{-fanalyzer} which enables it;
11339 use @option{-Wno-analyzer-tainted-offset} to disable it.
11341 This diagnostic warns for paths through the code in which a value
11342 that could be under an attacker's control is used as a pointer offset
11343 without being sanitized, so that an attacker could inject an out-of-bounds
11344 access.
11346 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
11348 @opindex Wanalyzer-tainted-size
11349 @opindex Wno-analyzer-tainted-size
11350 @item -Wno-analyzer-tainted-size
11351 This warning requires @option{-fanalyzer} which enables it;
11352 use @option{-Wno-analyzer-tainted-size} to disable it.
11354 This diagnostic warns for paths through the code in which a value
11355 that could be under an attacker's control is used as the size of
11356 an operation such as @code{memset} without being sanitized, so that an
11357 attacker could inject an out-of-bounds access.
11359 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11361 @opindex Wanalyzer-undefined-behavior-strtok
11362 @opindex Wno-analyzer-undefined-behavior-strtok
11363 @item -Wno-analyzer-undefined-behavior-strtok
11364 This warning requires @option{-fanalyzer}, which enables it; use
11365 @option{-Wno-analyzer-undefined-behavior-strtok} to disable it.
11367 This diagnostic warns for paths through the code in which a
11368 call is made to @code{strtok} with undefined behavior.
11370 Specifically, passing NULL as the first parameter for the initial
11371 call to @code{strtok} within a process has undefined behavior.
11373 @opindex Wanalyzer-unsafe-call-within-signal-handler
11374 @opindex Wno-analyzer-unsafe-call-within-signal-handler
11375 @item -Wno-analyzer-unsafe-call-within-signal-handler
11376 This warning requires @option{-fanalyzer}, which enables it; use
11377 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
11379 This diagnostic warns for paths through the code in which a
11380 function known to be async-signal-unsafe (such as @code{fprintf}) is
11381 called from a signal handler.
11383 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
11385 @opindex Wanalyzer-use-after-free
11386 @opindex Wno-analyzer-use-after-free
11387 @item -Wno-analyzer-use-after-free
11388 This warning requires @option{-fanalyzer}, which enables it; use
11389 @option{-Wno-analyzer-use-after-free} to disable it.
11391 This diagnostic warns for paths through the code in which a
11392 pointer is used after a deallocator is called on it: either @code{free},
11393 or a deallocator referenced by attribute @code{malloc}.
11395 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
11397 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
11398 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
11399 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
11400 This warning requires @option{-fanalyzer}, which enables it; use
11401 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
11402 to disable it.
11404 This diagnostic warns for paths through the code in which a pointer
11405 is dereferenced that points to a variable in a stale stack frame.
11407 @opindex Wanalyzer-va-arg-type-mismatch
11408 @opindex Wno-analyzer-va-arg-type-mismatch
11409 @item -Wno-analyzer-va-arg-type-mismatch
11410 This warning requires @option{-fanalyzer}, which enables it; use
11411 @option{-Wno-analyzer-va-arg-type-mismatch}
11412 to disable it.
11414 This diagnostic warns for interprocedural paths through the code for which
11415 the analyzer detects an attempt to use @code{va_arg} to extract a value
11416 passed to a variadic call, but uses a type that does not match that of
11417 the expression passed to the call.
11419 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11421 @opindex Wanalyzer-va-list-exhausted
11422 @opindex Wno-analyzer-va-list-exhausted
11423 @item -Wno-analyzer-va-list-exhausted
11424 This warning requires @option{-fanalyzer}, which enables it; use
11425 @option{-Wno-analyzer-va-list-exhausted}
11426 to disable it.
11428 This diagnostic warns for interprocedural paths through the code for which
11429 the analyzer detects an attempt to use @code{va_arg} to access the next
11430 value passed to a variadic call, but all of the values in the
11431 @code{va_list} have already been consumed.
11433 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11435 @opindex Wanalyzer-va-list-leak
11436 @opindex Wno-analyzer-va-list-leak
11437 @item -Wno-analyzer-va-list-leak
11438 This warning requires @option{-fanalyzer}, which enables it; use
11439 @option{-Wno-analyzer-va-list-leak}
11440 to disable it.
11442 This diagnostic warns for interprocedural paths through the code for which
11443 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11444 on a @code{va_list} without a corresponding call to @code{va_end}.
11446 @opindex Wanalyzer-va-list-use-after-va-end
11447 @opindex Wno-analyzer-va-list-use-after-va-end
11448 @item -Wno-analyzer-va-list-use-after-va-end
11449 This warning requires @option{-fanalyzer}, which enables it; use
11450 @option{-Wno-analyzer-va-list-use-after-va-end}
11451 to disable it.
11453 This diagnostic warns for interprocedural paths through the code for which
11454 the analyzer detects an attempt to use a @code{va_list}  after
11455 @code{va_end} has been called on it.
11456 @code{va_list}.
11458 @opindex Wanalyzer-write-to-const
11459 @opindex Wno-analyzer-write-to-const
11460 @item -Wno-analyzer-write-to-const
11461 This warning requires @option{-fanalyzer}, which enables it; use
11462 @option{-Wno-analyzer-write-to-const}
11463 to disable it.
11465 This diagnostic warns for paths through the code in which the analyzer
11466 detects an attempt to write through a pointer to a @code{const} object.
11467 However, the analyzer does not prioritize detection of such paths, so
11468 false negatives are more likely relative to other warnings.
11470 @opindex Wanalyzer-write-to-string-literal
11471 @opindex Wno-analyzer-write-to-string-literal
11472 @item -Wno-analyzer-write-to-string-literal
11473 This warning requires @option{-fanalyzer}, which enables it; use
11474 @option{-Wno-analyzer-write-to-string-literal}
11475 to disable it.
11477 This diagnostic warns for paths through the code in which the analyzer
11478 detects an attempt to write through a pointer to a string literal.
11479 However, the analyzer does not prioritize detection of such paths, so
11480 false negatives are more likely relative to other warnings.
11482 @opindex Wanalyzer-use-of-uninitialized-value
11483 @opindex Wno-analyzer-use-of-uninitialized-value
11484 @item -Wno-analyzer-use-of-uninitialized-value
11485 This warning requires @option{-fanalyzer}, which enables it; use
11486 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11488 This diagnostic warns for paths through the code in which an uninitialized
11489 value is used.
11491 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11493 @end table
11495 The analyzer has hardcoded knowledge about the behavior of the following
11496 memory-management functions:
11498 @itemize @bullet
11499 @item @code{alloca}
11500 @item The built-in functions @code{__builtin_alloc},
11501 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11502 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11503 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11504 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11505 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11506 @item @code{calloc}
11507 @item @code{free}
11508 @item @code{malloc}
11509 @item @code{memset}
11510 @item @code{operator delete}
11511 @item @code{operator delete []}
11512 @item @code{operator new}
11513 @item @code{operator new []}
11514 @item @code{realloc}
11515 @item @code{strdup}
11516 @item @code{strndup}
11517 @end itemize
11519 @noindent
11520 of the following functions for working with file descriptors:
11522 @itemize @bullet
11523 @item @code{open}
11524 @item @code{close}
11525 @item @code{creat}
11526 @item @code{dup}, @code{dup2} and @code{dup3}
11527 @item @code{isatty}
11528 @item @code{pipe}, and @code{pipe2}
11529 @item @code{read}
11530 @item @code{write}
11531 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11532 @end itemize
11534 @noindent
11535 of the following functions for working with @code{<stdio.h>} streams:
11536 @itemize @bullet
11537 @item The built-in functions @code{__builtin_fprintf},
11538 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11539 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11540 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11541 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11542 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11543 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11544 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11545 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11546 @code{__builtin_vprintf}
11547 @item @code{fopen}
11548 @item @code{fclose}
11549 @item @code{ferror}
11550 @item @code{fgets}
11551 @item @code{fgets_unlocked}
11552 @item @code{fileno}
11553 @item @code{fread}
11554 @item @code{getc}
11555 @item @code{getchar}
11556 @item @code{fprintf}
11557 @item @code{printf}
11558 @item @code{fwrite}
11559 @end itemize
11561 @noindent
11562 and of the following functions:
11564 @itemize @bullet
11565 @item The built-in functions @code{__builtin_expect},
11566 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11567 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11568 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11569 @code{__builtin_va_start}
11570 @item The GNU extensions @code{error} and @code{error_at_line}
11571 @item @code{getpass}
11572 @item @code{longjmp}
11573 @item @code{putenv}
11574 @item @code{setjmp}
11575 @item @code{siglongjmp}
11576 @item @code{signal}
11577 @item @code{sigsetjmp}
11578 @item @code{strcat}
11579 @item @code{strchr}
11580 @item @code{strlen}
11581 @end itemize
11583 In addition, various functions with an @code{__analyzer_} prefix have
11584 special meaning to the analyzer, described in the GCC Internals manual.
11586 Pertinent parameters for controlling the exploration are:
11587 @itemize @bullet
11588 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11589 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11590 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11591 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11592 @end itemize
11594 The following options control the analyzer.
11596 @table @gcctabopt
11598 @opindex fanalyzer-call-summaries
11599 @opindex fno-analyzer-call-summaries
11600 @item -fanalyzer-call-summaries
11601 Simplify interprocedural analysis by computing the effect of certain calls,
11602 rather than exploring all paths through the function from callsite to each
11603 possible return.
11605 If enabled, call summaries are only used for functions with more than one
11606 call site, and that are sufficiently complicated (as per
11607 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11609 @opindex fanalyzer-checker
11610 @item -fanalyzer-checker=@var{name}
11611 Restrict the analyzer to run just the named checker, and enable it.
11613 @opindex fanalyzer-debug-text-art
11614 @opindex fno-analyzer-debug-text-art
11615 @item -fanalyzer-debug-text-art-headings
11616 This option is intended for analyzer developers.  If enabled,
11617 the analyzer will add extra annotations to any diagrams it generates.
11619 @opindex fanalyzer-feasibility
11620 @opindex fno-analyzer-feasibility
11621 @item -fno-analyzer-feasibility
11622 This option is intended for analyzer developers.
11624 By default the analyzer verifies that there is a feasible control flow path
11625 for each diagnostic it emits: that the conditions that hold are not mutually
11626 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11627 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11628 debugging issues in this code.
11630 @opindex fanalyzer-fine-grained
11631 @opindex fno-analyzer-fine-grained
11632 @item -fanalyzer-fine-grained
11633 This option is intended for analyzer developers.
11635 Internally the analyzer builds an ``exploded graph'' that combines
11636 control flow graphs with data flow information.
11638 By default, an edge in this graph can contain the effects of a run
11639 of multiple statements within a basic block.  With
11640 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11642 @opindex fanalyzer-show-duplicate-count
11643 @opindex fno-analyzer-show-duplicate-count
11644 @item -fanalyzer-show-duplicate-count
11645 This option is intended for analyzer developers: if multiple diagnostics
11646 have been detected as being duplicates of each other, it emits a note when
11647 reporting the best diagnostic, giving the number of additional diagnostics
11648 that were suppressed by the deduplication logic.
11650 @opindex fanalyzer-show-events-in-system-headers
11651 @opindex fno-analyzer-show-events-in-system-headers
11652 @item -fanalyzer-show-events-in-system-headers
11653 By default the analyzer emits simplified diagnostics paths by hiding
11654 events fully located within a system header.
11655 With @option{-fanalyzer-show-events-in-system-headers} such
11656 events are no longer suppressed.
11658 @opindex fanalyzer-state-merge
11659 @opindex fno-analyzer-state-merge
11660 @item -fno-analyzer-state-merge
11661 This option is intended for analyzer developers.
11663 By default the analyzer attempts to simplify analysis by merging
11664 sufficiently similar states at each program point as it builds its
11665 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11666 merging can be suppressed, for debugging state-handling issues.
11668 @opindex fanalyzer-state-purge
11669 @opindex fno-analyzer-state-purge
11670 @item -fno-analyzer-state-purge
11671 This option is intended for analyzer developers.
11673 By default the analyzer attempts to simplify analysis by purging
11674 aspects of state at a program point that appear to no longer be relevant
11675 e.g. the values of locals that aren't accessed later in the function
11676 and which aren't relevant to leak analysis.
11678 With @option{-fno-analyzer-state-purge} this purging of state can
11679 be suppressed, for debugging state-handling issues.
11681 @opindex fanalyzer-suppress-followups
11682 @opindex fno-analyzer-suppress-followups
11683 @item -fno-analyzer-suppress-followups
11684 This option is intended for analyzer developers.
11686 By default the analyzer will stop exploring an execution path after
11687 encountering certain diagnostics, in order to avoid potentially issuing a
11688 cascade of follow-up diagnostics.
11690 The diagnostics that terminate analysis along a path are:
11692 @itemize
11693 @item @option{-Wanalyzer-null-argument}
11694 @item @option{-Wanalyzer-null-dereference}
11695 @item @option{-Wanalyzer-use-after-free}
11696 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11697 @item @option{-Wanalyzer-use-of-uninitialized-value}
11698 @end itemize
11700 With @option{-fno-analyzer-suppress-followups} the analyzer will
11701 continue to explore such paths even after such diagnostics, which may
11702 be helpful for debugging issues in the analyzer, or for microbenchmarks
11703 for detecting undefined behavior.
11705 @opindex fanalyzer-transitivity
11706 @opindex fno-analyzer-transitivity
11707 @item -fanalyzer-transitivity
11708 This option enables transitivity of constraints within the analyzer.
11710 @opindex fanalyzer-undo-inlining
11711 @opindex fno-analyzer-undo-inlining
11712 @item -fno-analyzer-undo-inlining
11713 This option is intended for analyzer developers.
11715 @option{-fanalyzer} runs relatively late compared to other code analysis
11716 tools, and some optimizations have already been applied to the code.  In
11717 particular function inlining may have occurred, leading to the
11718 interprocedural execution paths emitted by the analyzer containing
11719 function frames that don't correspond to those in the original source
11720 code.
11722 By default the analyzer attempts to reconstruct the original function
11723 frames, and to emit events showing the inlined calls.
11725 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11726 the original frame information can be disabled, which may be of help
11727 when debugging issues in the analyzer.
11729 @item -fanalyzer-verbose-edges
11730 This option is intended for analyzer developers.  It enables more
11731 verbose, lower-level detail in the descriptions of control flow
11732 within diagnostic paths.
11734 @item -fanalyzer-verbose-state-changes
11735 This option is intended for analyzer developers.  It enables more
11736 verbose, lower-level detail in the descriptions of events relating
11737 to state machines within diagnostic paths.
11739 @item -fanalyzer-verbosity=@var{level}
11740 This option controls the complexity of the control flow paths that are
11741 emitted for analyzer diagnostics.
11743 The @var{level} can be one of:
11745 @table @samp
11746 @item 0
11747 At this level, interprocedural call and return events are displayed,
11748 along with the most pertinent state-change events relating to
11749 a diagnostic.  For example, for a double-@code{free} diagnostic,
11750 both calls to @code{free} will be shown.
11752 @item 1
11753 As per the previous level, but also show events for the entry
11754 to each function.
11756 @item 2
11757 As per the previous level, but also show events relating to
11758 control flow that are significant to triggering the issue
11759 (e.g. ``true path taken'' at a conditional).
11761 This level is the default.
11763 @item 3
11764 As per the previous level, but show all control flow events, not
11765 just significant ones.
11767 @item 4
11768 This level is intended for analyzer developers; it adds various
11769 other events intended for debugging the analyzer.
11771 @end table
11773 @opindex fdump-analyzer
11774 @item -fdump-analyzer
11775 Dump internal details about what the analyzer is doing to
11776 @file{@var{file}.analyzer.txt}.
11777 @option{-fdump-analyzer-stderr} overrides this option.
11779 @opindex fdump-analyzer-stderr
11780 @item -fdump-analyzer-stderr
11781 Dump internal details about what the analyzer is doing to stderr.
11782 This option overrides @option{-fdump-analyzer}.
11784 @opindex fdump-analyzer-callgraph
11785 @item -fdump-analyzer-callgraph
11786 Dump a representation of the call graph suitable for viewing with
11787 GraphViz to @file{@var{file}.callgraph.dot}.
11789 @opindex fdump-analyzer-exploded-graph
11790 @item -fdump-analyzer-exploded-graph
11791 Dump a representation of the ``exploded graph'' suitable for viewing with
11792 GraphViz to @file{@var{file}.eg.dot}.
11793 Nodes are color-coded based on state-machine states to emphasize
11794 state changes.
11796 @opindex dump-analyzer-exploded-nodes
11797 @item -fdump-analyzer-exploded-nodes
11798 Emit diagnostics showing where nodes in the ``exploded graph'' are
11799 in relation to the program source.
11801 @opindex dump-analyzer-exploded-nodes-2
11802 @item -fdump-analyzer-exploded-nodes-2
11803 Dump a textual representation of the ``exploded graph'' to
11804 @file{@var{file}.eg.txt}.
11806 @opindex dump-analyzer-exploded-nodes-3
11807 @item -fdump-analyzer-exploded-nodes-3
11808 Dump a textual representation of the ``exploded graph'' to
11809 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11810 This is typically a large number of dump files.
11812 @opindex fdump-analyzer-exploded-paths
11813 @item -fdump-analyzer-exploded-paths
11814 Dump a textual representation of the ``exploded path'' for each
11815 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11817 @opindex dump-analyzer-feasibility
11818 @item -fdump-analyzer-feasibility
11819 Dump internal details about the analyzer's search for feasible paths.
11820 The details are written in a form suitable for viewing with GraphViz
11821 to filenames of the form @file{@var{file}.*.fg.dot},
11822 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11824 @opindex dump-analyzer-infinite-loop
11825 @item -fdump-analyzer-infinite-loop
11826 Dump internal details about the analyzer's search for infinite loops.
11827 The details are written in a form suitable for viewing with GraphViz
11828 to filenames of the form @file{@var{file}.*.infinite-loop.dot}.
11830 @opindex fdump-analyzer-json
11831 @item -fdump-analyzer-json
11832 Dump a compressed JSON representation of analyzer internals to
11833 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11834 to change.
11836 @opindex fdump-analyzer-state-purge
11837 @item -fdump-analyzer-state-purge
11838 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11839 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11840 graph with information on what state will be purged at each node.
11841 The graph is written to @file{@var{file}.state-purge.dot}.
11843 @opindex fdump-analyzer-supergraph
11844 @item -fdump-analyzer-supergraph
11845 Dump representations of the ``supergraph'' suitable for viewing with
11846 GraphViz to @file{@var{file}.supergraph.dot} and to
11847 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11848 control flow graphs in the program, with interprocedural edges for
11849 calls and returns.  The second dump contains annotations showing nodes
11850 in the ``exploded graph'' and diagnostics associated with them.
11852 @opindex fdump-analyzer-untracked
11853 @item -fdump-analyzer-untracked
11854 Emit custom warnings with internal details intended for analyzer developers.
11856 @end table
11858 @node Debugging Options
11859 @section Options for Debugging Your Program
11860 @cindex options, debugging
11861 @cindex debugging information options
11863 To tell GCC to emit extra information for use by a debugger, in almost 
11864 all cases you need only to add @option{-g} to your other options.  Some debug
11865 formats can co-exist (like DWARF with CTF) when each of them is enabled
11866 explicitly by adding the respective command line option to your other options.
11868 GCC allows you to use @option{-g} with
11869 @option{-O}.  The shortcuts taken by optimized code may occasionally
11870 be surprising: some variables you declared may not exist
11871 at all; flow of control may briefly move where you did not expect it;
11872 some statements may not be executed because they compute constant
11873 results or their values are already at hand; some statements may
11874 execute in different places because they have been moved out of loops.
11875 Nevertheless it is possible to debug optimized output.  This makes
11876 it reasonable to use the optimizer for programs that might have bugs.
11878 If you are not using some other optimization option, consider
11879 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11880 With no @option{-O} option at all, some compiler passes that collect
11881 information useful for debugging do not run at all, so that
11882 @option{-Og} may result in a better debugging experience.
11884 @table @gcctabopt
11885 @opindex g
11886 @item -g
11887 Produce debugging information in the operating system's native format
11888 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11889 information.
11891 On most systems that use stabs format, @option{-g} enables use of extra
11892 debugging information that only GDB can use; this extra information
11893 makes debugging work better in GDB but probably makes other debuggers
11894 crash or refuse to read the program.  If you want to control for certain whether
11895 to generate the extra information, use @option{-gvms} (see below).
11897 @opindex ggdb
11898 @item -ggdb
11899 Produce debugging information for use by GDB@.  This means to use the
11900 most expressive format available (DWARF, stabs, or the native format
11901 if neither of those are supported), including GDB extensions if at all
11902 possible.
11904 @opindex gdwarf
11905 @item -gdwarf
11906 @itemx -gdwarf-@var{version}
11907 Produce debugging information in DWARF format (if that is supported).
11908 The value of @var{version} may be either 2, 3, 4 or 5; the default
11909 version for most targets is 5 (with the exception of VxWorks, TPF and
11910 Darwin / macOS, which default to version 2, and AIX, which defaults
11911 to version 4).
11913 Note that with DWARF Version 2, some ports require and always
11914 use some non-conflicting DWARF 3 extensions in the unwind tables.
11916 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11917 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11919 GCC no longer supports DWARF Version 1, which is substantially
11920 different than Version 2 and later.  For historical reasons, some
11921 other DWARF-related options such as
11922 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11923 in their names, but apply to all currently-supported versions of DWARF.
11925 @opindex gbtf
11926 @item -gbtf
11927 Request BTF debug information.  BTF is the default debugging format for the
11928 eBPF target.  On other targets, like x86, BTF debug information can be
11929 generated along with DWARF debug information when both of the debug formats are
11930 enabled explicitly via their respective command line options.
11932 @opindex gctf
11933 @item -gctf
11934 @itemx -gctf@var{level}
11935 Request CTF debug information and use level to specify how much CTF debug
11936 information should be produced.  If @option{-gctf} is specified
11937 without a value for level, the default level of CTF debug information is 2.
11939 CTF debug information can be generated along with DWARF debug information when
11940 both of the debug formats are enabled explicitly via their respective command
11941 line options.
11943 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11944 negates @option{-gctf}.
11946 Level 1 produces CTF information for tracebacks only.  This includes callsite
11947 information, but does not include type information.
11949 Level 2 produces type information for entities (functions, data objects etc.)
11950 at file-scope or global-scope only.
11952 @opindex gvms
11953 @item -gvms
11954 Produce debugging information in Alpha/VMS debug format (if that is
11955 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11957 @item -gcodeview
11958 @opindex gcodeview
11959 Produce debugging information in CodeView debug format (if that is
11960 supported).  This is the format used by Microsoft Visual C++ on
11961 Windows.
11963 @item -g@var{level}
11964 @itemx -ggdb@var{level}
11965 @itemx -gvms@var{level}
11966 Request debugging information and also use @var{level} to specify how
11967 much information.  The default level is 2.
11969 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11970 @option{-g}.
11972 Level 1 produces minimal information, enough for making backtraces in
11973 parts of the program that you don't plan to debug.  This includes
11974 descriptions of functions and external variables, and line number
11975 tables, but no information about local variables.
11977 Level 3 includes extra information, such as all the macro definitions
11978 present in the program.  Some debuggers support macro expansion when
11979 you use @option{-g3}.
11981 If you use multiple @option{-g} options, with or without level numbers,
11982 the last such option is the one that is effective.
11984 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11985 confusion with @option{-gdwarf-@var{level}}.
11986 Instead use an additional @option{-g@var{level}} option to change the
11987 debug level for DWARF.
11989 @opindex feliminate-unused-debug-symbols
11990 @opindex fno-eliminate-unused-debug-symbols
11991 @item -fno-eliminate-unused-debug-symbols
11992 By default, no debug information is produced for symbols that are not actually
11993 used. Use this option if you want debug information for all symbols.
11995 @opindex femit-class-debug-always
11996 @item -femit-class-debug-always
11997 Instead of emitting debugging information for a C++ class in only one
11998 object file, emit it in all object files using the class.  This option
11999 should be used only with debuggers that are unable to handle the way GCC
12000 normally emits debugging information for classes because using this
12001 option increases the size of debugging information by as much as a
12002 factor of two.
12004 @opindex fmerge-debug-strings
12005 @opindex fno-merge-debug-strings
12006 @item -fno-merge-debug-strings
12007 Direct the linker to not merge together strings in the debugging
12008 information that are identical in different object files.  Merging is
12009 not supported by all assemblers or linkers.  Merging decreases the size
12010 of the debug information in the output file at the cost of increasing
12011 link processing time.  Merging is enabled by default.
12013 @opindex fdebug-prefix-map
12014 @item -fdebug-prefix-map=@var{old}=@var{new}
12015 When compiling files residing in directory @file{@var{old}}, record
12016 debugging information describing them as if the files resided in
12017 directory @file{@var{new}} instead.  This can be used to replace a
12018 build-time path with an install-time path in the debug info.  It can
12019 also be used to change an absolute path to a relative path by using
12020 @file{.} for @var{new}.  This can give more reproducible builds, which
12021 are location independent, but may require an extra command to tell GDB
12022 where to find the source files. See also @option{-ffile-prefix-map}
12023 and @option{-fcanon-prefix-map}.
12025 @opindex fvar-tracking
12026 @item -fvar-tracking
12027 Run variable tracking pass.  It computes where variables are stored at each
12028 position in code.  Better debugging information is then generated
12029 (if the debugging information format supports this information).
12031 It is enabled by default when compiling with optimization (@option{-Os},
12032 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
12033 the debug info format supports it.
12035 @opindex fvar-tracking-assignments
12036 @opindex fno-var-tracking-assignments
12037 @item -fvar-tracking-assignments
12038 Annotate assignments to user variables early in the compilation and
12039 attempt to carry the annotations over throughout the compilation all the
12040 way to the end, in an attempt to improve debug information while
12041 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
12043 It can be enabled even if var-tracking is disabled, in which case
12044 annotations are created and maintained, but discarded at the end.
12045 By default, this flag is enabled together with @option{-fvar-tracking},
12046 except when selective scheduling is enabled.
12048 @opindex gsplit-dwarf
12049 @item -gsplit-dwarf
12050 If DWARF debugging information is enabled, separate as much debugging
12051 information as possible into a separate output file with the extension
12052 @file{.dwo}.  This option allows the build system to avoid linking files with
12053 debug information.  To be useful, this option requires a debugger capable of
12054 reading @file{.dwo} files.
12056 @opindex gdwarf32
12057 @opindex gdwarf64
12058 @item -gdwarf32
12059 @itemx -gdwarf64
12060 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
12061 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
12062 DWARF format.  The default is target specific, on most targets it is
12063 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
12064 can't support more than 2GiB of debug information in any of the DWARF
12065 debug information sections.  The 64-bit DWARF format allows larger debug
12066 information and might not be well supported by all consumers yet.
12068 @opindex gdescribe-dies
12069 @item -gdescribe-dies
12070 Add description attributes to some DWARF DIEs that have no name attribute,
12071 such as artificial variables, external references and call site
12072 parameter DIEs.
12074 @opindex gpubnames
12075 @item -gpubnames
12076 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
12078 @opindex ggnu-pubnames
12079 @item -ggnu-pubnames
12080 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
12081 suitable for conversion into a GDB@ index.  This option is only useful
12082 with a linker that can produce GDB@ index version 7.
12084 @opindex fdebug-types-section
12085 @opindex fno-debug-types-section
12086 @item -fdebug-types-section
12087 When using DWARF Version 4 or higher, type DIEs can be put into
12088 their own @code{.debug_types} section instead of making them part of the
12089 @code{.debug_info} section.  It is more efficient to put them in a separate
12090 comdat section since the linker can then remove duplicates.
12091 But not all DWARF consumers support @code{.debug_types} sections yet
12092 and on some objects @code{.debug_types} produces larger instead of smaller
12093 debugging information.
12095 @opindex grecord-gcc-switches
12096 @opindex gno-record-gcc-switches
12097 @item -grecord-gcc-switches
12098 @itemx -gno-record-gcc-switches
12099 This switch causes the command-line options used to invoke the
12100 compiler that may affect code generation to be appended to the
12101 DW_AT_producer attribute in DWARF debugging information.  The options
12102 are concatenated with spaces separating them from each other and from
12103 the compiler version.  
12104 It is enabled by default.
12105 See also @option{-frecord-gcc-switches} for another
12106 way of storing compiler options into the object file.  
12108 @opindex gstrict-dwarf
12109 @item -gstrict-dwarf
12110 Disallow using extensions of later DWARF standard version than selected
12111 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
12112 DWARF extensions from later standard versions is allowed.
12114 @opindex gno-strict-dwarf
12115 @item -gno-strict-dwarf
12116 Allow using extensions of later DWARF standard version than selected with
12117 @option{-gdwarf-@var{version}}.
12119 @opindex gas-loc-support
12120 @item -gas-loc-support
12121 Inform the compiler that the assembler supports @code{.loc} directives.
12122 It may then use them for the assembler to generate DWARF2+ line number
12123 tables.
12125 This is generally desirable, because assembler-generated line-number
12126 tables are a lot more compact than those the compiler can generate
12127 itself.
12129 This option will be enabled by default if, at GCC configure time, the
12130 assembler was found to support such directives.
12132 @opindex gno-as-loc-support
12133 @item -gno-as-loc-support
12134 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
12135 line number tables are to be generated.
12137 @opindex gas-locview-support
12138 @item -gas-locview-support
12139 Inform the compiler that the assembler supports @code{view} assignment
12140 and reset assertion checking in @code{.loc} directives.
12142 This option will be enabled by default if, at GCC configure time, the
12143 assembler was found to support them.
12145 @item -gno-as-locview-support
12146 Force GCC to assign view numbers internally, if
12147 @option{-gvariable-location-views} are explicitly requested.
12149 @opindex gcolumn-info
12150 @opindex gno-column-info
12151 @item -gcolumn-info
12152 @itemx -gno-column-info
12153 Emit location column information into DWARF debugging information, rather
12154 than just file and line.
12155 This option is enabled by default.
12157 @opindex gstatement-frontiers
12158 @opindex gno-statement-frontiers
12159 @item -gstatement-frontiers
12160 @itemx -gno-statement-frontiers
12161 This option causes GCC to create markers in the internal representation
12162 at the beginning of statements, and to keep them roughly in place
12163 throughout compilation, using them to guide the output of @code{is_stmt}
12164 markers in the line number table.  This is enabled by default when
12165 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
12166 @dots{}), and outputting DWARF 2 debug information at the normal level.
12168 @opindex gvariable-location-views
12169 @opindex gvariable-location-views=incompat5
12170 @opindex gno-variable-location-views
12171 @item -gvariable-location-views
12172 @itemx -gvariable-location-views=incompat5
12173 @itemx -gno-variable-location-views
12174 Augment variable location lists with progressive view numbers implied
12175 from the line number table.  This enables debug information consumers to
12176 inspect state at certain points of the program, even if no instructions
12177 associated with the corresponding source locations are present at that
12178 point.  If the assembler lacks support for view numbers in line number
12179 tables, this will cause the compiler to emit the line number table,
12180 which generally makes them somewhat less compact.  The augmented line
12181 number tables and location lists are fully backward-compatible, so they
12182 can be consumed by debug information consumers that are not aware of
12183 these augmentations, but they won't derive any benefit from them either.
12185 This is enabled by default when outputting DWARF 2 debug information at
12186 the normal level, as long as there is assembler support,
12187 @option{-fvar-tracking-assignments} is enabled and
12188 @option{-gstrict-dwarf} is not.  When assembler support is not
12189 available, this may still be enabled, but it will force GCC to output
12190 internal line number tables, and if
12191 @option{-ginternal-reset-location-views} is not enabled, that will most
12192 certainly lead to silently mismatching location views.
12194 There is a proposed representation for view numbers that is not backward
12195 compatible with the location list format introduced in DWARF 5, that can
12196 be enabled with @option{-gvariable-location-views=incompat5}.  This
12197 option may be removed in the future, is only provided as a reference
12198 implementation of the proposed representation.  Debug information
12199 consumers are not expected to support this extended format, and they
12200 would be rendered unable to decode location lists using it.
12202 @opindex ginternal-reset-location-views
12203 @opindex gno-internal-reset-location-views
12204 @item -ginternal-reset-location-views
12205 @itemx -gno-internal-reset-location-views
12206 Attempt to determine location views that can be omitted from location
12207 view lists.  This requires the compiler to have very accurate insn
12208 length estimates, which isn't always the case, and it may cause
12209 incorrect view lists to be generated silently when using an assembler
12210 that does not support location view lists.  The GNU assembler will flag
12211 any such error as a @code{view number mismatch}.  This is only enabled
12212 on ports that define a reliable estimation function.
12214 @opindex ginline-points
12215 @opindex gno-inline-points
12216 @item -ginline-points
12217 @itemx -gno-inline-points
12218 Generate extended debug information for inlined functions.  Location
12219 view tracking markers are inserted at inlined entry points, so that
12220 address and view numbers can be computed and output in debug
12221 information.  This can be enabled independently of location views, in
12222 which case the view numbers won't be output, but it can only be enabled
12223 along with statement frontiers, and it is only enabled by default if
12224 location views are enabled.
12226 @opindex gz
12227 @item -gz@r{[}=@var{type}@r{]}
12228 Produce compressed debug sections in DWARF format, if that is supported.
12229 If @var{type} is not given, the default type depends on the capabilities
12230 of the assembler and linker used.  @var{type} may be one of
12231 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
12232 compression in ELF gABI format).  If the linker doesn't support writing
12233 compressed debug sections, the option is rejected.  Otherwise, if the
12234 assembler does not support them, @option{-gz} is silently ignored when
12235 producing object files.
12237 @opindex femit-struct-debug-baseonly
12238 @item -femit-struct-debug-baseonly
12239 Emit debug information for struct-like types
12240 only when the base name of the compilation source file
12241 matches the base name of file in which the struct is defined.
12243 This option substantially reduces the size of debugging information,
12244 but at significant potential loss in type information to the debugger.
12245 See @option{-femit-struct-debug-reduced} for a less aggressive option.
12246 See @option{-femit-struct-debug-detailed} for more detailed control.
12248 This option works only with DWARF debug output.
12250 @opindex femit-struct-debug-reduced
12251 @item -femit-struct-debug-reduced
12252 Emit debug information for struct-like types
12253 only when the base name of the compilation source file
12254 matches the base name of file in which the type is defined,
12255 unless the struct is a template or defined in a system header.
12257 This option significantly reduces the size of debugging information,
12258 with some potential loss in type information to the debugger.
12259 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
12260 See @option{-femit-struct-debug-detailed} for more detailed control.
12262 This option works only with DWARF debug output.
12264 @opindex femit-struct-debug-detailed
12265 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
12266 Specify the struct-like types
12267 for which the compiler generates debug information.
12268 The intent is to reduce duplicate struct debug information
12269 between different object files within the same program.
12271 This option is a detailed version of
12272 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
12273 which serves for most needs.
12275 A specification has the syntax@*
12276 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
12278 The optional first word limits the specification to
12279 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
12280 A struct type is used directly when it is the type of a variable, member.
12281 Indirect uses arise through pointers to structs.
12282 That is, when use of an incomplete struct is valid, the use is indirect.
12283 An example is
12284 @samp{struct one direct; struct two * indirect;}.
12286 The optional second word limits the specification to
12287 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
12288 Generic structs are a bit complicated to explain.
12289 For C++, these are non-explicit specializations of template classes,
12290 or non-template classes within the above.
12291 Other programming languages have generics,
12292 but @option{-femit-struct-debug-detailed} does not yet implement them.
12294 The third word specifies the source files for those
12295 structs for which the compiler should emit debug information.
12296 The values @samp{none} and @samp{any} have the normal meaning.
12297 The value @samp{base} means that
12298 the base of name of the file in which the type declaration appears
12299 must match the base of the name of the main compilation file.
12300 In practice, this means that when compiling @file{foo.c}, debug information
12301 is generated for types declared in that file and @file{foo.h},
12302 but not other header files.
12303 The value @samp{sys} means those types satisfying @samp{base}
12304 or declared in system or compiler headers.
12306 You may need to experiment to determine the best settings for your application.
12308 The default is @option{-femit-struct-debug-detailed=all}.
12310 This option works only with DWARF debug output.
12312 @opindex fdwarf2-cfi-asm
12313 @opindex fno-dwarf2-cfi-asm
12314 @item -fno-dwarf2-cfi-asm
12315 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
12316 instead of using GAS @code{.cfi_*} directives.
12318 @opindex feliminate-unused-debug-types
12319 @opindex fno-eliminate-unused-debug-types
12320 @item -fno-eliminate-unused-debug-types
12321 Normally, when producing DWARF output, GCC avoids producing debug symbol 
12322 output for types that are nowhere used in the source file being compiled.
12323 Sometimes it is useful to have GCC emit debugging
12324 information for all types declared in a compilation
12325 unit, regardless of whether or not they are actually used
12326 in that compilation unit, for example 
12327 if, in the debugger, you want to cast a value to a type that is
12328 not actually used in your program (but is declared).  More often,
12329 however, this results in a significant amount of wasted space.
12330 @end table
12332 @node Optimize Options
12333 @section Options That Control Optimization
12334 @cindex optimize options
12335 @cindex options, optimization
12337 These options control various sorts of optimizations.
12339 Without any optimization option, the compiler's goal is to reduce the
12340 cost of compilation and to make debugging produce the expected
12341 results.  Statements are independent: if you stop the program with a
12342 breakpoint between statements, you can then assign a new value to any
12343 variable or change the program counter to any other statement in the
12344 function and get exactly the results you expect from the source
12345 code.
12347 Turning on optimization flags makes the compiler attempt to improve
12348 the performance and/or code size at the expense of compilation time
12349 and possibly the ability to debug the program.
12351 The compiler performs optimization based on the knowledge it has of the
12352 program.  Compiling multiple files at once to a single output file mode allows
12353 the compiler to use information gained from all of the files when compiling
12354 each of them.
12356 Not all optimizations are controlled directly by a flag.  Only
12357 optimizations that have a flag are listed in this section.
12359 Most optimizations are completely disabled at @option{-O0} or if an
12360 @option{-O} level is not set on the command line, even if individual
12361 optimization flags are specified.  Similarly, @option{-Og} suppresses
12362 many optimization passes.
12364 Depending on the target and how GCC was configured, a slightly different
12365 set of optimizations may be enabled at each @option{-O} level than
12366 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
12367 to find out the exact set of optimizations that are enabled at each level.
12368 @xref{Overall Options}, for examples.
12370 @table @gcctabopt
12371 @opindex O
12372 @opindex O1
12373 @item -O
12374 @itemx -O1
12375 Optimize.  Optimizing compilation takes somewhat more time, and a lot
12376 more memory for a large function.
12378 With @option{-O}, the compiler tries to reduce code size and execution
12379 time, without performing any optimizations that take a great deal of
12380 compilation time.
12382 @c Note that in addition to the default_options_table list in opts.cc,
12383 @c several optimization flags default to true but control optimization
12384 @c passes that are explicitly disabled at -O0.
12386 @option{-O} turns on the following optimization flags:
12388 @c Please keep the following list alphabetized.
12389 @gccoptlist{-fauto-inc-dec
12390 -fbranch-count-reg
12391 -fcombine-stack-adjustments
12392 -fcompare-elim
12393 -fcprop-registers
12394 -fdce
12395 -fdefer-pop
12396 -fdelayed-branch
12397 -fdse
12398 -fforward-propagate
12399 -fguess-branch-probability
12400 -fif-conversion
12401 -fif-conversion2
12402 -finline-functions-called-once
12403 -fipa-modref
12404 -fipa-profile
12405 -fipa-pure-const
12406 -fipa-reference
12407 -fipa-reference-addressable
12408 -fmerge-constants
12409 -fmove-loop-invariants
12410 -fmove-loop-stores
12411 -fomit-frame-pointer
12412 -freorder-blocks
12413 -fshrink-wrap
12414 -fshrink-wrap-separate
12415 -fsplit-wide-types
12416 -fssa-backprop
12417 -fssa-phiopt
12418 -ftree-bit-ccp
12419 -ftree-ccp
12420 -ftree-ch
12421 -ftree-coalesce-vars
12422 -ftree-copy-prop
12423 -ftree-dce
12424 -ftree-dominator-opts
12425 -ftree-dse
12426 -ftree-forwprop
12427 -ftree-fre
12428 -ftree-phiprop
12429 -ftree-pta
12430 -ftree-scev-cprop
12431 -ftree-sink
12432 -ftree-slsr
12433 -ftree-sra
12434 -ftree-ter
12435 -funit-at-a-time}
12437 @opindex O2
12438 @item -O2
12439 Optimize even more.  GCC performs nearly all supported optimizations
12440 that do not involve a space-speed tradeoff.
12441 As compared to @option{-O}, this option increases both compilation time
12442 and the performance of the generated code.
12444 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12445 also turns on the following optimization flags:
12447 @c Please keep the following list alphabetized!
12448 @gccoptlist{-falign-functions  -falign-jumps
12449 -falign-labels  -falign-loops
12450 -fcaller-saves
12451 -fcode-hoisting
12452 -fcrossjumping
12453 -fcse-follow-jumps  -fcse-skip-blocks
12454 -fdelete-null-pointer-checks
12455 -fdevirtualize  -fdevirtualize-speculatively
12456 -fexpensive-optimizations
12457 -ffinite-loops
12458 -fgcse  -fgcse-lm
12459 -fhoist-adjacent-loads
12460 -finline-functions
12461 -finline-small-functions
12462 -findirect-inlining
12463 -fipa-bit-cp  -fipa-cp  -fipa-icf
12464 -fipa-ra  -fipa-sra  -fipa-vrp
12465 -fisolate-erroneous-paths-dereference
12466 -flra-remat
12467 -foptimize-sibling-calls
12468 -foptimize-strlen
12469 -fpartial-inlining
12470 -fpeephole2
12471 -freorder-blocks-algorithm=stc
12472 -freorder-blocks-and-partition  -freorder-functions
12473 -frerun-cse-after-loop
12474 -fschedule-insns  -fschedule-insns2
12475 -fsched-interblock  -fsched-spec
12476 -fstore-merging
12477 -fstrict-aliasing
12478 -fthread-jumps
12479 -ftree-builtin-call-dce
12480 -ftree-loop-vectorize
12481 -ftree-pre
12482 -ftree-slp-vectorize
12483 -ftree-switch-conversion  -ftree-tail-merge
12484 -ftree-vrp
12485 -fvect-cost-model=very-cheap}
12487 Please note the warning under @option{-fgcse} about
12488 invoking @option{-O2} on programs that use computed gotos.
12490 @opindex O3
12491 @item -O3
12492 Optimize yet more.  @option{-O3} turns on all optimizations specified
12493 by @option{-O2} and also turns on the following optimization flags:
12495 @c Please keep the following list alphabetized!
12496 @gccoptlist{-fgcse-after-reload
12497 -fipa-cp-clone
12498 -floop-interchange
12499 -floop-unroll-and-jam
12500 -fpeel-loops
12501 -fpredictive-commoning
12502 -fsplit-loops
12503 -fsplit-paths
12504 -ftree-loop-distribution
12505 -ftree-partial-pre
12506 -funswitch-loops
12507 -fvect-cost-model=dynamic
12508 -fversion-loops-for-strides}
12510 @opindex O0
12511 @item -O0
12512 Reduce compilation time and make debugging produce the expected
12513 results.  This is the default.
12515 @opindex Os
12516 @item -Os
12517 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12518 except those that often increase code size:
12520 @gccoptlist{-falign-functions  -falign-jumps
12521 -falign-labels  -falign-loops
12522 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12524 It also enables @option{-finline-functions}, causes the compiler to tune for
12525 code size rather than execution speed, and performs further optimizations
12526 designed to reduce code size.
12528 @opindex Ofast
12529 @item -Ofast
12530 Disregard strict standards compliance.  @option{-Ofast} enables all
12531 @option{-O3} optimizations.  It also enables optimizations that are not
12532 valid for all standard-compliant programs.
12533 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12534 and the Fortran-specific @option{-fstack-arrays}, unless
12535 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12536 It turns off @option{-fsemantic-interposition}.
12538 @opindex Og
12539 @item -Og
12540 Optimize debugging experience.  @option{-Og} should be the optimization
12541 level of choice for the standard edit-compile-debug cycle, offering
12542 a reasonable level of optimization while maintaining fast compilation
12543 and a good debugging experience.  It is a better choice than @option{-O0}
12544 for producing debuggable code because some compiler passes
12545 that collect debug information are disabled at @option{-O0}.
12547 Like @option{-O0}, @option{-Og} completely disables a number of 
12548 optimization passes so that individual options controlling them have
12549 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12550 optimization flags except for those that may interfere with debugging:
12552 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12553 -fdse  -fif-conversion  -fif-conversion2
12554 -finline-functions-called-once
12555 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12556 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12558 @opindex Oz
12559 @item -Oz
12560 Optimize aggressively for size rather than speed.  This may increase
12561 the number of instructions executed if those instructions require
12562 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12563 including enabling most @option{-O2} optimizations.
12565 @end table
12567 If you use multiple @option{-O} options, with or without level numbers,
12568 the last such option is the one that is effective.
12570 Options of the form @option{-f@var{flag}} specify machine-independent
12571 flags.  Most flags have both positive and negative forms; the negative
12572 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12573 below, only one of the forms is listed---the one you typically 
12574 use.  You can figure out the other form by either removing @samp{no-}
12575 or adding it.
12577 The following options control specific optimizations.  They are either
12578 activated by @option{-O} options or are related to ones that are.  You
12579 can use the following flags in the rare cases when ``fine-tuning'' of
12580 optimizations to be performed is desired.
12582 @table @gcctabopt
12583 @opindex fno-defer-pop
12584 @opindex fdefer-pop
12585 @item -fno-defer-pop
12586 For machines that must pop arguments after a function call, always pop 
12587 the arguments as soon as each function returns.  
12588 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12589 this allows the compiler to let arguments accumulate on the stack for several
12590 function calls and pop them all at once.
12592 @opindex fforward-propagate
12593 @item -fforward-propagate
12594 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12595 instructions and checks if the result can be simplified.  If loop unrolling
12596 is active, two passes are performed and the second is scheduled after
12597 loop unrolling.
12599 This option is enabled by default at optimization levels @option{-O1},
12600 @option{-O2}, @option{-O3}, @option{-Os}.
12602 @opindex ffp-contract
12603 @item -ffp-contract=@var{style}
12604 @option{-ffp-contract=off} disables floating-point expression contraction.
12605 @option{-ffp-contract=fast} enables floating-point expression contraction
12606 such as forming of fused multiply-add operations if the target has
12607 native support for them.
12608 @option{-ffp-contract=on} enables floating-point expression contraction
12609 if allowed by the language standard.  This is implemented for C and C++,
12610 where it enables contraction within one expression, but not across
12611 different statements.
12613 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12614 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12616 @opindex fomit-frame-pointer
12617 @item -fomit-frame-pointer
12618 Omit the frame pointer in functions that don't need one.  This avoids the
12619 instructions to save, set up and restore the frame pointer; on many targets
12620 it also makes an extra register available.
12622 On some targets this flag has no effect because the standard calling sequence
12623 always uses a frame pointer, so it cannot be omitted.
12625 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12626 is used in all functions.  Several targets always omit the frame pointer in
12627 leaf functions.
12629 Enabled by default at @option{-O1} and higher.
12631 @opindex foptimize-sibling-calls
12632 @item -foptimize-sibling-calls
12633 Optimize sibling and tail recursive calls.
12635 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12637 @opindex foptimize-strlen
12638 @item -foptimize-strlen
12639 Optimize various standard C string functions (e.g.@: @code{strlen},
12640 @code{strchr} or @code{strcpy}) and
12641 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12643 Enabled at levels @option{-O2}, @option{-O3}.
12645 @opindex finline-stringops
12646 @item -finline-stringops[=@var{fn}]
12647 Expand memory and string operations (for now, only @code{memset})
12648 inline, even when the length is variable or big enough as to require
12649 looping.  This is most useful along with @option{-ffreestanding} and
12650 @option{-fno-builtin}.
12652 In some circumstances, it enables the compiler to generate code that
12653 takes advantage of known alignment and length multipliers, but even then
12654 it may be less efficient than optimized runtime implementations, and
12655 grow code size so much that even a less performant but shared
12656 implementation runs faster due to better use of code caches.  This
12657 option is disabled by default.
12659 @opindex fno-inline
12660 @opindex finline
12661 @item -fno-inline
12662 Do not expand any functions inline apart from those marked with
12663 the @code{always_inline} attribute.  This is the default when not
12664 optimizing.
12666 Single functions can be exempted from inlining by marking them
12667 with the @code{noinline} attribute.
12669 @opindex finline-small-functions
12670 @item -finline-small-functions
12671 Integrate functions into their callers when their body is smaller than expected
12672 function call code (so overall size of program gets smaller).  The compiler
12673 heuristically decides which functions are simple enough to be worth integrating
12674 in this way.  This inlining applies to all functions, even those not declared
12675 inline.
12677 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12679 @opindex findirect-inlining
12680 @item -findirect-inlining
12681 Inline also indirect calls that are discovered to be known at compile
12682 time thanks to previous inlining.  This option has any effect only
12683 when inlining itself is turned on by the @option{-finline-functions}
12684 or @option{-finline-small-functions} options.
12686 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12688 @opindex finline-functions
12689 @item -finline-functions
12690 Consider all functions for inlining, even if they are not declared inline.
12691 The compiler heuristically decides which functions are worth integrating
12692 in this way.
12694 If all calls to a given function are integrated, and the function is
12695 declared @code{static}, then the function is normally not output as
12696 assembler code in its own right.
12698 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12699 by @option{-fprofile-use} and @option{-fauto-profile}.
12701 @opindex finline-functions-called-once
12702 @item -finline-functions-called-once
12703 Consider all @code{static} functions called once for inlining into their
12704 caller even if they are not marked @code{inline}.  If a call to a given
12705 function is integrated, then the function is not output as assembler code
12706 in its own right.
12708 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12709 but not @option{-Og}.
12711 @opindex fearly-inlining
12712 @item -fearly-inlining
12713 Inline functions marked by @code{always_inline} and functions whose body seems
12714 smaller than the function call overhead early before doing
12715 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12716 makes profiling significantly cheaper and usually inlining faster on programs
12717 having large chains of nested wrapper functions.
12719 Enabled by default.
12721 @opindex fipa-sra
12722 @item -fipa-sra
12723 Perform interprocedural scalar replacement of aggregates, removal of
12724 unused parameters and replacement of parameters passed by reference
12725 by parameters passed by value.
12727 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12729 @opindex finline-limit
12730 @item -finline-limit=@var{n}
12731 By default, GCC limits the size of functions that can be inlined.  This flag
12732 allows coarse control of this limit.  @var{n} is the size of functions that
12733 can be inlined in number of pseudo instructions.
12735 Inlining is actually controlled by a number of parameters, which may be
12736 specified individually by using @option{--param @var{name}=@var{value}}.
12737 The @option{-finline-limit=@var{n}} option sets some of these parameters
12738 as follows:
12740 @table @gcctabopt
12741 @item max-inline-insns-single
12742 is set to @var{n}/2.
12743 @item max-inline-insns-auto
12744 is set to @var{n}/2.
12745 @end table
12747 See below for a documentation of the individual
12748 parameters controlling inlining and for the defaults of these parameters.
12750 @emph{Note:} there may be no value to @option{-finline-limit} that results
12751 in default behavior.
12753 @emph{Note:} pseudo instruction represents, in this particular context, an
12754 abstract measurement of function's size.  In no way does it represent a count
12755 of assembly instructions and as such its exact meaning might change from one
12756 release to an another.
12758 @opindex fno-keep-inline-dllexport
12759 @opindex fkeep-inline-dllexport
12760 @item -fno-keep-inline-dllexport
12761 This is a more fine-grained version of @option{-fkeep-inline-functions},
12762 which applies only to functions that are declared using the @code{dllexport}
12763 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12764 Functions}.
12766 @opindex fkeep-inline-functions
12767 @item -fkeep-inline-functions
12768 In C, emit @code{static} functions that are declared @code{inline}
12769 into the object file, even if the function has been inlined into all
12770 of its callers.  This switch does not affect functions using the
12771 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12772 inline functions into the object file.
12774 @opindex fkeep-static-functions
12775 @item -fkeep-static-functions
12776 Emit @code{static} functions into the object file, even if the function
12777 is never used.
12779 @opindex fkeep-static-consts
12780 @item -fkeep-static-consts
12781 Emit variables declared @code{static const} when optimization isn't turned
12782 on, even if the variables aren't referenced.
12784 GCC enables this option by default.  If you want to force the compiler to
12785 check if a variable is referenced, regardless of whether or not
12786 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12788 @opindex fmerge-constants
12789 @item -fmerge-constants
12790 Attempt to merge identical constants (string constants and floating-point
12791 constants) across compilation units.
12793 This option is the default for optimized compilation if the assembler and
12794 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12795 behavior.
12797 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12799 @opindex fmerge-all-constants
12800 @item -fmerge-all-constants
12801 Attempt to merge identical constants and identical variables.
12803 This option implies @option{-fmerge-constants}.  In addition to
12804 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12805 arrays or initialized constant variables with integral or floating-point
12806 types.  Languages like C or C++ require each variable, including multiple
12807 instances of the same variable in recursive calls, to have distinct locations,
12808 so using this option results in non-conforming
12809 behavior.
12811 @opindex fmodulo-sched
12812 @item -fmodulo-sched
12813 Perform swing modulo scheduling immediately before the first scheduling
12814 pass.  This pass looks at innermost loops and reorders their
12815 instructions by overlapping different iterations.
12817 @opindex fmodulo-sched-allow-regmoves
12818 @item -fmodulo-sched-allow-regmoves
12819 Perform more aggressive SMS-based modulo scheduling with register moves
12820 allowed.  By setting this flag certain anti-dependences edges are
12821 deleted, which triggers the generation of reg-moves based on the
12822 life-range analysis.  This option is effective only with
12823 @option{-fmodulo-sched} enabled.
12825 @opindex fno-branch-count-reg
12826 @opindex fbranch-count-reg
12827 @item -fno-branch-count-reg
12828 Disable the optimization pass that scans for opportunities to use 
12829 ``decrement and branch'' instructions on a count register instead of
12830 instruction sequences that decrement a register, compare it against zero, and
12831 then branch based upon the result.  This option is only meaningful on
12832 architectures that support such instructions, which include x86, PowerPC,
12833 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12834 doesn't remove the decrement and branch instructions from the generated
12835 instruction stream introduced by other optimization passes.
12837 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12838 except for @option{-Og}.
12840 @opindex fno-function-cse
12841 @opindex ffunction-cse
12842 @item -fno-function-cse
12843 Do not put function addresses in registers; make each instruction that
12844 calls a constant function contain the function's address explicitly.
12846 This option results in less efficient code, but some strange hacks
12847 that alter the assembler output may be confused by the optimizations
12848 performed when this option is not used.
12850 The default is @option{-ffunction-cse}
12852 @opindex fno-zero-initialized-in-bss
12853 @opindex fzero-initialized-in-bss
12854 @item -fno-zero-initialized-in-bss
12855 If the target supports a BSS section, GCC by default puts variables that
12856 are initialized to zero into BSS@.  This can save space in the resulting
12857 code.
12859 This option turns off this behavior because some programs explicitly
12860 rely on variables going to the data section---e.g., so that the
12861 resulting executable can find the beginning of that section and/or make
12862 assumptions based on that.
12864 The default is @option{-fzero-initialized-in-bss}.
12866 @opindex fthread-jumps
12867 @item -fthread-jumps
12868 Perform optimizations that check to see if a jump branches to a
12869 location where another comparison subsumed by the first is found.  If
12870 so, the first branch is redirected to either the destination of the
12871 second branch or a point immediately following it, depending on whether
12872 the condition is known to be true or false.
12874 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12876 @opindex fsplit-wide-types
12877 @item -fsplit-wide-types
12878 When using a type that occupies multiple registers, such as @code{long
12879 long} on a 32-bit system, split the registers apart and allocate them
12880 independently.  This normally generates better code for those types,
12881 but may make debugging more difficult.
12883 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12884 @option{-Os}.
12886 @opindex fsplit-wide-types-early
12887 @item -fsplit-wide-types-early
12888 Fully split wide types early, instead of very late.
12889 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12891 This is the default on some targets.
12893 @opindex fcse-follow-jumps
12894 @item -fcse-follow-jumps
12895 In common subexpression elimination (CSE), scan through jump instructions
12896 when the target of the jump is not reached by any other path.  For
12897 example, when CSE encounters an @code{if} statement with an
12898 @code{else} clause, CSE follows the jump when the condition
12899 tested is false.
12901 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12903 @opindex fcse-skip-blocks
12904 @item -fcse-skip-blocks
12905 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12906 follow jumps that conditionally skip over blocks.  When CSE
12907 encounters a simple @code{if} statement with no else clause,
12908 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12909 body of the @code{if}.
12911 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12913 @opindex frerun-cse-after-loop
12914 @item -frerun-cse-after-loop
12915 Re-run common subexpression elimination after loop optimizations are
12916 performed.
12918 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12920 @opindex fgcse
12921 @item -fgcse
12922 Perform a global common subexpression elimination pass.
12923 This pass also performs global constant and copy propagation.
12925 @emph{Note:} When compiling a program using computed gotos, a GCC
12926 extension, you may get better run-time performance if you disable
12927 the global common subexpression elimination pass by adding
12928 @option{-fno-gcse} to the command line.
12930 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12932 @opindex fgcse-lm
12933 @item -fgcse-lm
12934 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12935 attempts to move loads that are only killed by stores into themselves.  This
12936 allows a loop containing a load/store sequence to be changed to a load outside
12937 the loop, and a copy/store within the loop.
12939 Enabled by default when @option{-fgcse} is enabled.
12941 @opindex fgcse-sm
12942 @item -fgcse-sm
12943 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12944 global common subexpression elimination.  This pass attempts to move
12945 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12946 loops containing a load/store sequence can be changed to a load before
12947 the loop and a store after the loop.
12949 Not enabled at any optimization level.
12951 @opindex fgcse-las
12952 @item -fgcse-las
12953 When @option{-fgcse-las} is enabled, the global common subexpression
12954 elimination pass eliminates redundant loads that come after stores to the
12955 same memory location (both partial and full redundancies).
12957 Not enabled at any optimization level.
12959 @opindex fgcse-after-reload
12960 @item -fgcse-after-reload
12961 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12962 pass is performed after reload.  The purpose of this pass is to clean up
12963 redundant spilling.
12965 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12967 @opindex faggressive-loop-optimizations
12968 @item -faggressive-loop-optimizations
12969 This option tells the loop optimizer to use language constraints to
12970 derive bounds for the number of iterations of a loop.  This assumes that
12971 loop code does not invoke undefined behavior by for example causing signed
12972 integer overflows or out-of-bound array accesses.  The bounds for the
12973 number of iterations of a loop are used to guide loop unrolling and peeling
12974 and loop exit test optimizations.
12975 This option is enabled by default.
12977 @opindex funconstrained-commons
12978 @item -funconstrained-commons
12979 This option tells the compiler that variables declared in common blocks
12980 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12981 prevents certain optimizations that depend on knowing the array bounds.
12983 @opindex fcrossjumping
12984 @item -fcrossjumping
12985 Perform cross-jumping transformation.
12986 This transformation unifies equivalent code and saves code size.  The
12987 resulting code may or may not perform better than without cross-jumping.
12989 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12991 @opindex fauto-inc-dec
12992 @item -fauto-inc-dec
12993 Combine increments or decrements of addresses with memory accesses.
12994 This pass is always skipped on architectures that do not have
12995 instructions to support this.  Enabled by default at @option{-O1} and
12996 higher on architectures that support this.
12998 @opindex fdce
12999 @item -fdce
13000 Perform dead code elimination (DCE) on RTL@.
13001 Enabled by default at @option{-O1} and higher.
13003 @opindex fdse
13004 @item -fdse
13005 Perform dead store elimination (DSE) on RTL@.
13006 Enabled by default at @option{-O1} and higher.
13008 @opindex fif-conversion
13009 @item -fif-conversion
13010 Attempt to transform conditional jumps into branch-less equivalents.  This
13011 includes use of conditional moves, min, max, set flags and abs instructions, and
13012 some tricks doable by standard arithmetics.  The use of conditional execution
13013 on chips where it is available is controlled by @option{-fif-conversion2}.
13015 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
13016 not with @option{-Og}.
13018 @opindex fif-conversion2
13019 @item -fif-conversion2
13020 Use conditional execution (where available) to transform conditional jumps into
13021 branch-less equivalents.
13023 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
13024 not with @option{-Og}.
13026 @opindex fdeclone-ctor-dtor
13027 @item -fdeclone-ctor-dtor
13028 The C++ ABI requires multiple entry points for constructors and
13029 destructors: one for a base subobject, one for a complete object, and
13030 one for a virtual destructor that calls operator delete afterwards.
13031 For a hierarchy with virtual bases, the base and complete variants are
13032 clones, which means two copies of the function.  With this option, the
13033 base and complete variants are changed to be thunks that call a common
13034 implementation.
13036 Enabled by @option{-Os}.
13038 @opindex fdelete-null-pointer-checks
13039 @item -fdelete-null-pointer-checks
13040 Assume that programs cannot safely dereference null pointers, and that
13041 no code or data element resides at address zero.
13042 This option enables simple constant
13043 folding optimizations at all optimization levels.  In addition, other
13044 optimization passes in GCC use this flag to control global dataflow
13045 analyses that eliminate useless checks for null pointers; these assume
13046 that a memory access to address zero always results in a trap, so
13047 that if a pointer is checked after it has already been dereferenced,
13048 it cannot be null.
13050 Note however that in some environments this assumption is not true.
13051 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
13052 for programs that depend on that behavior.
13054 This option is enabled by default on most targets.  On Nios II ELF, it
13055 defaults to off.  On AVR and MSP430, this option is completely disabled.
13057 Passes that use the dataflow information
13058 are enabled independently at different optimization levels.
13060 @opindex fdevirtualize
13061 @item -fdevirtualize
13062 Attempt to convert calls to virtual functions to direct calls.  This
13063 is done both within a procedure and interprocedurally as part of
13064 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
13065 propagation (@option{-fipa-cp}).
13066 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13068 @opindex fdevirtualize-speculatively
13069 @item -fdevirtualize-speculatively
13070 Attempt to convert calls to virtual functions to speculative direct calls.
13071 Based on the analysis of the type inheritance graph, determine for a given call
13072 the set of likely targets. If the set is small, preferably of size 1, change
13073 the call into a conditional deciding between direct and indirect calls.  The
13074 speculative calls enable more optimizations, such as inlining.  When they seem
13075 useless after further optimization, they are converted back into original form.
13077 @opindex fdevirtualize-at-ltrans
13078 @item -fdevirtualize-at-ltrans
13079 Stream extra information needed for aggressive devirtualization when running
13080 the link-time optimizer in local transformation mode.  
13081 This option enables more devirtualization but
13082 significantly increases the size of streamed data. For this reason it is
13083 disabled by default.
13085 @opindex fexpensive-optimizations
13086 @item -fexpensive-optimizations
13087 Perform a number of minor optimizations that are relatively expensive.
13089 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13091 @opindex free
13092 @item -free
13093 Attempt to remove redundant extension instructions.  This is especially
13094 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
13095 registers after writing to their lower 32-bit half.
13097 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
13098 levels @option{-O2}, @option{-O3}, @option{-Os}.
13100 @opindex fno-lifetime-dse
13101 @opindex flifetime-dse
13102 @item -fno-lifetime-dse
13103 In C++ the value of an object is only affected by changes within its
13104 lifetime: when the constructor begins, the object has an indeterminate
13105 value, and any changes during the lifetime of the object are dead when
13106 the object is destroyed.  Normally dead store elimination will take
13107 advantage of this; if your code relies on the value of the object
13108 storage persisting beyond the lifetime of the object, you can use this
13109 flag to disable this optimization.  To preserve stores before the
13110 constructor starts (e.g.@: because your operator new clears the object
13111 storage) but still treat the object as dead after the destructor, you
13112 can use @option{-flifetime-dse=1}.  The default behavior can be
13113 explicitly selected with @option{-flifetime-dse=2}.
13114 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
13116 @opindex flive-range-shrinkage
13117 @item -flive-range-shrinkage
13118 Attempt to decrease register pressure through register live range
13119 shrinkage.  This is helpful for fast processors with small or moderate
13120 size register sets.
13122 @opindex fira-algorithm
13123 @item -fira-algorithm=@var{algorithm}
13124 Use the specified coloring algorithm for the integrated register
13125 allocator.  The @var{algorithm} argument can be @samp{priority}, which
13126 specifies Chow's priority coloring, or @samp{CB}, which specifies
13127 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
13128 for all architectures, but for those targets that do support it, it is
13129 the default because it generates better code.
13131 @opindex fira-region
13132 @item -fira-region=@var{region}
13133 Use specified regions for the integrated register allocator.  The
13134 @var{region} argument should be one of the following:
13136 @table @samp
13138 @item all
13139 Use all loops as register allocation regions.
13140 This can give the best results for machines with a small and/or
13141 irregular register set.
13143 @item mixed
13144 Use all loops except for loops with small register pressure 
13145 as the regions.  This value usually gives
13146 the best results in most cases and for most architectures,
13147 and is enabled by default when compiling with optimization for speed
13148 (@option{-O}, @option{-O2}, @dots{}).
13150 @item one
13151 Use all functions as a single region.  
13152 This typically results in the smallest code size, and is enabled by default for
13153 @option{-Os} or @option{-O0}.
13155 @end table
13157 @opindex fira-hoist-pressure
13158 @item -fira-hoist-pressure
13159 Use IRA to evaluate register pressure in the code hoisting pass for
13160 decisions to hoist expressions.  This option usually results in smaller
13161 code, but it can slow the compiler down.
13163 This option is enabled at level @option{-Os} for all targets.
13165 @opindex fira-loop-pressure
13166 @item -fira-loop-pressure
13167 Use IRA to evaluate register pressure in loops for decisions to move
13168 loop invariants.  This option usually results in generation
13169 of faster and smaller code on machines with large register files (>= 32
13170 registers), but it can slow the compiler down.
13172 This option is enabled at level @option{-O3} for some targets.
13174 @opindex fno-ira-share-save-slots
13175 @opindex fira-share-save-slots
13176 @item -fno-ira-share-save-slots
13177 Disable sharing of stack slots used for saving call-used hard
13178 registers living through a call.  Each hard register gets a
13179 separate stack slot, and as a result function stack frames are
13180 larger.
13182 @opindex fno-ira-share-spill-slots
13183 @opindex fira-share-spill-slots
13184 @item -fno-ira-share-spill-slots
13185 Disable sharing of stack slots allocated for pseudo-registers.  Each
13186 pseudo-register that does not get a hard register gets a separate
13187 stack slot, and as a result function stack frames are larger.
13189 @opindex flra-remat
13190 @item -flra-remat
13191 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
13192 values of spilled pseudos, LRA tries to rematerialize (recalculate)
13193 values if it is profitable.
13195 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13197 @opindex fdelayed-branch
13198 @item -fdelayed-branch
13199 If supported for the target machine, attempt to reorder instructions
13200 to exploit instruction slots available after delayed branch
13201 instructions.
13203 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
13204 but not at @option{-Og}.
13206 @opindex fschedule-insns
13207 @item -fschedule-insns
13208 If supported for the target machine, attempt to reorder instructions to
13209 eliminate execution stalls due to required data being unavailable.  This
13210 helps machines that have slow floating point or memory load instructions
13211 by allowing other instructions to be issued until the result of the load
13212 or floating-point instruction is required.
13214 Enabled at levels @option{-O2}, @option{-O3}.
13216 @opindex fschedule-insns2
13217 @item -fschedule-insns2
13218 Similar to @option{-fschedule-insns}, but requests an additional pass of
13219 instruction scheduling after register allocation has been done.  This is
13220 especially useful on machines with a relatively small number of
13221 registers and where memory load instructions take more than one cycle.
13223 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13225 @opindex fno-sched-interblock
13226 @opindex fsched-interblock
13227 @item -fno-sched-interblock
13228 Disable instruction scheduling across basic blocks, which
13229 is normally enabled when scheduling before register allocation, i.e.@:
13230 with @option{-fschedule-insns} or at @option{-O2} or higher.
13232 @opindex fno-sched-spec
13233 @opindex fsched-spec
13234 @item -fno-sched-spec
13235 Disable speculative motion of non-load instructions, which
13236 is normally enabled when scheduling before register allocation, i.e.@:
13237 with @option{-fschedule-insns} or at @option{-O2} or higher.
13239 @opindex fsched-pressure
13240 @item -fsched-pressure
13241 Enable register pressure sensitive insn scheduling before register
13242 allocation.  This only makes sense when scheduling before register
13243 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
13244 @option{-O2} or higher.  Usage of this option can improve the
13245 generated code and decrease its size by preventing register pressure
13246 increase above the number of available hard registers and subsequent
13247 spills in register allocation.
13249 @opindex fsched-spec-load
13250 @item -fsched-spec-load
13251 Allow speculative motion of some load instructions.  This only makes
13252 sense when scheduling before register allocation, i.e.@: with
13253 @option{-fschedule-insns} or at @option{-O2} or higher.
13255 @opindex fsched-spec-load-dangerous
13256 @item -fsched-spec-load-dangerous
13257 Allow speculative motion of more load instructions.  This only makes
13258 sense when scheduling before register allocation, i.e.@: with
13259 @option{-fschedule-insns} or at @option{-O2} or higher.
13261 @opindex fsched-stalled-insns
13262 @item -fsched-stalled-insns
13263 @itemx -fsched-stalled-insns=@var{n}
13264 Define how many insns (if any) can be moved prematurely from the queue
13265 of stalled insns into the ready list during the second scheduling pass.
13266 @option{-fno-sched-stalled-insns} means that no insns are moved
13267 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
13268 on how many queued insns can be moved prematurely.
13269 @option{-fsched-stalled-insns} without a value is equivalent to
13270 @option{-fsched-stalled-insns=1}.
13272 @opindex fsched-stalled-insns-dep
13273 @item -fsched-stalled-insns-dep
13274 @itemx -fsched-stalled-insns-dep=@var{n}
13275 Define how many insn groups (cycles) are examined for a dependency
13276 on a stalled insn that is a candidate for premature removal from the queue
13277 of stalled insns.  This has an effect only during the second scheduling pass,
13278 and only if @option{-fsched-stalled-insns} is used.
13279 @option{-fno-sched-stalled-insns-dep} is equivalent to
13280 @option{-fsched-stalled-insns-dep=0}.
13281 @option{-fsched-stalled-insns-dep} without a value is equivalent to
13282 @option{-fsched-stalled-insns-dep=1}.
13284 @opindex fsched2-use-superblocks
13285 @item -fsched2-use-superblocks
13286 When scheduling after register allocation, use superblock scheduling.
13287 This allows motion across basic block boundaries,
13288 resulting in faster schedules.  This option is experimental, as not all machine
13289 descriptions used by GCC model the CPU closely enough to avoid unreliable
13290 results from the algorithm.
13292 This only makes sense when scheduling after register allocation, i.e.@: with
13293 @option{-fschedule-insns2} or at @option{-O2} or higher.
13295 @opindex fsched-group-heuristic
13296 @item -fsched-group-heuristic
13297 Enable the group heuristic in the scheduler.  This heuristic favors
13298 the instruction that belongs to a schedule group.  This is enabled
13299 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
13300 or @option{-fschedule-insns2} or at @option{-O2} or higher.
13302 @opindex fsched-critical-path-heuristic
13303 @item -fsched-critical-path-heuristic
13304 Enable the critical-path heuristic in the scheduler.  This heuristic favors
13305 instructions on the critical path.  This is enabled by default when
13306 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
13307 or @option{-fschedule-insns2} or at @option{-O2} or higher.
13309 @opindex fsched-spec-insn-heuristic
13310 @item -fsched-spec-insn-heuristic
13311 Enable the speculative instruction heuristic in the scheduler.  This
13312 heuristic favors speculative instructions with greater dependency weakness.
13313 This is enabled by default when scheduling is enabled, i.e.@:
13314 with @option{-fschedule-insns} or @option{-fschedule-insns2}
13315 or at @option{-O2} or higher.
13317 @opindex fsched-rank-heuristic
13318 @item -fsched-rank-heuristic
13319 Enable the rank heuristic in the scheduler.  This heuristic favors
13320 the instruction belonging to a basic block with greater size or frequency.
13321 This is enabled by default when scheduling is enabled, i.e.@:
13322 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13323 at @option{-O2} or higher.
13325 @opindex fsched-last-insn-heuristic
13326 @item -fsched-last-insn-heuristic
13327 Enable the last-instruction heuristic in the scheduler.  This heuristic
13328 favors the instruction that is less dependent on the last instruction
13329 scheduled.  This is enabled by default when scheduling is enabled,
13330 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13331 at @option{-O2} or higher.
13333 @opindex fsched-dep-count-heuristic
13334 @item -fsched-dep-count-heuristic
13335 Enable the dependent-count heuristic in the scheduler.  This heuristic
13336 favors the instruction that has more instructions depending on it.
13337 This is enabled by default when scheduling is enabled, i.e.@:
13338 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13339 at @option{-O2} or higher.
13341 @opindex freschedule-modulo-scheduled-loops
13342 @item -freschedule-modulo-scheduled-loops
13343 Modulo scheduling is performed before traditional scheduling.  If a loop
13344 is modulo scheduled, later scheduling passes may change its schedule.  
13345 Use this option to control that behavior.
13347 @opindex fselective-scheduling
13348 @item -fselective-scheduling
13349 Schedule instructions using selective scheduling algorithm.  Selective
13350 scheduling runs instead of the first scheduler pass.
13352 @opindex fselective-scheduling2
13353 @item -fselective-scheduling2
13354 Schedule instructions using selective scheduling algorithm.  Selective
13355 scheduling runs instead of the second scheduler pass.
13357 @opindex fsel-sched-pipelining
13358 @item -fsel-sched-pipelining
13359 Enable software pipelining of innermost loops during selective scheduling.
13360 This option has no effect unless one of @option{-fselective-scheduling} or
13361 @option{-fselective-scheduling2} is turned on.
13363 @opindex fsel-sched-pipelining-outer-loops
13364 @item -fsel-sched-pipelining-outer-loops
13365 When pipelining loops during selective scheduling, also pipeline outer loops.
13366 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
13368 @opindex fsemantic-interposition
13369 @item -fsemantic-interposition
13370 Some object formats, like ELF, allow interposing of symbols by the 
13371 dynamic linker.
13372 This means that for symbols exported from the DSO, the compiler cannot perform
13373 interprocedural propagation, inlining and other optimizations in anticipation
13374 that the function or variable in question may change. While this feature is
13375 useful, for example, to rewrite memory allocation functions by a debugging
13376 implementation, it is expensive in the terms of code quality.
13377 With @option{-fno-semantic-interposition} the compiler assumes that 
13378 if interposition happens for functions the overwriting function will have 
13379 precisely the same semantics (and side effects). 
13380 Similarly if interposition happens
13381 for variables, the constructor of the variable will be the same. The flag
13382 has no effect for functions explicitly declared inline 
13383 (where it is never allowed for interposition to change semantics) 
13384 and for symbols explicitly declared weak.
13386 @opindex fshrink-wrap
13387 @item -fshrink-wrap
13388 Emit function prologues only before parts of the function that need it,
13389 rather than at the top of the function.  This flag is enabled by default at
13390 @option{-O} and higher.
13392 @opindex fshrink-wrap-separate
13393 @item -fshrink-wrap-separate
13394 Shrink-wrap separate parts of the prologue and epilogue separately, so that
13395 those parts are only executed when needed.
13396 This option is on by default, but has no effect unless @option{-fshrink-wrap}
13397 is also turned on and the target supports this.
13399 @opindex fcaller-saves
13400 @item -fcaller-saves
13401 Enable allocation of values to registers that are clobbered by
13402 function calls, by emitting extra instructions to save and restore the
13403 registers around such calls.  Such allocation is done only when it
13404 seems to result in better code.
13406 This option is always enabled by default on certain machines, usually
13407 those which have no call-preserved registers to use instead.
13409 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13411 @opindex fcombine-stack-adjustments
13412 @item -fcombine-stack-adjustments
13413 Tracks stack adjustments (pushes and pops) and stack memory references
13414 and then tries to find ways to combine them.
13416 Enabled by default at @option{-O1} and higher.
13418 @opindex fipa-ra
13419 @item -fipa-ra
13420 Use caller save registers for allocation if those registers are not used by
13421 any called function.  In that case it is not necessary to save and restore
13422 them around calls.  This is only possible if called functions are part of
13423 same compilation unit as current function and they are compiled before it.
13425 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13426 is disabled if generated code will be instrumented for profiling
13427 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13428 exactly (this happens on targets that do not expose prologues
13429 and epilogues in RTL).
13431 @opindex fconserve-stack
13432 @item -fconserve-stack
13433 Attempt to minimize stack usage.  The compiler attempts to use less
13434 stack space, even if that makes the program slower.  This option
13435 implies setting the @option{large-stack-frame} parameter to 100
13436 and the @option{large-stack-frame-growth} parameter to 400.
13438 @opindex ftree-reassoc
13439 @item -ftree-reassoc
13440 Perform reassociation on trees.  This flag is enabled by default
13441 at @option{-O1} and higher.
13443 @opindex fcode-hoisting
13444 @item -fcode-hoisting
13445 Perform code hoisting.  Code hoisting tries to move the
13446 evaluation of expressions executed on all paths to the function exit
13447 as early as possible.  This is especially useful as a code size
13448 optimization, but it often helps for code speed as well.
13449 This flag is enabled by default at @option{-O2} and higher.
13451 @opindex ftree-pre
13452 @item -ftree-pre
13453 Perform partial redundancy elimination (PRE) on trees.  This flag is
13454 enabled by default at @option{-O2} and @option{-O3}.
13456 @opindex ftree-partial-pre
13457 @item -ftree-partial-pre
13458 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13459 enabled by default at @option{-O3}.
13461 @opindex ftree-forwprop
13462 @item -ftree-forwprop
13463 Perform forward propagation on trees.  This flag is enabled by default
13464 at @option{-O1} and higher.
13466 @opindex ftree-fre
13467 @item -ftree-fre
13468 Perform full redundancy elimination (FRE) on trees.  The difference
13469 between FRE and PRE is that FRE only considers expressions
13470 that are computed on all paths leading to the redundant computation.
13471 This analysis is faster than PRE, though it exposes fewer redundancies.
13472 This flag is enabled by default at @option{-O1} and higher.
13474 @opindex ftree-phiprop
13475 @item -ftree-phiprop
13476 Perform hoisting of loads from conditional pointers on trees.  This
13477 pass is enabled by default at @option{-O1} and higher.
13479 @opindex fhoist-adjacent-loads
13480 @item -fhoist-adjacent-loads
13481 Speculatively hoist loads from both branches of an if-then-else if the
13482 loads are from adjacent locations in the same structure and the target
13483 architecture has a conditional move instruction.  This flag is enabled
13484 by default at @option{-O2} and higher.
13486 @opindex ftree-copy-prop
13487 @item -ftree-copy-prop
13488 Perform copy propagation on trees.  This pass eliminates unnecessary
13489 copy operations.  This flag is enabled by default at @option{-O1} and
13490 higher.
13492 @opindex fipa-pure-const
13493 @item -fipa-pure-const
13494 Discover which functions are pure or constant.
13495 Enabled by default at @option{-O1} and higher.
13497 @opindex fipa-reference
13498 @item -fipa-reference
13499 Discover which static variables do not escape the
13500 compilation unit.
13501 Enabled by default at @option{-O1} and higher.
13503 @opindex fipa-reference-addressable
13504 @item -fipa-reference-addressable
13505 Discover read-only, write-only and non-addressable static variables.
13506 Enabled by default at @option{-O1} and higher.
13508 @opindex fipa-stack-alignment
13509 @item -fipa-stack-alignment
13510 Reduce stack alignment on call sites if possible.
13511 Enabled by default.
13513 @opindex fipa-pta
13514 @item -fipa-pta
13515 Perform interprocedural pointer analysis and interprocedural modification
13516 and reference analysis.  This option can cause excessive memory and
13517 compile-time usage on large compilation units.  It is not enabled by
13518 default at any optimization level.
13520 @opindex fipa-profile
13521 @item -fipa-profile
13522 Perform interprocedural profile propagation.  The functions called only from
13523 cold functions are marked as cold. Also functions executed once (such as
13524 @code{cold}, @code{noreturn}, static constructors or destructors) are
13525 identified. Cold functions and loop less parts of functions executed once are
13526 then optimized for size.
13527 Enabled by default at @option{-O1} and higher.
13529 @opindex fipa-modref
13530 @item -fipa-modref
13531 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13532 effects of functions (memory locations that are modified or referenced) and
13533 enables better optimization across the function call boundary.  This flag is
13534 enabled by default at @option{-O1} and higher.
13536 @opindex fipa-cp
13537 @item -fipa-cp
13538 Perform interprocedural constant propagation.
13539 This optimization analyzes the program to determine when values passed
13540 to functions are constants and then optimizes accordingly.
13541 This optimization can substantially increase performance
13542 if the application has constants passed to functions.
13543 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13544 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13546 @opindex fipa-cp-clone
13547 @item -fipa-cp-clone
13548 Perform function cloning to make interprocedural constant propagation stronger.
13549 When enabled, interprocedural constant propagation performs function cloning
13550 when externally visible function can be called with constant arguments.
13551 Because this optimization can create multiple copies of functions,
13552 it may significantly increase code size
13553 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13554 This flag is enabled by default at @option{-O3}.
13555 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13557 @opindex fipa-bit-cp
13558 @item -fipa-bit-cp
13559 When enabled, perform interprocedural bitwise constant
13560 propagation. This flag is enabled by default at @option{-O2} and
13561 by @option{-fprofile-use} and @option{-fauto-profile}.
13562 It requires that @option{-fipa-cp} is enabled.  
13564 @opindex fipa-vrp
13565 @item -fipa-vrp
13566 When enabled, perform interprocedural propagation of value
13567 ranges. This flag is enabled by default at @option{-O2}. It requires
13568 that @option{-fipa-cp} is enabled.
13570 @opindex fipa-icf
13571 @item -fipa-icf
13572 Perform Identical Code Folding for functions and read-only variables.
13573 The optimization reduces code size and may disturb unwind stacks by replacing
13574 a function by equivalent one with a different name. The optimization works
13575 more effectively with link-time optimization enabled.
13577 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13578 works on different levels and thus the optimizations are not same - there are
13579 equivalences that are found only by GCC and equivalences found only by Gold.
13581 This flag is enabled by default at @option{-O2} and @option{-Os}.
13583 @opindex flive-patching
13584 @item -flive-patching=@var{level}
13585 Control GCC's optimizations to produce output suitable for live-patching.
13587 If the compiler's optimization uses a function's body or information extracted
13588 from its body to optimize/change another function, the latter is called an
13589 impacted function of the former.  If a function is patched, its impacted
13590 functions should be patched too.
13592 The impacted functions are determined by the compiler's interprocedural
13593 optimizations.  For example, a caller is impacted when inlining a function
13594 into its caller,
13595 cloning a function and changing its caller to call this new clone,
13596 or extracting a function's pureness/constness information to optimize
13597 its direct or indirect callers, etc.
13599 Usually, the more IPA optimizations enabled, the larger the number of
13600 impacted functions for each function.  In order to control the number of
13601 impacted functions and more easily compute the list of impacted function,
13602 IPA optimizations can be partially enabled at two different levels.
13604 The @var{level} argument should be one of the following:
13606 @table @samp
13608 @item inline-clone
13610 Only enable inlining and cloning optimizations, which includes inlining,
13611 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13612 As a result, when patching a function, all its callers and its clones'
13613 callers are impacted, therefore need to be patched as well.
13615 @option{-flive-patching=inline-clone} disables the following optimization flags:
13616 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13617 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13618 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13619 -fipa-reference-addressable
13620 -fipa-stack-alignment -fipa-modref}
13622 @item inline-only-static
13624 Only enable inlining of static functions.
13625 As a result, when patching a static function, all its callers are impacted
13626 and so need to be patched as well.
13628 In addition to all the flags that @option{-flive-patching=inline-clone}
13629 disables,
13630 @option{-flive-patching=inline-only-static} disables the following additional
13631 optimization flags:
13632 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13634 @end table
13636 When @option{-flive-patching} is specified without any value, the default value
13637 is @var{inline-clone}.
13639 This flag is disabled by default.
13641 Note that @option{-flive-patching} is not supported with link-time optimization
13642 (@option{-flto}).
13644 @opindex fisolate-erroneous-paths-dereference
13645 @item -fisolate-erroneous-paths-dereference
13646 Detect paths that trigger erroneous or undefined behavior due to
13647 dereferencing a null pointer.  Isolate those paths from the main control
13648 flow and turn the statement with erroneous or undefined behavior into a trap.
13649 This flag is enabled by default at @option{-O2} and higher and depends on
13650 @option{-fdelete-null-pointer-checks} also being enabled.
13652 @opindex fisolate-erroneous-paths-attribute
13653 @item -fisolate-erroneous-paths-attribute
13654 Detect paths that trigger erroneous or undefined behavior due to a null value
13655 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13656 attribute.  Isolate those paths from the main control flow and turn the
13657 statement with erroneous or undefined behavior into a trap.  This is not
13658 currently enabled, but may be enabled by @option{-O2} in the future.
13660 @opindex ftree-sink
13661 @item -ftree-sink
13662 Perform forward store motion on trees.  This flag is
13663 enabled by default at @option{-O1} and higher.
13665 @opindex ftree-bit-ccp
13666 @item -ftree-bit-ccp
13667 Perform sparse conditional bit constant propagation on trees and propagate
13668 pointer alignment information.
13669 This pass only operates on local scalar variables and is enabled by default
13670 at @option{-O1} and higher, except for @option{-Og}.
13671 It requires that @option{-ftree-ccp} is enabled.
13673 @opindex ftree-ccp
13674 @item -ftree-ccp
13675 Perform sparse conditional constant propagation (CCP) on trees.  This
13676 pass only operates on local scalar variables and is enabled by default
13677 at @option{-O1} and higher.
13679 @opindex fssa-backprop
13680 @item -fssa-backprop
13681 Propagate information about uses of a value up the definition chain
13682 in order to simplify the definitions.  For example, this pass strips
13683 sign operations if the sign of a value never matters.  The flag is
13684 enabled by default at @option{-O1} and higher.
13686 @opindex fssa-phiopt
13687 @item -fssa-phiopt
13688 Perform pattern matching on SSA PHI nodes to optimize conditional
13689 code.  This pass is enabled by default at @option{-O1} and higher,
13690 except for @option{-Og}.
13692 @opindex ftree-switch-conversion
13693 @item -ftree-switch-conversion
13694 Perform conversion of simple initializations in a switch to
13695 initializations from a scalar array.  This flag is enabled by default
13696 at @option{-O2} and higher.
13698 @opindex ftree-tail-merge
13699 @item -ftree-tail-merge
13700 Look for identical code sequences.  When found, replace one with a jump to the
13701 other.  This optimization is known as tail merging or cross jumping.  This flag
13702 is enabled by default at @option{-O2} and higher.  The compilation time
13703 in this pass can
13704 be limited using @option{max-tail-merge-comparisons} parameter and
13705 @option{max-tail-merge-iterations} parameter.
13707 @opindex ftree-dce
13708 @item -ftree-dce
13709 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13710 default at @option{-O1} and higher.
13712 @opindex ftree-builtin-call-dce
13713 @item -ftree-builtin-call-dce
13714 Perform conditional dead code elimination (DCE) for calls to built-in functions
13715 that may set @code{errno} but are otherwise free of side effects.  This flag is
13716 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13717 specified.
13719 @opindex ffinite-loops
13720 @opindex fno-finite-loops
13721 @item -ffinite-loops
13722 Assume that a loop with an exit will eventually take the exit and not loop
13723 indefinitely.  This allows the compiler to remove loops that otherwise have
13724 no side-effects, not considering eventual endless looping as such.
13726 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13727 or higher.
13729 @opindex ftree-dominator-opts
13730 @item -ftree-dominator-opts
13731 Perform a variety of simple scalar cleanups (constant/copy
13732 propagation, redundancy elimination, range propagation and expression
13733 simplification) based on a dominator tree traversal.  This also
13734 performs jump threading (to reduce jumps to jumps). This flag is
13735 enabled by default at @option{-O1} and higher.
13737 @opindex ftree-dse
13738 @item -ftree-dse
13739 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13740 a memory location that is later overwritten by another store without
13741 any intervening loads.  In this case the earlier store can be deleted.  This
13742 flag is enabled by default at @option{-O1} and higher.
13744 @opindex ftree-ch
13745 @item -ftree-ch
13746 Perform loop header copying on trees.  This is beneficial since it increases
13747 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13748 is enabled by default at @option{-O1} and higher.  It is not enabled
13749 for @option{-Os}, since it usually increases code size.
13751 @opindex ftree-loop-optimize
13752 @item -ftree-loop-optimize
13753 Perform loop optimizations on trees.  This flag is enabled by default
13754 at @option{-O1} and higher.
13756 @opindex ftree-loop-linear
13757 @opindex floop-strip-mine
13758 @opindex floop-block
13759 @item -ftree-loop-linear
13760 @itemx -floop-strip-mine
13761 @itemx -floop-block
13762 Perform loop nest optimizations.  Same as
13763 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13764 to be configured with @option{--with-isl} to enable the Graphite loop
13765 transformation infrastructure.
13767 @opindex fgraphite-identity
13768 @item -fgraphite-identity
13769 Enable the identity transformation for graphite.  For every SCoP we generate
13770 the polyhedral representation and transform it back to gimple.  Using
13771 @option{-fgraphite-identity} we can check the costs or benefits of the
13772 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13773 are also performed by the code generator isl, like index splitting and
13774 dead code elimination in loops.
13776 @opindex floop-nest-optimize
13777 @item -floop-nest-optimize
13778 Enable the isl based loop nest optimizer.  This is a generic loop nest
13779 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13780 structure optimized for data-locality and parallelism.  This option
13781 is experimental.
13783 @opindex floop-parallelize-all
13784 @item -floop-parallelize-all
13785 Use the Graphite data dependence analysis to identify loops that can
13786 be parallelized.  Parallelize all the loops that can be analyzed to
13787 not contain loop carried dependences without checking that it is
13788 profitable to parallelize the loops.
13790 @opindex ftree-coalesce-vars
13791 @item -ftree-coalesce-vars
13792 While transforming the program out of the SSA representation, attempt to
13793 reduce copying by coalescing versions of different user-defined
13794 variables, instead of just compiler temporaries.  This may severely
13795 limit the ability to debug an optimized program compiled with
13796 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13797 prevents SSA coalescing of user variables.  This option is enabled by
13798 default if optimization is enabled, and it does very little otherwise.
13800 @opindex ftree-loop-if-convert
13801 @item -ftree-loop-if-convert
13802 Attempt to transform conditional jumps in the innermost loops to
13803 branch-less equivalents.  The intent is to remove control-flow from
13804 the innermost loops in order to improve the ability of the
13805 vectorization pass to handle these loops.  This is enabled by default
13806 if vectorization is enabled.
13808 @opindex ftree-loop-distribution
13809 @item -ftree-loop-distribution
13810 Perform loop distribution.  This flag can improve cache performance on
13811 big loop bodies and allow further loop optimizations, like
13812 parallelization or vectorization, to take place.  For example, the loop
13813 @smallexample
13814 DO I = 1, N
13815   A(I) = B(I) + C
13816   D(I) = E(I) * F
13817 ENDDO
13818 @end smallexample
13819 is transformed to
13820 @smallexample
13821 DO I = 1, N
13822    A(I) = B(I) + C
13823 ENDDO
13824 DO I = 1, N
13825    D(I) = E(I) * F
13826 ENDDO
13827 @end smallexample
13828 This flag is enabled by default at @option{-O3}.
13829 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13831 @opindex ftree-loop-distribute-patterns
13832 @item -ftree-loop-distribute-patterns
13833 Perform loop distribution of patterns that can be code generated with
13834 calls to a library.  This flag is enabled by default at @option{-O2} and
13835 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13837 This pass distributes the initialization loops and generates a call to
13838 memset zero.  For example, the loop
13839 @smallexample
13840 DO I = 1, N
13841   A(I) = 0
13842   B(I) = A(I) + I
13843 ENDDO
13844 @end smallexample
13845 is transformed to
13846 @smallexample
13847 DO I = 1, N
13848    A(I) = 0
13849 ENDDO
13850 DO I = 1, N
13851    B(I) = A(I) + I
13852 ENDDO
13853 @end smallexample
13854 and the initialization loop is transformed into a call to memset zero.
13856 @opindex floop-interchange
13857 @item -floop-interchange
13858 Perform loop interchange outside of graphite.  This flag can improve cache
13859 performance on loop nest and allow further loop optimizations, like
13860 vectorization, to take place.  For example, the loop
13861 @smallexample
13862 for (int i = 0; i < N; i++)
13863   for (int j = 0; j < N; j++)
13864     for (int k = 0; k < N; k++)
13865       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13866 @end smallexample
13867 is transformed to
13868 @smallexample
13869 for (int i = 0; i < N; i++)
13870   for (int k = 0; k < N; k++)
13871     for (int j = 0; j < N; j++)
13872       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13873 @end smallexample
13874 This flag is enabled by default at @option{-O3}.
13875 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13877 @opindex floop-unroll-and-jam
13878 @item -floop-unroll-and-jam
13879 Apply unroll and jam transformations on feasible loops.  In a loop
13880 nest this unrolls the outer loop by some factor and fuses the resulting
13881 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13882 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13884 @opindex ftree-loop-im
13885 @item -ftree-loop-im
13886 Perform loop invariant motion on trees.  This pass moves only invariants that
13887 are hard to handle at RTL level (function calls, operations that expand to
13888 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13889 operands of conditions that are invariant out of the loop, so that we can use
13890 just trivial invariantness analysis in loop unswitching.  The pass also includes
13891 store motion.
13893 @opindex ftree-loop-ivcanon
13894 @item -ftree-loop-ivcanon
13895 Create a canonical counter for number of iterations in loops for which
13896 determining number of iterations requires complicated analysis.  Later
13897 optimizations then may determine the number easily.  Useful especially
13898 in connection with unrolling.
13900 @opindex ftree-scev-cprop
13901 @item -ftree-scev-cprop
13902 Perform final value replacement.  If a variable is modified in a loop
13903 in such a way that its value when exiting the loop can be determined using
13904 only its initial value and the number of loop iterations, replace uses of
13905 the final value by such a computation, provided it is sufficiently cheap.
13906 This reduces data dependencies and may allow further simplifications.
13907 Enabled by default at @option{-O1} and higher.
13909 @opindex fivopts
13910 @item -fivopts
13911 Perform induction variable optimizations (strength reduction, induction
13912 variable merging and induction variable elimination) on trees.
13914 @opindex ftree-parallelize-loops
13915 @item -ftree-parallelize-loops=n
13916 Parallelize loops, i.e., split their iteration space to run in n threads.
13917 This is only possible for loops whose iterations are independent
13918 and can be arbitrarily reordered.  The optimization is only
13919 profitable on multiprocessor machines, for loops that are CPU-intensive,
13920 rather than constrained e.g.@: by memory bandwidth.  This option
13921 implies @option{-pthread}, and thus is only supported on targets
13922 that have support for @option{-pthread}.
13924 @opindex ftree-pta
13925 @item -ftree-pta
13926 Perform function-local points-to analysis on trees.  This flag is
13927 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13929 @opindex ftree-sra
13930 @item -ftree-sra
13931 Perform scalar replacement of aggregates.  This pass replaces structure
13932 references with scalars to prevent committing structures to memory too
13933 early.  This flag is enabled by default at @option{-O1} and higher,
13934 except for @option{-Og}.
13936 @opindex fstore-merging
13937 @item -fstore-merging
13938 Perform merging of narrow stores to consecutive memory addresses.  This pass
13939 merges contiguous stores of immediate values narrower than a word into fewer
13940 wider stores to reduce the number of instructions.  This is enabled by default
13941 at @option{-O2} and higher as well as @option{-Os}.
13943 @opindex ftree-ter
13944 @item -ftree-ter
13945 Perform temporary expression replacement during the SSA->normal phase.  Single
13946 use/single def temporaries are replaced at their use location with their
13947 defining expression.  This results in non-GIMPLE code, but gives the expanders
13948 much more complex trees to work on resulting in better RTL generation.  This is
13949 enabled by default at @option{-O1} and higher.
13951 @opindex ftree-slsr
13952 @item -ftree-slsr
13953 Perform straight-line strength reduction on trees.  This recognizes related
13954 expressions involving multiplications and replaces them by less expensive
13955 calculations when possible.  This is enabled by default at @option{-O1} and
13956 higher.
13958 @opindex ftree-vectorize
13959 @item -ftree-vectorize
13960 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13961 and @option{-ftree-slp-vectorize} if not explicitly specified.
13963 @opindex ftree-loop-vectorize
13964 @item -ftree-loop-vectorize
13965 Perform loop vectorization on trees. This flag is enabled by default at
13966 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13967 and @option{-fauto-profile}.
13969 @opindex ftree-slp-vectorize
13970 @item -ftree-slp-vectorize
13971 Perform basic block vectorization on trees. This flag is enabled by default at
13972 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13973 and @option{-fauto-profile}.
13975 @opindex ftrivial-auto-var-init
13976 @item -ftrivial-auto-var-init=@var{choice}
13977 Initialize automatic variables with either a pattern or with zeroes to increase
13978 the security and predictability of a program by preventing uninitialized memory
13979 disclosure and use.
13980 GCC still considers an automatic variable that doesn't have an explicit
13981 initializer as uninitialized, @option{-Wuninitialized} and
13982 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13983 warning messages on such automatic variables and the compiler will
13984 perform optimization as if the variable were uninitialized.
13985 With this option, GCC will also initialize any padding of automatic variables
13986 that have structure or union types to zeroes.
13987 However, the current implementation cannot initialize automatic variables that
13988 are declared between the controlling expression and the first case of a
13989 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13990 such cases.
13992 The three values of @var{choice} are:
13994 @itemize @bullet
13995 @item
13996 @samp{uninitialized} doesn't initialize any automatic variables.
13997 This is C and C++'s default.
13999 @item
14000 @samp{pattern} Initialize automatic variables with values which will likely
14001 transform logic bugs into crashes down the line, are easily recognized in a
14002 crash dump and without being values that programmers can rely on for useful
14003 program semantics.
14004 The current value is byte-repeatable pattern with byte "0xFE".
14005 The values used for pattern initialization might be changed in the future.
14007 @item
14008 @samp{zero} Initialize automatic variables with zeroes.
14009 @end itemize
14011 The default is @samp{uninitialized}.
14013 Note that the initializer values, whether @samp{zero} or @samp{pattern},
14014 refer to data representation (in memory or machine registers), rather
14015 than to their interpretation as numerical values.  This distinction may
14016 be important in languages that support types with biases or implicit
14017 multipliers, and with such extensions as @samp{hardbool} (@pxref{Type
14018 Attributes}).  For example, a variable that uses 8 bits to represent
14019 (biased) quantities in the @code{range 160..400} will be initialized
14020 with the bit patterns @code{0x00} or @code{0xFE}, depending on
14021 @var{choice}, whether or not these representations stand for values in
14022 that range, and even if they do, the interpretation of the value held by
14023 the variable will depend on the bias.  A @samp{hardbool} variable that
14024 uses say @code{0X5A} and @code{0xA5} for @code{false} and @code{true},
14025 respectively, will trap with either @samp{choice} of trivial
14026 initializer, i.e., @samp{zero} initialization will not convert to the
14027 representation for @code{false}, even if it would for a @code{static}
14028 variable of the same type.  This means the initializer pattern doesn't
14029 generally depend on the type of the initialized variable.  One notable
14030 exception is that (non-hardened) boolean variables that fit in registers
14031 are initialized with @code{false} (zero), even when @samp{pattern} is
14032 requested.
14034 You can control this behavior for a specific variable by using the variable
14035 attribute @code{uninitialized} (@pxref{Variable Attributes}).
14037 @opindex fvect-cost-model
14038 @item -fvect-cost-model=@var{model}
14039 Alter the cost model used for vectorization.  The @var{model} argument
14040 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
14041 @samp{very-cheap}.
14042 With the @samp{unlimited} model the vectorized code-path is assumed
14043 to be profitable while with the @samp{dynamic} model a runtime check
14044 guards the vectorized code-path to enable it only for iteration
14045 counts that will likely execute faster than when executing the original
14046 scalar loop.  The @samp{cheap} model disables vectorization of
14047 loops where doing so would be cost prohibitive for example due to
14048 required runtime checks for data dependence or alignment but otherwise
14049 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
14050 allows vectorization if the vector code would entirely replace the
14051 scalar code that is being vectorized.  For example, if each iteration
14052 of a vectorized loop would only be able to handle exactly four iterations
14053 of the scalar loop, the @samp{very-cheap} model would only allow
14054 vectorization if the scalar iteration count is known to be a multiple
14055 of four.
14057 The default cost model depends on other optimization flags and is
14058 either @samp{dynamic} or @samp{cheap}.
14060 @opindex fsimd-cost-model
14061 @item -fsimd-cost-model=@var{model}
14062 Alter the cost model used for vectorization of loops marked with the OpenMP
14063 simd directive.  The @var{model} argument should be one of
14064 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
14065 have the same meaning as described in @option{-fvect-cost-model} and by
14066 default a cost model defined with @option{-fvect-cost-model} is used.
14068 @opindex ftree-vrp
14069 @item -ftree-vrp
14070 Perform Value Range Propagation on trees.  This is similar to the
14071 constant propagation pass, but instead of values, ranges of values are
14072 propagated.  This allows the optimizers to remove unnecessary range
14073 checks like array bound checks and null pointer checks.  This is
14074 enabled by default at @option{-O2} and higher.  Null pointer check
14075 elimination is only done if @option{-fdelete-null-pointer-checks} is
14076 enabled.
14078 @opindex fsplit-paths
14079 @item -fsplit-paths
14080 Split paths leading to loop backedges.  This can improve dead code
14081 elimination and common subexpression elimination.  This is enabled by
14082 default at @option{-O3} and above.
14084 @opindex fsplit-ivs-in-unroller
14085 @item -fsplit-ivs-in-unroller
14086 Enables expression of values of induction variables in later iterations
14087 of the unrolled loop using the value in the first iteration.  This breaks
14088 long dependency chains, thus improving efficiency of the scheduling passes.
14090 A combination of @option{-fweb} and CSE is often sufficient to obtain the
14091 same effect.  However, that is not reliable in cases where the loop body
14092 is more complicated than a single basic block.  It also does not work at all
14093 on some architectures due to restrictions in the CSE pass.
14095 This optimization is enabled by default.
14097 @opindex fvariable-expansion-in-unroller
14098 @item -fvariable-expansion-in-unroller
14099 With this option, the compiler creates multiple copies of some
14100 local variables when unrolling a loop, which can result in superior code.
14102 This optimization is enabled by default for PowerPC targets, but disabled
14103 by default otherwise.
14105 @opindex fpartial-inlining
14106 @item -fpartial-inlining
14107 Inline parts of functions.  This option has any effect only
14108 when inlining itself is turned on by the @option{-finline-functions}
14109 or @option{-finline-small-functions} options.
14111 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14113 @opindex fpredictive-commoning
14114 @item -fpredictive-commoning
14115 Perform predictive commoning optimization, i.e., reusing computations
14116 (especially memory loads and stores) performed in previous
14117 iterations of loops.
14119 This option is enabled at level @option{-O3}.
14120 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14122 @opindex fprefetch-loop-arrays
14123 @item -fprefetch-loop-arrays
14124 If supported by the target machine, generate instructions to prefetch
14125 memory to improve the performance of loops that access large arrays.
14127 This option may generate better or worse code; results are highly
14128 dependent on the structure of loops within the source code.
14130 Disabled at level @option{-Os}.
14132 @opindex fno-printf-return-value
14133 @opindex fprintf-return-value
14134 @item -fno-printf-return-value
14135 Do not substitute constants for known return value of formatted output
14136 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
14137 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
14138 transformation allows GCC to optimize or even eliminate branches based
14139 on the known return value of these functions called with arguments that
14140 are either constant, or whose values are known to be in a range that
14141 makes determining the exact return value possible.  For example, when
14142 @option{-fprintf-return-value} is in effect, both the branch and the
14143 body of the @code{if} statement (but not the call to @code{snprint})
14144 can be optimized away when @code{i} is a 32-bit or smaller integer
14145 because the return value is guaranteed to be at most 8.
14147 @smallexample
14148 char buf[9];
14149 if (snprintf (buf, "%08x", i) >= sizeof buf)
14150   @dots{}
14151 @end smallexample
14153 The @option{-fprintf-return-value} option relies on other optimizations
14154 and yields best results with @option{-O2} and above.  It works in tandem
14155 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
14156 options.  The @option{-fprintf-return-value} option is enabled by default.
14158 @opindex fno-peephole
14159 @opindex fpeephole
14160 @opindex fno-peephole2
14161 @opindex fpeephole2
14162 @item -fno-peephole
14163 @itemx -fno-peephole2
14164 Disable any machine-specific peephole optimizations.  The difference
14165 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
14166 are implemented in the compiler; some targets use one, some use the
14167 other, a few use both.
14169 @option{-fpeephole} is enabled by default.
14170 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14172 @opindex fno-guess-branch-probability
14173 @opindex fguess-branch-probability
14174 @item -fno-guess-branch-probability
14175 Do not guess branch probabilities using heuristics.
14177 GCC uses heuristics to guess branch probabilities if they are
14178 not provided by profiling feedback (@option{-fprofile-arcs}).  These
14179 heuristics are based on the control flow graph.  If some branch probabilities
14180 are specified by @code{__builtin_expect}, then the heuristics are
14181 used to guess branch probabilities for the rest of the control flow graph,
14182 taking the @code{__builtin_expect} info into account.  The interactions
14183 between the heuristics and @code{__builtin_expect} can be complex, and in
14184 some cases, it may be useful to disable the heuristics so that the effects
14185 of @code{__builtin_expect} are easier to understand.
14187 It is also possible to specify expected probability of the expression
14188 with @code{__builtin_expect_with_probability} built-in function.
14190 The default is @option{-fguess-branch-probability} at levels
14191 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
14193 @opindex freorder-blocks
14194 @item -freorder-blocks
14195 Reorder basic blocks in the compiled function in order to reduce number of
14196 taken branches and improve code locality.
14198 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14200 @opindex freorder-blocks-algorithm
14201 @item -freorder-blocks-algorithm=@var{algorithm}
14202 Use the specified algorithm for basic block reordering.  The
14203 @var{algorithm} argument can be @samp{simple}, which does not increase
14204 code size (except sometimes due to secondary effects like alignment),
14205 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
14206 put all often executed code together, minimizing the number of branches
14207 executed by making extra copies of code.
14209 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
14210 @samp{stc} at levels @option{-O2}, @option{-O3}.
14212 @opindex freorder-blocks-and-partition
14213 @item -freorder-blocks-and-partition
14214 In addition to reordering basic blocks in the compiled function, in order
14215 to reduce number of taken branches, partitions hot and cold basic blocks
14216 into separate sections of the assembly and @file{.o} files, to improve
14217 paging and cache locality performance.
14219 This optimization is automatically turned off in the presence of
14220 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
14221 section attribute and on any architecture that does not support named
14222 sections.  When @option{-fsplit-stack} is used this option is not
14223 enabled by default (to avoid linker errors), but may be enabled
14224 explicitly (if using a working linker).
14226 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
14228 @opindex freorder-functions
14229 @item -freorder-functions
14230 Reorder functions in the object file in order to
14231 improve code locality.  This is implemented by using special
14232 subsections @code{.text.hot} for most frequently executed functions and
14233 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
14234 the linker so object file format must support named sections and linker must
14235 place them in a reasonable way.
14237 This option isn't effective unless you either provide profile feedback
14238 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
14239 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
14241 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14243 @opindex fstrict-aliasing
14244 @item -fstrict-aliasing
14245 Allow the compiler to assume the strictest aliasing rules applicable to
14246 the language being compiled.  For C (and C++), this activates
14247 optimizations based on the type of expressions.  In particular, an
14248 object of one type is assumed never to reside at the same address as an
14249 object of a different type, unless the types are almost the same.  For
14250 example, an @code{unsigned int} can alias an @code{int}, but not a
14251 @code{void*} or a @code{double}.  A character type may alias any other
14252 type.
14254 @anchor{Type-punning}Pay special attention to code like this:
14255 @smallexample
14256 union a_union @{
14257   int i;
14258   double d;
14261 int f() @{
14262   union a_union t;
14263   t.d = 3.0;
14264   return t.i;
14266 @end smallexample
14267 The practice of reading from a different union member than the one most
14268 recently written to (called ``type-punning'') is common.  Even with
14269 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
14270 is accessed through the union type.  So, the code above works as
14271 expected.  @xref{Structures unions enumerations and bit-fields
14272 implementation}.  However, this code might not:
14273 @smallexample
14274 int f() @{
14275   union a_union t;
14276   int* ip;
14277   t.d = 3.0;
14278   ip = &t.i;
14279   return *ip;
14281 @end smallexample
14283 Similarly, access by taking the address, casting the resulting pointer
14284 and dereferencing the result has undefined behavior, even if the cast
14285 uses a union type, e.g.:
14286 @smallexample
14287 int f() @{
14288   double d = 3.0;
14289   return ((union a_union *) &d)->i;
14291 @end smallexample
14293 The @option{-fstrict-aliasing} option is enabled at levels
14294 @option{-O2}, @option{-O3}, @option{-Os}.
14296 @opindex fipa-strict-aliasing
14297 @item -fipa-strict-aliasing
14298 Controls whether rules of @option{-fstrict-aliasing} are applied across
14299 function boundaries.  Note that if multiple functions gets inlined into a
14300 single function the memory accesses are no longer considered to be crossing a
14301 function boundary.
14303 The @option{-fipa-strict-aliasing} option is enabled by default and is
14304 effective only in combination with @option{-fstrict-aliasing}.
14306 @opindex falign-functions
14307 @item -falign-functions
14308 @itemx -falign-functions=@var{n}
14309 @itemx -falign-functions=@var{n}:@var{m}
14310 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
14311 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
14312 Align the start of functions to the next power-of-two greater than or
14313 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
14314 least the first @var{m} bytes of the function can be fetched by the CPU
14315 without crossing an @var{n}-byte alignment boundary.
14316 This is an optimization of code performance and alignment is ignored for
14317 functions considered cold.  If alignment is required for all functions,
14318 use @option{-fmin-function-alignment}.
14320 If @var{m} is not specified, it defaults to @var{n}.
14322 Examples: @option{-falign-functions=32} aligns functions to the next
14323 32-byte boundary, @option{-falign-functions=24} aligns to the next
14324 32-byte boundary only if this can be done by skipping 23 bytes or less,
14325 @option{-falign-functions=32:7} aligns to the next
14326 32-byte boundary only if this can be done by skipping 6 bytes or less.
14328 The second pair of @var{n2}:@var{m2} values allows you to specify
14329 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
14330 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
14331 otherwise aligns to the next 32-byte boundary if this can be done
14332 by skipping 2 bytes or less.
14333 If @var{m2} is not specified, it defaults to @var{n2}.
14335 Some assemblers only support this flag when @var{n} is a power of two;
14336 in that case, it is rounded up.
14338 @option{-fno-align-functions} and @option{-falign-functions=1} are
14339 equivalent and mean that functions are not aligned.
14341 If @var{n} is not specified or is zero, use a machine-dependent default.
14342 The maximum allowed @var{n} option value is 65536.
14344 Enabled at levels @option{-O2}, @option{-O3}.
14346 @item -flimit-function-alignment
14347 If this option is enabled, the compiler tries to avoid unnecessarily
14348 overaligning functions. It attempts to instruct the assembler to align
14349 by the amount specified by @option{-falign-functions}, but not to
14350 skip more bytes than the size of the function.
14352 @opindex falign-labels
14353 @item -falign-labels
14354 @itemx -falign-labels=@var{n}
14355 @itemx -falign-labels=@var{n}:@var{m}
14356 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
14357 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
14358 Align all branch targets to a power-of-two boundary.
14360 Parameters of this option are analogous to the @option{-falign-functions} option.
14361 @option{-fno-align-labels} and @option{-falign-labels=1} are
14362 equivalent and mean that labels are not aligned.
14364 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
14365 are greater than this value, then their values are used instead.
14367 If @var{n} is not specified or is zero, use a machine-dependent default
14368 which is very likely to be @samp{1}, meaning no alignment.
14369 The maximum allowed @var{n} option value is 65536.
14371 Enabled at levels @option{-O2}, @option{-O3}.
14373 @opindex falign-loops
14374 @item -falign-loops
14375 @itemx -falign-loops=@var{n}
14376 @itemx -falign-loops=@var{n}:@var{m}
14377 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
14378 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
14379 Align loops to a power-of-two boundary.  If the loops are executed
14380 many times, this makes up for any execution of the dummy padding
14381 instructions.
14382 This is an optimization of code performance and alignment is ignored for
14383 loops considered cold.
14385 If @option{-falign-labels} is greater than this value, then its value
14386 is used instead.
14388 Parameters of this option are analogous to the @option{-falign-functions} option.
14389 @option{-fno-align-loops} and @option{-falign-loops=1} are
14390 equivalent and mean that loops are not aligned.
14391 The maximum allowed @var{n} option value is 65536.
14393 If @var{n} is not specified or is zero, use a machine-dependent default.
14395 Enabled at levels @option{-O2}, @option{-O3}.
14397 @opindex falign-jumps
14398 @item -falign-jumps
14399 @itemx -falign-jumps=@var{n}
14400 @itemx -falign-jumps=@var{n}:@var{m}
14401 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
14402 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
14403 Align branch targets to a power-of-two boundary, for branch targets
14404 where the targets can only be reached by jumping.  In this case,
14405 no dummy operations need be executed.
14406 This is an optimization of code performance and alignment is ignored for
14407 jumps considered cold.
14409 If @option{-falign-labels} is greater than this value, then its value
14410 is used instead.
14412 Parameters of this option are analogous to the @option{-falign-functions} option.
14413 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
14414 equivalent and mean that loops are not aligned.
14416 If @var{n} is not specified or is zero, use a machine-dependent default.
14417 The maximum allowed @var{n} option value is 65536.
14419 Enabled at levels @option{-O2}, @option{-O3}.
14421 @opindex fmin-function-alignment=@var{n}
14422 @item -fmin-function-alignment
14423 Specify minimal alignment of functions to the next power-of-two greater than or
14424 equal to @var{n}. Unlike @option{-falign-functions} this alignment is applied
14425 also to all functions (even those considered cold).  The alignment is also not
14426 affected by @option{-flimit-function-alignment}
14429 @opindex fno-allocation-dce
14430 @item -fno-allocation-dce
14431 Do not remove unused C++ allocations in dead code elimination.
14433 @opindex fallow-store-data-races
14434 @item -fallow-store-data-races
14435 Allow the compiler to perform optimizations that may introduce new data races
14436 on stores, without proving that the variable cannot be concurrently accessed
14437 by other threads.  Does not affect optimization of local data.  It is safe to
14438 use this option if it is known that global data will not be accessed by
14439 multiple threads.
14441 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14442 hoisting or if-conversions that may cause a value that was already in memory
14443 to be re-written with that same value.  Such re-writing is safe in a single
14444 threaded context but may be unsafe in a multi-threaded context.  Note that on
14445 some processors, if-conversions may be required in order to enable
14446 vectorization.
14448 Enabled at level @option{-Ofast}.
14450 @opindex funit-at-a-time
14451 @item -funit-at-a-time
14452 This option is left for compatibility reasons. @option{-funit-at-a-time}
14453 has no effect, while @option{-fno-unit-at-a-time} implies
14454 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14456 Enabled by default.
14458 @opindex fno-toplevel-reorder
14459 @opindex ftoplevel-reorder
14460 @item -fno-toplevel-reorder
14461 Do not reorder top-level functions, variables, and @code{asm}
14462 statements.  Output them in the same order that they appear in the
14463 input file.  When this option is used, unreferenced static variables
14464 are not removed.  This option is intended to support existing code
14465 that relies on a particular ordering.  For new code, it is better to
14466 use attributes when possible.
14468 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14469 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14470 Additionally @option{-fno-toplevel-reorder} implies
14471 @option{-fno-section-anchors}.
14473 @opindex funreachable-traps
14474 @item -funreachable-traps
14475 With this option, the compiler turns calls to
14476 @code{__builtin_unreachable} into traps, instead of using them for
14477 optimization.  This also affects any such calls implicitly generated
14478 by the compiler.
14480 This option has the same effect as @option{-fsanitize=unreachable
14481 -fsanitize-trap=unreachable}, but does not affect the values of those
14482 options.  If @option{-fsanitize=unreachable} is enabled, that option
14483 takes priority over this one.
14485 This option is enabled by default at @option{-O0} and @option{-Og}.
14487 @opindex fweb
14488 @item -fweb
14489 Constructs webs as commonly used for register allocation purposes and assign
14490 each web individual pseudo register.  This allows the register allocation pass
14491 to operate on pseudos directly, but also strengthens several other optimization
14492 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14493 however, make debugging impossible, since variables no longer stay in a
14494 ``home register''.
14496 Enabled by default with @option{-funroll-loops}.
14498 @opindex fwhole-program
14499 @item -fwhole-program
14500 Assume that the current compilation unit represents the whole program being
14501 compiled.  All public functions and variables with the exception of @code{main}
14502 and those merged by attribute @code{externally_visible} become static functions
14503 and in effect are optimized more aggressively by interprocedural optimizers.
14505 With @option{-flto} this option has a limited use.  In most cases the
14506 precise list of symbols used or exported from the binary is known the
14507 resolution info passed to the link-time optimizer by the linker plugin.  It is
14508 still useful if no linker plugin is used or during incremental link step when
14509 final code is produced (with @option{-flto}
14510 @option{-flinker-output=nolto-rel}).
14512 @opindex flto
14513 @item -flto[=@var{n}]
14514 This option runs the standard link-time optimizer.  When invoked
14515 with source code, it generates GIMPLE (one of GCC's internal
14516 representations) and writes it to special ELF sections in the object
14517 file.  When the object files are linked together, all the function
14518 bodies are read from these ELF sections and instantiated as if they
14519 had been part of the same translation unit.
14521 To use the link-time optimizer, @option{-flto} and optimization
14522 options should be specified at compile time and during the final link.
14523 It is recommended that you compile all the files participating in the
14524 same link with the same options and also specify those options at
14525 link time.
14526 For example:
14528 @smallexample
14529 gcc -c -O2 -flto foo.c
14530 gcc -c -O2 -flto bar.c
14531 gcc -o myprog -flto -O2 foo.o bar.o
14532 @end smallexample
14534 The first two invocations to GCC save a bytecode representation
14535 of GIMPLE into special ELF sections inside @file{foo.o} and
14536 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14537 @file{foo.o} and @file{bar.o}, merges the two files into a single
14538 internal image, and compiles the result as usual.  Since both
14539 @file{foo.o} and @file{bar.o} are merged into a single image, this
14540 causes all the interprocedural analyses and optimizations in GCC to
14541 work across the two files as if they were a single one.  This means,
14542 for example, that the inliner is able to inline functions in
14543 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14545 Another (simpler) way to enable link-time optimization is:
14547 @smallexample
14548 gcc -o myprog -flto -O2 foo.c bar.c
14549 @end smallexample
14551 The above generates bytecode for @file{foo.c} and @file{bar.c},
14552 merges them together into a single GIMPLE representation and optimizes
14553 them as usual to produce @file{myprog}.
14555 The important thing to keep in mind is that to enable link-time
14556 optimizations you need to use the GCC driver to perform the link step.
14557 GCC automatically performs link-time optimization if any of the
14558 objects involved were compiled with the @option{-flto} command-line option.  
14559 You can always override
14560 the automatic decision to do link-time optimization
14561 by passing @option{-fno-lto} to the link command.
14563 To make whole program optimization effective, it is necessary to make
14564 certain whole program assumptions.  The compiler needs to know
14565 what functions and variables can be accessed by libraries and runtime
14566 outside of the link-time optimized unit.  When supported by the linker,
14567 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14568 to the compiler about used and externally visible symbols.  When
14569 the linker plugin is not available, @option{-fwhole-program} should be
14570 used to allow the compiler to make these assumptions, which leads
14571 to more aggressive optimization decisions.
14573 When a file is compiled with @option{-flto} without
14574 @option{-fuse-linker-plugin}, the generated object file is larger than
14575 a regular object file because it contains GIMPLE bytecodes and the usual
14576 final code (see @option{-ffat-lto-objects}).  This means that
14577 object files with LTO information can be linked as normal object
14578 files; if @option{-fno-lto} is passed to the linker, no
14579 interprocedural optimizations are applied.  Note that when
14580 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14581 but you cannot perform a regular, non-LTO link on them.
14583 When producing the final binary, GCC only
14584 applies link-time optimizations to those files that contain bytecode.
14585 Therefore, you can mix and match object files and libraries with
14586 GIMPLE bytecodes and final object code.  GCC automatically selects
14587 which files to optimize in LTO mode and which files to link without
14588 further processing.
14590 Generally, options specified at link time override those
14591 specified at compile time, although in some cases GCC attempts to infer
14592 link-time options from the settings used to compile the input files.
14594 If you do not specify an optimization level option @option{-O} at
14595 link time, then GCC uses the highest optimization level 
14596 used when compiling the object files.  Note that it is generally 
14597 ineffective to specify an optimization level option only at link time and 
14598 not at compile time, for two reasons.  First, compiling without 
14599 optimization suppresses compiler passes that gather information 
14600 needed for effective optimization at link time.  Second, some early
14601 optimization passes can be performed only at compile time and 
14602 not at link time.
14604 There are some code generation flags preserved by GCC when
14605 generating bytecodes, as they need to be used during the final link.
14606 Currently, the following options and their settings are taken from
14607 the first object file that explicitly specifies them: 
14608 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14609 @option{-fgnu-tm} and all the @option{-m} target flags.
14611 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14612 @option{-fPIE} are combined based on the following scheme:
14614 @smallexample
14615 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14616 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14617 @option{-fpic/-fPIC} + (no option) = (no option)
14618 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14619 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14620 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14621 @end smallexample
14623 Certain ABI-changing flags are required to match in all compilation units,
14624 and trying to override this at link time with a conflicting value
14625 is ignored.  This includes options such as @option{-freg-struct-return}
14626 and @option{-fpcc-struct-return}. 
14628 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14629 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14630 are passed through to the link stage and merged conservatively for
14631 conflicting translation units.  Specifically
14632 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14633 precedence; and for example @option{-ffp-contract=off} takes precedence
14634 over @option{-ffp-contract=fast}.  You can override them at link time.
14636 Diagnostic options such as @option{-Wstringop-overflow} are passed
14637 through to the link stage and their setting matches that of the
14638 compile-step at function granularity.  Note that this matters only
14639 for diagnostics emitted during optimization.  Note that code
14640 transforms such as inlining can lead to warnings being enabled
14641 or disabled for regions if code not consistent with the setting
14642 at compile time.
14644 When you need to pass options to the assembler via @option{-Wa} or
14645 @option{-Xassembler} make sure to either compile such translation
14646 units with @option{-fno-lto} or consistently use the same assembler
14647 options on all translation units.  You can alternatively also
14648 specify assembler options at LTO link time.
14650 To enable debug info generation you need to supply @option{-g} at
14651 compile time.  If any of the input files at link time were built
14652 with debug info generation enabled the link will enable debug info
14653 generation as well.  Any elaborate debug info settings
14654 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14655 at the linker command line and mixing different settings in different
14656 translation units is discouraged.
14658 If LTO encounters objects with C linkage declared with incompatible
14659 types in separate translation units to be linked together (undefined
14660 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14661 issued.  The behavior is still undefined at run time.  Similar
14662 diagnostics may be raised for other languages.
14664 Another feature of LTO is that it is possible to apply interprocedural
14665 optimizations on files written in different languages:
14667 @smallexample
14668 gcc -c -flto foo.c
14669 g++ -c -flto bar.cc
14670 gfortran -c -flto baz.f90
14671 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14672 @end smallexample
14674 Notice that the final link is done with @command{g++} to get the C++
14675 runtime libraries and @option{-lgfortran} is added to get the Fortran
14676 runtime libraries.  In general, when mixing languages in LTO mode, you
14677 should use the same link command options as when mixing languages in a
14678 regular (non-LTO) compilation.
14680 If object files containing GIMPLE bytecode are stored in a library archive, say
14681 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14682 are using a linker with plugin support.  To create static libraries suitable
14683 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14684 and @command{ranlib}; 
14685 to show the symbols of object files with GIMPLE bytecode, use
14686 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14687 and @command{nm} have been compiled with plugin support.  At link time, use the
14688 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14689 the LTO optimization process:
14691 @smallexample
14692 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14693 @end smallexample
14695 With the linker plugin enabled, the linker extracts the needed
14696 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14697 to make them part of the aggregated GIMPLE image to be optimized.
14699 If you are not using a linker with plugin support and/or do not
14700 enable the linker plugin, then the objects inside @file{libfoo.a}
14701 are extracted and linked as usual, but they do not participate
14702 in the LTO optimization process.  In order to make a static library suitable
14703 for both LTO optimization and usual linkage, compile its object files with
14704 @option{-flto} @option{-ffat-lto-objects}.
14706 Link-time optimizations do not require the presence of the whole program to
14707 operate.  If the program does not require any symbols to be exported, it is
14708 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14709 the interprocedural optimizers to use more aggressive assumptions which may
14710 lead to improved optimization opportunities.
14711 Use of @option{-fwhole-program} is not needed when linker plugin is
14712 active (see @option{-fuse-linker-plugin}).
14714 The current implementation of LTO makes no
14715 attempt to generate bytecode that is portable between different
14716 types of hosts.  The bytecode files are versioned and there is a
14717 strict version check, so bytecode files generated in one version of
14718 GCC do not work with an older or newer version of GCC.
14720 Link-time optimization does not work well with generation of debugging
14721 information on systems other than those using a combination of ELF and
14722 DWARF.
14724 If you specify the optional @var{n}, the optimization and code
14725 generation done at link time is executed in parallel using @var{n}
14726 parallel jobs by utilizing an installed @command{make} program.  The
14727 environment variable @env{MAKE} may be used to override the program
14728 used.
14730 You can also specify @option{-flto=jobserver} to use GNU make's
14731 job server mode to determine the number of parallel jobs. This
14732 is useful when the Makefile calling GCC is already executing in parallel.
14733 You must prepend a @samp{+} to the command recipe in the parent Makefile
14734 for this to work.  This option likely only works if @env{MAKE} is
14735 GNU make.  Even without the option value, GCC tries to automatically
14736 detect a running GNU make's job server.
14738 Use @option{-flto=auto} to use GNU make's job server, if available,
14739 or otherwise fall back to autodetection of the number of CPU threads
14740 present in your system.
14742 @opindex flto-partition
14743 @item -flto-partition=@var{alg}
14744 Specify the partitioning algorithm used by the link-time optimizer.
14745 The value is either @samp{1to1} to specify a partitioning mirroring
14746 the original source files or @samp{balanced} to specify partitioning
14747 into equally sized chunks (whenever possible) or @samp{max} to create
14748 new partition for every symbol where possible.  Specifying @samp{none}
14749 as an algorithm disables partitioning and streaming completely. 
14750 The default value is @samp{balanced}. While @samp{1to1} can be used
14751 as an workaround for various code ordering issues, the @samp{max}
14752 partitioning is intended for internal testing only.
14753 The value @samp{one} specifies that exactly one partition should be
14754 used while the value @samp{none} bypasses partitioning and executes
14755 the link-time optimization step directly from the WPA phase.
14757 @opindex flto-compression-level
14758 @item -flto-compression-level=@var{n}
14759 This option specifies the level of compression used for intermediate
14760 language written to LTO object files, and is only meaningful in
14761 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14762 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14763 to 19 (maximum compression), while zlib supports values from 0 to 9.
14764 Values outside this range are clamped to either minimum or maximum
14765 of the supported values.  If the option is not given,
14766 a default balanced compression setting is used.
14768 @opindex fuse-linker-plugin
14769 @item -fuse-linker-plugin
14770 Enables the use of a linker plugin during link-time optimization.  This
14771 option relies on plugin support in the linker, which is available in gold
14772 or in GNU ld 2.21 or newer.
14774 This option enables the extraction of object files with GIMPLE bytecode out
14775 of library archives. This improves the quality of optimization by exposing
14776 more code to the link-time optimizer.  This information specifies what
14777 symbols can be accessed externally (by non-LTO object or during dynamic
14778 linking).  Resulting code quality improvements on binaries (and shared
14779 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14780 See @option{-flto} for a description of the effect of this flag and how to
14781 use it.
14783 This option is enabled by default when LTO support in GCC is enabled
14784 and GCC was configured for use with
14785 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14787 @opindex ffat-lto-objects
14788 @item -ffat-lto-objects
14789 Fat LTO objects are object files that contain both the intermediate language
14790 and the object code. This makes them usable for both LTO linking and normal
14791 linking. This option is effective only when compiling with @option{-flto}
14792 and is ignored at link time.
14794 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14795 requires the complete toolchain to be aware of LTO. It requires a linker with
14796 linker plugin support for basic functionality.  Additionally,
14797 @command{nm}, @command{ar} and @command{ranlib}
14798 need to support linker plugins to allow a full-featured build environment
14799 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14800 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14801 to these tools. With non fat LTO makefiles need to be modified to use them.
14803 Note that modern binutils provide plugin auto-load mechanism.
14804 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14805 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14806 @command{gcc-ranlib}).
14808 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14809 support.
14811 @opindex fcompare-elim
14812 @item -fcompare-elim
14813 After register allocation and post-register allocation instruction splitting,
14814 identify arithmetic instructions that compute processor flags similar to a
14815 comparison operation based on that arithmetic.  If possible, eliminate the
14816 explicit comparison operation.
14818 This pass only applies to certain targets that cannot explicitly represent
14819 the comparison operation before register allocation is complete.
14821 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14823 @opindex ffold-mem-offsets
14824 @item -ffold-mem-offsets
14825 @itemx -fno-fold-mem-offsets
14826 Try to eliminate add instructions by folding them in memory loads/stores.
14828 Enabled at levels @option{-O2}, @option{-O3}.
14830 @opindex fcprop-registers
14831 @item -fcprop-registers
14832 After register allocation and post-register allocation instruction splitting,
14833 perform a copy-propagation pass to try to reduce scheduling dependencies
14834 and occasionally eliminate the copy.
14836 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14838 @opindex fprofile-correction
14839 @item -fprofile-correction
14840 Profiles collected using an instrumented binary for multi-threaded programs may
14841 be inconsistent due to missed counter updates. When this option is specified,
14842 GCC uses heuristics to correct or smooth out such inconsistencies. By
14843 default, GCC emits an error message when an inconsistent profile is detected.
14845 This option is enabled by @option{-fauto-profile}.
14847 @opindex fprofile-partial-training
14848 @item -fprofile-partial-training
14849 With @code{-fprofile-use} all portions of programs not executed during train
14850 run are optimized agressively for size rather than speed.  In some cases it is
14851 not practical to train all possible hot paths in the program. (For
14852 example, program may contain functions specific for a given hardware and
14853 trianing may not cover all hardware configurations program is run on.)  With
14854 @code{-fprofile-partial-training} profile feedback will be ignored for all
14855 functions not executed during the train run leading them to be optimized as if
14856 they were compiled without profile feedback. This leads to better performance
14857 when train run is not representative but also leads to significantly bigger
14858 code.
14860 @opindex fprofile-use
14861 @item -fprofile-use
14862 @itemx -fprofile-use=@var{path}
14863 Enable profile feedback-directed optimizations, 
14864 and the following optimizations, many of which
14865 are generally profitable only with profile feedback available:
14867 @gccoptlist{-fbranch-probabilities  -fprofile-values
14868 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14869 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14870 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14871 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14872 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14873 -fprofile-reorder-functions}
14875 Before you can use this option, you must first generate profiling information.
14876 @xref{Instrumentation Options}, for information about the
14877 @option{-fprofile-generate} option.
14879 By default, GCC emits an error message if the feedback profiles do not
14880 match the source code.  This error can be turned into a warning by using
14881 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14882 optimized code.  Additionally, by default, GCC also emits a warning message if
14883 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14885 If @var{path} is specified, GCC looks at the @var{path} to find
14886 the profile feedback data files. See @option{-fprofile-dir}.
14888 @opindex fauto-profile
14889 @item -fauto-profile
14890 @itemx -fauto-profile=@var{path}
14891 Enable sampling-based feedback-directed optimizations, 
14892 and the following optimizations,
14893 many of which are generally profitable only with profile feedback available:
14895 @gccoptlist{-fbranch-probabilities  -fprofile-values
14896 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14897 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14898 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14899 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14900 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14901 -fprofile-correction}
14903 @var{path} is the name of a file containing AutoFDO profile information.
14904 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14906 Producing an AutoFDO profile data file requires running your program
14907 with the @command{perf} utility on a supported GNU/Linux target system.
14908 For more information, see @uref{https://perf.wiki.kernel.org/}.
14910 E.g.
14911 @smallexample
14912 perf record -e br_inst_retired:near_taken -b -o perf.data \
14913     -- your_program
14914 @end smallexample
14916 Then use the @command{create_gcov} tool to convert the raw profile data
14917 to a format that can be used by GCC.@  You must also supply the 
14918 unstripped binary for your program to this tool.  
14919 See @uref{https://github.com/google/autofdo}.
14921 E.g.
14922 @smallexample
14923 create_gcov --binary=your_program.unstripped --profile=perf.data \
14924     --gcov=profile.afdo
14925 @end smallexample
14926 @end table
14928 The following options control compiler behavior regarding floating-point 
14929 arithmetic.  These options trade off between speed and
14930 correctness.  All must be specifically enabled.
14932 @table @gcctabopt
14933 @opindex ffloat-store
14934 @item -ffloat-store
14935 Do not store floating-point variables in registers, and inhibit other
14936 options that might change whether a floating-point value is taken from a
14937 register or memory.
14939 @cindex floating-point precision
14940 This option prevents undesirable excess precision on machines such as
14941 the 68000 where the floating registers (of the 68881) keep more
14942 precision than a @code{double} is supposed to have.  Similarly for the
14943 x86 architecture.  For most programs, the excess precision does only
14944 good, but a few programs rely on the precise definition of IEEE floating
14945 point.  Use @option{-ffloat-store} for such programs, after modifying
14946 them to store all pertinent intermediate computations into variables.
14948 @opindex fexcess-precision
14949 @item -fexcess-precision=@var{style}
14950 This option allows further control over excess precision on machines
14951 where floating-point operations occur in a format with more precision or
14952 range than the IEEE standard and interchange floating-point types.  By
14953 default, @option{-fexcess-precision=fast} is in effect; this means that
14954 operations may be carried out in a wider precision than the types specified
14955 in the source if that would result in faster code, and it is unpredictable
14956 when rounding to the types specified in the source code takes place.
14957 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14958 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14959 both casts and assignments cause values to be rounded to their
14960 semantic types (whereas @option{-ffloat-store} only affects
14961 assignments).  This option is enabled by default for C or C++ if a strict
14962 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14963 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14964 regardless of whether a strict conformance option is used.
14965 If @option{-fexcess-precision=16} is specified, constants and the
14966 results of expressions with types @code{_Float16} and @code{__bf16}
14967 are computed without excess precision.
14969 @opindex mfpmath
14970 @option{-fexcess-precision=standard} is not implemented for languages
14971 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14972 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14973 semantics apply without excess precision, and in the latter, rounding
14974 is unpredictable.
14976 @opindex ffast-math
14977 @item -ffast-math
14978 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14979 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14980 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14981 @option{-fexcess-precision=fast}.
14983 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14985 This option is not turned on by any @option{-O} option besides
14986 @option{-Ofast} since it can result in incorrect output for programs
14987 that depend on an exact implementation of IEEE or ISO rules/specifications
14988 for math functions. It may, however, yield faster code for programs
14989 that do not require the guarantees of these specifications.
14991 @opindex fno-math-errno
14992 @opindex fmath-errno
14993 @item -fno-math-errno
14994 Do not set @code{errno} after calling math functions that are executed
14995 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14996 IEEE exceptions for math error handling may want to use this flag
14997 for speed while maintaining IEEE arithmetic compatibility.
14999 This option is not turned on by any @option{-O} option since
15000 it can result in incorrect output for programs that depend on
15001 an exact implementation of IEEE or ISO rules/specifications for
15002 math functions. It may, however, yield faster code for programs
15003 that do not require the guarantees of these specifications.
15005 The default is @option{-fmath-errno}.
15007 On Darwin systems, the math library never sets @code{errno}.  There is
15008 therefore no reason for the compiler to consider the possibility that
15009 it might, and @option{-fno-math-errno} is the default.
15011 @opindex funsafe-math-optimizations
15012 @item -funsafe-math-optimizations
15014 Allow optimizations for floating-point arithmetic that (a) assume
15015 that arguments and results are valid and (b) may violate IEEE or
15016 ANSI standards.  When used at link time, it may include libraries
15017 or startup files that change the default FPU control word or other
15018 similar optimizations.
15020 This option is not turned on by any @option{-O} option since
15021 it can result in incorrect output for programs that depend on
15022 an exact implementation of IEEE or ISO rules/specifications for
15023 math functions. It may, however, yield faster code for programs
15024 that do not require the guarantees of these specifications.
15025 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
15026 @option{-fassociative-math} and @option{-freciprocal-math}.
15028 The default is @option{-fno-unsafe-math-optimizations}.
15030 @opindex fassociative-math
15031 @item -fassociative-math
15033 Allow re-association of operands in series of floating-point operations.
15034 This violates the ISO C and C++ language standard by possibly changing
15035 computation result.  NOTE: re-ordering may change the sign of zero as
15036 well as ignore NaNs and inhibit or create underflow or overflow (and
15037 thus cannot be used on code that relies on rounding behavior like
15038 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
15039 and thus may not be used when ordered comparisons are required.
15040 This option requires that both @option{-fno-signed-zeros} and
15041 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
15042 much sense with @option{-frounding-math}. For Fortran the option
15043 is automatically enabled when both @option{-fno-signed-zeros} and
15044 @option{-fno-trapping-math} are in effect.
15046 The default is @option{-fno-associative-math}.
15048 @opindex freciprocal-math
15049 @item -freciprocal-math
15051 Allow the reciprocal of a value to be used instead of dividing by
15052 the value if this enables optimizations.  For example @code{x / y}
15053 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
15054 is subject to common subexpression elimination.  Note that this loses
15055 precision and increases the number of flops operating on the value.
15057 The default is @option{-fno-reciprocal-math}.
15059 @opindex ffinite-math-only
15060 @item -ffinite-math-only
15061 Allow optimizations for floating-point arithmetic that assume
15062 that arguments and results are not NaNs or +-Infs.
15064 This option is not turned on by any @option{-O} option since
15065 it can result in incorrect output for programs that depend on
15066 an exact implementation of IEEE or ISO rules/specifications for
15067 math functions. It may, however, yield faster code for programs
15068 that do not require the guarantees of these specifications.
15070 The default is @option{-fno-finite-math-only}.
15072 @opindex fno-signed-zeros
15073 @opindex fsigned-zeros
15074 @item -fno-signed-zeros
15075 Allow optimizations for floating-point arithmetic that ignore the
15076 signedness of zero.  IEEE arithmetic specifies the behavior of
15077 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
15078 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
15079 This option implies that the sign of a zero result isn't significant.
15081 The default is @option{-fsigned-zeros}.
15083 @opindex fno-trapping-math
15084 @opindex ftrapping-math
15085 @item -fno-trapping-math
15086 Compile code assuming that floating-point operations cannot generate
15087 user-visible traps.  These traps include division by zero, overflow,
15088 underflow, inexact result and invalid operation.  This option requires
15089 that @option{-fno-signaling-nans} be in effect.  Setting this option may
15090 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
15092 This option should never be turned on by any @option{-O} option since
15093 it can result in incorrect output for programs that depend on
15094 an exact implementation of IEEE or ISO rules/specifications for
15095 math functions.
15097 The default is @option{-ftrapping-math}.
15099 Future versions of GCC may provide finer control of this setting
15100 using C99's @code{FENV_ACCESS} pragma.  This command-line option
15101 will be used along with @option{-frounding-math} to specify the
15102 default state for @code{FENV_ACCESS}.
15104 @opindex frounding-math
15105 @item -frounding-math
15106 Disable transformations and optimizations that assume default floating-point
15107 rounding behavior.  This is round-to-zero for all floating point
15108 to integer conversions, and round-to-nearest for all other arithmetic
15109 truncations.  This option should be specified for programs that change
15110 the FP rounding mode dynamically, or that may be executed with a
15111 non-default rounding mode.  This option disables constant folding of
15112 floating-point expressions at compile time (which may be affected by
15113 rounding mode) and arithmetic transformations that are unsafe in the
15114 presence of sign-dependent rounding modes.
15116 The default is @option{-fno-rounding-math}.
15118 This option is experimental and does not currently guarantee to
15119 disable all GCC optimizations that are affected by rounding mode.
15120 Future versions of GCC may provide finer control of this setting
15121 using C99's @code{FENV_ACCESS} pragma.  This command-line option
15122 will be used along with @option{-ftrapping-math} to specify the
15123 default state for @code{FENV_ACCESS}.
15125 @opindex fsignaling-nans
15126 @item -fsignaling-nans
15127 Compile code assuming that IEEE signaling NaNs may generate user-visible
15128 traps during floating-point operations.  Setting this option disables
15129 optimizations that may change the number of exceptions visible with
15130 signaling NaNs.  This option implies @option{-ftrapping-math}.
15132 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
15133 be defined.
15135 The default is @option{-fno-signaling-nans}.
15137 This option is experimental and does not currently guarantee to
15138 disable all GCC optimizations that affect signaling NaN behavior.
15140 @opindex fno-fp-int-builtin-inexact
15141 @opindex ffp-int-builtin-inexact
15142 @item -fno-fp-int-builtin-inexact
15143 Do not allow the built-in functions @code{ceil}, @code{floor},
15144 @code{round} and @code{trunc}, and their @code{float} and @code{long
15145 double} variants, to generate code that raises the ``inexact''
15146 floating-point exception for noninteger arguments.  ISO C99 and C11
15147 allow these functions to raise the ``inexact'' exception, but ISO/IEC
15148 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
15149 ISO C23, does not allow these functions to do so.
15151 The default is @option{-ffp-int-builtin-inexact}, allowing the
15152 exception to be raised, unless C23 or a later C standard is selected.
15153 This option does nothing unless @option{-ftrapping-math} is in effect.
15155 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
15156 generate a call to a library function then the ``inexact'' exception
15157 may be raised if the library implementation does not follow TS 18661.
15159 @opindex fsingle-precision-constant
15160 @item -fsingle-precision-constant
15161 Treat floating-point constants as single precision instead of
15162 implicitly converting them to double-precision constants.
15164 @opindex fcx-limited-range
15165 @item -fcx-limited-range
15166 When enabled, this option states that a range reduction step is not
15167 needed when performing complex division.  Also, there is no checking
15168 whether the result of a complex multiplication or division is @code{NaN
15169 + I*NaN}, with an attempt to rescue the situation in that case.  The
15170 default is @option{-fno-cx-limited-range}, but is enabled by
15171 @option{-ffast-math}.
15173 This option controls the default setting of the ISO C99
15174 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
15175 all languages.
15177 @opindex fcx-fortran-rules
15178 @item -fcx-fortran-rules
15179 Complex multiplication and division follow Fortran rules.  Range
15180 reduction is done as part of complex division, but there is no checking
15181 whether the result of a complex multiplication or division is @code{NaN
15182 + I*NaN}, with an attempt to rescue the situation in that case.
15184 The default is @option{-fno-cx-fortran-rules}.
15186 @end table
15188 The following options control optimizations that may improve
15189 performance, but are not enabled by any @option{-O} options.  This
15190 section includes experimental options that may produce broken code.
15192 @table @gcctabopt
15193 @opindex fbranch-probabilities
15194 @item -fbranch-probabilities
15195 After running a program compiled with @option{-fprofile-arcs}
15196 (@pxref{Instrumentation Options}),
15197 you can compile it a second time using
15198 @option{-fbranch-probabilities}, to improve optimizations based on
15199 the number of times each branch was taken.  When a program
15200 compiled with @option{-fprofile-arcs} exits, it saves arc execution
15201 counts to a file called @file{@var{sourcename}.gcda} for each source
15202 file.  The information in this data file is very dependent on the
15203 structure of the generated code, so you must use the same source code
15204 and the same optimization options for both compilations.
15205 See details about the file naming in @option{-fprofile-arcs}.
15207 With @option{-fbranch-probabilities}, GCC puts a
15208 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
15209 These can be used to improve optimization.  Currently, they are only
15210 used in one place: in @file{reorg.cc}, instead of guessing which path a
15211 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
15212 exactly determine which path is taken more often.
15214 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15216 @opindex fprofile-values
15217 @item -fprofile-values
15218 If combined with @option{-fprofile-arcs}, it adds code so that some
15219 data about values of expressions in the program is gathered.
15221 With @option{-fbranch-probabilities}, it reads back the data gathered
15222 from profiling values of expressions for usage in optimizations.
15224 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
15225 @option{-fauto-profile}.
15227 @opindex fprofile-reorder-functions
15228 @item -fprofile-reorder-functions
15229 Function reordering based on profile instrumentation collects
15230 first time of execution of a function and orders these functions
15231 in ascending order.
15233 Enabled with @option{-fprofile-use}.
15235 @opindex fvpt
15236 @item -fvpt
15237 If combined with @option{-fprofile-arcs}, this option instructs the compiler
15238 to add code to gather information about values of expressions.
15240 With @option{-fbranch-probabilities}, it reads back the data gathered
15241 and actually performs the optimizations based on them.
15242 Currently the optimizations include specialization of division operations
15243 using the knowledge about the value of the denominator.
15245 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
15247 @opindex frename-registers
15248 @item -frename-registers
15249 Attempt to avoid false dependencies in scheduled code by making use
15250 of registers left over after register allocation.  This optimization
15251 most benefits processors with lots of registers.  Depending on the
15252 debug information format adopted by the target, however, it can
15253 make debugging impossible, since variables no longer stay in
15254 a ``home register''.
15256 Enabled by default with @option{-funroll-loops}.
15258 @opindex fschedule-fusion
15259 @item -fschedule-fusion
15260 Performs a target dependent pass over the instruction stream to schedule
15261 instructions of same type together because target machine can execute them
15262 more efficiently if they are adjacent to each other in the instruction flow.
15264 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
15266 @opindex ftracer
15267 @item -ftracer
15268 Perform tail duplication to enlarge superblock size.  This transformation
15269 simplifies the control flow of the function allowing other optimizations to do
15270 a better job.
15272 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15274 @opindex funroll-loops
15275 @item -funroll-loops
15276 Unroll loops whose number of iterations can be determined at compile time or
15277 upon entry to the loop.  @option{-funroll-loops} implies
15278 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
15279 It also turns on complete loop peeling (i.e.@: complete removal of loops with
15280 a small constant number of iterations).  This option makes code larger, and may
15281 or may not make it run faster.
15283 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15285 @opindex funroll-all-loops
15286 @item -funroll-all-loops
15287 Unroll all loops, even if their number of iterations is uncertain when
15288 the loop is entered.  This usually makes programs run more slowly.
15289 @option{-funroll-all-loops} implies the same options as
15290 @option{-funroll-loops}.
15292 @opindex fpeel-loops
15293 @item -fpeel-loops
15294 Peels loops for which there is enough information that they do not
15295 roll much (from profile feedback or static analysis).  It also turns on
15296 complete loop peeling (i.e.@: complete removal of loops with small constant
15297 number of iterations).
15299 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
15301 @opindex fmove-loop-invariants
15302 @item -fmove-loop-invariants
15303 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
15304 at level @option{-O1} and higher, except for @option{-Og}.
15306 @opindex fmove-loop-stores
15307 @item -fmove-loop-stores
15308 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
15309 moves invariant stores to after the end of the loop in exchange for
15310 carrying the stored value in a register across the iteration.
15311 Note for this option to have an effect @option{-ftree-loop-im} has to
15312 be enabled as well.  Enabled at level @option{-O1} and higher, except
15313 for @option{-Og}.
15315 @opindex fsplit-loops
15316 @item -fsplit-loops
15317 Split a loop into two if it contains a condition that's always true
15318 for one side of the iteration space and false for the other.
15320 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15322 @opindex funswitch-loops
15323 @item -funswitch-loops
15324 Move branches with loop invariant conditions out of the loop, with duplicates
15325 of the loop on both branches (modified according to result of the condition).
15327 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15329 @opindex fversion-loops-for-strides
15330 @item -fversion-loops-for-strides
15331 If a loop iterates over an array with a variable stride, create another
15332 version of the loop that assumes the stride is always one.  For example:
15334 @smallexample
15335 for (int i = 0; i < n; ++i)
15336   x[i * stride] = @dots{};
15337 @end smallexample
15339 becomes:
15341 @smallexample
15342 if (stride == 1)
15343   for (int i = 0; i < n; ++i)
15344     x[i] = @dots{};
15345 else
15346   for (int i = 0; i < n; ++i)
15347     x[i * stride] = @dots{};
15348 @end smallexample
15350 This is particularly useful for assumed-shape arrays in Fortran where
15351 (for example) it allows better vectorization assuming contiguous accesses.
15352 This flag is enabled by default at @option{-O3}.
15353 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15355 @opindex ffunction-sections
15356 @opindex fdata-sections
15357 @item -ffunction-sections
15358 @itemx -fdata-sections
15359 Place each function or data item into its own section in the output
15360 file if the target supports arbitrary sections.  The name of the
15361 function or the name of the data item determines the section's name
15362 in the output file.
15364 Use these options on systems where the linker can perform optimizations to
15365 improve locality of reference in the instruction space.  Most systems using the
15366 ELF object format have linkers with such optimizations.  On AIX, the linker
15367 rearranges sections (CSECTs) based on the call graph.  The performance impact
15368 varies.
15370 Together with a linker garbage collection (linker @option{--gc-sections}
15371 option) these options may lead to smaller statically-linked executables (after
15372 stripping).
15374 On ELF/DWARF systems these options do not degenerate the quality of the debug
15375 information.  There could be issues with other object files/debug info formats.
15377 Only use these options when there are significant benefits from doing so.  When
15378 you specify these options, the assembler and linker create larger object and
15379 executable files and are also slower.  These options affect code generation.
15380 They prevent optimizations by the compiler and assembler using relative
15381 locations inside a translation unit since the locations are unknown until
15382 link time.  An example of such an optimization is relaxing calls to short call
15383 instructions.
15385 @opindex fstdarg-opt
15386 @item -fstdarg-opt
15387 Optimize the prologue of variadic argument functions with respect to usage of
15388 those arguments.
15390 @opindex fsection-anchors
15391 @item -fsection-anchors
15392 Try to reduce the number of symbolic address calculations by using
15393 shared ``anchor'' symbols to address nearby objects.  This transformation
15394 can help to reduce the number of GOT entries and GOT accesses on some
15395 targets.
15397 For example, the implementation of the following function @code{foo}:
15399 @smallexample
15400 static int a, b, c;
15401 int foo (void) @{ return a + b + c; @}
15402 @end smallexample
15404 @noindent
15405 usually calculates the addresses of all three variables, but if you
15406 compile it with @option{-fsection-anchors}, it accesses the variables
15407 from a common anchor point instead.  The effect is similar to the
15408 following pseudocode (which isn't valid C):
15410 @smallexample
15411 int foo (void)
15413   register int *xr = &x;
15414   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
15416 @end smallexample
15418 Not all targets support this option.
15420 @opindex fzero-call-used-regs
15421 @item -fzero-call-used-regs=@var{choice}
15422 Zero call-used registers at function return to increase program
15423 security by either mitigating Return-Oriented Programming (ROP)
15424 attacks or preventing information leakage through registers.
15426 The possible values of @var{choice} are the same as for the
15427 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
15428 The default is @samp{skip}.
15430 You can control this behavior for a specific function by using the function
15431 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
15433 @opindex param
15434 @item --param @var{name}=@var{value}
15435 In some places, GCC uses various constants to control the amount of
15436 optimization that is done.  For example, GCC does not inline functions
15437 that contain more than a certain number of instructions.  You can
15438 control some of these constants on the command line using the
15439 @option{--param} option.
15441 The names of specific parameters, and the meaning of the values, are
15442 tied to the internals of the compiler, and are subject to change
15443 without notice in future releases.
15445 In order to get the minimal, maximal and default values of a parameter,
15446 use the @option{--help=param -Q} options.
15448 In each case, the @var{value} is an integer.  The following choices
15449 of @var{name} are recognized for all targets:
15451 @table @gcctabopt
15452 @item predictable-branch-outcome
15453 When branch is predicted to be taken with probability lower than this threshold
15454 (in percent), then it is considered well predictable.
15456 @item max-rtl-if-conversion-insns
15457 RTL if-conversion tries to remove conditional branches around a block and
15458 replace them with conditionally executed instructions.  This parameter
15459 gives the maximum number of instructions in a block which should be
15460 considered for if-conversion.  The compiler will
15461 also use other heuristics to decide whether if-conversion is likely to be
15462 profitable.
15464 @item max-rtl-if-conversion-predictable-cost
15465 RTL if-conversion will try to remove conditional branches around a block
15466 and replace them with conditionally executed instructions.  These parameters
15467 give the maximum permissible cost for the sequence that would be generated
15468 by if-conversion depending on whether the branch is statically determined
15469 to be predictable or not.  The units for this parameter are the same as
15470 those for the GCC internal seq_cost metric.  The compiler will try to
15471 provide a reasonable default for this parameter using the BRANCH_COST
15472 target macro.
15474 @item max-crossjump-edges
15475 The maximum number of incoming edges to consider for cross-jumping.
15476 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15477 the number of edges incoming to each block.  Increasing values mean
15478 more aggressive optimization, making the compilation time increase with
15479 probably small improvement in executable size.
15481 @item min-crossjump-insns
15482 The minimum number of instructions that must be matched at the end
15483 of two blocks before cross-jumping is performed on them.  This
15484 value is ignored in the case where all instructions in the block being
15485 cross-jumped from are matched.
15487 @item max-grow-copy-bb-insns
15488 The maximum code size expansion factor when copying basic blocks
15489 instead of jumping.  The expansion is relative to a jump instruction.
15491 @item max-goto-duplication-insns
15492 The maximum number of instructions to duplicate to a block that jumps
15493 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15494 passes, GCC factors computed gotos early in the compilation process,
15495 and unfactors them as late as possible.  Only computed jumps at the
15496 end of a basic blocks with no more than max-goto-duplication-insns are
15497 unfactored.
15499 @item max-delay-slot-insn-search
15500 The maximum number of instructions to consider when looking for an
15501 instruction to fill a delay slot.  If more than this arbitrary number of
15502 instructions are searched, the time savings from filling the delay slot
15503 are minimal, so stop searching.  Increasing values mean more
15504 aggressive optimization, making the compilation time increase with probably
15505 small improvement in execution time.
15507 @item max-delay-slot-live-search
15508 When trying to fill delay slots, the maximum number of instructions to
15509 consider when searching for a block with valid live register
15510 information.  Increasing this arbitrarily chosen value means more
15511 aggressive optimization, increasing the compilation time.  This parameter
15512 should be removed when the delay slot code is rewritten to maintain the
15513 control-flow graph.
15515 @item max-gcse-memory
15516 The approximate maximum amount of memory in @code{kB} that can be allocated in
15517 order to perform the global common subexpression elimination
15518 optimization.  If more memory than specified is required, the
15519 optimization is not done.
15521 @item max-gcse-insertion-ratio
15522 If the ratio of expression insertions to deletions is larger than this value
15523 for any expression, then RTL PRE inserts or removes the expression and thus
15524 leaves partially redundant computations in the instruction stream.
15526 @item max-pending-list-length
15527 The maximum number of pending dependencies scheduling allows
15528 before flushing the current state and starting over.  Large functions
15529 with few branches or calls can create excessively large lists which
15530 needlessly consume memory and resources.
15532 @item max-modulo-backtrack-attempts
15533 The maximum number of backtrack attempts the scheduler should make
15534 when modulo scheduling a loop.  Larger values can exponentially increase
15535 compilation time.
15537 @item max-inline-functions-called-once-loop-depth
15538 Maximal loop depth of a call considered by inline heuristics that tries to
15539 inline all functions called once.
15541 @item max-inline-functions-called-once-insns
15542 Maximal estimated size of functions produced while inlining functions called
15543 once.
15545 @item max-inline-insns-single
15546 Several parameters control the tree inliner used in GCC@.  This number sets the
15547 maximum number of instructions (counted in GCC's internal representation) in a
15548 single function that the tree inliner considers for inlining.  This only
15549 affects functions declared inline and methods implemented in a class
15550 declaration (C++). 
15553 @item max-inline-insns-auto
15554 When you use @option{-finline-functions} (included in @option{-O3}),
15555 a lot of functions that would otherwise not be considered for inlining
15556 by the compiler are investigated.  To those functions, a different
15557 (more restrictive) limit compared to functions declared inline can
15558 be applied (@option{--param max-inline-insns-auto}).
15560 @item max-inline-insns-small
15561 This is bound applied to calls which are considered relevant with
15562 @option{-finline-small-functions}.
15564 @item max-inline-insns-size
15565 This is bound applied to calls which are optimized for size. Small growth
15566 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15568 @item uninlined-function-insns
15569 Number of instructions accounted by inliner for function overhead such as
15570 function prologue and epilogue.
15572 @item uninlined-function-time
15573 Extra time accounted by inliner for function overhead such as time needed to
15574 execute function prologue and epilogue.
15576 @item inline-heuristics-hint-percent
15577 The scale (in percents) applied to @option{inline-insns-single},
15578 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15579 when inline heuristics hints that inlining is
15580 very profitable (will enable later optimizations).
15582 @item uninlined-thunk-insns
15583 @item uninlined-thunk-time
15584 Same as @option{--param uninlined-function-insns} and
15585 @option{--param uninlined-function-time} but applied to function thunks.
15587 @item inline-min-speedup
15588 When estimated performance improvement of caller + callee runtime exceeds this
15589 threshold (in percent), the function can be inlined regardless of the limit on
15590 @option{--param max-inline-insns-single} and @option{--param
15591 max-inline-insns-auto}.
15593 @item large-function-insns
15594 The limit specifying really large functions.  For functions larger than this
15595 limit after inlining, inlining is constrained by
15596 @option{--param large-function-growth}.  This parameter is useful primarily
15597 to avoid extreme compilation time caused by non-linear algorithms used by the
15598 back end.
15600 @item large-function-growth
15601 Specifies maximal growth of large function caused by inlining in percents.
15602 For example, parameter value 100 limits large function growth to 2.0 times
15603 the original size.
15605 @item large-unit-insns
15606 The limit specifying large translation unit.  Growth caused by inlining of
15607 units larger than this limit is limited by @option{--param inline-unit-growth}.
15608 For small units this might be too tight.
15609 For example, consider a unit consisting of function A
15610 that is inline and B that just calls A three times.  If B is small relative to
15611 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15612 large units consisting of small inlineable functions, however, the overall unit
15613 growth limit is needed to avoid exponential explosion of code size.  Thus for
15614 smaller units, the size is increased to @option{--param large-unit-insns}
15615 before applying @option{--param inline-unit-growth}.
15617 @item lazy-modules
15618 Maximum number of concurrently open C++ module files when lazy loading.
15620 @item inline-unit-growth
15621 Specifies maximal overall growth of the compilation unit caused by inlining.
15622 For example, parameter value 20 limits unit growth to 1.2 times the original
15623 size. Cold functions (either marked cold via an attribute or by profile
15624 feedback) are not accounted into the unit size.
15626 @item ipa-cp-unit-growth
15627 Specifies maximal overall growth of the compilation unit caused by
15628 interprocedural constant propagation.  For example, parameter value 10 limits
15629 unit growth to 1.1 times the original size.
15631 @item ipa-cp-large-unit-insns
15632 The size of translation unit that IPA-CP pass considers large.
15634 @item large-stack-frame
15635 The limit specifying large stack frames.  While inlining the algorithm is trying
15636 to not grow past this limit too much.
15638 @item large-stack-frame-growth
15639 Specifies maximal growth of large stack frames caused by inlining in percents.
15640 For example, parameter value 1000 limits large stack frame growth to 11 times
15641 the original size.
15643 @item max-inline-insns-recursive
15644 @itemx max-inline-insns-recursive-auto
15645 Specifies the maximum number of instructions an out-of-line copy of a
15646 self-recursive inline
15647 function can grow into by performing recursive inlining.
15649 @option{--param max-inline-insns-recursive} applies to functions
15650 declared inline.
15651 For functions not declared inline, recursive inlining
15652 happens only when @option{-finline-functions} (included in @option{-O3}) is
15653 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15655 @item max-inline-recursive-depth
15656 @itemx max-inline-recursive-depth-auto
15657 Specifies the maximum recursion depth used for recursive inlining.
15659 @option{--param max-inline-recursive-depth} applies to functions
15660 declared inline.  For functions not declared inline, recursive inlining
15661 happens only when @option{-finline-functions} (included in @option{-O3}) is
15662 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15664 @item min-inline-recursive-probability
15665 Recursive inlining is profitable only for function having deep recursion
15666 in average and can hurt for function having little recursion depth by
15667 increasing the prologue size or complexity of function body to other
15668 optimizers.
15670 When profile feedback is available (see @option{-fprofile-generate}) the actual
15671 recursion depth can be guessed from the probability that function recurses
15672 via a given call expression.  This parameter limits inlining only to call
15673 expressions whose probability exceeds the given threshold (in percents).
15675 @item early-inlining-insns
15676 Specify growth that the early inliner can make.  In effect it increases
15677 the amount of inlining for code having a large abstraction penalty.
15679 @item max-early-inliner-iterations
15680 Limit of iterations of the early inliner.  This basically bounds
15681 the number of nested indirect calls the early inliner can resolve.
15682 Deeper chains are still handled by late inlining.
15684 @item comdat-sharing-probability
15685 Probability (in percent) that C++ inline function with comdat visibility
15686 are shared across multiple compilation units.
15688 @item modref-max-bases
15689 @item modref-max-refs
15690 @item modref-max-accesses
15691 Specifies the maximal number of base pointers, references and accesses stored
15692 for a single function by mod/ref analysis.
15694 @item modref-max-tests
15695 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15696 memory locations using the mod/ref information.  This parameter ought to be
15697 bigger than @option{--param modref-max-bases} and @option{--param
15698 modref-max-refs}.
15700 @item modref-max-depth
15701 Specifies the maximum depth of DFS walk used by modref escape analysis.
15702 Setting to 0 disables the analysis completely.
15704 @item modref-max-escape-points
15705 Specifies the maximum number of escape points tracked by modref per SSA-name.
15707 @item modref-max-adjustments
15708 Specifies the maximum number the access range is enlarged during modref dataflow
15709 analysis.
15711 @item profile-func-internal-id
15712 A parameter to control whether to use function internal id in profile
15713 database lookup. If the value is 0, the compiler uses an id that
15714 is based on function assembler name and filename, which makes old profile
15715 data more tolerant to source changes such as function reordering etc.
15717 @item min-vect-loop-bound
15718 The minimum number of iterations under which loops are not vectorized
15719 when @option{-ftree-vectorize} is used.  The number of iterations after
15720 vectorization needs to be greater than the value specified by this option
15721 to allow vectorization.
15723 @item gcse-cost-distance-ratio
15724 Scaling factor in calculation of maximum distance an expression
15725 can be moved by GCSE optimizations.  This is currently supported only in the
15726 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15727 is with simple expressions, i.e., the expressions that have cost
15728 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15729 hoisting of simple expressions.
15731 @item gcse-unrestricted-cost
15732 Cost, roughly measured as the cost of a single typical machine
15733 instruction, at which GCSE optimizations do not constrain
15734 the distance an expression can travel.  This is currently
15735 supported only in the code hoisting pass.  The lesser the cost,
15736 the more aggressive code hoisting is.  Specifying 0 
15737 allows all expressions to travel unrestricted distances.
15739 @item max-hoist-depth
15740 The depth of search in the dominator tree for expressions to hoist.
15741 This is used to avoid quadratic behavior in hoisting algorithm.
15742 The value of 0 does not limit on the search, but may slow down compilation
15743 of huge functions.
15745 @item max-tail-merge-comparisons
15746 The maximum amount of similar bbs to compare a bb with.  This is used to
15747 avoid quadratic behavior in tree tail merging.
15749 @item max-tail-merge-iterations
15750 The maximum amount of iterations of the pass over the function.  This is used to
15751 limit compilation time in tree tail merging.
15753 @item store-merging-allow-unaligned
15754 Allow the store merging pass to introduce unaligned stores if it is legal to
15755 do so.
15757 @item max-stores-to-merge
15758 The maximum number of stores to attempt to merge into wider stores in the store
15759 merging pass.
15761 @item max-store-chains-to-track
15762 The maximum number of store chains to track at the same time in the attempt
15763 to merge them into wider stores in the store merging pass.
15765 @item max-stores-to-track
15766 The maximum number of stores to track at the same time in the attemt to
15767 to merge them into wider stores in the store merging pass.
15769 @item max-unrolled-insns
15770 The maximum number of instructions that a loop may have to be unrolled.
15771 If a loop is unrolled, this parameter also determines how many times
15772 the loop code is unrolled.
15774 @item max-average-unrolled-insns
15775 The maximum number of instructions biased by probabilities of their execution
15776 that a loop may have to be unrolled.  If a loop is unrolled,
15777 this parameter also determines how many times the loop code is unrolled.
15779 @item max-unroll-times
15780 The maximum number of unrollings of a single loop.
15782 @item max-peeled-insns
15783 The maximum number of instructions that a loop may have to be peeled.
15784 If a loop is peeled, this parameter also determines how many times
15785 the loop code is peeled.
15787 @item max-peel-times
15788 The maximum number of peelings of a single loop.
15790 @item max-peel-branches
15791 The maximum number of branches on the hot path through the peeled sequence.
15793 @item max-completely-peeled-insns
15794 The maximum number of insns of a completely peeled loop.
15796 @item max-completely-peel-times
15797 The maximum number of iterations of a loop to be suitable for complete peeling.
15799 @item max-completely-peel-loop-nest-depth
15800 The maximum depth of a loop nest suitable for complete peeling.
15802 @item max-unswitch-insns
15803 The maximum number of insns of an unswitched loop.
15805 @item max-unswitch-depth
15806 The maximum depth of a loop nest to be unswitched.
15808 @item lim-expensive
15809 The minimum cost of an expensive expression in the loop invariant motion.
15811 @item min-loop-cond-split-prob
15812 When FDO profile information is available, @option{min-loop-cond-split-prob}
15813 specifies minimum threshold for probability of semi-invariant condition
15814 statement to trigger loop split.
15816 @item iv-consider-all-candidates-bound
15817 Bound on number of candidates for induction variables, below which
15818 all candidates are considered for each use in induction variable
15819 optimizations.  If there are more candidates than this,
15820 only the most relevant ones are considered to avoid quadratic time complexity.
15822 @item iv-max-considered-uses
15823 The induction variable optimizations give up on loops that contain more
15824 induction variable uses.
15826 @item iv-always-prune-cand-set-bound
15827 If the number of candidates in the set is smaller than this value,
15828 always try to remove unnecessary ivs from the set
15829 when adding a new one.
15831 @item avg-loop-niter
15832 Average number of iterations of a loop.
15834 @item dse-max-object-size
15835 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15836 Larger values may result in larger compilation times.
15838 @item dse-max-alias-queries-per-store
15839 Maximum number of queries into the alias oracle per store.
15840 Larger values result in larger compilation times and may result in more
15841 removed dead stores.
15843 @item scev-max-expr-size
15844 Bound on size of expressions used in the scalar evolutions analyzer.
15845 Large expressions slow the analyzer.
15847 @item scev-max-expr-complexity
15848 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15849 Complex expressions slow the analyzer.
15851 @item max-tree-if-conversion-phi-args
15852 Maximum number of arguments in a PHI supported by TREE if conversion
15853 unless the loop is marked with simd pragma.
15855 @item vect-max-layout-candidates
15856 The maximum number of possible vector layouts (such as permutations)
15857 to consider when optimizing to-be-vectorized code.
15859 @item vect-max-version-for-alignment-checks
15860 The maximum number of run-time checks that can be performed when
15861 doing loop versioning for alignment in the vectorizer.
15863 @item vect-max-version-for-alias-checks
15864 The maximum number of run-time checks that can be performed when
15865 doing loop versioning for alias in the vectorizer.
15867 @item vect-max-peeling-for-alignment
15868 The maximum number of loop peels to enhance access alignment
15869 for vectorizer. Value -1 means no limit.
15871 @item max-iterations-to-track
15872 The maximum number of iterations of a loop the brute-force algorithm
15873 for analysis of the number of iterations of the loop tries to evaluate.
15875 @item hot-bb-count-fraction
15876 The denominator n of fraction 1/n of the maximal execution count of a
15877 basic block in the entire program that a basic block needs to at least
15878 have in order to be considered hot.  The default is 10000, which means
15879 that a basic block is considered hot if its execution count is greater
15880 than 1/10000 of the maximal execution count.  0 means that it is never
15881 considered hot.  Used in non-LTO mode.
15883 @item hot-bb-count-ws-permille
15884 The number of most executed permilles, ranging from 0 to 1000, of the
15885 profiled execution of the entire program to which the execution count
15886 of a basic block must be part of in order to be considered hot.  The
15887 default is 990, which means that a basic block is considered hot if
15888 its execution count contributes to the upper 990 permilles, or 99.0%,
15889 of the profiled execution of the entire program.  0 means that it is
15890 never considered hot.  Used in LTO mode.
15892 @item hot-bb-frequency-fraction
15893 The denominator n of fraction 1/n of the execution frequency of the
15894 entry block of a function that a basic block of this function needs
15895 to at least have in order to be considered hot.  The default is 1000,
15896 which means that a basic block is considered hot in a function if it
15897 is executed more frequently than 1/1000 of the frequency of the entry
15898 block of the function.  0 means that it is never considered hot.
15900 @item unlikely-bb-count-fraction
15901 The denominator n of fraction 1/n of the number of profiled runs of
15902 the entire program below which the execution count of a basic block
15903 must be in order for the basic block to be considered unlikely executed.
15904 The default is 20, which means that a basic block is considered unlikely
15905 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15906 the program.  0 means that it is always considered unlikely executed.
15908 @item max-predicted-iterations
15909 The maximum number of loop iterations we predict statically.  This is useful
15910 in cases where a function contains a single loop with known bound and
15911 another loop with unknown bound.
15912 The known number of iterations is predicted correctly, while
15913 the unknown number of iterations average to roughly 10.  This means that the
15914 loop without bounds appears artificially cold relative to the other one.
15916 @item builtin-expect-probability
15917 Control the probability of the expression having the specified value. This
15918 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15920 @item builtin-string-cmp-inline-length
15921 The maximum length of a constant string for a builtin string cmp call 
15922 eligible for inlining.
15924 @item align-threshold
15926 Select fraction of the maximal frequency of executions of a basic block in
15927 a function to align the basic block.
15929 @item align-loop-iterations
15931 A loop expected to iterate at least the selected number of iterations is
15932 aligned.
15934 @item tracer-dynamic-coverage
15935 @itemx tracer-dynamic-coverage-feedback
15937 This value is used to limit superblock formation once the given percentage of
15938 executed instructions is covered.  This limits unnecessary code size
15939 expansion.
15941 The @option{tracer-dynamic-coverage-feedback} parameter
15942 is used only when profile
15943 feedback is available.  The real profiles (as opposed to statically estimated
15944 ones) are much less balanced allowing the threshold to be larger value.
15946 @item tracer-max-code-growth
15947 Stop tail duplication once code growth has reached given percentage.  This is
15948 a rather artificial limit, as most of the duplicates are eliminated later in
15949 cross jumping, so it may be set to much higher values than is the desired code
15950 growth.
15952 @item tracer-min-branch-ratio
15954 Stop reverse growth when the reverse probability of best edge is less than this
15955 threshold (in percent).
15957 @item tracer-min-branch-probability
15958 @itemx tracer-min-branch-probability-feedback
15960 Stop forward growth if the best edge has probability lower than this
15961 threshold.
15963 Similarly to @option{tracer-dynamic-coverage} two parameters are
15964 provided.  @option{tracer-min-branch-probability-feedback} is used for
15965 compilation with profile feedback and @option{tracer-min-branch-probability}
15966 compilation without.  The value for compilation with profile feedback
15967 needs to be more conservative (higher) in order to make tracer
15968 effective.
15970 @item stack-clash-protection-guard-size
15971 Specify the size of the operating system provided stack guard as
15972 2 raised to @var{num} bytes.  Higher values may reduce the
15973 number of explicit probes, but a value larger than the operating system
15974 provided guard will leave code vulnerable to stack clash style attacks.
15976 @item stack-clash-protection-probe-interval
15977 Stack clash protection involves probing stack space as it is allocated.  This
15978 param controls the maximum distance between probes into the stack as 2 raised
15979 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15980 larger than the operating system provided guard will leave code vulnerable to
15981 stack clash style attacks.
15983 @item max-cse-path-length
15985 The maximum number of basic blocks on path that CSE considers.
15987 @item max-cse-insns
15988 The maximum number of instructions CSE processes before flushing.
15990 @item ggc-min-expand
15992 GCC uses a garbage collector to manage its own memory allocation.  This
15993 parameter specifies the minimum percentage by which the garbage
15994 collector's heap should be allowed to expand between collections.
15995 Tuning this may improve compilation speed; it has no effect on code
15996 generation.
15998 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15999 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
16000 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
16001 GCC is not able to calculate RAM on a particular platform, the lower
16002 bound of 30% is used.  Setting this parameter and
16003 @option{ggc-min-heapsize} to zero causes a full collection to occur at
16004 every opportunity.  This is extremely slow, but can be useful for
16005 debugging.
16007 @item ggc-min-heapsize
16009 Minimum size of the garbage collector's heap before it begins bothering
16010 to collect garbage.  The first collection occurs after the heap expands
16011 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
16012 tuning this may improve compilation speed, and has no effect on code
16013 generation.
16015 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
16016 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
16017 with a lower bound of 4096 (four megabytes) and an upper bound of
16018 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
16019 particular platform, the lower bound is used.  Setting this parameter
16020 very large effectively disables garbage collection.  Setting this
16021 parameter and @option{ggc-min-expand} to zero causes a full collection
16022 to occur at every opportunity.
16024 @item max-reload-search-insns
16025 The maximum number of instruction reload should look backward for equivalent
16026 register.  Increasing values mean more aggressive optimization, making the
16027 compilation time increase with probably slightly better performance.
16029 @item max-cselib-memory-locations
16030 The maximum number of memory locations cselib should take into account.
16031 Increasing values mean more aggressive optimization, making the compilation time
16032 increase with probably slightly better performance.
16034 @item max-sched-ready-insns
16035 The maximum number of instructions ready to be issued the scheduler should
16036 consider at any given time during the first scheduling pass.  Increasing
16037 values mean more thorough searches, making the compilation time increase
16038 with probably little benefit.
16040 @item max-sched-region-blocks
16041 The maximum number of blocks in a region to be considered for
16042 interblock scheduling.
16044 @item max-pipeline-region-blocks
16045 The maximum number of blocks in a region to be considered for
16046 pipelining in the selective scheduler.
16048 @item max-sched-region-insns
16049 The maximum number of insns in a region to be considered for
16050 interblock scheduling.
16052 @item max-pipeline-region-insns
16053 The maximum number of insns in a region to be considered for
16054 pipelining in the selective scheduler.
16056 @item min-spec-prob
16057 The minimum probability (in percents) of reaching a source block
16058 for interblock speculative scheduling.
16060 @item max-sched-extend-regions-iters
16061 The maximum number of iterations through CFG to extend regions.
16062 A value of 0 disables region extensions.
16064 @item max-sched-insn-conflict-delay
16065 The maximum conflict delay for an insn to be considered for speculative motion.
16067 @item sched-spec-prob-cutoff
16068 The minimal probability of speculation success (in percents), so that
16069 speculative insns are scheduled.
16071 @item sched-state-edge-prob-cutoff
16072 The minimum probability an edge must have for the scheduler to save its
16073 state across it.
16075 @item sched-mem-true-dep-cost
16076 Minimal distance (in CPU cycles) between store and load targeting same
16077 memory locations.
16079 @item selsched-max-lookahead
16080 The maximum size of the lookahead window of selective scheduling.  It is a
16081 depth of search for available instructions.
16083 @item selsched-max-sched-times
16084 The maximum number of times that an instruction is scheduled during
16085 selective scheduling.  This is the limit on the number of iterations
16086 through which the instruction may be pipelined.
16088 @item selsched-insns-to-rename
16089 The maximum number of best instructions in the ready list that are considered
16090 for renaming in the selective scheduler.
16092 @item sms-min-sc
16093 The minimum value of stage count that swing modulo scheduler
16094 generates.
16096 @item max-last-value-rtl
16097 The maximum size measured as number of RTLs that can be recorded in an expression
16098 in combiner for a pseudo register as last known value of that register.
16100 @item max-combine-insns
16101 The maximum number of instructions the RTL combiner tries to combine.
16103 @item integer-share-limit
16104 Small integer constants can use a shared data structure, reducing the
16105 compiler's memory usage and increasing its speed.  This sets the maximum
16106 value of a shared integer constant.
16108 @item ssp-buffer-size
16109 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
16110 protection when @option{-fstack-protector} is used.
16112 @item min-size-for-stack-sharing
16113 The minimum size of variables taking part in stack slot sharing when not
16114 optimizing.
16116 @item max-jump-thread-duplication-stmts
16117 Maximum number of statements allowed in a block that needs to be
16118 duplicated when threading jumps.
16120 @item max-jump-thread-paths
16121 The maximum number of paths to consider when searching for jump threading
16122 opportunities.  When arriving at a block, incoming edges are only considered
16123 if the number of paths to be searched so far multiplied by the number of
16124 incoming edges does not exhaust the specified maximum number of paths to
16125 consider.
16127 @item max-fields-for-field-sensitive
16128 Maximum number of fields in a structure treated in
16129 a field sensitive manner during pointer analysis.
16131 @item prefetch-latency
16132 Estimate on average number of instructions that are executed before
16133 prefetch finishes.  The distance prefetched ahead is proportional
16134 to this constant.  Increasing this number may also lead to less
16135 streams being prefetched (see @option{simultaneous-prefetches}).
16137 @item simultaneous-prefetches
16138 Maximum number of prefetches that can run at the same time.
16140 @item l1-cache-line-size
16141 The size of cache line in L1 data cache, in bytes.
16143 @item l1-cache-size
16144 The size of L1 data cache, in kilobytes.
16146 @item l2-cache-size
16147 The size of L2 data cache, in kilobytes.
16149 @item prefetch-dynamic-strides
16150 Whether the loop array prefetch pass should issue software prefetch hints
16151 for strides that are non-constant.  In some cases this may be
16152 beneficial, though the fact the stride is non-constant may make it
16153 hard to predict when there is clear benefit to issuing these hints.
16155 Set to 1 if the prefetch hints should be issued for non-constant
16156 strides.  Set to 0 if prefetch hints should be issued only for strides that
16157 are known to be constant and below @option{prefetch-minimum-stride}.
16159 @item prefetch-minimum-stride
16160 Minimum constant stride, in bytes, to start using prefetch hints for.  If
16161 the stride is less than this threshold, prefetch hints will not be issued.
16163 This setting is useful for processors that have hardware prefetchers, in
16164 which case there may be conflicts between the hardware prefetchers and
16165 the software prefetchers.  If the hardware prefetchers have a maximum
16166 stride they can handle, it should be used here to improve the use of
16167 software prefetchers.
16169 A value of -1 means we don't have a threshold and therefore
16170 prefetch hints can be issued for any constant stride.
16172 This setting is only useful for strides that are known and constant.
16174 @item destructive-interference-size
16175 @item constructive-interference-size
16176 The values for the C++17 variables
16177 @code{std::hardware_destructive_interference_size} and
16178 @code{std::hardware_constructive_interference_size}.  The destructive
16179 interference size is the minimum recommended offset between two
16180 independent concurrently-accessed objects; the constructive
16181 interference size is the maximum recommended size of contiguous memory
16182 accessed together.  Typically both will be the size of an L1 cache
16183 line for the target, in bytes.  For a generic target covering a range of L1
16184 cache line sizes, typically the constructive interference size will be
16185 the small end of the range and the destructive size will be the large
16186 end.
16188 The destructive interference size is intended to be used for layout,
16189 and thus has ABI impact.  The default value is not expected to be
16190 stable, and on some targets varies with @option{-mtune}, so use of
16191 this variable in a context where ABI stability is important, such as
16192 the public interface of a library, is strongly discouraged; if it is
16193 used in that context, users can stabilize the value using this
16194 option.
16196 The constructive interference size is less sensitive, as it is
16197 typically only used in a @samp{static_assert} to make sure that a type
16198 fits within a cache line.
16200 See also @option{-Winterference-size}.
16202 @item loop-interchange-max-num-stmts
16203 The maximum number of stmts in a loop to be interchanged.
16205 @item loop-interchange-stride-ratio
16206 The minimum ratio between stride of two loops for interchange to be profitable.
16208 @item min-insn-to-prefetch-ratio
16209 The minimum ratio between the number of instructions and the
16210 number of prefetches to enable prefetching in a loop.
16212 @item prefetch-min-insn-to-mem-ratio
16213 The minimum ratio between the number of instructions and the
16214 number of memory references to enable prefetching in a loop.
16216 @item use-canonical-types
16217 Whether the compiler should use the ``canonical'' type system.
16218 Should always be 1, which uses a more efficient internal
16219 mechanism for comparing types in C++ and Objective-C++.  However, if
16220 bugs in the canonical type system are causing compilation failures,
16221 set this value to 0 to disable canonical types.
16223 @item switch-conversion-max-branch-ratio
16224 Switch initialization conversion refuses to create arrays that are
16225 bigger than @option{switch-conversion-max-branch-ratio} times the number of
16226 branches in the switch.
16228 @item max-partial-antic-length
16229 Maximum length of the partial antic set computed during the tree
16230 partial redundancy elimination optimization (@option{-ftree-pre}) when
16231 optimizing at @option{-O3} and above.  For some sorts of source code
16232 the enhanced partial redundancy elimination optimization can run away,
16233 consuming all of the memory available on the host machine.  This
16234 parameter sets a limit on the length of the sets that are computed,
16235 which prevents the runaway behavior.  Setting a value of 0 for
16236 this parameter allows an unlimited set length.
16238 @item rpo-vn-max-loop-depth
16239 Maximum loop depth that is value-numbered optimistically.
16240 When the limit hits the innermost
16241 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
16242 loop nest are value-numbered optimistically and the remaining ones not.
16244 @item sccvn-max-alias-queries-per-access
16245 Maximum number of alias-oracle queries we perform when looking for
16246 redundancies for loads and stores.  If this limit is hit the search
16247 is aborted and the load or store is not considered redundant.  The
16248 number of queries is algorithmically limited to the number of
16249 stores on all paths from the load to the function entry.
16251 @item ira-max-loops-num
16252 IRA uses regional register allocation by default.  If a function
16253 contains more loops than the number given by this parameter, only at most
16254 the given number of the most frequently-executed loops form regions
16255 for regional register allocation.
16257 @item ira-max-conflict-table-size 
16258 Although IRA uses a sophisticated algorithm to compress the conflict
16259 table, the table can still require excessive amounts of memory for
16260 huge functions.  If the conflict table for a function could be more
16261 than the size in MB given by this parameter, the register allocator
16262 instead uses a faster, simpler, and lower-quality
16263 algorithm that does not require building a pseudo-register conflict table.  
16265 @item ira-loop-reserved-regs
16266 IRA can be used to evaluate more accurate register pressure in loops
16267 for decisions to move loop invariants (see @option{-O3}).  The number
16268 of available registers reserved for some other purposes is given
16269 by this parameter.  Default of the parameter
16270 is the best found from numerous experiments.
16272 @item ira-consider-dup-in-all-alts
16273 Make IRA to consider matching constraint (duplicated operand number)
16274 heavily in all available alternatives for preferred register class.
16275 If it is set as zero, it means IRA only respects the matching
16276 constraint when it's in the only available alternative with an
16277 appropriate register class.  Otherwise, it means IRA will check all
16278 available alternatives for preferred register class even if it has
16279 found some choice with an appropriate register class and respect the
16280 found qualified matching constraint.
16282 @item ira-simple-lra-insn-threshold
16283 Approximate function insn number in 1K units triggering simple local RA.
16285 @item lra-inheritance-ebb-probability-cutoff
16286 LRA tries to reuse values reloaded in registers in subsequent insns.
16287 This optimization is called inheritance.  EBB is used as a region to
16288 do this optimization.  The parameter defines a minimal fall-through
16289 edge probability in percentage used to add BB to inheritance EBB in
16290 LRA.  The default value was chosen
16291 from numerous runs of SPEC2000 on x86-64.
16293 @item loop-invariant-max-bbs-in-loop
16294 Loop invariant motion can be very expensive, both in compilation time and
16295 in amount of needed compile-time memory, with very large loops.  Loops
16296 with more basic blocks than this parameter won't have loop invariant
16297 motion optimization performed on them.
16299 @item loop-max-datarefs-for-datadeps
16300 Building data dependencies is expensive for very large loops.  This
16301 parameter limits the number of data references in loops that are
16302 considered for data dependence analysis.  These large loops are no
16303 handled by the optimizations using loop data dependencies.
16305 @item max-vartrack-size
16306 Sets a maximum number of hash table slots to use during variable
16307 tracking dataflow analysis of any function.  If this limit is exceeded
16308 with variable tracking at assignments enabled, analysis for that
16309 function is retried without it, after removing all debug insns from
16310 the function.  If the limit is exceeded even without debug insns, var
16311 tracking analysis is completely disabled for the function.  Setting
16312 the parameter to zero makes it unlimited.
16314 @item max-vartrack-expr-depth
16315 Sets a maximum number of recursion levels when attempting to map
16316 variable names or debug temporaries to value expressions.  This trades
16317 compilation time for more complete debug information.  If this is set too
16318 low, value expressions that are available and could be represented in
16319 debug information may end up not being used; setting this higher may
16320 enable the compiler to find more complex debug expressions, but compile
16321 time and memory use may grow.
16323 @item max-debug-marker-count
16324 Sets a threshold on the number of debug markers (e.g.@: begin stmt
16325 markers) to avoid complexity explosion at inlining or expanding to RTL.
16326 If a function has more such gimple stmts than the set limit, such stmts
16327 will be dropped from the inlined copy of a function, and from its RTL
16328 expansion.
16330 @item min-nondebug-insn-uid
16331 Use uids starting at this parameter for nondebug insns.  The range below
16332 the parameter is reserved exclusively for debug insns created by
16333 @option{-fvar-tracking-assignments}, but debug insns may get
16334 (non-overlapping) uids above it if the reserved range is exhausted.
16336 @item ipa-sra-deref-prob-threshold
16337 IPA-SRA replaces a pointer which is known not be NULL with one or more
16338 new parameters only when the probability (in percent, relative to
16339 function entry) of it being dereferenced is higher than this parameter.
16341 @item ipa-sra-ptr-growth-factor
16342 IPA-SRA replaces a pointer to an aggregate with one or more new
16343 parameters only when their cumulative size is less or equal to
16344 @option{ipa-sra-ptr-growth-factor} times the size of the original
16345 pointer parameter.
16347 @item ipa-sra-ptrwrap-growth-factor
16348 Additional maximum allowed growth of total size of new parameters
16349 that ipa-sra replaces a pointer to an aggregate with,
16350 if it points to a local variable that the caller only writes to and
16351 passes it as an argument to other functions.
16353 @item ipa-sra-max-replacements
16354 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
16355 consequence, it is also the maximum number of replacements of a formal
16356 parameter.
16358 @item sra-max-scalarization-size-Ospeed
16359 @itemx sra-max-scalarization-size-Osize
16360 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
16361 replace scalar parts of aggregates with uses of independent scalar
16362 variables.  These parameters control the maximum size, in storage units,
16363 of aggregate which is considered for replacement when compiling for
16364 speed
16365 (@option{sra-max-scalarization-size-Ospeed}) or size
16366 (@option{sra-max-scalarization-size-Osize}) respectively.
16368 @item sra-max-propagations
16369 The maximum number of artificial accesses that Scalar Replacement of
16370 Aggregates (SRA) will track, per one local variable, in order to
16371 facilitate copy propagation.
16373 @item tm-max-aggregate-size
16374 When making copies of thread-local variables in a transaction, this
16375 parameter specifies the size in bytes after which variables are
16376 saved with the logging functions as opposed to save/restore code
16377 sequence pairs.  This option only applies when using
16378 @option{-fgnu-tm}.
16380 @item graphite-max-nb-scop-params
16381 To avoid exponential effects in the Graphite loop transforms, the
16382 number of parameters in a Static Control Part (SCoP) is bounded.
16383 A value of zero can be used to lift
16384 the bound.  A variable whose value is unknown at compilation time and
16385 defined outside a SCoP is a parameter of the SCoP.
16387 @item hardcfr-max-blocks
16388 Disable @option{-fharden-control-flow-redundancy} for functions with a
16389 larger number of blocks than the specified value.  Zero removes any
16390 limit.
16392 @item hardcfr-max-inline-blocks
16393 Force @option{-fharden-control-flow-redundancy} to use out-of-line
16394 checking for functions with a larger number of basic blocks than the
16395 specified value.
16397 @item loop-block-tile-size
16398 Loop blocking or strip mining transforms, enabled with
16399 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
16400 loop in the loop nest by a given number of iterations.  The strip
16401 length can be changed using the @option{loop-block-tile-size}
16402 parameter.
16404 @item ipa-jump-function-lookups
16405 Specifies number of statements visited during jump function offset discovery.
16407 @item ipa-cp-value-list-size
16408 IPA-CP attempts to track all possible values and types passed to a function's
16409 parameter in order to propagate them and perform devirtualization.
16410 @option{ipa-cp-value-list-size} is the maximum number of values and types it
16411 stores per one formal parameter of a function.
16413 @item ipa-cp-eval-threshold
16414 IPA-CP calculates its own score of cloning profitability heuristics
16415 and performs those cloning opportunities with scores that exceed
16416 @option{ipa-cp-eval-threshold}.
16418 @item ipa-cp-max-recursive-depth
16419 Maximum depth of recursive cloning for self-recursive function.
16421 @item ipa-cp-min-recursive-probability
16422 Recursive cloning only when the probability of call being executed exceeds
16423 the parameter.
16425 @item ipa-cp-profile-count-base
16426 When using @option{-fprofile-use} option, IPA-CP will consider the measured
16427 execution count of a call graph edge at this percentage position in their
16428 histogram as the basis for its heuristics calculation.
16430 @item ipa-cp-recursive-freq-factor
16431 The number of times interprocedural copy propagation expects recursive
16432 functions to call themselves.
16434 @item ipa-cp-recursion-penalty
16435 Percentage penalty the recursive functions will receive when they
16436 are evaluated for cloning.
16438 @item ipa-cp-single-call-penalty
16439 Percentage penalty functions containing a single call to another
16440 function will receive when they are evaluated for cloning.
16442 @item ipa-max-agg-items
16443 IPA-CP is also capable to propagate a number of scalar values passed
16444 in an aggregate. @option{ipa-max-agg-items} controls the maximum
16445 number of such values per one parameter.
16447 @item ipa-cp-loop-hint-bonus
16448 When IPA-CP determines that a cloning candidate would make the number
16449 of iterations of a loop known, it adds a bonus of
16450 @option{ipa-cp-loop-hint-bonus} to the profitability score of
16451 the candidate.
16453 @item ipa-max-loop-predicates
16454 The maximum number of different predicates IPA will use to describe when
16455 loops in a function have known properties.
16457 @item ipa-max-aa-steps
16458 During its analysis of function bodies, IPA-CP employs alias analysis
16459 in order to track values pointed to by function parameters.  In order
16460 not spend too much time analyzing huge functions, it gives up and
16461 consider all memory clobbered after examining
16462 @option{ipa-max-aa-steps} statements modifying memory.
16464 @item ipa-max-switch-predicate-bounds
16465 Maximal number of boundary endpoints of case ranges of switch statement.
16466 For switch exceeding this limit, IPA-CP will not construct cloning cost
16467 predicate, which is used to estimate cloning benefit, for default case
16468 of the switch statement.
16470 @item ipa-max-param-expr-ops
16471 IPA-CP will analyze conditional statement that references some function
16472 parameter to estimate benefit for cloning upon certain constant value.
16473 But if number of operations in a parameter expression exceeds
16474 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16475 one, and is not handled by IPA analysis.
16477 @item lto-partitions
16478 Specify desired number of partitions produced during WHOPR compilation.
16479 The number of partitions should exceed the number of CPUs used for compilation.
16481 @item lto-min-partition
16482 Size of minimal partition for WHOPR (in estimated instructions).
16483 This prevents expenses of splitting very small programs into too many
16484 partitions.
16486 @item lto-max-partition
16487 Size of max partition for WHOPR (in estimated instructions).
16488 to provide an upper bound for individual size of partition.
16489 Meant to be used only with balanced partitioning.
16491 @item lto-max-streaming-parallelism
16492 Maximal number of parallel processes used for LTO streaming.
16494 @item cxx-max-namespaces-for-diagnostic-help
16495 The maximum number of namespaces to consult for suggestions when C++
16496 name lookup fails for an identifier.
16498 @item sink-frequency-threshold
16499 The maximum relative execution frequency (in percents) of the target block
16500 relative to a statement's original block to allow statement sinking of a
16501 statement.  Larger numbers result in more aggressive statement sinking.
16502 A small positive adjustment is applied for
16503 statements with memory operands as those are even more profitable so sink.
16505 @item max-stores-to-sink
16506 The maximum number of conditional store pairs that can be sunk.  Set to 0
16507 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16508 (@option{-ftree-loop-if-convert}) is disabled.
16510 @item case-values-threshold
16511 The smallest number of different values for which it is best to use a
16512 jump-table instead of a tree of conditional branches.  If the value is
16513 0, use the default for the machine.
16515 @item jump-table-max-growth-ratio-for-size
16516 The maximum code size growth ratio when expanding
16517 into a jump table (in percent).  The parameter is used when
16518 optimizing for size.
16520 @item jump-table-max-growth-ratio-for-speed
16521 The maximum code size growth ratio when expanding
16522 into a jump table (in percent).  The parameter is used when
16523 optimizing for speed.
16525 @item tree-reassoc-width
16526 Set the maximum number of instructions executed in parallel in
16527 reassociated tree. This parameter overrides target dependent
16528 heuristics used by default if has non zero value.
16530 @item sched-pressure-algorithm
16531 Choose between the two available implementations of
16532 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16533 and is the more likely to prevent instructions from being reordered.
16534 Algorithm 2 was designed to be a compromise between the relatively
16535 conservative approach taken by algorithm 1 and the rather aggressive
16536 approach taken by the default scheduler.  It relies more heavily on
16537 having a regular register file and accurate register pressure classes.
16538 See @file{haifa-sched.cc} in the GCC sources for more details.
16540 The default choice depends on the target.
16542 @item max-slsr-cand-scan
16543 Set the maximum number of existing candidates that are considered when
16544 seeking a basis for a new straight-line strength reduction candidate.
16546 @item asan-globals
16547 Enable buffer overflow detection for global objects.  This kind
16548 of protection is enabled by default if you are using
16549 @option{-fsanitize=address} option.
16550 To disable global objects protection use @option{--param asan-globals=0}.
16552 @item asan-stack
16553 Enable buffer overflow detection for stack objects.  This kind of
16554 protection is enabled by default when using @option{-fsanitize=address}.
16555 To disable stack protection use @option{--param asan-stack=0} option.
16557 @item asan-instrument-reads
16558 Enable buffer overflow detection for memory reads.  This kind of
16559 protection is enabled by default when using @option{-fsanitize=address}.
16560 To disable memory reads protection use
16561 @option{--param asan-instrument-reads=0}.
16563 @item asan-instrument-writes
16564 Enable buffer overflow detection for memory writes.  This kind of
16565 protection is enabled by default when using @option{-fsanitize=address}.
16566 To disable memory writes protection use
16567 @option{--param asan-instrument-writes=0} option.
16569 @item asan-memintrin
16570 Enable detection for built-in functions.  This kind of protection
16571 is enabled by default when using @option{-fsanitize=address}.
16572 To disable built-in functions protection use
16573 @option{--param asan-memintrin=0}.
16575 @item asan-use-after-return
16576 Enable detection of use-after-return.  This kind of protection
16577 is enabled by default when using the @option{-fsanitize=address} option.
16578 To disable it use @option{--param asan-use-after-return=0}.
16580 Note: By default the check is disabled at run time.  To enable it,
16581 add @code{detect_stack_use_after_return=1} to the environment variable
16582 @env{ASAN_OPTIONS}.
16584 @item asan-instrumentation-with-call-threshold
16585 If number of memory accesses in function being instrumented
16586 is greater or equal to this number, use callbacks instead of inline checks.
16587 E.g. to disable inline code use
16588 @option{--param asan-instrumentation-with-call-threshold=0}.
16590 @item asan-kernel-mem-intrinsic-prefix
16591 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16592 with @samp{__asan_} or @samp{__hwasan_}
16593 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16594 respectively.
16596 @item hwasan-instrument-stack
16597 Enable hwasan instrumentation of statically sized stack-allocated variables.
16598 This kind of instrumentation is enabled by default when using
16599 @option{-fsanitize=hwaddress} and disabled by default when using
16600 @option{-fsanitize=kernel-hwaddress}.
16601 To disable stack instrumentation use
16602 @option{--param hwasan-instrument-stack=0}, and to enable it use
16603 @option{--param hwasan-instrument-stack=1}.
16605 @item hwasan-random-frame-tag
16606 When using stack instrumentation, decide tags for stack variables using a
16607 deterministic sequence beginning at a random tag for each frame.  With this
16608 parameter unset tags are chosen using the same sequence but beginning from 1.
16609 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16610 for @option{-fsanitize=kernel-hwaddress}.
16611 To disable it use @option{--param hwasan-random-frame-tag=0}.
16613 @item hwasan-instrument-allocas
16614 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16615 This kind of instrumentation is enabled by default when using
16616 @option{-fsanitize=hwaddress} and disabled by default when using
16617 @option{-fsanitize=kernel-hwaddress}.
16618 To disable instrumentation of such variables use
16619 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16620 @option{--param hwasan-instrument-allocas=1}.
16622 @item hwasan-instrument-reads
16623 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16624 default for both @option{-fsanitize=hwaddress} and
16625 @option{-fsanitize=kernel-hwaddress}.
16626 To disable checking memory reads use
16627 @option{--param hwasan-instrument-reads=0}.
16629 @item hwasan-instrument-writes
16630 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16631 default for both @option{-fsanitize=hwaddress} and
16632 @option{-fsanitize=kernel-hwaddress}.
16633 To disable checking memory writes use
16634 @option{--param hwasan-instrument-writes=0}.
16636 @item hwasan-instrument-mem-intrinsics
16637 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16638 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16639 and @option{-fsanitize=kernel-hwaddress}.
16640 To disable instrumentation of builtin functions use
16641 @option{--param hwasan-instrument-mem-intrinsics=0}.
16643 @item use-after-scope-direct-emission-threshold
16644 If the size of a local variable in bytes is smaller or equal to this
16645 number, directly poison (or unpoison) shadow memory instead of using
16646 run-time callbacks.
16648 @item tsan-distinguish-volatile
16649 Emit special instrumentation for accesses to volatiles.
16651 @item tsan-instrument-func-entry-exit
16652 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16654 @item max-fsm-thread-path-insns
16655 Maximum number of instructions to copy when duplicating blocks on a
16656 finite state automaton jump thread path.
16658 @item threader-debug
16659 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16661 @item parloops-chunk-size
16662 Chunk size of omp schedule for loops parallelized by parloops.
16664 @item parloops-schedule
16665 Schedule type of omp schedule for loops parallelized by parloops (static,
16666 dynamic, guided, auto, runtime).
16668 @item parloops-min-per-thread
16669 The minimum number of iterations per thread of an innermost parallelized
16670 loop for which the parallelized variant is preferred over the single threaded
16671 one.  Note that for a parallelized loop nest the
16672 minimum number of iterations of the outermost loop per thread is two.
16674 @item max-ssa-name-query-depth
16675 Maximum depth of recursion when querying properties of SSA names in things
16676 like fold routines.  One level of recursion corresponds to following a
16677 use-def chain.
16679 @item max-speculative-devirt-maydefs
16680 The maximum number of may-defs we analyze when looking for a must-def
16681 specifying the dynamic type of an object that invokes a virtual call
16682 we may be able to devirtualize speculatively.
16684 @item ranger-debug
16685 Specifies the type of debug output to be issued for ranges.
16687 @item unroll-jam-min-percent
16688 The minimum percentage of memory references that must be optimized
16689 away for the unroll-and-jam transformation to be considered profitable.
16691 @item unroll-jam-max-unroll
16692 The maximum number of times the outer loop should be unrolled by
16693 the unroll-and-jam transformation.
16695 @item max-rtl-if-conversion-unpredictable-cost
16696 Maximum permissible cost for the sequence that would be generated
16697 by the RTL if-conversion pass for a branch that is considered unpredictable.
16699 @item max-variable-expansions-in-unroller
16700 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16701 of times that an individual variable will be expanded during loop unrolling.
16703 @item partial-inlining-entry-probability
16704 Maximum probability of the entry BB of split region
16705 (in percent relative to entry BB of the function)
16706 to make partial inlining happen.
16708 @item max-tracked-strlens
16709 Maximum number of strings for which strlen optimization pass will
16710 track string lengths.
16712 @item gcse-after-reload-partial-fraction
16713 The threshold ratio for performing partial redundancy
16714 elimination after reload.
16716 @item gcse-after-reload-critical-fraction
16717 The threshold ratio of critical edges execution count that
16718 permit performing redundancy elimination after reload.
16720 @item max-loop-header-insns
16721 The maximum number of insns in loop header duplicated
16722 by the copy loop headers pass.
16724 @item vect-epilogues-nomask
16725 Enable loop epilogue vectorization using smaller vector size.
16727 @item vect-partial-vector-usage
16728 Controls when the loop vectorizer considers using partial vector loads
16729 and stores as an alternative to falling back to scalar code.  0 stops
16730 the vectorizer from ever using partial vector loads and stores.  1 allows
16731 partial vector loads and stores if vectorization removes the need for the
16732 code to iterate.  2 allows partial vector loads and stores in all loops.
16733 The parameter only has an effect on targets that support partial
16734 vector loads and stores.
16736 @item vect-inner-loop-cost-factor
16737 The maximum factor which the loop vectorizer applies to the cost of statements
16738 in an inner loop relative to the loop being vectorized.  The factor applied
16739 is the maximum of the estimated number of iterations of the inner loop and
16740 this parameter.  The default value of this parameter is 50.
16742 @item vect-induction-float
16743 Enable loop vectorization of floating point inductions.
16745 @item vrp-sparse-threshold
16746 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16748 @item vrp-switch-limit
16749 Maximum number of outgoing edges in a switch before VRP will not process it.
16751 @item vrp-vector-threshold
16752 Maximum number of basic blocks for VRP to use a basic cache vector.
16754 @item avoid-fma-max-bits
16755 Maximum number of bits for which we avoid creating FMAs.
16757 @item fully-pipelined-fma
16758 Whether the target fully pipelines FMA instructions.  If non-zero,
16759 reassociation considers the benefit of parallelizing FMA's multiplication
16760 part and addition part, assuming FMUL and FMA use the same units that can
16761 also do FADD.
16763 @item sms-loop-average-count-threshold
16764 A threshold on the average loop count considered by the swing modulo scheduler.
16766 @item sms-dfa-history
16767 The number of cycles the swing modulo scheduler considers when checking
16768 conflicts using DFA.
16770 @item graphite-allow-codegen-errors
16771 Whether codegen errors should be ICEs when @option{-fchecking}.
16773 @item sms-max-ii-factor
16774 A factor for tuning the upper bound that swing modulo scheduler
16775 uses for scheduling a loop.
16777 @item lra-max-considered-reload-pseudos
16778 The max number of reload pseudos which are considered during
16779 spilling a non-reload pseudo.
16781 @item max-pow-sqrt-depth
16782 Maximum depth of sqrt chains to use when synthesizing exponentiation
16783 by a real constant.
16785 @item max-dse-active-local-stores
16786 Maximum number of active local stores in RTL dead store elimination.
16788 @item asan-instrument-allocas
16789 Enable asan allocas/VLAs protection.
16791 @item max-iterations-computation-cost
16792 Bound on the cost of an expression to compute the number of iterations.
16794 @item max-isl-operations
16795 Maximum number of isl operations, 0 means unlimited.
16797 @item graphite-max-arrays-per-scop
16798 Maximum number of arrays per scop.
16800 @item max-vartrack-reverse-op-size
16801 Max. size of loc list for which reverse ops should be added.
16803 @item fsm-scale-path-stmts
16804 Scale factor to apply to the number of statements in a threading path
16805 crossing a loop backedge when comparing to
16806 @option{--param=max-jump-thread-duplication-stmts}.
16808 @item uninit-control-dep-attempts
16809 Maximum number of nested calls to search for control dependencies
16810 during uninitialized variable analysis.
16812 @item uninit-max-chain-len
16813 Maximum number of predicates anded for each predicate ored in the normalized
16814 predicate chain.
16816 @item uninit-max-num-chains
16817 Maximum number of predicates ored in the normalized predicate chain.
16819 @item sched-autopref-queue-depth
16820 Hardware autoprefetcher scheduler model control flag.
16821 Number of lookahead cycles the model looks into; at '
16822 ' only enable instruction sorting heuristic.
16824 @item loop-versioning-max-inner-insns
16825 The maximum number of instructions that an inner loop can have
16826 before the loop versioning pass considers it too big to copy.
16828 @item loop-versioning-max-outer-insns
16829 The maximum number of instructions that an outer loop can have
16830 before the loop versioning pass considers it too big to copy,
16831 discounting any instructions in inner loops that directly benefit
16832 from versioning.
16834 @item ssa-name-def-chain-limit
16835 The maximum number of SSA_NAME assignments to follow in determining
16836 a property of a variable such as its value.  This limits the number
16837 of iterations or recursive calls GCC performs when optimizing certain
16838 statements or when determining their validity prior to issuing
16839 diagnostics.
16841 @item store-merging-max-size
16842 Maximum size of a single store merging region in bytes.
16844 @item hash-table-verification-limit
16845 The number of elements for which hash table verification is done
16846 for each searched element.
16848 @item max-find-base-term-values
16849 Maximum number of VALUEs handled during a single find_base_term call.
16851 @item analyzer-max-enodes-per-program-point
16852 The maximum number of exploded nodes per program point within
16853 the analyzer, before terminating analysis of that point.
16855 @item analyzer-max-constraints
16856 The maximum number of constraints per state.
16858 @item analyzer-min-snodes-for-call-summary
16859 The minimum number of supernodes within a function for the
16860 analyzer to consider summarizing its effects at call sites.
16862 @item analyzer-max-enodes-for-full-dump
16863 The maximum depth of exploded nodes that should appear in a dot dump
16864 before switching to a less verbose format.
16866 @item analyzer-max-recursion-depth
16867 The maximum number of times a callsite can appear in a call stack
16868 within the analyzer, before terminating analysis of a call that would
16869 recurse deeper.
16871 @item analyzer-max-svalue-depth
16872 The maximum depth of a symbolic value, before approximating
16873 the value as unknown.
16875 @item analyzer-max-infeasible-edges
16876 The maximum number of infeasible edges to reject before declaring
16877 a diagnostic as infeasible.
16879 @item gimple-fe-computed-hot-bb-threshold
16880 The number of executions of a basic block which is considered hot.
16881 The parameter is used only in GIMPLE FE.
16883 @item analyzer-bb-explosion-factor
16884 The maximum number of 'after supernode' exploded nodes within the analyzer
16885 per supernode, before terminating analysis.
16887 @item analyzer-text-art-string-ellipsis-threshold
16888 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16890 @item analyzer-text-art-ideal-canvas-width
16891 The ideal width in characters of text art diagrams generated by the analyzer.
16893 @item analyzer-text-art-string-ellipsis-head-len
16894 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16896 @item analyzer-text-art-string-ellipsis-tail-len
16897 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16899 @item ranger-logical-depth
16900 Maximum depth of logical expression evaluation ranger will look through
16901 when evaluating outgoing edge ranges.
16903 @item ranger-recompute-depth
16904 Maximum depth of instruction chains to consider for recomputation
16905 in the outgoing range calculator.
16907 @item relation-block-limit
16908 Maximum number of relations the oracle will register in a basic block.
16910 @item min-pagesize
16911 Minimum page size for warning purposes.
16913 @item openacc-kernels
16914 Specify mode of OpenACC `kernels' constructs handling.
16915 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16916 constructs are decomposed into parts, a sequence of compute
16917 constructs, each then handled individually.
16918 This is work in progress.
16919 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16920 constructs are handled by the @samp{parloops} pass, en bloc.
16921 This is the current default.
16923 @item openacc-privatization
16924 Control whether the @option{-fopt-info-omp-note} and applicable
16925 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16926 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16927 This is the current default.
16928 With @option{--param=openacc-privatization=noisy}, do diagnose.
16930 @end table
16932 The following choices of @var{name} are available on AArch64 targets:
16934 @table @gcctabopt
16935 @item aarch64-vect-compare-costs
16936 When vectorizing, consider using multiple different approaches and use
16937 the cost model to choose the cheapest one.  This includes:
16939 @itemize
16940 @item
16941 Trying both SVE and Advanced SIMD, when SVE is available.
16943 @item
16944 Trying to use 64-bit Advanced SIMD vectors for the smallest data elements,
16945 rather than using 128-bit vectors for everything.
16947 @item
16948 Trying to use ``unpacked'' SVE vectors for smaller elements.  This includes
16949 storing smaller elements in larger containers and accessing elements with
16950 extending loads and truncating stores.
16951 @end itemize
16953 @item aarch64-float-recp-precision
16954 The number of Newton iterations for calculating the reciprocal for float type.
16955 The precision of division is proportional to this param when division
16956 approximation is enabled.  The default value is 1.
16958 @item aarch64-double-recp-precision
16959 The number of Newton iterations for calculating the reciprocal for double type.
16960 The precision of division is propotional to this param when division
16961 approximation is enabled.  The default value is 2.
16963 @item aarch64-autovec-preference
16964 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16965 0 to 4, inclusive.
16966 @table @samp
16967 @item 0
16968 Use the default heuristics.
16969 @item 1
16970 Use only Advanced SIMD for auto-vectorization.
16971 @item 2
16972 Use only SVE for auto-vectorization.
16973 @item 3
16974 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16975 deemed equal.
16976 @item 4
16977 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16978 @end table
16979 The default value is 0.
16981 @item aarch64-ldp-policy
16982 Fine-grained policy for load pairs.
16983 With @option{--param=aarch64-ldp-policy=default}, use the policy of the
16984 tuning structure.  This is the current default.
16985 With @option{--param=aarch64-ldp-policy=always}, emit ldp regardless
16986 of alignment.
16987 With @option{--param=aarch64-ldp-policy=never}, do not emit ldp.
16988 With @option{--param=aarch64-ldp-policy=aligned}, emit ldp only if the
16989 source pointer is aligned to at least double the alignment of the type.
16991 @item aarch64-stp-policy
16992 Fine-grained policy for store pairs.
16993 With @option{--param=aarch64-stp-policy=default}, use the policy of the
16994 tuning structure.  This is the current default.
16995 With @option{--param=aarch64-stp-policy=always}, emit stp regardless
16996 of alignment.
16997 With @option{--param=aarch64-stp-policy=never}, do not emit stp.
16998 With @option{--param=aarch64-stp-policy=aligned}, emit stp only if the
16999 source pointer is aligned to at least double the alignment of the type.
17001 @item aarch64-ldp-alias-check-limit
17002 Limit on the number of alias checks performed by the AArch64 load/store pair
17003 fusion pass when attempting to form an ldp/stp.  Higher values make the pass
17004 more aggressive at re-ordering loads over stores, at the expense of increased
17005 compile time.
17007 @item aarch64-ldp-writeback
17008 Param to control which writeback opportunities we try to handle in the AArch64
17009 load/store pair fusion pass.  A value of zero disables writeback handling.  One
17010 means we try to form pairs involving one or more existing individual writeback
17011 accesses where possible.  A value of two means we also try to opportunistically
17012 form writeback opportunities by folding in trailing destructive updates of the
17013 base register used by a pair.
17015 @item aarch64-loop-vect-issue-rate-niters
17016 The tuning for some AArch64 CPUs tries to take both latencies and issue
17017 rates into account when deciding whether a loop should be vectorized
17018 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
17019 If this parameter is set to @var{n}, GCC will not use this heuristic
17020 for loops that are known to execute in fewer than @var{n} Advanced
17021 SIMD iterations.
17023 @item aarch64-vect-unroll-limit
17024 The vectorizer will use available tuning information to determine whether it
17025 would be beneficial to unroll the main vectorized loop and by how much.  This
17026 parameter set's the upper bound of how much the vectorizer will unroll the main
17027 loop.  The default value is four.
17029 @end table
17031 The following choices of @var{name} are available on GCN targets:
17033 @table @gcctabopt
17034 @item gcn-preferred-vectorization-factor
17035 Preferred vectorization factor: @samp{default}, @samp{32}, @samp{64}.
17037 @end table
17039 The following choices of @var{name} are available on i386 and x86_64 targets:
17041 @table @gcctabopt
17042 @item x86-stlf-window-ninsns
17043 Instructions number above which STFL stall penalty can be compensated.
17045 @item x86-stv-max-visits
17046 The maximum number of use and def visits when discovering a STV chain before
17047 the discovery is aborted.
17049 @end table
17051 @end table
17053 @node Instrumentation Options
17054 @section Program Instrumentation Options
17055 @cindex instrumentation options
17056 @cindex program instrumentation options
17057 @cindex run-time error checking options
17058 @cindex profiling options
17059 @cindex options, program instrumentation
17060 @cindex options, run-time error checking
17061 @cindex options, profiling
17063 GCC supports a number of command-line options that control adding
17064 run-time instrumentation to the code it normally generates.  
17065 For example, one purpose of instrumentation is collect profiling
17066 statistics for use in finding program hot spots, code coverage
17067 analysis, or profile-guided optimizations.
17068 Another class of program instrumentation is adding run-time checking 
17069 to detect programming errors like invalid pointer
17070 dereferences or out-of-bounds array accesses, as well as deliberately
17071 hostile attacks such as stack smashing or C++ vtable hijacking.
17072 There is also a general hook which can be used to implement other
17073 forms of tracing or function-level instrumentation for debug or
17074 program analysis purposes.
17076 @table @gcctabopt
17077 @cindex @command{prof}
17078 @cindex @command{gprof}
17079 @opindex p
17080 @opindex pg
17081 @item -p
17082 @itemx -pg
17083 Generate extra code to write profile information suitable for the
17084 analysis program @command{prof} (for @option{-p}) or @command{gprof}
17085 (for @option{-pg}).  You must use this option when compiling
17086 the source files you want data about, and you must also use it when
17087 linking.
17089 You can use the function attribute @code{no_instrument_function} to
17090 suppress profiling of individual functions when compiling with these options.
17091 @xref{Common Function Attributes}.
17093 @opindex fprofile-arcs
17094 @item -fprofile-arcs
17095 Add code so that program flow @dfn{arcs} are instrumented.  During
17096 execution the program records how many times each branch and call is
17097 executed and how many times it is taken or returns.  On targets that support
17098 constructors with priority support, profiling properly handles constructors,
17099 destructors and C++ constructors (and destructors) of classes which are used
17100 as a type of a global variable.
17102 When the compiled
17103 program exits it saves this data to a file called
17104 @file{@var{auxname}.gcda} for each source file.  The data may be used for
17105 profile-directed optimizations (@option{-fbranch-probabilities}), or for
17106 test coverage analysis (@option{-ftest-coverage}).  Each object file's
17107 @var{auxname} is generated from the name of the output file, if
17108 explicitly specified and it is not the final executable, otherwise it is
17109 the basename of the source file.  In both cases any suffix is removed
17110 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
17111 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
17113 Note that if a command line directly links source files, the corresponding
17114 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
17115 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
17116 @file{binary-b.gcda} files.
17118 @item -fcondition-coverage
17119 @opindex fcondition-coverage
17120 Add code so that program conditions are instrumented.  During execution the
17121 program records what terms in a conditional contributes to a decision, which
17122 can be used to verify that all terms in a Boolean function are tested and have
17123 an independent effect on the outcome of a decision.  The result can be read
17124 with @code{gcov --conditions}.
17126 @xref{Cross-profiling}.
17128 @cindex @command{gcov}
17129 @opindex coverage
17130 @item --coverage
17132 This option is used to compile and link code instrumented for coverage
17133 analysis.  The option is a synonym for @option{-fprofile-arcs}
17134 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
17135 linking).  See the documentation for those options for more details.
17137 @itemize
17139 @item
17140 Compile the source files with @option{-fprofile-arcs} plus optimization
17141 and code generation options.  For test coverage analysis, use the
17142 additional @option{-ftest-coverage} option.  You do not need to profile
17143 every source file in a program.
17145 @item
17146 Compile the source files additionally with @option{-fprofile-abs-path}
17147 to create absolute path names in the @file{.gcno} files.  This allows
17148 @command{gcov} to find the correct sources in projects where compilations
17149 occur with different working directories.
17151 @item
17152 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
17153 (the latter implies the former).
17155 @item
17156 Run the program on a representative workload to generate the arc profile
17157 information.  This may be repeated any number of times.  You can run
17158 concurrent instances of your program, and provided that the file system
17159 supports locking, the data files will be correctly updated.  Unless
17160 a strict ISO C dialect option is in effect, @code{fork} calls are
17161 detected and correctly handled without double counting.
17163 Moreover, an object file can be recompiled multiple times
17164 and the corresponding @file{.gcda} file merges as long as
17165 the source file and the compiler options are unchanged.
17167 @item
17168 For profile-directed optimizations, compile the source files again with
17169 the same optimization and code generation options plus
17170 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
17171 Control Optimization}).
17173 @item
17174 For test coverage analysis, use @command{gcov} to produce human readable
17175 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
17176 @command{gcov} documentation for further information.
17178 @end itemize
17180 With @option{-fprofile-arcs}, for each function of your program GCC
17181 creates a program flow graph, then finds a spanning tree for the graph.
17182 Only arcs that are not on the spanning tree have to be instrumented: the
17183 compiler adds code to count the number of times that these arcs are
17184 executed.  When an arc is the only exit or only entrance to a block, the
17185 instrumentation code can be added to the block; otherwise, a new basic
17186 block must be created to hold the instrumentation code.
17188 With @option{-fcondition-coverage}, for each conditional in your program GCC
17189 creates a bitset and records the exercised boolean values that have an
17190 independent effect on the outcome of that expression.
17192 @need 2000
17193 @opindex ftest-coverage
17194 @item -ftest-coverage
17195 Produce a notes file that the @command{gcov} code-coverage utility
17196 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
17197 show program coverage.  Each source file's note file is called
17198 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
17199 above for a description of @var{auxname} and instructions on how to
17200 generate test coverage data.  Coverage data matches the source files
17201 more closely if you do not optimize.
17203 @opindex fprofile-abs-path
17204 @item -fprofile-abs-path
17205 Automatically convert relative source file names to absolute path names
17206 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
17207 sources in projects where compilations occur with different working
17208 directories.
17210 @opindex fprofile-dir
17211 @item -fprofile-dir=@var{path}
17213 Set the directory to search for the profile data files in to @var{path}.
17214 This option affects only the profile data generated by
17215 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
17216 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
17217 and its related options.  Both absolute and relative paths can be used.
17218 By default, GCC uses the current directory as @var{path}, thus the
17219 profile data file appears in the same directory as the object file.
17220 In order to prevent the file name clashing, if the object file name is
17221 not an absolute path, we mangle the absolute path of the
17222 @file{@var{sourcename}.gcda} file and use it as the file name of a
17223 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
17224 See similar option @option{-fprofile-note}.
17226 When an executable is run in a massive parallel environment, it is recommended
17227 to save profile to different folders.  That can be done with variables
17228 in @var{path} that are exported during run-time:
17230 @table @gcctabopt
17232 @item %p
17233 process ID.
17235 @item %q@{VAR@}
17236 value of environment variable @var{VAR}
17238 @end table
17240 @opindex fprofile-generate
17241 @item -fprofile-generate
17242 @itemx -fprofile-generate=@var{path}
17244 Enable options usually used for instrumenting application to produce
17245 profile useful for later recompilation with profile feedback based
17246 optimization.  You must use @option{-fprofile-generate} both when
17247 compiling and when linking your program.
17249 The following options are enabled:
17250 @option{-fprofile-arcs}, @option{-fprofile-values},
17251 @option{-finline-functions}, and @option{-fipa-bit-cp}.
17253 If @var{path} is specified, GCC looks at the @var{path} to find
17254 the profile feedback data files. See @option{-fprofile-dir}.
17256 To optimize the program based on the collected profile information, use
17257 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
17259 @opindex fprofile-info-section
17260 @item -fprofile-info-section
17261 @itemx -fprofile-info-section=@var{name}
17263 Register the profile information in the specified section instead of using a
17264 constructor/destructor.  The section name is @var{name} if it is specified,
17265 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
17266 profile information generated by @option{-fprofile-arcs} is placed in the
17267 specified section for each translation unit.  This option disables the profile
17268 information registration through a constructor and it disables the profile
17269 information processing through a destructor.  This option is not intended to be
17270 used in hosted environments such as GNU/Linux.  It targets freestanding
17271 environments (for example embedded systems) with limited resources which do not
17272 support constructors/destructors or the C library file I/O.
17274 The linker could collect the input sections in a continuous memory block and
17275 define start and end symbols.  A GNU linker script example which defines a
17276 linker output section follows:
17278 @smallexample
17279   .gcov_info      :
17280   @{
17281     PROVIDE (__gcov_info_start = .);
17282     KEEP (*(.gcov_info))
17283     PROVIDE (__gcov_info_end = .);
17284   @}
17285 @end smallexample
17287 The program could dump the profiling information registered in this linker set
17288 for example like this:
17290 @smallexample
17291 #include <gcov.h>
17292 #include <stdio.h>
17293 #include <stdlib.h>
17295 extern const struct gcov_info *const __gcov_info_start[];
17296 extern const struct gcov_info *const __gcov_info_end[];
17298 static void
17299 dump (const void *d, unsigned n, void *arg)
17301   const unsigned char *c = d;
17303   for (unsigned i = 0; i < n; ++i)
17304     printf ("%02x", c[i]);
17307 static void
17308 filename (const char *f, void *arg)
17310   __gcov_filename_to_gcfn (f, dump, arg );
17313 static void *
17314 allocate (unsigned length, void *arg)
17316   return malloc (length);
17319 static void
17320 dump_gcov_info (void)
17322   const struct gcov_info *const *info = __gcov_info_start;
17323   const struct gcov_info *const *end = __gcov_info_end;
17325   /* Obfuscate variable to prevent compiler optimizations.  */
17326   __asm__ ("" : "+r" (info));
17328   while (info != end)
17329   @{
17330     void *arg = NULL;
17331     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
17332     putchar ('\n');
17333     ++info;
17334   @}
17338 main (void)
17340   dump_gcov_info ();
17341   return 0;
17343 @end smallexample
17345 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
17346 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
17347 @code{__gcov_info_to_gcda} functions and merge the profile information into
17348 @file{.gcda} files on the host filesystem.
17350 @opindex fprofile-note
17351 @item -fprofile-note=@var{path}
17353 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
17354 location.  If you combine the option with multiple source files,
17355 the @file{.gcno} file will be overwritten.
17357 @opindex fprofile-prefix-path
17358 @item -fprofile-prefix-path=@var{path}
17360 This option can be used in combination with
17361 @option{profile-generate=}@var{profile_dir} and
17362 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
17363 directory of built source tree.  By default @var{profile_dir} will contain
17364 files with mangled absolute paths of all object files in the built project.
17365 This is not desirable when directory used to build the instrumented binary
17366 differs from the directory used to build the binary optimized with profile
17367 feedback because the profile data will not be found during the optimized build.
17368 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
17369 pointing to the base directory of the build can be used to strip the irrelevant
17370 part of the path and keep all file names relative to the main build directory.
17372 @opindex fprofile-prefix-map
17373 @item -fprofile-prefix-map=@var{old}=@var{new}
17374 When compiling files residing in directory @file{@var{old}}, record
17375 profiling information (with @option{--coverage})
17376 describing them as if the files resided in
17377 directory @file{@var{new}} instead.
17378 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
17380 @opindex fprofile-update
17381 @item -fprofile-update=@var{method}
17383 Alter the update method for an application instrumented for profile
17384 feedback based optimization.  The @var{method} argument should be one of
17385 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
17386 The first one is useful for single-threaded applications,
17387 while the second one prevents profile corruption by emitting thread-safe code.
17389 @strong{Warning:} When an application does not properly join all threads
17390 (or creates an detached thread), a profile file can be still corrupted.
17392 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
17393 when supported by a target, or to @samp{single} otherwise.  The GCC driver
17394 automatically selects @samp{prefer-atomic} when @option{-pthread}
17395 is present in the command line, otherwise the default method is @samp{single}.
17397 If @samp{atomic} is selected, then the profile information is updated using
17398 atomic operations on a best-effort basis.  Ideally, the profile information is
17399 updated through atomic operations in hardware.  If the target platform does not
17400 support the required atomic operations in hardware, however, @file{libatomic}
17401 is available, then the profile information is updated through calls to
17402 @file{libatomic}.  If the target platform neither supports the required atomic
17403 operations in hardware nor @file{libatomic}, then the profile information is
17404 not atomically updated and a warning is issued.  In this case, the obtained
17405 profiling information may be corrupt for multi-threaded applications.
17407 For performance reasons, if 64-bit counters are used for the profiling
17408 information and the target platform only supports 32-bit atomic operations in
17409 hardware, then the performance critical profiling updates are done using two
17410 32-bit atomic operations for each counter update.  If a signal interrupts these
17411 two operations updating a counter, then the profiling information may be in an
17412 inconsistent state.
17414 @opindex fprofile-filter-files
17415 @item -fprofile-filter-files=@var{regex}
17417 Instrument only functions from files whose name matches
17418 any of the regular expressions (separated by semi-colons).
17420 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
17421 only @file{main.c} and all C files starting with 'module'.
17423 @opindex fprofile-exclude-files
17424 @item -fprofile-exclude-files=@var{regex}
17426 Instrument only functions from files whose name does not match
17427 any of the regular expressions (separated by semi-colons).
17429 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
17430 of all files that are located in the @file{/usr/} folder.
17432 @opindex fprofile-reproducible
17433 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
17434 Control level of reproducibility of profile gathered by
17435 @code{-fprofile-generate}.  This makes it possible to rebuild program
17436 with same outcome which is useful, for example, for distribution
17437 packages.
17439 With @option{-fprofile-reproducible=serial} the profile gathered by
17440 @option{-fprofile-generate} is reproducible provided the trained program
17441 behaves the same at each invocation of the train run, it is not
17442 multi-threaded and profile data streaming is always done in the same
17443 order.  Note that profile streaming happens at the end of program run but
17444 also before @code{fork} function is invoked.
17446 Note that it is quite common that execution counts of some part of
17447 programs depends, for example, on length of temporary file names or
17448 memory space randomization (that may affect hash-table collision rate).
17449 Such non-reproducible part of programs may be annotated by
17450 @code{no_instrument_function} function attribute. @command{gcov-dump} with
17451 @option{-l} can be used to dump gathered data and verify that they are
17452 indeed reproducible.
17454 With @option{-fprofile-reproducible=parallel-runs} collected profile
17455 stays reproducible regardless the order of streaming of the data into
17456 gcda files.  This setting makes it possible to run multiple instances of
17457 instrumented program in parallel (such as with @code{make -j}). This
17458 reduces quality of gathered data, in particular of indirect call
17459 profiling.
17461 @opindex fsanitize=address
17462 @item -fsanitize=address
17463 Enable AddressSanitizer, a fast memory error detector.
17464 Memory access instructions are instrumented to detect
17465 out-of-bounds and use-after-free bugs.
17466 The option enables @option{-fsanitize-address-use-after-scope}.
17467 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
17468 more details.  The run-time behavior can be influenced using the
17469 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
17470 the available options are shown at startup of the instrumented program.  See
17471 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
17472 for a list of supported options.
17473 The option cannot be combined with @option{-fsanitize=thread} or
17474 @option{-fsanitize=hwaddress}.  Note that the only target
17475 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
17477 To get more accurate stack traces, it is possible to use options such as
17478 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
17479 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
17480 optimizing sibling and tail recursive calls; this option is implicit for
17481 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
17482 disables Identical Code Folding for functions).  Since multiple runs of the
17483 program may yield backtraces with different addresses due to ASLR (Address
17484 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
17485 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
17487 @opindex fsanitize=kernel-address
17488 @item -fsanitize=kernel-address
17489 Enable AddressSanitizer for Linux kernel.
17490 See @uref{https://github.com/google/kernel-sanitizers} for more details.
17492 @opindex fsanitize=hwaddress
17493 @item -fsanitize=hwaddress
17494 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
17495 ignore the top byte of a pointer to allow the detection of memory errors with
17496 a low memory overhead.
17497 Memory access instructions are instrumented to detect out-of-bounds and
17498 use-after-free bugs.
17499 The option enables @option{-fsanitize-address-use-after-scope}.
17501 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
17502 for more details.  The run-time behavior can be influenced using the
17503 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
17504 the available options are shown at startup of the instrumented program.
17505 The option cannot be combined with @option{-fsanitize=thread} or
17506 @option{-fsanitize=address}, and is currently only available on AArch64.
17508 @opindex fsanitize=kernel-hwaddress
17509 @item -fsanitize=kernel-hwaddress
17510 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
17511 Similar to @option{-fsanitize=kernel-address} but using an alternate
17512 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
17513 instrumentation differences necessary for compiling the Linux kernel.
17514 These differences are to avoid hwasan library initialization calls and to
17515 account for the stack pointer having a different value in its top byte.
17517 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
17518 Instrumenting the stack and alloca calls are not on by default but are still
17519 possible by specifying the command-line options
17520 @option{--param hwasan-instrument-stack=1} and
17521 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
17522 tag is not implemented for kernel instrumentation.
17524 @opindex fsanitize=pointer-compare
17525 @item -fsanitize=pointer-compare
17526 Instrument comparison operation (<, <=, >, >=) with pointer operands.
17527 The option must be combined with either @option{-fsanitize=kernel-address} or
17528 @option{-fsanitize=address}
17529 The option cannot be combined with @option{-fsanitize=thread}.
17530 Note: By default the check is disabled at run time.  To enable it,
17531 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17532 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17533 invalid operation only when both pointers are non-null.
17535 @opindex fsanitize=pointer-subtract
17536 @item -fsanitize=pointer-subtract
17537 Instrument subtraction with pointer operands.
17538 The option must be combined with either @option{-fsanitize=kernel-address} or
17539 @option{-fsanitize=address}
17540 The option cannot be combined with @option{-fsanitize=thread}.
17541 Note: By default the check is disabled at run time.  To enable it,
17542 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17543 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17544 invalid operation only when both pointers are non-null.
17546 @opindex fsanitize=shadow-call-stack
17547 @item -fsanitize=shadow-call-stack
17548 Enable ShadowCallStack, a security enhancement mechanism used to protect
17549 programs against return address overwrites (e.g. stack buffer overflows.)
17550 It works by saving a function's return address to a separately allocated
17551 shadow call stack in the function prologue and restoring the return address
17552 from the shadow call stack in the function epilogue.  Instrumentation only
17553 occurs in functions that need to save the return address to the stack.
17555 Currently it only supports the aarch64 platform.  It is specifically
17556 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17557 For the user space programs, runtime support is not currently provided
17558 in libc and libgcc.  Users who want to use this feature in user space need
17559 to provide their own support for the runtime.  It should be noted that
17560 this may cause the ABI rules to be broken.
17562 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17563 This generally means that any code that may run on the same thread as code
17564 compiled with ShadowCallStack must be compiled with the flag
17565 @option{-ffixed-x18}, otherwise functions compiled without
17566 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17567 stack pointer.
17569 Also, because there is no userspace runtime support, code compiled with
17570 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17571 to turn off exceptions.
17573 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17574 details.
17576 @opindex fsanitize=thread
17577 @item -fsanitize=thread
17578 Enable ThreadSanitizer, a fast data race detector.
17579 Memory access instructions are instrumented to detect
17580 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17581 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17582 environment variable; see
17583 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17584 supported options.
17585 The option cannot be combined with @option{-fsanitize=address},
17586 @option{-fsanitize=leak}.
17588 Note that sanitized atomic builtins cannot throw exceptions when
17589 operating on invalid memory addresses with non-call exceptions
17590 (@option{-fnon-call-exceptions}).
17592 @opindex fsanitize=leak
17593 @item -fsanitize=leak
17594 Enable LeakSanitizer, a memory leak detector.
17595 This option only matters for linking of executables.
17596 The executable is linked against a library that overrides @code{malloc}
17597 and other allocator functions.  See
17598 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17599 details.  The run-time behavior can be influenced using the
17600 @env{LSAN_OPTIONS} environment variable.
17601 The option cannot be combined with @option{-fsanitize=thread}.
17603 @opindex fsanitize=undefined
17604 @item -fsanitize=undefined
17605 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17606 Various computations are instrumented to detect undefined behavior
17607 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17608 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17610 @table @gcctabopt
17612 @opindex fsanitize=shift
17613 @item -fsanitize=shift
17614 This option enables checking that the result of a shift operation is
17615 not undefined.  Note that what exactly is considered undefined differs
17616 slightly between C and C++, as well as between ISO C90 and C99, etc.
17617 This option has two suboptions, @option{-fsanitize=shift-base} and
17618 @option{-fsanitize=shift-exponent}.
17620 @opindex fsanitize=shift-exponent
17621 @item -fsanitize=shift-exponent
17622 This option enables checking that the second argument of a shift operation
17623 is not negative and is smaller than the precision of the promoted first
17624 argument.
17626 @opindex fsanitize=shift-base
17627 @item -fsanitize=shift-base
17628 If the second argument of a shift operation is within range, check that the
17629 result of a shift operation is not undefined.  Note that what exactly is
17630 considered undefined differs slightly between C and C++, as well as between
17631 ISO C90 and C99, etc.
17633 @opindex fsanitize=integer-divide-by-zero
17634 @item -fsanitize=integer-divide-by-zero
17635 Detect integer division by zero.
17637 @opindex fsanitize=unreachable
17638 @item -fsanitize=unreachable
17639 With this option, the compiler turns the @code{__builtin_unreachable}
17640 call into a diagnostics message call instead.  When reaching the
17641 @code{__builtin_unreachable} call, the behavior is undefined.
17643 @opindex fsanitize=vla-bound
17644 @item -fsanitize=vla-bound
17645 This option instructs the compiler to check that the size of a variable
17646 length array is positive.
17648 @opindex fsanitize=null
17649 @item -fsanitize=null
17650 This option enables pointer checking.  Particularly, the application
17651 built with this option turned on will issue an error message when it
17652 tries to dereference a NULL pointer, or if a reference (possibly an
17653 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17654 on an object pointed by a NULL pointer.
17656 @opindex fsanitize=return
17657 @item -fsanitize=return
17658 This option enables return statement checking.  Programs
17659 built with this option turned on will issue an error message
17660 when the end of a non-void function is reached without actually
17661 returning a value.  This option works in C++ only.
17663 @opindex fsanitize=signed-integer-overflow
17664 @item -fsanitize=signed-integer-overflow
17665 This option enables signed integer overflow checking.  We check that
17666 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17667 does not overflow in the signed arithmetics.  This also detects
17668 @code{INT_MIN / -1} signed division.  Note, integer promotion
17669 rules must be taken into account.  That is, the following is not an
17670 overflow:
17671 @smallexample
17672 signed char a = SCHAR_MAX;
17673 a++;
17674 @end smallexample
17676 @opindex fsanitize=bounds
17677 @item -fsanitize=bounds
17678 This option enables instrumentation of array bounds.  Various out of bounds
17679 accesses are detected.  Flexible array members, flexible array member-like
17680 arrays, and initializers of variables with static storage are not
17681 instrumented, with the exception of flexible array member-like arrays
17682 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17683 options or @code{strict_flex_array} attributes say they shouldn't be treated
17684 like flexible array member-like arrays.
17686 @opindex fsanitize=bounds-strict
17687 @item -fsanitize=bounds-strict
17688 This option enables strict instrumentation of array bounds.  Most out of bounds
17689 accesses are detected, including flexible array member-like arrays.
17690 Initializers of variables with static storage are not instrumented.
17692 @opindex fsanitize=alignment
17693 @item -fsanitize=alignment
17695 This option enables checking of alignment of pointers when they are
17696 dereferenced, or when a reference is bound to insufficiently aligned target,
17697 or when a method or constructor is invoked on insufficiently aligned object.
17699 @opindex fsanitize=object-size
17700 @item -fsanitize=object-size
17701 This option enables instrumentation of memory references using the
17702 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17703 pointer accesses are detected.
17705 @opindex fsanitize=float-divide-by-zero
17706 @item -fsanitize=float-divide-by-zero
17707 Detect floating-point division by zero.  Unlike other similar options,
17708 @option{-fsanitize=float-divide-by-zero} is not enabled by
17709 @option{-fsanitize=undefined}, since floating-point division by zero can
17710 be a legitimate way of obtaining infinities and NaNs.
17712 @opindex fsanitize=float-cast-overflow
17713 @item -fsanitize=float-cast-overflow
17714 This option enables floating-point type to integer conversion checking.
17715 We check that the result of the conversion does not overflow.
17716 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17717 not enabled by @option{-fsanitize=undefined}.
17718 This option does not work well with @code{FE_INVALID} exceptions enabled.
17720 @opindex fsanitize=nonnull-attribute
17721 @item -fsanitize=nonnull-attribute
17723 This option enables instrumentation of calls, checking whether null values
17724 are not passed to arguments marked as requiring a non-null value by the
17725 @code{nonnull} function attribute.
17727 @opindex fsanitize=returns-nonnull-attribute
17728 @item -fsanitize=returns-nonnull-attribute
17730 This option enables instrumentation of return statements in functions
17731 marked with @code{returns_nonnull} function attribute, to detect returning
17732 of null values from such functions.
17734 @opindex fsanitize=bool
17735 @item -fsanitize=bool
17737 This option enables instrumentation of loads from bool.  If a value other
17738 than 0/1 is loaded, a run-time error is issued.
17740 @opindex fsanitize=enum
17741 @item -fsanitize=enum
17743 This option enables instrumentation of loads from an enum type.  If
17744 a value outside the range of values for the enum type is loaded,
17745 a run-time error is issued.
17747 @opindex fsanitize=vptr
17748 @item -fsanitize=vptr
17750 This option enables instrumentation of C++ member function calls, member
17751 accesses and some conversions between pointers to base and derived classes,
17752 to verify the referenced object has the correct dynamic type.
17754 @opindex fsanitize=pointer-overflow
17755 @item -fsanitize=pointer-overflow
17757 This option enables instrumentation of pointer arithmetics.  If the pointer
17758 arithmetics overflows, a run-time error is issued.
17760 @opindex fsanitize=builtin
17761 @item -fsanitize=builtin
17763 This option enables instrumentation of arguments to selected builtin
17764 functions.  If an invalid value is passed to such arguments, a run-time
17765 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17766 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17767 by this option.
17769 @end table
17771 Note that sanitizers tend to increase the rate of false positive
17772 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17773 We recommend against combining @option{-Werror} and [the use of]
17774 sanitizers.
17776 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17777 @option{-fsanitize=undefined} gives a diagnostic message.
17778 This currently works only for the C family of languages.
17780 @opindex fno-sanitize=all
17781 @item -fno-sanitize=all
17783 This option disables all previously enabled sanitizers.
17784 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17785 together.
17787 @opindex fasan-shadow-offset
17788 @item -fasan-shadow-offset=@var{number}
17789 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17790 It is useful for experimenting with different shadow memory layouts in
17791 Kernel AddressSanitizer.
17793 @opindex fsanitize-sections
17794 @item -fsanitize-sections=@var{s1},@var{s2},...
17795 Sanitize global variables in selected user-defined sections.  @var{si} may
17796 contain wildcards.
17798 @opindex fsanitize-recover
17799 @opindex fno-sanitize-recover
17800 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17801 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17802 mentioned in comma-separated list of @var{opts}.  Enabling this option
17803 for a sanitizer component causes it to attempt to continue
17804 running the program as if no error happened.  This means multiple
17805 runtime errors can be reported in a single program run, and the exit
17806 code of the program may indicate success even when errors
17807 have been reported.  The @option{-fno-sanitize-recover=} option
17808 can be used to alter
17809 this behavior: only the first detected error is reported
17810 and program then exits with a non-zero exit code.
17812 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17813 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17814 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17815 @option{-fsanitize=bounds-strict},
17816 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17817 For these sanitizers error recovery is turned on by default,
17818 except @option{-fsanitize=address}, for which this feature is experimental.
17819 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17820 accepted, the former enables recovery for all sanitizers that support it,
17821 the latter disables recovery for all sanitizers that support it.
17823 Even if a recovery mode is turned on the compiler side, it needs to be also
17824 enabled on the runtime library side, otherwise the failures are still fatal.
17825 The runtime library defaults to @code{halt_on_error=0} for
17826 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17827 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17828 setting the @code{halt_on_error} flag in the corresponding environment variable.
17830 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17831 equivalent to specifying an @var{opts} list of:
17833 @smallexample
17834 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17835 @end smallexample
17837 @opindex fsanitize-address-use-after-scope
17838 @item -fsanitize-address-use-after-scope
17839 Enable sanitization of local variables to detect use-after-scope bugs.
17840 The option sets @option{-fstack-reuse} to @samp{none}.
17842 @opindex fsanitize-trap
17843 @opindex fno-sanitize-trap
17844 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17845 The @option{-fsanitize-trap=} option instructs the compiler to
17846 report for sanitizers mentioned in comma-separated list of @var{opts}
17847 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17848 library routine.  If this option is enabled for certain sanitizer,
17849 it takes precedence over the @option{-fsanitizer-recover=} for that
17850 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17851 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17853 The advantage of this is that the @code{libubsan} library is not needed
17854 and is not linked in, so this is usable even in freestanding environments.
17856 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17857 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17858 @option{-fsanitize=float-divide-by-zero} and
17859 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17860 specified, which enables it for @code{undefined} suboptions,
17861 @option{-fsanitize=float-cast-overflow},
17862 @option{-fsanitize=float-divide-by-zero} and
17863 @option{-fsanitize=bounds-strict}.
17864 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17865 and @code{-fsanitize=vptr} is enabled on the command line, the
17866 instrumentation is silently ignored as the instrumentation always needs
17867 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17869 @opindex fsanitize-undefined-trap-on-error
17870 @item -fsanitize-undefined-trap-on-error
17871 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17872 equivalent of @option{-fsanitize-trap=all}.
17874 @opindex fsanitize-coverage=trace-pc
17875 @item -fsanitize-coverage=trace-pc
17876 Enable coverage-guided fuzzing code instrumentation.
17877 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17879 @opindex fsanitize-coverage=trace-cmp
17880 @item -fsanitize-coverage=trace-cmp
17881 Enable dataflow guided fuzzing code instrumentation.
17882 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17883 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17884 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17885 variable or @code{__sanitizer_cov_trace_const_cmp1},
17886 @code{__sanitizer_cov_trace_const_cmp2},
17887 @code{__sanitizer_cov_trace_const_cmp4} or
17888 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17889 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17890 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17891 @code{__sanitizer_cov_trace_switch} for switch statements.
17893 @opindex fcf-protection
17894 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17895 Enable code instrumentation of control-flow transfers to increase
17896 program security by checking that target addresses of control-flow
17897 transfer instructions (such as indirect function call, function return,
17898 indirect jump) are valid.  This prevents diverting the flow of control
17899 to an unexpected target.  This is intended to protect against such
17900 threats as Return-oriented Programming (ROP), and similarly
17901 call/jmp-oriented programming (COP/JOP).
17903 The value @code{branch} tells the compiler to implement checking of
17904 validity of control-flow transfer at the point of indirect branch
17905 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17906 implements checking of validity at the point of returning from a
17907 function.  The value @code{full} is an alias for specifying both
17908 @code{branch} and @code{return}. The value @code{none} turns off
17909 instrumentation.
17911 To override @option{-fcf-protection}, @option{-fcf-protection=none}
17912 needs to be added and then with @option{-fcf-protection=xxx}.
17914 The value @code{check} is used for the final link with link-time
17915 optimization (LTO).  An error is issued if LTO object files are
17916 compiled with different @option{-fcf-protection} values.  The
17917 value @code{check} is ignored at the compile time.
17919 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17920 used.  The first bit of @code{__CET__} is set to 1 for the value
17921 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17922 the @code{return}.
17924 You can also use the @code{nocf_check} attribute to identify
17925 which functions and calls should be skipped from instrumentation
17926 (@pxref{Function Attributes}).
17928 Currently the x86 GNU/Linux target provides an implementation based
17929 on Intel Control-flow Enforcement Technology (CET) which works for
17930 i686 processor or newer.
17932 @opindex fharden-compares
17933 @item -fharden-compares
17934 For every logical test that survives gimple optimizations and is
17935 @emph{not} the condition in a conditional branch (for example,
17936 conditions tested for conditional moves, or to store in boolean
17937 variables), emit extra code to compute and verify the reversed
17938 condition, and to call @code{__builtin_trap} if the results do not
17939 match.  Use with @samp{-fharden-conditional-branches} to cover all
17940 conditionals.
17942 @opindex fharden-conditional-branches
17943 @item -fharden-conditional-branches
17944 For every non-vectorized conditional branch that survives gimple
17945 optimizations, emit extra code to compute and verify the reversed
17946 condition, and to call @code{__builtin_trap} if the result is
17947 unexpected.  Use with @samp{-fharden-compares} to cover all
17948 conditionals.
17950 @opindex fharden-control-flow-redundancy
17951 @item -fharden-control-flow-redundancy
17952 Emit extra code to set booleans when entering basic blocks, and to
17953 verify and trap, at function exits, when the booleans do not form an
17954 execution path that is compatible with the control flow graph.
17956 Verification takes place before returns, before mandatory tail calls
17957 (see below) and, optionally, before escaping exceptions with
17958 @option{-fhardcfr-check-exceptions}, before returning calls with
17959 @option{-fhardcfr-check-returning-calls}, and before noreturn calls with
17960 @option{-fhardcfr-check-noreturn-calls}).  Tuning options
17961 @option{--param hardcfr-max-blocks} and @option{--param
17962 hardcfr-max-inline-blocks} are available.
17964 Tail call optimization takes place too late to affect control flow
17965 redundancy, but calls annotated as mandatory tail calls by language
17966 front-ends, and any calls marked early enough as potential tail calls
17967 would also have verification issued before the call, but these
17968 possibilities are merely theoretical, as these conditions can only be
17969 met when using custom compiler plugins.
17971 @opindex fhardcfr-skip-leaf
17972 @item -fhardcfr-skip-leaf
17973 Disable @option{-fharden-control-flow-redundancy} in leaf functions.
17975 @opindex fhardcfr-check-exceptions
17976 @opindex fno-hardcfr-check-exceptions
17977 @item -fhardcfr-check-exceptions
17978 When @option{-fharden-control-flow-redundancy} is active, check the
17979 recorded execution path against the control flow graph at exception
17980 escape points, as if the function body was wrapped with a cleanup
17981 handler that performed the check and reraised.  This option is enabled
17982 by default; use @option{-fno-hardcfr-check-exceptions} to disable it.
17984 @opindex fhardcfr-check-returning-calls
17985 @opindex fno-hardcfr-check-returning-calls
17986 @item -fhardcfr-check-returning-calls
17987 When @option{-fharden-control-flow-redundancy} is active, check the
17988 recorded execution path against the control flow graph before any
17989 function call immediately followed by a return of its result, if any, so
17990 as to not prevent tail-call optimization, whether or not it is
17991 ultimately optimized to a tail call.
17993 This option is enabled by default whenever sibling call optimizations
17994 are enabled (see @option{-foptimize-sibling-calls}), but it can be
17995 enabled (or disabled, using its negated form) explicitly, regardless of
17996 the optimizations.
17998 @opindex fhardcfr-check-noreturn-calls
17999 @item -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
18000 When @option{-fharden-control-flow-redundancy} is active, check the
18001 recorded execution path against the control flow graph before
18002 @code{noreturn} calls, either all of them (@option{always}), those that
18003 aren't expected to return control to the caller through an exception
18004 (@option{no-xthrow}, the default), those that may not return control to
18005 the caller through an exception either (@option{nothrow}), or none of
18006 them (@option{never}).
18008 Checking before a @code{noreturn} function that may return control to
18009 the caller through an exception may cause checking to be performed more
18010 than once, if the exception is caught in the caller, whether by a
18011 handler or a cleanup.  When @option{-fhardcfr-check-exceptions} is also
18012 enabled, the compiler will avoid associating a @code{noreturn} call with
18013 the implicitly-added cleanup handler, since it would be redundant with
18014 the check performed before the call, but other handlers or cleanups in
18015 the function, if activated, will modify the recorded execution path and
18016 check it again when another checkpoint is hit.  The checkpoint may even
18017 be another @code{noreturn} call, so checking may end up performed
18018 multiple times.
18020 Various optimizers may cause calls to be marked as @code{noreturn}
18021 and/or @code{nothrow}, even in the absence of the corresponding
18022 attributes, which may affect the placement of checks before calls, as
18023 well as the addition of implicit cleanup handlers for them.  This
18024 unpredictability, and the fact that raising and reraising exceptions
18025 frequently amounts to implicitly calling @code{noreturn} functions, have
18026 made @option{no-xthrow} the default setting for this option: it excludes
18027 from the @code{noreturn} treatment only internal functions used to
18028 (re)raise exceptions, that are not affected by these optimizations.
18030 @opindex fhardened
18031 @item -fhardened
18032 Enable a set of flags for C and C++ that improve the security of the
18033 generated code without affecting its ABI.  The precise flags enabled
18034 may change between major releases of GCC, but are currently:
18036 @c Keep this in sync with print_help_hardened!
18037 @gccoptlist{
18038 -D_FORTIFY_SOURCE=3
18039 -D_GLIBCXX_ASSERTIONS
18040 -ftrivial-auto-var-init=zero
18041 -fPIE  -pie  -Wl,-z,relro,-z,now
18042 -fstack-protector-strong
18043 -fstack-clash-protection
18044 -fcf-protection=full @r{(x86 GNU/Linux only)}
18047 The list of options enabled by @option{-fhardened} can be generated using
18048 the @option{--help=hardened} option.
18050 When the system glibc is older than 2.35, @option{-D_FORTIFY_SOURCE=2}
18051 is used instead.
18053 This option is intended to be used in production builds, not merely
18054 in debug builds.
18056 Currently, @option{-fhardened} is only supported on GNU/Linux targets.
18058 @option{-fhardened} only enables a particular option if it wasn't
18059 already specified anywhere on the command line.  For instance,
18060 @option{-fhardened} @option{-fstack-protector} will only enable
18061 @option{-fstack-protector}, but not @option{-fstack-protector-strong}.
18063 @opindex fstack-protector
18064 @item -fstack-protector
18065 Emit extra code to check for buffer overflows, such as stack smashing
18066 attacks.  This is done by adding a guard variable to functions with
18067 vulnerable objects.  This includes functions that call @code{alloca}, and
18068 functions with buffers larger than or equal to 8 bytes.  The guards are
18069 initialized when a function is entered and then checked when the function
18070 exits.  If a guard check fails, an error message is printed and the program
18071 exits.  Only variables that are actually allocated on the stack are
18072 considered, optimized away variables or variables allocated in registers
18073 don't count.
18075 @opindex fstack-protector-all
18076 @item -fstack-protector-all
18077 Like @option{-fstack-protector} except that all functions are protected.
18079 @opindex fstack-protector-strong
18080 @item -fstack-protector-strong
18081 Like @option{-fstack-protector} but includes additional functions to
18082 be protected --- those that have local array definitions, or have
18083 references to local frame addresses.  Only variables that are actually
18084 allocated on the stack are considered, optimized away variables or variables
18085 allocated in registers don't count.
18087 @opindex fstack-protector-explicit
18088 @item -fstack-protector-explicit
18089 Like @option{-fstack-protector} but only protects those functions which
18090 have the @code{stack_protect} attribute.
18092 @opindex fstack-check
18093 @item -fstack-check
18094 Generate code to verify that you do not go beyond the boundary of the
18095 stack.  You should specify this flag if you are running in an
18096 environment with multiple threads, but you only rarely need to specify it in
18097 a single-threaded environment since stack overflow is automatically
18098 detected on nearly all systems if there is only one stack.
18100 Note that this switch does not actually cause checking to be done; the
18101 operating system or the language runtime must do that.  The switch causes
18102 generation of code to ensure that they see the stack being extended.
18104 You can additionally specify a string parameter: @samp{no} means no
18105 checking, @samp{generic} means force the use of old-style checking,
18106 @samp{specific} means use the best checking method and is equivalent
18107 to bare @option{-fstack-check}.
18109 Old-style checking is a generic mechanism that requires no specific
18110 target support in the compiler but comes with the following drawbacks:
18112 @enumerate
18113 @item
18114 Modified allocation strategy for large objects: they are always
18115 allocated dynamically if their size exceeds a fixed threshold.  Note this
18116 may change the semantics of some code.
18118 @item
18119 Fixed limit on the size of the static frame of functions: when it is
18120 topped by a particular function, stack checking is not reliable and
18121 a warning is issued by the compiler.
18123 @item
18124 Inefficiency: because of both the modified allocation strategy and the
18125 generic implementation, code performance is hampered.
18126 @end enumerate
18128 Note that old-style stack checking is also the fallback method for
18129 @samp{specific} if no target support has been added in the compiler.
18131 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
18132 and stack overflows.  @samp{specific} is an excellent choice when compiling
18133 Ada code.  It is not generally sufficient to protect against stack-clash
18134 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
18136 @opindex fstack-clash-protection
18137 @item -fstack-clash-protection
18138 Generate code to prevent stack clash style attacks.  When this option is
18139 enabled, the compiler will only allocate one page of stack space at a time
18140 and each page is accessed immediately after allocation.  Thus, it prevents
18141 allocations from jumping over any stack guard page provided by the
18142 operating system.
18144 Most targets do not fully support stack clash protection.  However, on
18145 those targets @option{-fstack-clash-protection} will protect dynamic stack
18146 allocations.  @option{-fstack-clash-protection} may also provide limited
18147 protection for static stack allocations if the target supports
18148 @option{-fstack-check=specific}.
18150 @opindex fstack-limit-register
18151 @opindex fstack-limit-symbol
18152 @opindex fno-stack-limit
18153 @item -fstack-limit-register=@var{reg}
18154 @itemx -fstack-limit-symbol=@var{sym}
18155 @itemx -fno-stack-limit
18156 Generate code to ensure that the stack does not grow beyond a certain value,
18157 either the value of a register or the address of a symbol.  If a larger
18158 stack is required, a signal is raised at run time.  For most targets,
18159 the signal is raised before the stack overruns the boundary, so
18160 it is possible to catch the signal without taking special precautions.
18162 For instance, if the stack starts at absolute address @samp{0x80000000}
18163 and grows downwards, you can use the flags
18164 @option{-fstack-limit-symbol=__stack_limit} and
18165 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18166 of 128KB@.  Note that this may only work with the GNU linker.
18168 You can locally override stack limit checking by using the
18169 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
18171 @opindex fsplit-stack
18172 @item -fsplit-stack
18173 Generate code to automatically split the stack before it overflows.
18174 The resulting program has a discontiguous stack which can only
18175 overflow if the program is unable to allocate any more memory.  This
18176 is most useful when running threaded programs, as it is no longer
18177 necessary to calculate a good stack size to use for each thread.  This
18178 is currently only implemented for the x86 targets running
18179 GNU/Linux.
18181 When code compiled with @option{-fsplit-stack} calls code compiled
18182 without @option{-fsplit-stack}, there may not be much stack space
18183 available for the latter code to run.  If compiling all code,
18184 including library code, with @option{-fsplit-stack} is not an option,
18185 then the linker can fix up these calls so that the code compiled
18186 without @option{-fsplit-stack} always has a large stack.  Support for
18187 this is implemented in the gold linker in GNU binutils release 2.21
18188 and later.
18190 @opindex -fstrub=disable
18191 @item -fstrub=disable
18192 Disable stack scrubbing entirely, ignoring any @code{strub} attributes.
18193 See @xref{Common Type Attributes}.
18195 @opindex fstrub=strict
18196 @item -fstrub=strict
18197 Functions default to @code{strub} mode @code{disabled}, and apply
18198 @option{strict}ly the restriction that only functions associated with
18199 @code{strub}-@code{callable} modes (@code{at-calls}, @code{callable} and
18200 @code{always_inline} @code{internal}) are @code{callable} by functions
18201 with @code{strub}-enabled modes (@code{at-calls} and @code{internal}).
18203 @opindex fstrub=relaxed
18204 @item -fstrub=relaxed
18205 Restore the default stack scrub (@code{strub}) setting, namely,
18206 @code{strub} is only enabled as required by @code{strub} attributes
18207 associated with function and data types.  @code{Relaxed} means that
18208 strub contexts are only prevented from calling functions explicitly
18209 associated with @code{strub} mode @code{disabled}.  This option is only
18210 useful to override other @option{-fstrub=*} options that precede it in
18211 the command line.
18213 @opindex fstrub=at-calls
18214 @item -fstrub=at-calls
18215 Enable @code{at-calls} @code{strub} mode where viable.  The primary use
18216 of this option is for testing.  It exercises the @code{strub} machinery
18217 in scenarios strictly local to a translation unit.  This @code{strub}
18218 mode modifies function interfaces, so any function that is visible to
18219 other translation units, or that has its address taken, will @emph{not}
18220 be affected by this option.  Optimization options may also affect
18221 viability.  See the @code{strub} attribute documentation for details on
18222 viability and eligibility requirements.
18224 @opindex fstrub=internal
18225 @item -fstrub=internal
18226 Enable @code{internal} @code{strub} mode where viable.  The primary use
18227 of this option is for testing.  This option is intended to exercise
18228 thoroughly parts of the @code{strub} machinery that implement the less
18229 efficient, but interface-preserving @code{strub} mode.  Functions that
18230 would not be affected by this option are quite uncommon.
18232 @opindex fstrub=all
18233 @item -fstrub=all
18234 Enable some @code{strub} mode where viable.  When both strub modes are
18235 viable, @code{at-calls} is preferred.  @option{-fdump-ipa-strubm} adds
18236 function attributes that tell which mode was selected for each function.
18237 The primary use of this option is for testing, to exercise thoroughly
18238 the @code{strub} machinery.
18240 @opindex fvtable-verify
18241 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
18242 This option is only available when compiling C++ code.
18243 It turns on (or off, if using @option{-fvtable-verify=none}) the security
18244 feature that verifies at run time, for every virtual call, that
18245 the vtable pointer through which the call is made is valid for the type of
18246 the object, and has not been corrupted or overwritten.  If an invalid vtable
18247 pointer is detected at run time, an error is reported and execution of the
18248 program is immediately halted.
18250 This option causes run-time data structures to be built at program startup,
18251 which are used for verifying the vtable pointers.  
18252 The options @samp{std} and @samp{preinit}
18253 control the timing of when these data structures are built.  In both cases the
18254 data structures are built before execution reaches @code{main}.  Using
18255 @option{-fvtable-verify=std} causes the data structures to be built after
18256 shared libraries have been loaded and initialized.
18257 @option{-fvtable-verify=preinit} causes them to be built before shared
18258 libraries have been loaded and initialized.
18260 If this option appears multiple times in the command line with different
18261 values specified, @samp{none} takes highest priority over both @samp{std} and
18262 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
18264 @opindex fvtv-debug
18265 @item -fvtv-debug
18266 When used in conjunction with @option{-fvtable-verify=std} or 
18267 @option{-fvtable-verify=preinit}, causes debug versions of the 
18268 runtime functions for the vtable verification feature to be called.  
18269 This flag also causes the compiler to log information about which 
18270 vtable pointers it finds for each class.
18271 This information is written to a file named @file{vtv_set_ptr_data.log} 
18272 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
18273 if that is defined or the current working directory otherwise.
18275 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
18276 file, be sure to delete any existing one.
18278 @opindex fvtv-counts
18279 @item -fvtv-counts
18280 This is a debugging flag.  When used in conjunction with
18281 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
18282 causes the compiler to keep track of the total number of virtual calls
18283 it encounters and the number of verifications it inserts.  It also
18284 counts the number of calls to certain run-time library functions
18285 that it inserts and logs this information for each compilation unit.
18286 The compiler writes this information to a file named
18287 @file{vtv_count_data.log} in the directory named by the environment
18288 variable @env{VTV_LOGS_DIR} if that is defined or the current working
18289 directory otherwise.  It also counts the size of the vtable pointer sets
18290 for each class, and writes this information to @file{vtv_class_set_sizes.log}
18291 in the same directory.
18293 Note:  This feature @emph{appends} data to the log files.  To get fresh log
18294 files, be sure to delete any existing ones.
18296 @opindex finstrument-functions
18297 @item -finstrument-functions
18298 Generate instrumentation calls for entry and exit to functions.  Just
18299 after function entry and just before function exit, the following
18300 profiling functions are called with the address of the current
18301 function and its call site.  (On some platforms,
18302 @code{__builtin_return_address} does not work beyond the current
18303 function, so the call site information may not be available to the
18304 profiling functions otherwise.)
18306 @smallexample
18307 void __cyg_profile_func_enter (void *this_fn,
18308                                void *call_site);
18309 void __cyg_profile_func_exit  (void *this_fn,
18310                                void *call_site);
18311 @end smallexample
18313 The first argument is the address of the start of the current function,
18314 which may be looked up exactly in the symbol table.
18316 This instrumentation is also done for functions expanded inline in other
18317 functions.  The profiling calls indicate where, conceptually, the
18318 inline function is entered and exited.  This means that addressable
18319 versions of such functions must be available.  If all your uses of a
18320 function are expanded inline, this may mean an additional expansion of
18321 code size.  If you use @code{extern inline} in your C code, an
18322 addressable version of such functions must be provided.  (This is
18323 normally the case anyway, but if you get lucky and the optimizer always
18324 expands the functions inline, you might have gotten away without
18325 providing static copies.)
18327 A function may be given the attribute @code{no_instrument_function}, in
18328 which case this instrumentation is not done.  This can be used, for
18329 example, for the profiling functions listed above, high-priority
18330 interrupt routines, and any functions from which the profiling functions
18331 cannot safely be called (perhaps signal handlers, if the profiling
18332 routines generate output or allocate memory).
18333 @xref{Common Function Attributes}.
18335 @opindex finstrument-functions-once
18336 @item -finstrument-functions-once
18337 This is similar to @option{-finstrument-functions}, but the profiling
18338 functions are called only once per instrumented function, i.e. the first
18339 profiling function is called after the first entry into the instrumented
18340 function and the second profiling function is called before the exit
18341 corresponding to this first entry.
18343 The definition of @code{once} for the purpose of this option is a little
18344 vague because the implementation is not protected against data races.
18345 As a result, the implementation only guarantees that the profiling
18346 functions are called at @emph{least} once per process and at @emph{most}
18347 once per thread, but the calls are always paired, that is to say, if a
18348 thread calls the first function, then it will call the second function,
18349 unless it never reaches the exit of the instrumented function.
18351 @opindex finstrument-functions-exclude-file-list
18352 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
18354 Set the list of functions that are excluded from instrumentation (see
18355 the description of @option{-finstrument-functions}).  If the file that
18356 contains a function definition matches with one of @var{file}, then
18357 that function is not instrumented.  The match is done on substrings:
18358 if the @var{file} parameter is a substring of the file name, it is
18359 considered to be a match.
18361 For example:
18363 @smallexample
18364 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
18365 @end smallexample
18367 @noindent
18368 excludes any inline function defined in files whose pathnames
18369 contain @file{/bits/stl} or @file{include/sys}.
18371 If, for some reason, you want to include letter @samp{,} in one of
18372 @var{sym}, write @samp{\,}. For example,
18373 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
18374 (note the single quote surrounding the option).
18376 @opindex finstrument-functions-exclude-function-list
18377 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
18379 This is similar to @option{-finstrument-functions-exclude-file-list},
18380 but this option sets the list of function names to be excluded from
18381 instrumentation.  The function name to be matched is its user-visible
18382 name, such as @code{vector<int> blah(const vector<int> &)}, not the
18383 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
18384 match is done on substrings: if the @var{sym} parameter is a substring
18385 of the function name, it is considered to be a match.  For C99 and C++
18386 extended identifiers, the function name must be given in UTF-8, not
18387 using universal character names.
18389 @opindex fpatchable-function-entry
18390 @item -fpatchable-function-entry=@var{N}[,@var{M}]
18391 Generate @var{N} NOPs right at the beginning
18392 of each function, with the function entry point before the @var{M}th NOP.
18393 If @var{M} is omitted, it defaults to @code{0} so the
18394 function entry points to the address just at the first NOP.
18395 The NOP instructions reserve extra space which can be used to patch in
18396 any desired instrumentation at run time, provided that the code segment
18397 is writable.  The amount of space is controllable indirectly via
18398 the number of NOPs; the NOP instruction used corresponds to the instruction
18399 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
18400 is target-specific and may also depend on the architecture variant and/or
18401 other compilation options.
18403 For run-time identification, the starting addresses of these areas,
18404 which correspond to their respective function entries minus @var{M},
18405 are additionally collected in the @code{__patchable_function_entries}
18406 section of the resulting binary.
18408 Note that the value of @code{__attribute__ ((patchable_function_entry
18409 (N,M)))} takes precedence over command-line option
18410 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
18411 the area size or to remove it completely on a single function.
18412 If @code{N=0}, no pad location is recorded.
18414 The NOP instructions are inserted at---and maybe before, depending on
18415 @var{M}---the function entry address, even before the prologue.  On
18416 PowerPC with the ELFv2 ABI, for a function with dual entry points,
18417 the local entry point is this function entry address.
18419 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
18420 ELFv2 ABI, for a function with dual entry points, the supported values
18421 for @var{M} are 0, 2, 6 and 14.
18422 @end table
18425 @node Preprocessor Options
18426 @section Options Controlling the Preprocessor
18427 @cindex preprocessor options
18428 @cindex options, preprocessor
18430 These options control the C preprocessor, which is run on each C source
18431 file before actual compilation.
18433 If you use the @option{-E} option, nothing is done except preprocessing.
18434 Some of these options make sense only together with @option{-E} because
18435 they cause the preprocessor output to be unsuitable for actual
18436 compilation.
18438 In addition to the options listed here, there are a number of options 
18439 to control search paths for include files documented in 
18440 @ref{Directory Options}.  
18441 Options to control preprocessor diagnostics are listed in 
18442 @ref{Warning Options}.
18444 @table @gcctabopt
18445 @include cppopts.texi
18447 @opindex Wp
18448 @item -Wp,@var{option}
18449 You can use @option{-Wp,@var{option}} to bypass the compiler driver
18450 and pass @var{option} directly through to the preprocessor.  If
18451 @var{option} contains commas, it is split into multiple options at the
18452 commas.  However, many options are modified, translated or interpreted
18453 by the compiler driver before being passed to the preprocessor, and
18454 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
18455 interface is undocumented and subject to change, so whenever possible
18456 you should avoid using @option{-Wp} and let the driver handle the
18457 options instead.
18459 @opindex Xpreprocessor
18460 @item -Xpreprocessor @var{option}
18461 Pass @var{option} as an option to the preprocessor.  You can use this to
18462 supply system-specific preprocessor options that GCC does not 
18463 recognize.
18465 If you want to pass an option that takes an argument, you must use
18466 @option{-Xpreprocessor} twice, once for the option and once for the argument.
18468 @opindex no-integrated-cpp
18469 @item -no-integrated-cpp
18470 Perform preprocessing as a separate pass before compilation.
18471 By default, GCC performs preprocessing as an integrated part of
18472 input tokenization and parsing.
18473 If this option is provided, the appropriate language front end
18474 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
18475 and Objective-C, respectively) is instead invoked twice,
18476 once for preprocessing only and once for actual compilation
18477 of the preprocessed input.
18478 This option may be useful in conjunction with the @option{-B} or
18479 @option{-wrapper} options to specify an alternate preprocessor or
18480 perform additional processing of the program source between
18481 normal preprocessing and compilation.
18483 @opindex flarge-source-files
18484 @item -flarge-source-files
18485 Adjust GCC to expect large source files, at the expense of slower
18486 compilation and higher memory usage.
18488 Specifically, GCC normally tracks both column numbers and line numbers
18489 within source files and it normally prints both of these numbers in
18490 diagnostics.  However, once it has processed a certain number of source
18491 lines, it stops tracking column numbers and only tracks line numbers.
18492 This means that diagnostics for later lines do not include column numbers.
18493 It also means that options like @option{-Wmisleading-indentation} cease to work
18494 at that point, although the compiler prints a note if this happens.
18495 Passing @option{-flarge-source-files} significantly increases the number
18496 of source lines that GCC can process before it stops tracking columns.
18498 @end table
18500 @node Assembler Options
18501 @section Passing Options to the Assembler
18503 @c prevent bad page break with this line
18504 You can pass options to the assembler.
18506 @table @gcctabopt
18507 @opindex Wa
18508 @item -Wa,@var{option}
18509 Pass @var{option} as an option to the assembler.  If @var{option}
18510 contains commas, it is split into multiple options at the commas.
18512 @opindex Xassembler
18513 @item -Xassembler @var{option}
18514 Pass @var{option} as an option to the assembler.  You can use this to
18515 supply system-specific assembler options that GCC does not
18516 recognize.
18518 If you want to pass an option that takes an argument, you must use
18519 @option{-Xassembler} twice, once for the option and once for the argument.
18521 @end table
18523 @node Link Options
18524 @section Options for Linking
18525 @cindex link options
18526 @cindex options, linking
18528 These options come into play when the compiler links object files into
18529 an executable output file.  They are meaningless if the compiler is
18530 not doing a link step.
18532 @table @gcctabopt
18533 @cindex file names
18534 @item @var{object-file-name}
18535 A file name that does not end in a special recognized suffix is
18536 considered to name an object file or library.  (Object files are
18537 distinguished from libraries by the linker according to the file
18538 contents.)  If linking is done, these object files are used as input
18539 to the linker.
18541 @opindex c
18542 @opindex S
18543 @opindex E
18544 @item -c
18545 @itemx -S
18546 @itemx -E
18547 If any of these options is used, then the linker is not run, and
18548 object file names should not be used as arguments.  @xref{Overall
18549 Options}.
18551 @opindex flinker-output
18552 @item -flinker-output=@var{type}
18553 This option controls code generation of the link-time optimizer.  By
18554 default the linker output is automatically determined by the linker
18555 plugin.  For debugging the compiler and if incremental linking with a 
18556 non-LTO object file is desired, it may be useful to control the type
18557 manually.
18559 If @var{type} is @samp{exec}, code generation produces a static
18560 binary. In this case @option{-fpic} and @option{-fpie} are both
18561 disabled.
18563 If @var{type} is @samp{dyn}, code generation produces a shared
18564 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
18565 but not enabled automatically.  This allows to build shared libraries
18566 without position-independent code on architectures where this is
18567 possible, i.e.@: on x86.
18569 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
18570 executable. This results in similar optimizations as @samp{exec}
18571 except that @option{-fpie} is not disabled if specified at compilation
18572 time.
18574 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
18575 done.  The sections containing intermediate code for link-time optimization are
18576 merged, pre-optimized, and output to the resulting object file. In addition, if
18577 @option{-ffat-lto-objects} is specified, binary code is produced for future
18578 non-LTO linking. The object file produced by incremental linking is smaller
18579 than a static library produced from the same object files.  At link time the
18580 result of incremental linking also loads faster than a static
18581 library assuming that the majority of objects in the library are used.
18583 Finally @samp{nolto-rel} configures the compiler for incremental linking where
18584 code generation is forced, a final binary is produced, and the intermediate
18585 code for later link-time optimization is stripped. When multiple object files
18586 are linked together the resulting code is better optimized than with
18587 link-time optimizations disabled (for example, cross-module inlining 
18588 happens), but most of benefits of whole program optimizations are lost. 
18590 During the incremental link (by @option{-r}) the linker plugin defaults to
18591 @option{rel}. With current interfaces to GNU Binutils it is however not
18592 possible to incrementally link LTO objects and non-LTO objects into a single
18593 mixed object file.  If any of object files in incremental link cannot
18594 be used for link-time optimization, the linker plugin issues a warning and
18595 uses @samp{nolto-rel}. To maintain whole program optimization, it is
18596 recommended to link such objects into static library instead. Alternatively it
18597 is possible to use H.J. Lu's binutils with support for mixed objects.
18599 @opindex fuse-ld=bfd
18600 @item -fuse-ld=bfd
18601 Use the @command{bfd} linker instead of the default linker.
18603 @opindex fuse-ld=gold
18604 @item -fuse-ld=gold
18605 Use the @command{gold} linker instead of the default linker.
18607 @opindex fuse-ld=lld
18608 @item -fuse-ld=lld
18609 Use the LLVM @command{lld} linker instead of the default linker.
18611 @opindex fuse-ld=mold
18612 @item -fuse-ld=mold
18613 Use the Modern Linker (@command{mold}) instead of the default linker.
18615 @cindex Libraries
18616 @opindex l
18617 @item -l@var{library}
18618 @itemx -l @var{library}
18619 Search the library named @var{library} when linking.  (The second
18620 alternative with the library as a separate argument is only for
18621 POSIX compliance and is not recommended.)
18623 The @option{-l} option is passed directly to the linker by GCC.  Refer
18624 to your linker documentation for exact details.  The general
18625 description below applies to the GNU linker.  
18627 The linker searches a standard list of directories for the library.
18628 The directories searched include several standard system directories
18629 plus any that you specify with @option{-L}.
18631 Static libraries are archives of object files, and have file names
18632 like @file{lib@var{library}.a}.  Some targets also support shared
18633 libraries, which typically have names like @file{lib@var{library}.so}.
18634 If both static and shared libraries are found, the linker gives
18635 preference to linking with the shared library unless the
18636 @option{-static} option is used.
18638 It makes a difference where in the command you write this option; the
18639 linker searches and processes libraries and object files in the order they
18640 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
18641 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
18642 to functions in @samp{z}, those functions may not be loaded.
18644 @opindex lobjc
18645 @item -lobjc
18646 You need this special case of the @option{-l} option in order to
18647 link an Objective-C or Objective-C++ program.
18649 @opindex nostartfiles
18650 @item -nostartfiles
18651 Do not use the standard system startup files when linking.
18652 The standard system libraries are used normally, unless @option{-nostdlib},
18653 @option{-nolibc}, or @option{-nodefaultlibs} is used.
18655 @opindex nodefaultlibs
18656 @item -nodefaultlibs
18657 Do not use the standard system libraries when linking.
18658 Only the libraries you specify are passed to the linker, and options
18659 specifying linkage of the system libraries, such as @option{-static-libgcc}
18660 or @option{-shared-libgcc}, are ignored.  
18661 The standard startup files are used normally, unless @option{-nostartfiles}
18662 is used.  
18664 The compiler may generate calls to @code{memcmp},
18665 @code{memset}, @code{memcpy} and @code{memmove}.
18666 These entries are usually resolved by entries in
18667 libc.  These entry points should be supplied through some other
18668 mechanism when this option is specified.
18670 @opindex nolibc
18671 @item -nolibc
18672 Do not use the C library or system libraries tightly coupled with it when
18673 linking.  Still link with the startup files, @file{libgcc} or toolchain
18674 provided language support libraries such as @file{libgnat}, @file{libgfortran}
18675 or @file{libstdc++} unless options preventing their inclusion are used as
18676 well.  This typically removes @option{-lc} from the link command line, as well
18677 as system libraries that normally go with it and become meaningless when
18678 absence of a C library is assumed, for example @option{-lpthread} or
18679 @option{-lm} in some configurations.  This is intended for bare-board
18680 targets when there is indeed no C library available.
18682 @opindex nostdlib
18683 @item -nostdlib
18684 Do not use the standard system startup files or libraries when linking.
18685 No startup files and only the libraries you specify are passed to
18686 the linker, and options specifying linkage of the system libraries, such as
18687 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
18689 The compiler may generate calls to @code{memcmp}, @code{memset},
18690 @code{memcpy} and @code{memmove}.
18691 These entries are usually resolved by entries in
18692 libc.  These entry points should be supplied through some other
18693 mechanism when this option is specified.
18695 @cindex @option{-lgcc}, use with @option{-nostdlib}
18696 @cindex @option{-nostdlib} and unresolved references
18697 @cindex unresolved references and @option{-nostdlib}
18698 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
18699 @cindex @option{-nodefaultlibs} and unresolved references
18700 @cindex unresolved references and @option{-nodefaultlibs}
18701 One of the standard libraries bypassed by @option{-nostdlib} and
18702 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
18703 which GCC uses to overcome shortcomings of particular machines, or special
18704 needs for some languages.
18705 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
18706 Collection (GCC) Internals},
18707 for more discussion of @file{libgcc.a}.)
18708 In most cases, you need @file{libgcc.a} even when you want to avoid
18709 other standard libraries.  In other words, when you specify @option{-nostdlib}
18710 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
18711 This ensures that you have no unresolved references to internal GCC
18712 library subroutines.
18713 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18714 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18715 GNU Compiler Collection (GCC) Internals}.)
18717 @opindex nostdlib++
18718 @item -nostdlib++
18719 Do not implicitly link with standard C++ libraries.
18721 @opindex e
18722 @opindex entry
18723 @item -e @var{entry}
18724 @itemx --entry=@var{entry}
18726 Specify that the program entry point is @var{entry}.  The argument is
18727 interpreted by the linker; the GNU linker accepts either a symbol name
18728 or an address.
18730 @opindex pie
18731 @item -pie
18732 Produce a dynamically linked position independent executable on targets
18733 that support it.  For predictable results, you must also specify the same
18734 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18735 or model suboptions) when you specify this linker option.
18737 @opindex no-pie
18738 @item -no-pie
18739 Don't produce a dynamically linked position independent executable.
18741 @opindex static-pie
18742 @item -static-pie
18743 Produce a static position independent executable on targets that support
18744 it.  A static position independent executable is similar to a static
18745 executable, but can be loaded at any address without a dynamic linker.
18746 For predictable results, you must also specify the same set of options
18747 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18748 suboptions) when you specify this linker option.
18750 @opindex pthread
18751 @item -pthread
18752 Link with the POSIX threads library.  This option is supported on 
18753 GNU/Linux targets, most other Unix derivatives, and also on 
18754 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18755 flags for the preprocessor, so it should be used consistently for both
18756 compilation and linking.
18758 @opindex r
18759 @item -r
18760 Produce a relocatable object as output.  This is also known as partial
18761 linking.
18763 @opindex rdynamic
18764 @item -rdynamic
18765 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18766 that support it. This instructs the linker to add all symbols, not
18767 only used ones, to the dynamic symbol table. This option is needed
18768 for some uses of @code{dlopen} or to allow obtaining backtraces
18769 from within a program.
18771 @opindex s
18772 @item -s
18773 Remove all symbol table and relocation information from the executable.
18775 @opindex static
18776 @item -static
18777 On systems that support dynamic linking, this overrides @option{-pie}
18778 and prevents linking with the shared libraries.  On other systems, this
18779 option has no effect.
18781 @opindex shared
18782 @item -shared
18783 Produce a shared object which can then be linked with other objects to
18784 form an executable.  Not all systems support this option.  For predictable
18785 results, you must also specify the same set of options used for compilation
18786 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18787 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18788 needs to build supplementary stub code for constructors to work.  On
18789 multi-libbed systems, @samp{gcc -shared} must select the correct support
18790 libraries to link against.  Failing to supply the correct flags may lead
18791 to subtle defects.  Supplying them in cases where they are not necessary
18792 is innocuous.  @option{-shared} suppresses the addition of startup code
18793 to alter the floating-point environment as done with @option{-ffast-math},
18794 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18796 @opindex shared-libgcc
18797 @opindex static-libgcc
18798 @item -shared-libgcc
18799 @itemx -static-libgcc
18800 On systems that provide @file{libgcc} as a shared library, these options
18801 force the use of either the shared or static version, respectively.
18802 If no shared version of @file{libgcc} was built when the compiler was
18803 configured, these options have no effect.
18805 There are several situations in which an application should use the
18806 shared @file{libgcc} instead of the static version.  The most common
18807 of these is when the application wishes to throw and catch exceptions
18808 across different shared libraries.  In that case, each of the libraries
18809 as well as the application itself should use the shared @file{libgcc}.
18811 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18812 whenever you build a shared library or a main executable, because C++
18813 programs typically use exceptions, so this is the right thing to do.
18815 If, instead, you use the GCC driver to create shared libraries, you may
18816 find that they are not always linked with the shared @file{libgcc}.
18817 If GCC finds, at its configuration time, that you have a non-GNU linker
18818 or a GNU linker that does not support option @option{--eh-frame-hdr},
18819 it links the shared version of @file{libgcc} into shared libraries
18820 by default.  Otherwise, it takes advantage of the linker and optimizes
18821 away the linking with the shared version of @file{libgcc}, linking with
18822 the static version of libgcc by default.  This allows exceptions to
18823 propagate through such shared libraries, without incurring relocation
18824 costs at library load time.
18826 However, if a library or main executable is supposed to throw or catch
18827 exceptions, you must link it using the G++ driver, or using the option
18828 @option{-shared-libgcc}, such that it is linked with the shared
18829 @file{libgcc}.
18831 @opindex static-libasan
18832 @item -static-libasan
18833 When the @option{-fsanitize=address} option is used to link a program,
18834 the GCC driver automatically links against @option{libasan}.  If
18835 @file{libasan} is available as a shared library, and the @option{-static}
18836 option is not used, then this links against the shared version of
18837 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18838 driver to link @file{libasan} statically, without necessarily linking
18839 other libraries statically.
18841 @opindex static-libtsan
18842 @item -static-libtsan
18843 When the @option{-fsanitize=thread} option is used to link a program,
18844 the GCC driver automatically links against @option{libtsan}.  If
18845 @file{libtsan} is available as a shared library, and the @option{-static}
18846 option is not used, then this links against the shared version of
18847 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18848 driver to link @file{libtsan} statically, without necessarily linking
18849 other libraries statically.
18851 @opindex static-liblsan
18852 @item -static-liblsan
18853 When the @option{-fsanitize=leak} option is used to link a program,
18854 the GCC driver automatically links against @option{liblsan}.  If
18855 @file{liblsan} is available as a shared library, and the @option{-static}
18856 option is not used, then this links against the shared version of
18857 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18858 driver to link @file{liblsan} statically, without necessarily linking
18859 other libraries statically.
18861 @opindex static-libubsan
18862 @item -static-libubsan
18863 When the @option{-fsanitize=undefined} option is used to link a program,
18864 the GCC driver automatically links against @option{libubsan}.  If
18865 @file{libubsan} is available as a shared library, and the @option{-static}
18866 option is not used, then this links against the shared version of
18867 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18868 driver to link @file{libubsan} statically, without necessarily linking
18869 other libraries statically.
18871 @opindex static-libstdc++
18872 @item -static-libstdc++
18873 When the @command{g++} program is used to link a C++ program, it
18874 normally automatically links against @option{libstdc++}.  If
18875 @file{libstdc++} is available as a shared library, and the
18876 @option{-static} option is not used, then this links against the
18877 shared version of @file{libstdc++}.  That is normally fine.  However, it
18878 is sometimes useful to freeze the version of @file{libstdc++} used by
18879 the program without going all the way to a fully static link.  The
18880 @option{-static-libstdc++} option directs the @command{g++} driver to
18881 link @file{libstdc++} statically, without necessarily linking other
18882 libraries statically.
18884 @opindex symbolic
18885 @item -symbolic
18886 Bind references to global symbols when building a shared object.  Warn
18887 about any unresolved references (unless overridden by the link editor
18888 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18889 this option.
18891 @opindex T
18892 @cindex linker script
18893 @item -T @var{script}
18894 Use @var{script} as the linker script.  This option is supported by most
18895 systems using the GNU linker.  On some targets, such as bare-board
18896 targets without an operating system, the @option{-T} option may be required
18897 when linking to avoid references to undefined symbols.
18899 @opindex Xlinker
18900 @item -Xlinker @var{option}
18901 Pass @var{option} as an option to the linker.  You can use this to
18902 supply system-specific linker options that GCC does not recognize.
18904 If you want to pass an option that takes a separate argument, you must use
18905 @option{-Xlinker} twice, once for the option and once for the argument.
18906 For example, to pass @option{-assert definitions}, you must write
18907 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18908 @option{-Xlinker "-assert definitions"}, because this passes the entire
18909 string as a single argument, which is not what the linker expects.
18911 When using the GNU linker, it is usually more convenient to pass
18912 arguments to linker options using the @option{@var{option}=@var{value}}
18913 syntax than as separate arguments.  For example, you can specify
18914 @option{-Xlinker -Map=output.map} rather than
18915 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18916 this syntax for command-line options.
18918 @opindex Wl
18919 @item -Wl,@var{option}
18920 Pass @var{option} as an option to the linker.  If @var{option} contains
18921 commas, it is split into multiple options at the commas.  You can use this
18922 syntax to pass an argument to the option.
18923 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18924 linker.  When using the GNU linker, you can also get the same effect with
18925 @option{-Wl,-Map=output.map}.
18927 @opindex u
18928 @item -u @var{symbol}
18929 Pretend the symbol @var{symbol} is undefined, to force linking of
18930 library modules to define it.  You can use @option{-u} multiple times with
18931 different symbols to force loading of additional library modules.
18933 @opindex z
18934 @item -z @var{keyword}
18935 @option{-z} is passed directly on to the linker along with the keyword
18936 @var{keyword}. See the section in the documentation of your linker for
18937 permitted values and their meanings.
18938 @end table
18940 @node Directory Options
18941 @section Options for Directory Search
18942 @cindex directory options
18943 @cindex options, directory search
18944 @cindex search path
18946 These options specify directories to search for header files, for
18947 libraries and for parts of the compiler:
18949 @table @gcctabopt
18950 @include cppdiropts.texi
18952 @opindex iplugindir=
18953 @item -iplugindir=@var{dir}
18954 Set the directory to search for plugins that are passed
18955 by @option{-fplugin=@var{name}} instead of
18956 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18957 to be used by the user, but only passed by the driver.
18959 @opindex L
18960 @item -L@var{dir}
18961 Add directory @var{dir} to the list of directories to be searched
18962 for @option{-l}.
18964 @opindex B
18965 @item -B@var{prefix}
18966 This option specifies where to find the executables, libraries,
18967 include files, and data files of the compiler itself.
18969 The compiler driver program runs one or more of the subprograms
18970 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18971 @var{prefix} as a prefix for each program it tries to run, both with and
18972 without @samp{@var{machine}/@var{version}/} for the corresponding target
18973 machine and compiler version.
18975 For each subprogram to be run, the compiler driver first tries the
18976 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18977 is not specified, the driver tries two standard prefixes, 
18978 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18979 those results in a file name that is found, the unmodified program
18980 name is searched for using the directories specified in your
18981 @env{PATH} environment variable.
18983 The compiler checks to see if the path provided by @option{-B}
18984 refers to a directory, and if necessary it adds a directory
18985 separator character at the end of the path.
18987 @option{-B} prefixes that effectively specify directory names also apply
18988 to libraries in the linker, because the compiler translates these
18989 options into @option{-L} options for the linker.  They also apply to
18990 include files in the preprocessor, because the compiler translates these
18991 options into @option{-isystem} options for the preprocessor.  In this case,
18992 the compiler appends @samp{include} to the prefix.
18994 The runtime support file @file{libgcc.a} can also be searched for using
18995 the @option{-B} prefix, if needed.  If it is not found there, the two
18996 standard prefixes above are tried, and that is all.  The file is left
18997 out of the link if it is not found by those means.
18999 Another way to specify a prefix much like the @option{-B} prefix is to use
19000 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
19001 Variables}.
19003 As a special kludge, if the path provided by @option{-B} is
19004 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
19005 9, then it is replaced by @file{[dir/]include}.  This is to help
19006 with boot-strapping the compiler.
19008 @opindex no-canonical-prefixes
19009 @item -no-canonical-prefixes
19010 Do not expand any symbolic links, resolve references to @samp{/../}
19011 or @samp{/./}, or make the path absolute when generating a relative
19012 prefix.
19014 @opindex sysroot
19015 @item --sysroot=@var{dir}
19016 Use @var{dir} as the logical root directory for headers and libraries.
19017 For example, if the compiler normally searches for headers in
19018 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
19019 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
19021 If you use both this option and the @option{-isysroot} option, then
19022 the @option{--sysroot} option applies to libraries, but the
19023 @option{-isysroot} option applies to header files.
19025 The GNU linker (beginning with version 2.16) has the necessary support
19026 for this option.  If your linker does not support this option, the
19027 header file aspect of @option{--sysroot} still works, but the
19028 library aspect does not.
19030 @opindex no-sysroot-suffix
19031 @item --no-sysroot-suffix
19032 For some targets, a suffix is added to the root directory specified
19033 with @option{--sysroot}, depending on the other options used, so that
19034 headers may for example be found in
19035 @file{@var{dir}/@var{suffix}/usr/include} instead of
19036 @file{@var{dir}/usr/include}.  This option disables the addition of
19037 such a suffix.
19039 @end table
19041 @node Code Gen Options
19042 @section Options for Code Generation Conventions
19043 @cindex code generation conventions
19044 @cindex options, code generation
19045 @cindex run-time options
19047 These machine-independent options control the interface conventions
19048 used in code generation.
19050 Most of them have both positive and negative forms; the negative form
19051 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
19052 one of the forms is listed---the one that is not the default.  You
19053 can figure out the other form by either removing @samp{no-} or adding
19056 @table @gcctabopt
19057 @opindex fstack_reuse
19058 @item -fstack-reuse=@var{reuse-level}
19059 This option controls stack space reuse for user declared local/auto variables
19060 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
19061 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
19062 local variables and temporaries, @samp{named_vars} enables the reuse only for
19063 user defined local variables with names, and @samp{none} disables stack reuse
19064 completely. The default value is @samp{all}. The option is needed when the
19065 program extends the lifetime of a scoped local variable or a compiler generated
19066 temporary beyond the end point defined by the language.  When a lifetime of
19067 a variable ends, and if the variable lives in memory, the optimizing compiler
19068 has the freedom to reuse its stack space with other temporaries or scoped
19069 local variables whose live range does not overlap with it. Legacy code extending
19070 local lifetime is likely to break with the stack reuse optimization.
19072 For example,
19074 @smallexample
19075    int *p;
19076    @{
19077      int local1;
19079      p = &local1;
19080      local1 = 10;
19081      ....
19082    @}
19083    @{
19084       int local2;
19085       local2 = 20;
19086       ...
19087    @}
19089    if (*p == 10)  // out of scope use of local1
19090      @{
19092      @}
19093 @end smallexample
19095 Another example:
19096 @smallexample
19098    struct A
19099    @{
19100        A(int k) : i(k), j(k) @{ @}
19101        int i;
19102        int j;
19103    @};
19105    A *ap;
19107    void foo(const A& ar)
19108    @{
19109       ap = &ar;
19110    @}
19112    void bar()
19113    @{
19114       foo(A(10)); // temp object's lifetime ends when foo returns
19116       @{
19117         A a(20);
19118         ....
19119       @}
19120       ap->i+= 10;  // ap references out of scope temp whose space
19121                    // is reused with a. What is the value of ap->i?
19122    @}
19124 @end smallexample
19126 The lifetime of a compiler generated temporary is well defined by the C++
19127 standard. When a lifetime of a temporary ends, and if the temporary lives
19128 in memory, the optimizing compiler has the freedom to reuse its stack
19129 space with other temporaries or scoped local variables whose live range
19130 does not overlap with it. However some of the legacy code relies on
19131 the behavior of older compilers in which temporaries' stack space is
19132 not reused, the aggressive stack reuse can lead to runtime errors. This
19133 option is used to control the temporary stack reuse optimization.
19135 @opindex ftrapv
19136 @item -ftrapv
19137 This option generates traps for signed overflow on addition, subtraction,
19138 multiplication operations.
19139 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
19140 @option{-ftrapv} @option{-fwrapv} on the command-line results in
19141 @option{-fwrapv} being effective.  Note that only active options override, so
19142 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
19143 results in @option{-ftrapv} being effective.
19145 @opindex fwrapv
19146 @item -fwrapv
19147 This option instructs the compiler to assume that signed arithmetic
19148 overflow of addition, subtraction and multiplication wraps around
19149 using twos-complement representation.  This flag enables some optimizations
19150 and disables others.
19151 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
19152 @option{-ftrapv} @option{-fwrapv} on the command-line results in
19153 @option{-fwrapv} being effective.  Note that only active options override, so
19154 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
19155 results in @option{-ftrapv} being effective.
19157 @opindex fwrapv-pointer
19158 @item -fwrapv-pointer
19159 This option instructs the compiler to assume that pointer arithmetic
19160 overflow on addition and subtraction wraps around using twos-complement
19161 representation.  This flag disables some optimizations which assume
19162 pointer overflow is invalid.
19164 @opindex fstrict-overflow
19165 @item -fstrict-overflow
19166 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
19167 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
19169 @opindex fexceptions
19170 @item -fexceptions
19171 Enable exception handling.  Generates extra code needed to propagate
19172 exceptions.  For some targets, this implies GCC generates frame
19173 unwind information for all functions, which can produce significant data
19174 size overhead, although it does not affect execution.  If you do not
19175 specify this option, GCC enables it by default for languages like
19176 C++ that normally require exception handling, and disables it for
19177 languages like C that do not normally require it.  However, you may need
19178 to enable this option when compiling C code that needs to interoperate
19179 properly with exception handlers written in C++.  You may also wish to
19180 disable this option if you are compiling older C++ programs that don't
19181 use exception handling.
19183 @opindex fnon-call-exceptions
19184 @item -fnon-call-exceptions
19185 Generate code that allows trapping instructions to throw exceptions.
19186 Note that this requires platform-specific runtime support that does
19187 not exist everywhere.  Moreover, it only allows @emph{trapping}
19188 instructions to throw exceptions, i.e.@: memory references or floating-point
19189 instructions.  It does not allow exceptions to be thrown from
19190 arbitrary signal handlers such as @code{SIGALRM}.  This enables
19191 @option{-fexceptions}.
19193 @opindex fdelete-dead-exceptions
19194 @item -fdelete-dead-exceptions
19195 Consider that instructions that may throw exceptions but don't otherwise
19196 contribute to the execution of the program can be optimized away.
19197 This does not affect calls to functions except those with the
19198 @code{pure} or @code{const} attributes.
19199 This option is enabled by default for the Ada and C++ compilers, as permitted by
19200 the language specifications.
19201 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
19203 @opindex funwind-tables
19204 @item -funwind-tables
19205 Similar to @option{-fexceptions}, except that it just generates any needed
19206 static data, but does not affect the generated code in any other way.
19207 You normally do not need to enable this option; instead, a language processor
19208 that needs this handling enables it on your behalf.
19210 @opindex fasynchronous-unwind-tables
19211 @item -fasynchronous-unwind-tables
19212 Generate unwind table in DWARF format, if supported by target machine.  The
19213 table is exact at each instruction boundary, so it can be used for stack
19214 unwinding from asynchronous events (such as debugger or garbage collector).
19216 @opindex fno-gnu-unique
19217 @opindex fgnu-unique
19218 @item -fno-gnu-unique
19219 On systems with recent GNU assembler and C library, the C++ compiler
19220 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
19221 of template static data members and static local variables in inline
19222 functions are unique even in the presence of @code{RTLD_LOCAL}; this
19223 is necessary to avoid problems with a library used by two different
19224 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
19225 therefore disagreeing with the other one about the binding of the
19226 symbol.  But this causes @code{dlclose} to be ignored for affected
19227 DSOs; if your program relies on reinitialization of a DSO via
19228 @code{dlclose} and @code{dlopen}, you can use
19229 @option{-fno-gnu-unique}.
19231 @opindex fpcc-struct-return
19232 @item -fpcc-struct-return
19233 Return ``short'' @code{struct} and @code{union} values in memory like
19234 longer ones, rather than in registers.  This convention is less
19235 efficient, but it has the advantage of allowing intercallability between
19236 GCC-compiled files and files compiled with other compilers, particularly
19237 the Portable C Compiler (pcc).
19239 The precise convention for returning structures in memory depends
19240 on the target configuration macros.
19242 Short structures and unions are those whose size and alignment match
19243 that of some integer type.
19245 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
19246 switch is not binary compatible with code compiled with the
19247 @option{-freg-struct-return} switch.
19248 Use it to conform to a non-default application binary interface.
19250 @opindex freg-struct-return
19251 @item -freg-struct-return
19252 Return @code{struct} and @code{union} values in registers when possible.
19253 This is more efficient for small structures than
19254 @option{-fpcc-struct-return}.
19256 If you specify neither @option{-fpcc-struct-return} nor
19257 @option{-freg-struct-return}, GCC defaults to whichever convention is
19258 standard for the target.  If there is no standard convention, GCC
19259 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
19260 the principal compiler.  In those cases, we can choose the standard, and
19261 we chose the more efficient register return alternative.
19263 @strong{Warning:} code compiled with the @option{-freg-struct-return}
19264 switch is not binary compatible with code compiled with the
19265 @option{-fpcc-struct-return} switch.
19266 Use it to conform to a non-default application binary interface.
19268 @opindex fshort-enums
19269 @item -fshort-enums
19270 Allocate to an @code{enum} type only as many bytes as it needs for the
19271 declared range of possible values.  Specifically, the @code{enum} type
19272 is equivalent to the smallest integer type that has enough room.
19273 This option has no effect for an enumeration type with a fixed underlying
19274 type.
19276 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
19277 code that is not binary compatible with code generated without that switch.
19278 Use it to conform to a non-default application binary interface.
19280 @opindex fshort-wchar
19281 @item -fshort-wchar
19282 Override the underlying type for @code{wchar_t} to be @code{short
19283 unsigned int} instead of the default for the target.  This option is
19284 useful for building programs to run under WINE@.
19286 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
19287 code that is not binary compatible with code generated without that switch.
19288 Use it to conform to a non-default application binary interface.
19290 @opindex fcommon
19291 @opindex fno-common
19292 @cindex tentative definitions
19293 @item -fcommon
19294 In C code, this option controls the placement of global variables
19295 defined without an initializer, known as @dfn{tentative definitions}
19296 in the C standard.  Tentative definitions are distinct from declarations
19297 of a variable with the @code{extern} keyword, which do not allocate storage.
19299 The default is @option{-fno-common}, which specifies that the compiler places
19300 uninitialized global variables in the BSS section of the object file.
19301 This inhibits the merging of tentative definitions by the linker so you get a
19302 multiple-definition error if the same variable is accidentally defined in more
19303 than one compilation unit.
19305 The @option{-fcommon} places uninitialized global variables in a common block.
19306 This allows the linker to resolve all tentative definitions of the same variable
19307 in different compilation units to the same object, or to a non-tentative
19308 definition.  This behavior is inconsistent with C++, and on many targets implies
19309 a speed and code size penalty on global variable references.  It is mainly
19310 useful to enable legacy code to link without errors.
19312 @opindex fno-ident
19313 @opindex fident
19314 @item -fno-ident
19315 Ignore the @code{#ident} directive.
19317 @opindex finhibit-size-directive
19318 @item -finhibit-size-directive
19319 Don't output a @code{.size} assembler directive, or anything else that
19320 would cause trouble if the function is split in the middle, and the
19321 two halves are placed at locations far apart in memory.  This option is
19322 used when compiling @file{crtstuff.c}; you should not need to use it
19323 for anything else.
19325 @opindex fverbose-asm
19326 @item -fverbose-asm
19327 Put extra commentary information in the generated assembly code to
19328 make it more readable.  This option is generally only of use to those
19329 who actually need to read the generated assembly code (perhaps while
19330 debugging the compiler itself).
19332 @option{-fno-verbose-asm}, the default, causes the
19333 extra information to be omitted and is useful when comparing two assembler
19334 files.
19336 The added comments include:
19338 @itemize @bullet
19340 @item
19341 information on the compiler version and command-line options,
19343 @item
19344 the source code lines associated with the assembly instructions,
19345 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
19347 @item
19348 hints on which high-level expressions correspond to
19349 the various assembly instruction operands.
19351 @end itemize
19353 For example, given this C source file:
19355 @smallexample
19356 int test (int n)
19358   int i;
19359   int total = 0;
19361   for (i = 0; i < n; i++)
19362     total += i * i;
19364   return total;
19366 @end smallexample
19368 compiling to (x86_64) assembly via @option{-S} and emitting the result
19369 direct to stdout via @option{-o} @option{-}
19371 @smallexample
19372 gcc -S test.c -fverbose-asm -Os -o -
19373 @end smallexample
19375 gives output similar to this:
19377 @smallexample
19378         .file   "test.c"
19379 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
19380   [...snip...]
19381 # options passed:
19382   [...snip...]
19384         .text
19385         .globl  test
19386         .type   test, @@function
19387 test:
19388 .LFB0:
19389         .cfi_startproc
19390 # test.c:4:   int total = 0;
19391         xorl    %eax, %eax      # <retval>
19392 # test.c:6:   for (i = 0; i < n; i++)
19393         xorl    %edx, %edx      # i
19394 .L2:
19395 # test.c:6:   for (i = 0; i < n; i++)
19396         cmpl    %edi, %edx      # n, i
19397         jge     .L5     #,
19398 # test.c:7:     total += i * i;
19399         movl    %edx, %ecx      # i, tmp92
19400         imull   %edx, %ecx      # i, tmp92
19401 # test.c:6:   for (i = 0; i < n; i++)
19402         incl    %edx    # i
19403 # test.c:7:     total += i * i;
19404         addl    %ecx, %eax      # tmp92, <retval>
19405         jmp     .L2     #
19406 .L5:
19407 # test.c:10: @}
19408         ret
19409         .cfi_endproc
19410 .LFE0:
19411         .size   test, .-test
19412         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
19413         .section        .note.GNU-stack,"",@@progbits
19414 @end smallexample
19416 The comments are intended for humans rather than machines and hence the
19417 precise format of the comments is subject to change.
19419 @opindex frecord-gcc-switches
19420 @item -frecord-gcc-switches
19421 This switch causes the command line used to invoke the
19422 compiler to be recorded into the object file that is being created.
19423 This switch is only implemented on some targets and the exact format
19424 of the recording is target and binary file format dependent, but it
19425 usually takes the form of a section containing ASCII text.  This
19426 switch is related to the @option{-fverbose-asm} switch, but that
19427 switch only records information in the assembler output file as
19428 comments, so it never reaches the object file.
19429 See also @option{-grecord-gcc-switches} for another
19430 way of storing compiler options into the object file.
19432 @opindex fpic
19433 @cindex global offset table
19434 @cindex PIC
19435 @item -fpic
19436 Generate position-independent code (PIC) suitable for use in a shared
19437 library, if supported for the target machine.  Such code accesses all
19438 constant addresses through a global offset table (GOT)@.  The dynamic
19439 loader resolves the GOT entries when the program starts (the dynamic
19440 loader is not part of GCC; it is part of the operating system).  If
19441 the GOT size for the linked executable exceeds a machine-specific
19442 maximum size, you get an error message from the linker indicating that
19443 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
19444 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
19445 on the m68k and RS/6000.  The x86 has no such limit.)
19447 Position-independent code requires special support, and therefore works
19448 only on certain machines.  For the x86, GCC supports PIC for System V
19449 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
19450 position-independent.
19452 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
19453 are defined to 1.
19455 @opindex fPIC
19456 @item -fPIC
19457 If supported for the target machine, emit position-independent code,
19458 suitable for dynamic linking and avoiding any limit on the size of the
19459 global offset table.  This option makes a difference on AArch64, m68k,
19460 PowerPC and SPARC@.
19462 Position-independent code requires special support, and therefore works
19463 only on certain machines.
19465 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
19466 are defined to 2.
19468 @opindex fpie
19469 @opindex fPIE
19470 @item -fpie
19471 @itemx -fPIE
19472 These options are similar to @option{-fpic} and @option{-fPIC}, but the
19473 generated position-independent code can be only linked into executables.
19474 Usually these options are used to compile code that will be linked using
19475 the @option{-pie} GCC option.
19477 @option{-fpie} and @option{-fPIE} both define the macros
19478 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
19479 for @option{-fpie} and 2 for @option{-fPIE}.
19481 @opindex fno-plt
19482 @opindex fplt
19483 @item -fno-plt
19484 Do not use the PLT for external function calls in position-independent code.
19485 Instead, load the callee address at call sites from the GOT and branch to it.
19486 This leads to more efficient code by eliminating PLT stubs and exposing
19487 GOT loads to optimizations.  On architectures such as 32-bit x86 where
19488 PLT stubs expect the GOT pointer in a specific register, this gives more
19489 register allocation freedom to the compiler.
19490 Lazy binding requires use of the PLT; 
19491 with @option{-fno-plt} all external symbols are resolved at load time.
19493 Alternatively, the function attribute @code{noplt} can be used to avoid calls
19494 through the PLT for specific external functions.
19496 In position-dependent code, a few targets also convert calls to
19497 functions that are marked to not use the PLT to use the GOT instead.
19499 @opindex fno-jump-tables
19500 @opindex fjump-tables
19501 @item -fno-jump-tables
19502 Do not use jump tables for switch statements even where it would be
19503 more efficient than other code generation strategies.  This option is
19504 of use in conjunction with @option{-fpic} or @option{-fPIC} for
19505 building code that forms part of a dynamic linker and cannot
19506 reference the address of a jump table.  On some targets, jump tables
19507 do not require a GOT and this option is not needed.
19509 @opindex fno-bit-tests
19510 @opindex fbit-tests
19511 @item -fno-bit-tests
19512 Do not use bit tests for switch statements even where it would be
19513 more efficient than other code generation strategies.
19515 @opindex ffixed
19516 @item -ffixed-@var{reg}
19517 Treat the register named @var{reg} as a fixed register; generated code
19518 should never refer to it (except perhaps as a stack pointer, frame
19519 pointer or in some other fixed role).
19521 @var{reg} must be the name of a register.  The register names accepted
19522 are machine-specific and are defined in the @code{REGISTER_NAMES}
19523 macro in the machine description macro file.
19525 This flag does not have a negative form, because it specifies a
19526 three-way choice.
19528 @opindex fcall-used
19529 @item -fcall-used-@var{reg}
19530 Treat the register named @var{reg} as an allocable register that is
19531 clobbered by function calls.  It may be allocated for temporaries or
19532 variables that do not live across a call.  Functions compiled this way
19533 do not save and restore the register @var{reg}.
19535 It is an error to use this flag with the frame pointer or stack pointer.
19536 Use of this flag for other registers that have fixed pervasive roles in
19537 the machine's execution model produces disastrous results.
19539 This flag does not have a negative form, because it specifies a
19540 three-way choice.
19542 @opindex fcall-saved
19543 @item -fcall-saved-@var{reg}
19544 Treat the register named @var{reg} as an allocable register saved by
19545 functions.  It may be allocated even for temporaries or variables that
19546 live across a call.  Functions compiled this way save and restore
19547 the register @var{reg} if they use it.
19549 It is an error to use this flag with the frame pointer or stack pointer.
19550 Use of this flag for other registers that have fixed pervasive roles in
19551 the machine's execution model produces disastrous results.
19553 A different sort of disaster results from the use of this flag for
19554 a register in which function values may be returned.
19556 This flag does not have a negative form, because it specifies a
19557 three-way choice.
19559 @opindex fpack-struct
19560 @item -fpack-struct[=@var{n}]
19561 Without a value specified, pack all structure members together without
19562 holes.  When a value is specified (which must be a small power of two), pack
19563 structure members according to this value, representing the maximum
19564 alignment (that is, objects with default alignment requirements larger than
19565 this are output potentially unaligned at the next fitting location.
19567 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
19568 code that is not binary compatible with code generated without that switch.
19569 Additionally, it makes the code suboptimal.
19570 Use it to conform to a non-default application binary interface.
19572 @opindex fleading-underscore
19573 @item -fleading-underscore
19574 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19575 change the way C symbols are represented in the object file.  One use
19576 is to help link with legacy assembly code.
19578 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19579 generate code that is not binary compatible with code generated without that
19580 switch.  Use it to conform to a non-default application binary interface.
19581 Not all targets provide complete support for this switch.
19583 @opindex ftls-model
19584 @item -ftls-model=@var{model}
19585 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19586 The @var{model} argument should be one of @samp{global-dynamic},
19587 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
19588 Note that the choice is subject to optimization: the compiler may use
19589 a more efficient model for symbols not visible outside of the translation
19590 unit, or if @option{-fpic} is not given on the command line.
19592 The default without @option{-fpic} is @samp{initial-exec}; with
19593 @option{-fpic} the default is @samp{global-dynamic}.
19595 @opindex ftrampolines
19596 @item -ftrampolines
19597 For targets that normally need trampolines for nested functions, always
19598 generate them instead of using descriptors.  Otherwise, for targets that
19599 do not need them, like for example HP-PA or IA-64, do nothing.
19601 A trampoline is a small piece of code that is created at run time on the
19602 stack when the address of a nested function is taken, and is used to call
19603 the nested function indirectly.  Therefore, it requires the stack to be
19604 made executable in order for the program to work properly.
19606 @option{-fno-trampolines} is enabled by default on a language by language
19607 basis to let the compiler avoid generating them, if it computes that this
19608 is safe, and replace them with descriptors.  Descriptors are made up of data
19609 only, but the generated code must be prepared to deal with them.  As of this
19610 writing, @option{-fno-trampolines} is enabled by default only for Ada.
19612 Moreover, code compiled with @option{-ftrampolines} and code compiled with
19613 @option{-fno-trampolines} are not binary compatible if nested functions are
19614 present.  This option must therefore be used on a program-wide basis and be
19615 manipulated with extreme care.
19617 For languages other than Ada, the @code{-ftrampolines} and
19618 @code{-fno-trampolines} options currently have no effect, and
19619 trampolines are always generated on platforms that need them
19620 for nested functions.
19622 @opindex ftrampoline-impl
19623 @item -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
19624 By default, trampolines are generated on stack.  However, certain platforms
19625 (such as the Apple M1) do not permit an executable stack.  Compiling with
19626 @option{-ftrampoline-impl=heap} generate calls to
19627 @code{__gcc_nested_func_ptr_created} and
19628 @code{__gcc_nested_func_ptr_deleted} in order to allocate and
19629 deallocate trampoline space on the executable heap.  These functions are
19630 implemented in libgcc, and will only be provided on specific targets:
19631 x86_64 Darwin, x86_64 and aarch64 Linux.  @emph{PLEASE NOTE}: Heap
19632 trampolines are @emph{not} guaranteed to be correctly deallocated if you
19633 @code{setjmp}, instantiate nested functions, and then @code{longjmp} back
19634 to a state prior to having allocated those nested functions.
19636 @opindex fvisibility
19637 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
19638 Set the default ELF image symbol visibility to the specified option---all
19639 symbols are marked with this unless overridden within the code.
19640 Using this feature can very substantially improve linking and
19641 load times of shared object libraries, produce more optimized
19642 code, provide near-perfect API export and prevent symbol clashes.
19643 It is @strong{strongly} recommended that you use this in any shared objects
19644 you distribute.
19646 Despite the nomenclature, @samp{default} always means public; i.e.,
19647 available to be linked against from outside the shared object.
19648 @samp{protected} and @samp{internal} are pretty useless in real-world
19649 usage so the only other commonly used option is @samp{hidden}.
19650 The default if @option{-fvisibility} isn't specified is
19651 @samp{default}, i.e., make every symbol public.
19653 A good explanation of the benefits offered by ensuring ELF
19654 symbols have the correct visibility is given by ``How To Write
19655 Shared Libraries'' by Ulrich Drepper (which can be found at
19656 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
19657 solution made possible by this option to marking things hidden when
19658 the default is public is to make the default hidden and mark things
19659 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
19660 and @code{__attribute__ ((visibility("default")))} instead of
19661 @code{__declspec(dllexport)} you get almost identical semantics with
19662 identical syntax.  This is a great boon to those working with
19663 cross-platform projects.
19665 For those adding visibility support to existing code, you may find
19666 @code{#pragma GCC visibility} of use.  This works by you enclosing
19667 the declarations you wish to set visibility for with (for example)
19668 @code{#pragma GCC visibility push(hidden)} and
19669 @code{#pragma GCC visibility pop}.
19670 Bear in mind that symbol visibility should be viewed @strong{as
19671 part of the API interface contract} and thus all new code should
19672 always specify visibility when it is not the default; i.e., declarations
19673 only for use within the local DSO should @strong{always} be marked explicitly
19674 as hidden as so to avoid PLT indirection overheads---making this
19675 abundantly clear also aids readability and self-documentation of the code.
19676 Note that due to ISO C++ specification requirements, @code{operator new} and
19677 @code{operator delete} must always be of default visibility.
19679 Be aware that headers from outside your project, in particular system
19680 headers and headers from any other library you use, may not be
19681 expecting to be compiled with visibility other than the default.  You
19682 may need to explicitly say @code{#pragma GCC visibility push(default)}
19683 before including any such headers.
19685 @code{extern} declarations are not affected by @option{-fvisibility}, so
19686 a lot of code can be recompiled with @option{-fvisibility=hidden} with
19687 no modifications.  However, this means that calls to @code{extern}
19688 functions with no explicit visibility use the PLT, so it is more
19689 effective to use @code{__attribute ((visibility))} and/or
19690 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
19691 declarations should be treated as hidden.
19693 Note that @option{-fvisibility} does affect C++ vague linkage
19694 entities. This means that, for instance, an exception class that is
19695 be thrown between DSOs must be explicitly marked with default
19696 visibility so that the @samp{type_info} nodes are unified between
19697 the DSOs.
19699 An overview of these techniques, their benefits and how to use them
19700 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
19702 @opindex fstrict-volatile-bitfields
19703 @item -fstrict-volatile-bitfields
19704 This option should be used if accesses to volatile bit-fields (or other
19705 structure fields, although the compiler usually honors those types
19706 anyway) should use a single access of the width of the
19707 field's type, aligned to a natural alignment if possible.  For
19708 example, targets with memory-mapped peripheral registers might require
19709 all such accesses to be 16 bits wide; with this flag you can
19710 declare all peripheral bit-fields as @code{unsigned short} (assuming short
19711 is 16 bits on these targets) to force GCC to use 16-bit accesses
19712 instead of, perhaps, a more efficient 32-bit access.
19714 If this option is disabled, the compiler uses the most efficient
19715 instruction.  In the previous example, that might be a 32-bit load
19716 instruction, even though that accesses bytes that do not contain
19717 any portion of the bit-field, or memory-mapped registers unrelated to
19718 the one being updated.
19720 In some cases, such as when the @code{packed} attribute is applied to a 
19721 structure field, it may not be possible to access the field with a single
19722 read or write that is correctly aligned for the target machine.  In this
19723 case GCC falls back to generating multiple accesses rather than code that 
19724 will fault or truncate the result at run time.
19726 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
19727 not allowed to touch non bit-field members.  It is therefore recommended
19728 to define all bits of the field's type as bit-field members.
19730 The default value of this option is determined by the application binary
19731 interface for the target processor.
19733 @opindex fsync-libcalls
19734 @item -fsync-libcalls
19735 This option controls whether any out-of-line instance of the @code{__sync}
19736 family of functions may be used to implement the C++11 @code{__atomic}
19737 family of functions.
19739 The default value of this option is enabled, thus the only useful form
19740 of the option is @option{-fno-sync-libcalls}.  This option is used in
19741 the implementation of the @file{libatomic} runtime library.
19743 @end table
19745 @node Developer Options
19746 @section GCC Developer Options
19747 @cindex developer options
19748 @cindex debugging GCC
19749 @cindex debug dump options
19750 @cindex dump options
19751 @cindex compilation statistics
19753 This section describes command-line options that are primarily of
19754 interest to GCC developers, including options to support compiler
19755 testing and investigation of compiler bugs and compile-time
19756 performance problems.  This includes options that produce debug dumps
19757 at various points in the compilation; that print statistics such as
19758 memory use and execution time; and that print information about GCC's
19759 configuration, such as where it searches for libraries.  You should
19760 rarely need to use any of these options for ordinary compilation and
19761 linking tasks.
19763 Many developer options that cause GCC to dump output to a file take an
19764 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19765 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19766 error.
19768 If @samp{=@var{filename}} is omitted, a default dump file name is
19769 constructed by concatenating the base dump file name, a pass number,
19770 phase letter, and pass name.  The base dump file name is the name of
19771 output file produced by the compiler if explicitly specified and not
19772 an executable; otherwise it is the source file name.
19773 The pass number is determined by the order passes are registered with
19774 the compiler's pass manager. 
19775 This is generally the same as the order of execution, but passes
19776 registered by plugins, target-specific passes, or passes that are
19777 otherwise registered late are numbered higher than the pass named
19778 @samp{final}, even if they are executed earlier.  The phase letter is
19779 one of @samp{i} (inter-procedural analysis), @samp{l}
19780 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19781 The files are created in the directory of the output file. 
19783 @table @gcctabopt
19785 @opindex fcallgraph-info
19786 @item -fcallgraph-info
19787 @itemx -fcallgraph-info=@var{MARKERS}
19788 Makes the compiler output callgraph information for the program, on a
19789 per-object-file basis.  The information is generated in the common VCG
19790 format.  It can be decorated with additional, per-node and/or per-edge
19791 information, if a list of comma-separated markers is additionally
19792 specified.  When the @code{su} marker is specified, the callgraph is
19793 decorated with stack usage information; it is equivalent to
19794 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19795 callgraph is decorated with information about dynamically allocated
19796 objects.
19798 When compiling with @option{-flto}, no callgraph information is output
19799 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19800 may generate multiple callgraph information files next to intermediate
19801 LTO output files.
19803 @opindex d
19804 @opindex fdump-rtl-@var{pass}
19805 @item -d@var{letters}
19806 @itemx -fdump-rtl-@var{pass}
19807 @itemx -fdump-rtl-@var{pass}=@var{filename}
19808 Says to make debugging dumps during compilation at times specified by
19809 @var{letters}.  This is used for debugging the RTL-based passes of the
19810 compiler.
19812 Some @option{-d@var{letters}} switches have different meaning when
19813 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19814 for information about preprocessor-specific dump options.
19816 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19817 @option{-d} option @var{letters}.  Here are the possible
19818 letters for use in @var{pass} and @var{letters}, and their meanings:
19820 @table @gcctabopt
19822 @opindex fdump-rtl-alignments
19823 @item -fdump-rtl-alignments
19824 Dump after branch alignments have been computed.
19826 @opindex fdump-rtl-asmcons
19827 @item -fdump-rtl-asmcons
19828 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19830 @opindex fdump-rtl-auto_inc_dec
19831 @item -fdump-rtl-auto_inc_dec
19832 Dump after auto-inc-dec discovery.  This pass is only run on
19833 architectures that have auto inc or auto dec instructions.
19835 @opindex fdump-rtl-barriers
19836 @item -fdump-rtl-barriers
19837 Dump after cleaning up the barrier instructions.
19839 @opindex fdump-rtl-bbpart
19840 @item -fdump-rtl-bbpart
19841 Dump after partitioning hot and cold basic blocks.
19843 @opindex fdump-rtl-bbro
19844 @item -fdump-rtl-bbro
19845 Dump after block reordering.
19847 @opindex fdump-rtl-btl2
19848 @opindex fdump-rtl-btl2
19849 @item -fdump-rtl-btl1
19850 @itemx -fdump-rtl-btl2
19851 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19852 after the two branch
19853 target load optimization passes.
19855 @opindex fdump-rtl-bypass
19856 @item -fdump-rtl-bypass
19857 Dump after jump bypassing and control flow optimizations.
19859 @opindex fdump-rtl-combine
19860 @item -fdump-rtl-combine
19861 Dump after the RTL instruction combination pass.
19863 @opindex fdump-rtl-compgotos
19864 @item -fdump-rtl-compgotos
19865 Dump after duplicating the computed gotos.
19867 @opindex fdump-rtl-ce1
19868 @opindex fdump-rtl-ce2
19869 @opindex fdump-rtl-ce3
19870 @item -fdump-rtl-ce1
19871 @itemx -fdump-rtl-ce2
19872 @itemx -fdump-rtl-ce3
19873 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19874 @option{-fdump-rtl-ce3} enable dumping after the three
19875 if conversion passes.
19877 @opindex fdump-rtl-cprop_hardreg
19878 @item -fdump-rtl-cprop_hardreg
19879 Dump after hard register copy propagation.
19881 @opindex fdump-rtl-csa
19882 @item -fdump-rtl-csa
19883 Dump after combining stack adjustments.
19885 @opindex fdump-rtl-cse1
19886 @opindex fdump-rtl-cse2
19887 @item -fdump-rtl-cse1
19888 @itemx -fdump-rtl-cse2
19889 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19890 the two common subexpression elimination passes.
19892 @opindex fdump-rtl-dce
19893 @item -fdump-rtl-dce
19894 Dump after the standalone dead code elimination passes.
19896 @opindex fdump-rtl-dbr
19897 @item -fdump-rtl-dbr
19898 Dump after delayed branch scheduling.
19900 @opindex fdump-rtl-dce1
19901 @opindex fdump-rtl-dce2
19902 @item -fdump-rtl-dce1
19903 @itemx -fdump-rtl-dce2
19904 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19905 the two dead store elimination passes.
19907 @opindex fdump-rtl-eh
19908 @item -fdump-rtl-eh
19909 Dump after finalization of EH handling code.
19911 @opindex fdump-rtl-eh_ranges
19912 @item -fdump-rtl-eh_ranges
19913 Dump after conversion of EH handling range regions.
19915 @opindex fdump-rtl-expand
19916 @item -fdump-rtl-expand
19917 Dump after RTL generation.
19919 @opindex fdump-rtl-fwprop1
19920 @opindex fdump-rtl-fwprop2
19921 @item -fdump-rtl-fwprop1
19922 @itemx -fdump-rtl-fwprop2
19923 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19924 dumping after the two forward propagation passes.
19926 @opindex fdump-rtl-gcse1
19927 @opindex fdump-rtl-gcse2
19928 @item -fdump-rtl-gcse1
19929 @itemx -fdump-rtl-gcse2
19930 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19931 after global common subexpression elimination.
19933 @opindex fdump-rtl-init-regs
19934 @item -fdump-rtl-init-regs
19935 Dump after the initialization of the registers.
19937 @opindex fdump-rtl-initvals
19938 @item -fdump-rtl-initvals
19939 Dump after the computation of the initial value sets.
19941 @opindex fdump-rtl-into_cfglayout
19942 @item -fdump-rtl-into_cfglayout
19943 Dump after converting to cfglayout mode.
19945 @opindex fdump-rtl-ira
19946 @item -fdump-rtl-ira
19947 Dump after iterated register allocation.
19949 @opindex fdump-rtl-jump
19950 @item -fdump-rtl-jump
19951 Dump after the second jump optimization.
19953 @opindex fdump-rtl-loop2
19954 @item -fdump-rtl-loop2
19955 @option{-fdump-rtl-loop2} enables dumping after the rtl
19956 loop optimization passes.
19958 @opindex fdump-rtl-mach
19959 @item -fdump-rtl-mach
19960 Dump after performing the machine dependent reorganization pass, if that
19961 pass exists.
19963 @opindex fdump-rtl-mode_sw
19964 @item -fdump-rtl-mode_sw
19965 Dump after removing redundant mode switches.
19967 @opindex fdump-rtl-rnreg
19968 @item -fdump-rtl-rnreg
19969 Dump after register renumbering.
19971 @opindex fdump-rtl-outof_cfglayout
19972 @item -fdump-rtl-outof_cfglayout
19973 Dump after converting from cfglayout mode.
19975 @opindex fdump-rtl-peephole2
19976 @item -fdump-rtl-peephole2
19977 Dump after the peephole pass.
19979 @opindex fdump-rtl-postreload
19980 @item -fdump-rtl-postreload
19981 Dump after post-reload optimizations.
19983 @opindex fdump-rtl-pro_and_epilogue
19984 @item -fdump-rtl-pro_and_epilogue
19985 Dump after generating the function prologues and epilogues.
19987 @opindex fdump-rtl-sched1
19988 @opindex fdump-rtl-sched2
19989 @item -fdump-rtl-sched1
19990 @itemx -fdump-rtl-sched2
19991 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19992 after the basic block scheduling passes.
19994 @opindex fdump-rtl-ree
19995 @item -fdump-rtl-ree
19996 Dump after sign/zero extension elimination.
19998 @opindex fdump-rtl-seqabstr
19999 @item -fdump-rtl-seqabstr
20000 Dump after common sequence discovery.
20002 @opindex fdump-rtl-shorten
20003 @item -fdump-rtl-shorten
20004 Dump after shortening branches.
20006 @opindex fdump-rtl-sibling
20007 @item -fdump-rtl-sibling
20008 Dump after sibling call optimizations.
20010 @opindex fdump-rtl-split1
20011 @opindex fdump-rtl-split2
20012 @opindex fdump-rtl-split3
20013 @opindex fdump-rtl-split4
20014 @opindex fdump-rtl-split5
20015 @item -fdump-rtl-split1
20016 @itemx -fdump-rtl-split2
20017 @itemx -fdump-rtl-split3
20018 @itemx -fdump-rtl-split4
20019 @itemx -fdump-rtl-split5
20020 These options enable dumping after five rounds of
20021 instruction splitting.
20023 @opindex fdump-rtl-sms
20024 @item -fdump-rtl-sms
20025 Dump after modulo scheduling.  This pass is only run on some
20026 architectures.
20028 @opindex fdump-rtl-stack
20029 @item -fdump-rtl-stack
20030 Dump after conversion from GCC's ``flat register file'' registers to the
20031 x87's stack-like registers.  This pass is only run on x86 variants.
20033 @opindex fdump-rtl-subreg1
20034 @opindex fdump-rtl-subreg2
20035 @item -fdump-rtl-subreg1
20036 @itemx -fdump-rtl-subreg2
20037 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
20038 the two subreg expansion passes.
20040 @opindex fdump-rtl-unshare
20041 @item -fdump-rtl-unshare
20042 Dump after all rtl has been unshared.
20044 @opindex fdump-rtl-vartrack
20045 @item -fdump-rtl-vartrack
20046 Dump after variable tracking.
20048 @opindex fdump-rtl-vregs
20049 @item -fdump-rtl-vregs
20050 Dump after converting virtual registers to hard registers.
20052 @opindex fdump-rtl-web
20053 @item -fdump-rtl-web
20054 Dump after live range splitting.
20056 @opindex fdump-rtl-regclass
20057 @opindex fdump-rtl-subregs_of_mode_init
20058 @opindex fdump-rtl-subregs_of_mode_finish
20059 @opindex fdump-rtl-dfinit
20060 @opindex fdump-rtl-dfinish
20061 @item -fdump-rtl-regclass
20062 @itemx -fdump-rtl-subregs_of_mode_init
20063 @itemx -fdump-rtl-subregs_of_mode_finish
20064 @itemx -fdump-rtl-dfinit
20065 @itemx -fdump-rtl-dfinish
20066 These dumps are defined but always produce empty files.
20068 @opindex da
20069 @opindex fdump-rtl-all
20070 @item -da
20071 @itemx -fdump-rtl-all
20072 Produce all the dumps listed above.
20074 @opindex dA
20075 @item -dA
20076 Annotate the assembler output with miscellaneous debugging information.
20078 @opindex dD
20079 @item -dD
20080 Dump all macro definitions, at the end of preprocessing, in addition to
20081 normal output.
20083 @opindex dH
20084 @item -dH
20085 Produce a core dump whenever an error occurs.
20087 @opindex dp
20088 @item -dp
20089 Annotate the assembler output with a comment indicating which
20090 pattern and alternative is used.  The length and cost of each instruction are
20091 also printed.
20093 @opindex dP
20094 @item -dP
20095 Dump the RTL in the assembler output as a comment before each instruction.
20096 Also turns on @option{-dp} annotation.
20098 @opindex dx
20099 @item -dx
20100 Just generate RTL for a function instead of compiling it.  Usually used
20101 with @option{-fdump-rtl-expand}.
20102 @end table
20104 @opindex fdump-debug
20105 @item -fdump-debug
20106 Dump debugging information generated during the debug
20107 generation phase.
20109 @opindex fdump-earlydebug
20110 @item -fdump-earlydebug
20111 Dump debugging information generated during the early debug
20112 generation phase.
20114 @opindex fdump-noaddr
20115 @item -fdump-noaddr
20116 When doing debugging dumps, suppress address output.  This makes it more
20117 feasible to use diff on debugging dumps for compiler invocations with
20118 different compiler binaries and/or different
20119 text / bss / data / heap / stack / dso start locations.
20121 @opindex freport-bug
20122 @item -freport-bug
20123 Collect and dump debug information into a temporary file if an
20124 internal compiler error (ICE) occurs.
20126 @opindex fdump-unnumbered
20127 @item -fdump-unnumbered
20128 When doing debugging dumps, suppress instruction numbers and address output.
20129 This makes it more feasible to use diff on debugging dumps for compiler
20130 invocations with different options, in particular with and without
20131 @option{-g}.
20133 @opindex fdump-unnumbered-links
20134 @item -fdump-unnumbered-links
20135 When doing debugging dumps (see @option{-d} option above), suppress
20136 instruction numbers for the links to the previous and next instructions
20137 in a sequence.
20139 @opindex fdump-ipa
20140 @item -fdump-ipa-@var{switch}
20141 @itemx -fdump-ipa-@var{switch}-@var{options}
20142 Control the dumping at various stages of inter-procedural analysis
20143 language tree to a file.  The file name is generated by appending a
20144 switch specific suffix to the source file name, and the file is created
20145 in the same directory as the output file.  The following dumps are
20146 possible:
20148 @table @samp
20149 @item all
20150 Enables all inter-procedural analysis dumps.
20152 @item cgraph
20153 Dumps information about call-graph optimization, unused function removal,
20154 and inlining decisions.
20156 @item inline
20157 Dump after function inlining.
20159 @item strubm
20160 Dump after selecting @code{strub} modes, and recording the selections as
20161 function attributes.
20163 @item strub
20164 Dump @code{strub} transformations: interface changes, function wrapping,
20165 and insertion of builtin calls for stack scrubbing and watermarking.
20167 @end table
20169 Additionally, the options @option{-optimized}, @option{-missed},
20170 @option{-note}, and @option{-all} can be provided, with the same meaning
20171 as for @option{-fopt-info}, defaulting to @option{-optimized}.
20173 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
20174 information on callsites that were inlined, along with callsites
20175 that were not inlined.
20177 By default, the dump will contain messages about successful
20178 optimizations (equivalent to @option{-optimized}) together with
20179 low-level details about the analysis.
20181 @opindex fdump-lang
20182 @item -fdump-lang
20183 Dump language-specific information.  The file name is made by appending
20184 @file{.lang} to the source file name.
20186 @opindex fdump-lang-all
20187 @opindex fdump-lang
20188 @item -fdump-lang-all
20189 @itemx -fdump-lang-@var{switch}
20190 @itemx -fdump-lang-@var{switch}-@var{options}
20191 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
20192 Control the dumping of language-specific information.  The @var{options}
20193 and @var{filename} portions behave as described in the
20194 @option{-fdump-tree} option.  The following @var{switch} values are
20195 accepted:
20197 @table @samp
20198 @item all
20200 Enable all language-specific dumps.
20202 @item class
20203 Dump class hierarchy information.  Virtual table information is emitted
20204 unless '@option{slim}' is specified.  This option is applicable to C++ only.
20206 @item module
20207 Dump module information.  Options @option{lineno} (locations),
20208 @option{graph} (reachability), @option{blocks} (clusters),
20209 @option{uid} (serialization), @option{alias} (mergeable),
20210 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
20211 (macros) may provide additional information.  This option is
20212 applicable to C++ only.
20214 @item raw
20215 Dump the raw internal tree data.  This option is applicable to C++ only.
20217 @end table
20219 @opindex fdump-passes
20220 @item -fdump-passes
20221 Print on @file{stderr} the list of optimization passes that are turned
20222 on and off by the current command-line options.
20224 @opindex fdump-statistics
20225 @item -fdump-statistics-@var{option}
20226 Enable and control dumping of pass statistics in a separate file.  The
20227 file name is generated by appending a suffix ending in
20228 @samp{.statistics} to the source file name, and the file is created in
20229 the same directory as the output file.  If the @samp{-@var{option}}
20230 form is used, @samp{-stats} causes counters to be summed over the
20231 whole compilation unit while @samp{-details} dumps every event as
20232 the passes generate them.  The default with no option is to sum
20233 counters for each function compiled.
20235 @opindex fdump-tree-all
20236 @opindex fdump-tree
20237 @item -fdump-tree-all
20238 @itemx -fdump-tree-@var{switch}
20239 @itemx -fdump-tree-@var{switch}-@var{options}
20240 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
20241 Control the dumping at various stages of processing the intermediate
20242 language tree to a file.  If the @samp{-@var{options}}
20243 form is used, @var{options} is a list of @samp{-} separated options
20244 which control the details of the dump.  Not all options are applicable
20245 to all dumps; those that are not meaningful are ignored.  The
20246 following options are available
20248 @table @samp
20249 @item address
20250 Print the address of each node.  Usually this is not meaningful as it
20251 changes according to the environment and source file.  Its primary use
20252 is for tying up a dump file with a debug environment.
20253 @item asmname
20254 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
20255 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
20256 use working backward from mangled names in the assembly file.
20257 @item slim
20258 When dumping front-end intermediate representations, inhibit dumping
20259 of members of a scope or body of a function merely because that scope
20260 has been reached.  Only dump such items when they are directly reachable
20261 by some other path.
20263 When dumping pretty-printed trees, this option inhibits dumping the
20264 bodies of control structures.
20266 When dumping RTL, print the RTL in slim (condensed) form instead of
20267 the default LISP-like representation.
20268 @item raw
20269 Print a raw representation of the tree.  By default, trees are
20270 pretty-printed into a C-like representation.
20271 @item details
20272 Enable more detailed dumps (not honored by every dump option). Also
20273 include information from the optimization passes.
20274 @item stats
20275 Enable dumping various statistics about the pass (not honored by every dump
20276 option).
20277 @item blocks
20278 Enable showing basic block boundaries (disabled in raw dumps).
20279 @item graph
20280 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
20281 dump a representation of the control flow graph suitable for viewing with
20282 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
20283 the file is pretty-printed as a subgraph, so that GraphViz can render them
20284 all in a single plot.
20286 This option currently only works for RTL dumps, and the RTL is always
20287 dumped in slim form.
20288 @item vops
20289 Enable showing virtual operands for every statement.
20290 @item lineno
20291 Enable showing line numbers for statements.
20292 @item uid
20293 Enable showing the unique ID (@code{DECL_UID}) for each variable.
20294 @item verbose
20295 Enable showing the tree dump for each statement.
20296 @item eh
20297 Enable showing the EH region number holding each statement.
20298 @item scev
20299 Enable showing scalar evolution analysis details.
20300 @item optimized
20301 Enable showing optimization information (only available in certain
20302 passes).
20303 @item missed
20304 Enable showing missed optimization information (only available in certain
20305 passes).
20306 @item note
20307 Enable other detailed optimization information (only available in
20308 certain passes).
20309 @item all
20310 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
20311 and @option{lineno}.
20312 @item optall
20313 Turn on all optimization options, i.e., @option{optimized},
20314 @option{missed}, and @option{note}.
20315 @end table
20317 To determine what tree dumps are available or find the dump for a pass
20318 of interest follow the steps below.
20320 @enumerate
20321 @item
20322 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
20323 look for a code that corresponds to the pass you are interested in.
20324 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
20325 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
20326 The number at the end distinguishes distinct invocations of the same pass.
20327 @item
20328 To enable the creation of the dump file, append the pass code to
20329 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
20330 to enable the dump from the Early Value Range Propagation pass, invoke
20331 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
20332 specify the name of the dump file.  If you don't specify one, GCC
20333 creates as described below.
20334 @item
20335 Find the pass dump in a file whose name is composed of three components
20336 separated by a period: the name of the source file GCC was invoked to
20337 compile, a numeric suffix indicating the pass number followed by the
20338 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
20339 and finally the pass code.  For example, the Early VRP pass dump might
20340 be in a file named @file{myfile.c.038t.evrp} in the current working
20341 directory.  Note that the numeric codes are not stable and may change
20342 from one version of GCC to another.
20343 @end enumerate
20345 @opindex fopt-info
20346 @item -fopt-info
20347 @itemx -fopt-info-@var{options}
20348 @itemx -fopt-info-@var{options}=@var{filename}
20349 Controls optimization dumps from various optimization passes. If the
20350 @samp{-@var{options}} form is used, @var{options} is a list of
20351 @samp{-} separated option keywords to select the dump details and
20352 optimizations.  
20354 The @var{options} can be divided into three groups:
20355 @enumerate
20356 @item
20357 options describing what kinds of messages should be emitted,
20358 @item
20359 options describing the verbosity of the dump, and
20360 @item
20361 options describing which optimizations should be included.
20362 @end enumerate
20363 The options from each group can be freely mixed as they are
20364 non-overlapping. However, in case of any conflicts,
20365 the later options override the earlier options on the command
20366 line. 
20368 The following options control which kinds of messages should be emitted:
20370 @table @samp
20371 @item optimized
20372 Print information when an optimization is successfully applied. It is
20373 up to a pass to decide which information is relevant. For example, the
20374 vectorizer passes print the source location of loops which are
20375 successfully vectorized.
20376 @item missed
20377 Print information about missed optimizations. Individual passes
20378 control which information to include in the output. 
20379 @item note
20380 Print verbose information about optimizations, such as certain
20381 transformations, more detailed messages about decisions etc.
20382 @item all
20383 Print detailed optimization information. This includes
20384 @samp{optimized}, @samp{missed}, and @samp{note}.
20385 @end table
20387 The following option controls the dump verbosity:
20389 @table @samp
20390 @item internals
20391 By default, only ``high-level'' messages are emitted. This option enables
20392 additional, more detailed, messages, which are likely to only be of interest
20393 to GCC developers.
20394 @end table
20396 One or more of the following option keywords can be used to describe a
20397 group of optimizations:
20399 @table @samp
20400 @item ipa
20401 Enable dumps from all interprocedural optimizations.
20402 @item loop
20403 Enable dumps from all loop optimizations.
20404 @item inline
20405 Enable dumps from all inlining optimizations.
20406 @item omp
20407 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
20408 @item vec
20409 Enable dumps from all vectorization optimizations.
20410 @item optall
20411 Enable dumps from all optimizations. This is a superset of
20412 the optimization groups listed above.
20413 @end table
20415 If @var{options} is
20416 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
20417 about successful optimizations from all the passes, omitting messages
20418 that are treated as ``internals''.
20420 If the @var{filename} is provided, then the dumps from all the
20421 applicable optimizations are concatenated into the @var{filename}.
20422 Otherwise the dump is output onto @file{stderr}. Though multiple
20423 @option{-fopt-info} options are accepted, only one of them can include
20424 a @var{filename}. If other filenames are provided then all but the
20425 first such option are ignored.
20427 Note that the output @var{filename} is overwritten
20428 in case of multiple translation units. If a combined output from
20429 multiple translation units is desired, @file{stderr} should be used
20430 instead.
20432 In the following example, the optimization info is output to
20433 @file{stderr}:
20435 @smallexample
20436 gcc -O3 -fopt-info
20437 @end smallexample
20439 This example:
20440 @smallexample
20441 gcc -O3 -fopt-info-missed=missed.all
20442 @end smallexample
20444 @noindent
20445 outputs missed optimization report from all the passes into
20446 @file{missed.all}, and this one:
20448 @smallexample
20449 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
20450 @end smallexample
20452 @noindent
20453 prints information about missed optimization opportunities from
20454 vectorization passes on @file{stderr}.  
20455 Note that @option{-fopt-info-vec-missed} is equivalent to 
20456 @option{-fopt-info-missed-vec}.  The order of the optimization group
20457 names and message types listed after @option{-fopt-info} does not matter.
20459 As another example,
20460 @smallexample
20461 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
20462 @end smallexample
20464 @noindent
20465 outputs information about missed optimizations as well as
20466 optimized locations from all the inlining passes into
20467 @file{inline.txt}.
20469 Finally, consider:
20471 @smallexample
20472 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
20473 @end smallexample
20475 @noindent
20476 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
20477 in conflict since only one output file is allowed. In this case, only
20478 the first option takes effect and the subsequent options are
20479 ignored. Thus only @file{vec.miss} is produced which contains
20480 dumps from the vectorizer about missed opportunities.
20482 @opindex fsave-optimization-record
20483 @item -fsave-optimization-record
20484 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
20485 were performed, for those optimizations that support @option{-fopt-info}.
20487 This option is experimental and the format of the data within the
20488 compressed JSON file is subject to change.
20490 It is roughly equivalent to a machine-readable version of
20491 @option{-fopt-info-all}, as a collection of messages with source file,
20492 line number and column number, with the following additional data for
20493 each message:
20495 @itemize @bullet
20497 @item
20498 the execution count of the code being optimized, along with metadata about
20499 whether this was from actual profile data, or just an estimate, allowing
20500 consumers to prioritize messages by code hotness,
20502 @item
20503 the function name of the code being optimized, where applicable,
20505 @item
20506 the ``inlining chain'' for the code being optimized, so that when
20507 a function is inlined into several different places (which might
20508 themselves be inlined), the reader can distinguish between the copies,
20510 @item
20511 objects identifying those parts of the message that refer to expressions,
20512 statements or symbol-table nodes, which of these categories they are, and,
20513 when available, their source code location,
20515 @item
20516 the GCC pass that emitted the message, and
20518 @item
20519 the location in GCC's own code from which the message was emitted
20521 @end itemize
20523 Additionally, some messages are logically nested within other
20524 messages, reflecting implementation details of the optimization
20525 passes.
20527 @opindex fsched-verbose
20528 @item -fsched-verbose=@var{n}
20529 On targets that use instruction scheduling, this option controls the
20530 amount of debugging output the scheduler prints to the dump files.
20532 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
20533 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
20534 For @var{n} greater than one, it also output basic block probabilities,
20535 detailed ready list information and unit/insn info.  For @var{n} greater
20536 than two, it includes RTL at abort point, control-flow and regions info.
20537 And for @var{n} over four, @option{-fsched-verbose} also includes
20538 dependence info.
20542 @opindex fdisable-
20543 @opindex fenable-
20544 @item -fenable-@var{kind}-@var{pass}
20545 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
20547 This is a set of options that are used to explicitly disable/enable
20548 optimization passes.  These options are intended for use for debugging GCC.
20549 Compiler users should use regular options for enabling/disabling
20550 passes instead.
20552 @table @gcctabopt
20554 @item -fdisable-ipa-@var{pass}
20555 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
20556 statically invoked in the compiler multiple times, the pass name should be
20557 appended with a sequential number starting from 1.
20559 @item -fdisable-rtl-@var{pass}
20560 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
20561 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20562 statically invoked in the compiler multiple times, the pass name should be
20563 appended with a sequential number starting from 1.  @var{range-list} is a 
20564 comma-separated list of function ranges or assembler names.  Each range is a number
20565 pair separated by a colon.  The range is inclusive in both ends.  If the range
20566 is trivial, the number pair can be simplified as a single number.  If the
20567 function's call graph node's @var{uid} falls within one of the specified ranges,
20568 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
20569 function header of a dump file, and the pass names can be dumped by using
20570 option @option{-fdump-passes}.
20572 @item -fdisable-tree-@var{pass}
20573 @itemx -fdisable-tree-@var{pass}=@var{range-list}
20574 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
20575 option arguments.
20577 @item -fenable-ipa-@var{pass}
20578 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20579 statically invoked in the compiler multiple times, the pass name should be
20580 appended with a sequential number starting from 1.
20582 @item -fenable-rtl-@var{pass}
20583 @itemx -fenable-rtl-@var{pass}=@var{range-list}
20584 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
20585 description and examples.
20587 @item -fenable-tree-@var{pass}
20588 @itemx -fenable-tree-@var{pass}=@var{range-list}
20589 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
20590 of option arguments.
20592 @end table
20594 Here are some examples showing uses of these options.
20596 @smallexample
20598 # disable ccp1 for all functions
20599    -fdisable-tree-ccp1
20600 # disable complete unroll for function whose cgraph node uid is 1
20601    -fenable-tree-cunroll=1
20602 # disable gcse2 for functions at the following ranges [1,1],
20603 # [300,400], and [400,1000]
20604 # disable gcse2 for functions foo and foo2
20605    -fdisable-rtl-gcse2=foo,foo2
20606 # disable early inlining
20607    -fdisable-tree-einline
20608 # disable ipa inlining
20609    -fdisable-ipa-inline
20610 # enable tree full unroll
20611    -fenable-tree-unroll
20613 @end smallexample
20615 @opindex fchecking
20616 @opindex fno-checking
20617 @item -fchecking
20618 @itemx -fchecking=@var{n}
20619 Enable internal consistency checking.  The default depends on
20620 the compiler configuration.  @option{-fchecking=2} enables further
20621 internal consistency checking that might affect code generation.
20623 @opindex frandom-seed
20624 @item -frandom-seed=@var{string}
20625 This option provides a seed that GCC uses in place of
20626 random numbers in generating certain symbol names
20627 that have to be different in every compiled file.  It is also used to
20628 place unique stamps in coverage data files and the object files that
20629 produce them.  You can use the @option{-frandom-seed} option to produce
20630 reproducibly identical object files.
20632 The @var{string} can either be a number (decimal, octal or hex) or an
20633 arbitrary string (in which case it's converted to a number by
20634 computing CRC32).
20636 The @var{string} should be different for every file you compile.
20638 @opindex save-temps
20639 @item -save-temps
20640 Store the usual ``temporary'' intermediate files permanently; name them
20641 as auxiliary output files, as specified described under
20642 @option{-dumpbase} and @option{-dumpdir}.
20644 When used in combination with the @option{-x} command-line option,
20645 @option{-save-temps} is sensible enough to avoid overwriting an
20646 input source file with the same extension as an intermediate file.
20647 The corresponding intermediate file may be obtained by renaming the
20648 source file before using @option{-save-temps}.
20650 @opindex save-temps=cwd
20651 @item -save-temps=cwd
20652 Equivalent to @option{-save-temps -dumpdir ./}.
20654 @opindex save-temps=obj
20655 @item -save-temps=obj
20656 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
20657 @file{outdir/} is the directory of the output file specified after the
20658 @option{-o} option, including any directory separators.  If the
20659 @option{-o} option is not used, the @option{-save-temps=obj} switch
20660 behaves like @option{-save-temps=cwd}.
20662 @opindex time
20663 @item -time@r{[}=@var{file}@r{]}
20664 Report the CPU time taken by each subprocess in the compilation
20665 sequence.  For C source files, this is the compiler proper and assembler
20666 (plus the linker if linking is done).
20668 Without the specification of an output file, the output looks like this:
20670 @smallexample
20671 # cc1 0.12 0.01
20672 # as 0.00 0.01
20673 @end smallexample
20675 The first number on each line is the ``user time'', that is time spent
20676 executing the program itself.  The second number is ``system time'',
20677 time spent executing operating system routines on behalf of the program.
20678 Both numbers are in seconds.
20680 With the specification of an output file, the output is appended to the
20681 named file, and it looks like this:
20683 @smallexample
20684 0.12 0.01 cc1 @var{options}
20685 0.00 0.01 as @var{options}
20686 @end smallexample
20688 The ``user time'' and the ``system time'' are moved before the program
20689 name, and the options passed to the program are displayed, so that one
20690 can later tell what file was being compiled, and with which options.
20692 @opindex fdump-final-insns
20693 @item -fdump-final-insns@r{[}=@var{file}@r{]}
20694 Dump the final internal representation (RTL) to @var{file}.  If the
20695 optional argument is omitted (or if @var{file} is @code{.}), the name
20696 of the dump file is determined by appending @code{.gkd} to the
20697 dump base name, see @option{-dumpbase}.
20699 @opindex fcompare-debug
20700 @opindex fno-compare-debug
20701 @item -fcompare-debug@r{[}=@var{opts}@r{]}
20702 If no error occurs during compilation, run the compiler a second time,
20703 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
20704 passed to the second compilation.  Dump the final internal
20705 representation in both compilations, and print an error if they differ.
20707 If the equal sign is omitted, the default @option{-gtoggle} is used.
20709 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
20710 and nonzero, implicitly enables @option{-fcompare-debug}.  If
20711 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
20712 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
20713 is used.
20715 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
20716 is equivalent to @option{-fno-compare-debug}, which disables the dumping
20717 of the final representation and the second compilation, preventing even
20718 @env{GCC_COMPARE_DEBUG} from taking effect.
20720 To verify full coverage during @option{-fcompare-debug} testing, set
20721 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
20722 which GCC rejects as an invalid option in any actual compilation
20723 (rather than preprocessing, assembly or linking).  To get just a
20724 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
20725 not overridden} will do.
20727 @opindex fcompare-debug-second
20728 @item -fcompare-debug-second
20729 This option is implicitly passed to the compiler for the second
20730 compilation requested by @option{-fcompare-debug}, along with options to
20731 silence warnings, and omitting other options that would cause the compiler
20732 to produce output to files or to standard output as a side effect.  Dump
20733 files and preserved temporary files are renamed so as to contain the
20734 @code{.gk} additional extension during the second compilation, to avoid
20735 overwriting those generated by the first.
20737 When this option is passed to the compiler driver, it causes the
20738 @emph{first} compilation to be skipped, which makes it useful for little
20739 other than debugging the compiler proper.
20741 @opindex gtoggle
20742 @item -gtoggle
20743 Turn off generation of debug info, if leaving out this option
20744 generates it, or turn it on at level 2 otherwise.  The position of this
20745 argument in the command line does not matter; it takes effect after all
20746 other options are processed, and it does so only once, no matter how
20747 many times it is given.  This is mainly intended to be used with
20748 @option{-fcompare-debug}.
20750 @opindex fvar-tracking-assignments-toggle
20751 @opindex fno-var-tracking-assignments-toggle
20752 @item -fvar-tracking-assignments-toggle
20753 Toggle @option{-fvar-tracking-assignments}, in the same way that
20754 @option{-gtoggle} toggles @option{-g}.
20756 @opindex Q
20757 @item -Q
20758 Makes the compiler print out each function name as it is compiled, and
20759 print some statistics about each pass when it finishes.
20761 @opindex ftime-report
20762 @item -ftime-report
20763 Makes the compiler print some statistics to stderr about the time consumed
20764 by each pass when it finishes.
20766 If SARIF output of diagnostics was requested via
20767 @option{-fdiagnostics-format=sarif-file} or
20768 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20769 information is instead emitted in JSON form as part of SARIF output.  The
20770 precise format of this JSON data is subject to change, and the values may
20771 not exactly match those emitted to stderr due to being written out at a
20772 slightly different place within the compiler.
20774 @opindex ftime-report-details
20775 @item -ftime-report-details
20776 Record the time consumed by infrastructure parts separately for each pass.
20778 @opindex fira-verbose
20779 @item -fira-verbose=@var{n}
20780 Control the verbosity of the dump file for the integrated register allocator.
20781 The default value is 5.  If the value @var{n} is greater or equal to 10,
20782 the dump output is sent to stderr using the same format as @var{n} minus 10.
20784 @opindex flto-report
20785 @item -flto-report
20786 Prints a report with internal details on the workings of the link-time
20787 optimizer.  The contents of this report vary from version to version.
20788 It is meant to be useful to GCC developers when processing object
20789 files in LTO mode (via @option{-flto}).
20791 Disabled by default.
20793 @opindex flto-report-wpa
20794 @item -flto-report-wpa
20795 Like @option{-flto-report}, but only print for the WPA phase of link-time
20796 optimization.
20798 @opindex fmem-report
20799 @item -fmem-report
20800 Makes the compiler print some statistics about permanent memory
20801 allocation when it finishes.
20803 @opindex fmem-report-wpa
20804 @item -fmem-report-wpa
20805 Makes the compiler print some statistics about permanent memory
20806 allocation for the WPA phase only.
20808 @opindex fpre-ipa-mem-report
20809 @opindex fpost-ipa-mem-report
20810 @item -fpre-ipa-mem-report
20811 @item -fpost-ipa-mem-report
20812 Makes the compiler print some statistics about permanent memory
20813 allocation before or after interprocedural optimization.
20815 @opindex fmultiflags
20816 @item -fmultiflags
20817 This option enables multilib-aware @code{TFLAGS} to be used to build
20818 target libraries with options different from those the compiler is
20819 configured to use by default, through the use of specs (@pxref{Spec
20820 Files}) set up by compiler internals, by the target, or by builders at
20821 configure time.
20823 Like @code{TFLAGS}, this allows the target libraries to be built for
20824 portable baseline environments, while the compiler defaults to more
20825 demanding ones.  That's useful because users can easily override the
20826 defaults the compiler is configured to use to build their own programs,
20827 if the defaults are not ideal for their target environment, whereas
20828 rebuilding the runtime libraries is usually not as easy or desirable.
20830 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20831 selected for different multilibs.  The way to accomplish that is to
20832 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20833 @samp{--with-specs=%@{fmultiflags:...@}}.
20835 This option is discarded by the driver once it's done processing driver
20836 self spec.
20838 It is also useful to check that @code{TFLAGS} are being used to build
20839 all target libraries, by configuring a non-bootstrap compiler
20840 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20841 the compiler and target libraries.
20843 @opindex fprofile-report
20844 @item -fprofile-report
20845 Makes the compiler print some statistics about consistency of the
20846 (estimated) profile and effect of individual passes.
20848 @opindex fstack-usage
20849 @item -fstack-usage
20850 Makes the compiler output stack usage information for the program, on a
20851 per-function basis.  The filename for the dump is made by appending
20852 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20853 the output file, if explicitly specified and it is not an executable,
20854 otherwise it is the basename of the source file.  An entry is made up
20855 of three fields:
20857 @itemize
20858 @item
20859 The name of the function.
20860 @item
20861 A number of bytes.
20862 @item
20863 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20864 @end itemize
20866 The qualifier @code{static} means that the function manipulates the stack
20867 statically: a fixed number of bytes are allocated for the frame on function
20868 entry and released on function exit; no stack adjustments are otherwise made
20869 in the function.  The second field is this fixed number of bytes.
20871 The qualifier @code{dynamic} means that the function manipulates the stack
20872 dynamically: in addition to the static allocation described above, stack
20873 adjustments are made in the body of the function, for example to push/pop
20874 arguments around function calls.  If the qualifier @code{bounded} is also
20875 present, the amount of these adjustments is bounded at compile time and
20876 the second field is an upper bound of the total amount of stack used by
20877 the function.  If it is not present, the amount of these adjustments is
20878 not bounded at compile time and the second field only represents the
20879 bounded part.
20881 @opindex fstats
20882 @item -fstats
20883 Emit statistics about front-end processing at the end of the compilation.
20884 This option is supported only by the C++ front end, and
20885 the information is generally only useful to the G++ development team.
20887 @opindex fdbg-cnt-list
20888 @item -fdbg-cnt-list
20889 Print the name and the counter upper bound for all debug counters.
20892 @opindex fdbg-cnt
20893 @item -fdbg-cnt=@var{counter-value-list}
20894 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20895 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20896 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20897 the name of the counter and list of closed intervals.
20898 The @var{lower_bound} is optional and is zero
20899 initialized if not set.
20900 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20901 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20902 eleventh invocation.
20903 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20905 @opindex print-file-name
20906 @item -print-file-name=@var{library}
20907 Print the full absolute name of the library file @var{library} that
20908 would be used when linking---and don't do anything else.  With this
20909 option, GCC does not compile or link anything; it just prints the
20910 file name.
20912 @opindex print-multi-directory
20913 @item -print-multi-directory
20914 Print the directory name corresponding to the multilib selected by any
20915 other switches present in the command line.  This directory is supposed
20916 to exist in @env{GCC_EXEC_PREFIX}.
20918 @opindex print-multi-lib
20919 @item -print-multi-lib
20920 Print the mapping from multilib directory names to compiler switches
20921 that enable them.  The directory name is separated from the switches by
20922 @samp{;}, and each switch starts with an @samp{@@} instead of the
20923 @samp{-}, without spaces between multiple switches.  This is supposed to
20924 ease shell processing.
20926 @opindex print-multi-os-directory
20927 @item -print-multi-os-directory
20928 Print the path to OS libraries for the selected
20929 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20930 present in the @file{lib} subdirectory and no multilibs are used, this is
20931 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20932 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20933 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20934 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20936 @opindex print-multiarch
20937 @item -print-multiarch
20938 Print the path to OS libraries for the selected multiarch,
20939 relative to some @file{lib} subdirectory.
20941 @opindex print-prog-name
20942 @item -print-prog-name=@var{program}
20943 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20945 @opindex print-libgcc-file-name
20946 @item -print-libgcc-file-name
20947 Same as @option{-print-file-name=libgcc.a}.
20949 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20950 but you do want to link with @file{libgcc.a}.  You can do:
20952 @smallexample
20953 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20954 @end smallexample
20956 @opindex print-search-dirs
20957 @item -print-search-dirs
20958 Print the name of the configured installation directory and a list of
20959 program and library directories @command{gcc} searches---and don't do anything else.
20961 This is useful when @command{gcc} prints the error message
20962 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20963 To resolve this you either need to put @file{cpp0} and the other compiler
20964 components where @command{gcc} expects to find them, or you can set the environment
20965 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20966 Don't forget the trailing @samp{/}.
20967 @xref{Environment Variables}.
20969 @opindex print-sysroot
20970 @item -print-sysroot
20971 Print the target sysroot directory that is used during
20972 compilation.  This is the target sysroot specified either at configure
20973 time or using the @option{--sysroot} option, possibly with an extra
20974 suffix that depends on compilation options.  If no target sysroot is
20975 specified, the option prints nothing.
20977 @opindex print-sysroot-headers-suffix
20978 @item -print-sysroot-headers-suffix
20979 Print the suffix added to the target sysroot when searching for
20980 headers, or give an error if the compiler is not configured with such
20981 a suffix---and don't do anything else.
20983 @opindex dumpmachine
20984 @item -dumpmachine
20985 Print the compiler's target machine (for example,
20986 @samp{i686-pc-linux-gnu})---and don't do anything else.
20988 @opindex dumpversion
20989 @item -dumpversion
20990 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20991 anything else.  This is the compiler version used in filesystem paths and
20992 specs. Depending on how the compiler has been configured it can be just
20993 a single number (major version), two numbers separated by a dot (major and
20994 minor version) or three numbers separated by dots (major, minor and patchlevel
20995 version).
20997 @opindex dumpfullversion
20998 @item -dumpfullversion
20999 Print the full compiler version---and don't do anything else. The output is
21000 always three numbers separated by dots, major, minor and patchlevel version.
21002 @opindex dumpspecs
21003 @item -dumpspecs
21004 Print the compiler's built-in specs---and don't do anything else.  (This
21005 is used when GCC itself is being built.)  @xref{Spec Files}.
21006 @end table
21008 @node Submodel Options
21009 @section Machine-Dependent Options
21010 @cindex submodel options
21011 @cindex specifying hardware config
21012 @cindex hardware models and configurations, specifying
21013 @cindex target-dependent options
21014 @cindex machine-dependent options
21016 Each target machine supported by GCC can have its own options---for
21017 example, to allow you to compile for a particular processor variant or
21018 ABI, or to control optimizations specific to that machine.  By
21019 convention, the names of machine-specific options start with
21020 @samp{-m}.
21022 Some configurations of the compiler also support additional target-specific
21023 options, usually for compatibility with other compilers on the same
21024 platform.
21026 @c This list is ordered alphanumerically by subsection name.
21027 @c It should be the same order and spelling as these options are listed
21028 @c in Machine Dependent Options
21030 @menu
21031 * AArch64 Options::
21032 * Adapteva Epiphany Options::
21033 * AMD GCN Options::
21034 * ARC Options::
21035 * ARM Options::
21036 * AVR Options::
21037 * Blackfin Options::
21038 * C6X Options::
21039 * CRIS Options::
21040 * C-SKY Options::
21041 * Darwin Options::
21042 * DEC Alpha Options::
21043 * eBPF Options::
21044 * FR30 Options::
21045 * FT32 Options::
21046 * FRV Options::
21047 * GNU/Linux Options::
21048 * H8/300 Options::
21049 * HPPA Options::
21050 * IA-64 Options::
21051 * LM32 Options::
21052 * LoongArch Options::
21053 * M32C Options::
21054 * M32R/D Options::
21055 * M680x0 Options::
21056 * MCore Options::
21057 * MicroBlaze Options::
21058 * MIPS Options::
21059 * MMIX Options::
21060 * MN10300 Options::
21061 * Moxie Options::
21062 * MSP430 Options::
21063 * NDS32 Options::
21064 * Nios II Options::
21065 * Nvidia PTX Options::
21066 * OpenRISC Options::
21067 * PDP-11 Options::
21068 * PowerPC Options::
21069 * PRU Options::
21070 * RISC-V Options::
21071 * RL78 Options::
21072 * RS/6000 and PowerPC Options::
21073 * RX Options::
21074 * S/390 and zSeries Options::
21075 * SH Options::
21076 * Solaris 2 Options::
21077 * SPARC Options::
21078 * System V Options::
21079 * V850 Options::
21080 * VAX Options::
21081 * Visium Options::
21082 * VMS Options::
21083 * VxWorks Options::
21084 * x86 Options::
21085 * x86 Windows Options::
21086 * Xstormy16 Options::
21087 * Xtensa Options::
21088 * zSeries Options::
21089 @end menu
21091 @node AArch64 Options
21092 @subsection AArch64 Options
21093 @cindex AArch64 Options
21095 These options are defined for AArch64 implementations:
21097 @table @gcctabopt
21099 @opindex mabi
21100 @item -mabi=@var{name}
21101 Generate code for the specified data model.  Permissible values
21102 are @samp{ilp32} for SysV-like data model where int, long int and pointers
21103 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
21104 but long int and pointers are 64 bits.
21106 The default depends on the specific target configuration.  Note that
21107 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
21108 entire program with the same ABI, and link with a compatible set of libraries.
21110 @opindex mbig-endian
21111 @item -mbig-endian
21112 Generate big-endian code.  This is the default when GCC is configured for an
21113 @samp{aarch64_be-*-*} target.
21115 @opindex mgeneral-regs-only
21116 @item -mgeneral-regs-only
21117 Generate code which uses only the general-purpose registers.  This will prevent
21118 the compiler from using floating-point and Advanced SIMD registers but will not
21119 impose any restrictions on the assembler.
21121 @opindex mlittle-endian
21122 @item -mlittle-endian
21123 Generate little-endian code.  This is the default when GCC is configured for an
21124 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
21126 @opindex mcmodel=tiny
21127 @item -mcmodel=tiny
21128 Generate code for the tiny code model.  The program and its statically defined
21129 symbols must be within 1MB of each other.  Programs can be statically or
21130 dynamically linked.
21132 @opindex mcmodel=small
21133 @item -mcmodel=small
21134 Generate code for the small code model.  The program and its statically defined
21135 symbols must be within 4GB of each other.  Programs can be statically or
21136 dynamically linked.  This is the default code model.
21138 @opindex mcmodel=large
21139 @item -mcmodel=large
21140 Generate code for the large code model.  This makes no assumptions about
21141 addresses and sizes of sections.  Programs can be statically linked only.  The
21142 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
21143 @option{-fpic} and @option{-fPIC}.
21145 @item -mtp=@var{name}
21146 @opindex mtp
21147 Specify the system register to use as a thread pointer.  The valid values
21148 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
21149 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
21150 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
21151 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
21152 code intended to interoperate with the same value of this option to avoid
21153 accessing a different thread pointer from the wrong exception level.
21155 @opindex mstrict-align
21156 @opindex mno-strict-align
21157 @item -mstrict-align
21158 @itemx -mno-strict-align
21159 Avoid or allow generating memory accesses that may not be aligned on a natural
21160 object boundary as described in the architecture specification.
21162 @opindex momit-leaf-frame-pointer
21163 @opindex mno-omit-leaf-frame-pointer
21164 @item -momit-leaf-frame-pointer
21165 @itemx -mno-omit-leaf-frame-pointer
21166 Omit or keep the frame pointer in leaf functions.  The former behavior is the
21167 default.
21169 @opindex mstack-protector-guard
21170 @opindex mstack-protector-guard-reg
21171 @opindex mstack-protector-guard-offset
21172 @item -mstack-protector-guard=@var{guard}
21173 @itemx -mstack-protector-guard-reg=@var{reg}
21174 @itemx -mstack-protector-guard-offset=@var{offset}
21175 Generate stack protection code using canary at @var{guard}.  Supported
21176 locations are @samp{global} for a global canary or @samp{sysreg} for a
21177 canary in an appropriate system register.
21179 With the latter choice the options
21180 @option{-mstack-protector-guard-reg=@var{reg}} and
21181 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
21182 which system register to use as base register for reading the canary,
21183 and from what offset from that base register. There is no default
21184 register or offset as this is entirely for use within the Linux
21185 kernel.
21187 @opindex mtls-dialect=desc
21188 @item -mtls-dialect=desc
21189 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
21190 of TLS variables.  This is the default.
21192 @opindex mtls-dialect=traditional
21193 @item -mtls-dialect=traditional
21194 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
21195 of TLS variables.
21197 @opindex mtls-size
21198 @item -mtls-size=@var{size}
21199 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
21200 This option requires binutils 2.26 or newer.
21202 @opindex mfix-cortex-a53-835769
21203 @opindex mno-fix-cortex-a53-835769
21204 @item -mfix-cortex-a53-835769
21205 @itemx -mno-fix-cortex-a53-835769
21206 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
21207 This involves inserting a NOP instruction between memory instructions and
21208 64-bit integer multiply-accumulate instructions.
21210 @opindex mfix-cortex-a53-843419
21211 @opindex mno-fix-cortex-a53-843419
21212 @item -mfix-cortex-a53-843419
21213 @itemx -mno-fix-cortex-a53-843419
21214 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
21215 This erratum workaround is made at link time and this will only pass the
21216 corresponding flag to the linker.
21218 @opindex mlow-precision-recip-sqrt
21219 @opindex mno-low-precision-recip-sqrt
21220 @item -mlow-precision-recip-sqrt
21221 @itemx -mno-low-precision-recip-sqrt
21222 Enable or disable the reciprocal square root approximation.
21223 This option only has an effect if @option{-ffast-math} or
21224 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21225 precision of reciprocal square root results to about 16 bits for
21226 single precision and to 32 bits for double precision.
21228 @opindex mlow-precision-sqrt
21229 @opindex mno-low-precision-sqrt
21230 @item -mlow-precision-sqrt
21231 @itemx -mno-low-precision-sqrt
21232 Enable or disable the square root approximation.
21233 This option only has an effect if @option{-ffast-math} or
21234 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21235 precision of square root results to about 16 bits for
21236 single precision and to 32 bits for double precision.
21237 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
21239 @opindex mlow-precision-div
21240 @opindex mno-low-precision-div
21241 @item -mlow-precision-div
21242 @itemx -mno-low-precision-div
21243 Enable or disable the division approximation.
21244 This option only has an effect if @option{-ffast-math} or
21245 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21246 precision of division results to about 16 bits for
21247 single precision and to 32 bits for double precision.
21249 @item -mtrack-speculation
21250 @itemx -mno-track-speculation
21251 Enable or disable generation of additional code to track speculative
21252 execution through conditional branches.  The tracking state can then
21253 be used by the compiler when expanding calls to
21254 @code{__builtin_speculation_safe_copy} to permit a more efficient code
21255 sequence to be generated.
21257 @item -moutline-atomics
21258 @itemx -mno-outline-atomics
21259 Enable or disable calls to out-of-line helpers to implement atomic operations.
21260 These helpers will, at runtime, determine if the LSE instructions from
21261 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
21262 instructions that are present in the base ARMv8.0 ISA.
21264 This option is only applicable when compiling for the base ARMv8.0
21265 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
21266 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
21267 used directly.  The same applies when using @option{-mcpu=} when the
21268 selected cpu supports the @samp{lse} feature.
21269 This option is on by default.
21271 @opindex march
21272 @item -march=@var{name}
21273 Specify the name of the target architecture and, optionally, one or
21274 more feature modifiers.  This option has the form
21275 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
21277 The table below summarizes the permissible values for @var{arch}
21278 and the features that they enable by default:
21280 @multitable @columnfractions 0.20 0.20 0.60
21281 @headitem @var{arch} value @tab Architecture @tab Includes by default
21282 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
21283 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
21284 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
21285 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
21286 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
21287 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
21288 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
21289 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
21290 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
21291 @item @samp{armv8.9-a} @tab Armv8.9-a @tab @samp{armv8.8-a}
21292 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
21293 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
21294 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
21295 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
21296 @item @samp{armv9.4-a} @tab Armv9.4-A @tab @samp{armv9.3-a}
21297 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
21298 @end multitable
21300 The value @samp{native} is available on native AArch64 GNU/Linux and
21301 causes the compiler to pick the architecture of the host system.  This
21302 option has no effect if the compiler is unable to recognize the
21303 architecture of the host system,
21305 The permissible values for @var{feature} are listed in the sub-section
21306 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
21307 Feature Modifiers}.  Where conflicting feature modifiers are
21308 specified, the right-most feature is used.
21310 GCC uses @var{name} to determine what kind of instructions it can emit
21311 when generating assembly code.  If @option{-march} is specified
21312 without either of @option{-mtune} or @option{-mcpu} also being
21313 specified, the code is tuned to perform well across a range of target
21314 processors implementing the target architecture.
21316 @opindex mtune
21317 @item -mtune=@var{name}
21318 Specify the name of the target processor for which GCC should tune the
21319 performance of the code.  Permissible values for this option are:
21320 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
21321 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
21322 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
21323 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
21324 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
21325 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
21326 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
21327 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
21328 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
21329 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
21330 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
21331 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
21332 @samp{octeontx2f95mm},
21333 @samp{a64fx},
21334 @samp{thunderx}, @samp{thunderxt88},
21335 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
21336 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
21337 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21338 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
21339 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
21340 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
21341 @samp{cortex-x3}, @samp{cortex-x4}, @samp{cortex-a510}, @samp{cortex-a520},
21342 @samp{cortex-a710}, @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1},
21343 @samp{ampere1a}, @samp{ampere1b}, @samp{cobalt-100} and @samp{native}.
21345 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21346 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
21347 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
21348 should tune for a big.LITTLE system.
21350 The value @samp{neoverse-512tvb} specifies that GCC should tune
21351 for Neoverse cores that (a) implement SVE and (b) have a total vector
21352 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
21353 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
21354 instructions a cycle and that can execute an equivalent number of SVE
21355 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
21356 This is more general than tuning for a specific core like Neoverse V1
21357 but is more specific than the default tuning described below.
21359 Additionally on native AArch64 GNU/Linux systems the value
21360 @samp{native} tunes performance to the host system.  This option has no effect
21361 if the compiler is unable to recognize the processor of the host system.
21363 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
21364 are specified, the code is tuned to perform well across a range
21365 of target processors.
21367 This option cannot be suffixed by feature modifiers.
21369 @opindex mcpu
21370 @item -mcpu=@var{name}
21371 Specify the name of the target processor, optionally suffixed by one
21372 or more feature modifiers.  This option has the form
21373 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
21374 the permissible values for @var{cpu} are the same as those available
21375 for @option{-mtune}.  The permissible values for @var{feature} are
21376 documented in the sub-section on
21377 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
21378 Feature Modifiers}.  Where conflicting feature modifiers are
21379 specified, the right-most feature is used.
21381 GCC uses @var{name} to determine what kind of instructions it can emit when
21382 generating assembly code (as if by @option{-march}) and to determine
21383 the target processor for which to tune for performance (as if
21384 by @option{-mtune}).  Where this option is used in conjunction
21385 with @option{-march} or @option{-mtune}, those options take precedence
21386 over the appropriate part of this option.
21388 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
21389 to a specific core, but instead refers to all Neoverse cores that
21390 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
21391 a cycle.  Unless overridden by @option{-march},
21392 @option{-mcpu=neoverse-512tvb} generates code that can run on a
21393 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
21394 these properties.  Unless overridden by @option{-mtune},
21395 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
21396 @option{-mtune=neoverse-512tvb}.
21398 @opindex moverride
21399 @item -moverride=@var{string}
21400 Override tuning decisions made by the back-end in response to a
21401 @option{-mtune=} switch.  The syntax, semantics, and accepted values
21402 for @var{string} in this option are not guaranteed to be consistent
21403 across releases.
21405 This option is only intended to be useful when developing GCC.
21407 @opindex mverbose-cost-dump
21408 @item -mverbose-cost-dump
21409 Enable verbose cost model dumping in the debug dump files.  This option is
21410 provided for use in debugging the compiler.
21412 @opindex mpc-relative-literal-loads
21413 @opindex mno-pc-relative-literal-loads
21414 @item -mpc-relative-literal-loads
21415 @itemx -mno-pc-relative-literal-loads
21416 Enable or disable PC-relative literal loads.  With this option literal pools are
21417 accessed using a single instruction and emitted after each function.  This
21418 limits the maximum size of functions to 1MB.  This is enabled by default for
21419 @option{-mcmodel=tiny}.
21421 @opindex msign-return-address
21422 @item -msign-return-address=@var{scope}
21423 Select the function scope on which return address signing will be applied.
21424 Permissible values are @samp{none}, which disables return address signing,
21425 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
21426 functions, and @samp{all}, which enables pointer signing for all functions.  The
21427 default value is @samp{none}. This option has been deprecated by
21428 -mbranch-protection.
21430 @opindex mbranch-protection
21431 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
21432 Select the branch protection features to use.
21433 @samp{none} is the default and turns off all types of branch protection.
21434 @samp{standard} turns on all types of branch protection features.  If a feature
21435 has additional tuning options, then @samp{standard} sets it to its standard
21436 level.
21437 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
21438 level: signing functions that save the return address to memory (non-leaf
21439 functions will practically always do this) using the a-key.  The optional
21440 argument @samp{leaf} can be used to extend the signing to include leaf
21441 functions.  The optional argument @samp{b-key} can be used to sign the functions
21442 with the B-key instead of the A-key.
21443 @samp{bti} turns on branch target identification mechanism.
21445 @opindex mharden-sls
21446 @item -mharden-sls=@var{opts}
21447 Enable compiler hardening against straight line speculation (SLS).
21448 @var{opts} is a comma-separated list of the following options:
21449 @table @samp
21450 @item retbr
21451 @item blr
21452 @end table
21453 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
21454 @samp{-mharden-sls=none} disables all SLS hardening.
21456 @opindex mearly-ra
21457 @item -mearly-ra=@var{scope}
21458 Determine when to enable an early register allocation pass.  This pass runs
21459 before instruction scheduling and tries to find a spill-free allocation of
21460 floating-point and vector code.  It also tries to make use of strided
21461 multi-register instructions, such as SME2's strided LD1 and ST1.
21463 The possible values of @var{scope} are: @var{all}, which runs the pass on
21464 all functions; @var{strided}, which runs the pass on functions that have
21465 access to strided multi-register instructions; and @var{none}, which
21466 disables the pass.
21468 @option{-mearly-ra=all} is the default for @option{-O2} and above, and for
21469 @option{-Os}.  @option{-mearly-ra=none} is the default otherwise.
21471 @opindex mearly-ldp-fusion
21472 @item -mearly-ldp-fusion
21473 Enable the copy of the AArch64 load/store pair fusion pass that runs before
21474 register allocation.  Enabled by default at @samp{-O} and above.
21476 @opindex mlate-ldp-fusion
21477 @item -mlate-ldp-fusion
21478 Enable the copy of the AArch64 load/store pair fusion pass that runs after
21479 register allocation.  Enabled by default at @samp{-O} and above.
21481 @opindex msve-vector-bits
21482 @item -msve-vector-bits=@var{bits}
21483 Specify the number of bits in an SVE vector register.  This option only has
21484 an effect when SVE is enabled.
21486 GCC supports two forms of SVE code generation: ``vector-length
21487 agnostic'' output that works with any size of vector register and
21488 ``vector-length specific'' output that allows GCC to make assumptions
21489 about the vector length when it is useful for optimization reasons.
21490 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
21491 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
21492 Specifying @samp{scalable} selects vector-length agnostic
21493 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
21494 agnostic output for big-endian targets.  All other values generate
21495 vector-length specific code.  The behavior of these values may change
21496 in future releases and no value except @samp{scalable} should be
21497 relied on for producing code that is portable across different
21498 hardware SVE vector lengths.
21500 The default is @samp{-msve-vector-bits=scalable}, which produces
21501 vector-length agnostic code.
21502 @end table
21504 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
21505 @anchor{aarch64-feature-modifiers}
21506 @cindex @option{-march} feature modifiers
21507 @cindex @option{-mcpu} feature modifiers
21508 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
21509 the following and their inverses @option{no@var{feature}}:
21511 @table @samp
21512 @item crc
21513 Enable CRC extension.  This is on by default for
21514 @option{-march=armv8.1-a}.
21515 @item crypto
21516 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
21517 instructions.
21518 @item fp
21519 Enable floating-point instructions.  This is on by default for all possible
21520 values for options @option{-march} and @option{-mcpu}.
21521 @item simd
21522 Enable Advanced SIMD instructions.  This also enables floating-point
21523 instructions.  This is on by default for all possible values for options
21524 @option{-march} and @option{-mcpu}.
21525 @item sve
21526 Enable Scalable Vector Extension instructions.  This also enables Advanced
21527 SIMD and floating-point instructions.
21528 @item lse
21529 Enable Large System Extension instructions.  This is on by default for
21530 @option{-march=armv8.1-a}.
21531 @item rdma
21532 Enable Round Double Multiply Accumulate instructions.  This is on by default
21533 for @option{-march=armv8.1-a}.
21534 @item fp16
21535 Enable FP16 extension.  This also enables floating-point instructions.
21536 @item fp16fml
21537 Enable FP16 fmla extension.  This also enables FP16 extensions and
21538 floating-point instructions. This option is enabled by default for @option{-march=armv8.4-a}. Use of this option with architectures prior to Armv8.2-A is not supported.
21540 @item rcpc
21541 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
21542 load-acquire atomic semantics, and passes it on to the assembler, enabling
21543 inline asm statements to use instructions from the RCpc extension.
21544 @item dotprod
21545 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
21546 @item aes
21547 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
21548 SIMD instructions.
21549 @item sha2
21550 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
21551 @item sha3
21552 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
21553 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
21554 @item sm4
21555 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
21556 Use of this option with architectures prior to Armv8.2-A is not supported.
21557 @item profile
21558 Enable the Statistical Profiling extension.  This option is only to enable the
21559 extension at the assembler level and does not affect code generation.
21560 @item rng
21561 Enable the Armv8.5-a Random Number instructions.  This option is only to
21562 enable the extension at the assembler level and does not affect code
21563 generation.
21564 @item memtag
21565 Enable the Armv8.5-a Memory Tagging Extensions.
21566 Use of this option with architectures prior to Armv8.5-A is not supported.
21567 @item sb
21568 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
21569 enable the extension at the assembler level and does not affect code
21570 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21571 @item ssbs
21572 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
21573 is only to enable the extension at the assembler level and does not affect code
21574 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21575 @item predres
21576 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
21577 This option is only to enable the extension at the assembler level and does
21578 not affect code generation.  This option is enabled by default for
21579 @option{-march=armv8.5-a}.
21580 @item sve2
21581 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
21582 instructions.
21583 @item sve2-bitperm
21584 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
21585 @item sve2-sm4
21586 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
21587 @item sve2-aes
21588 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
21589 @item sve2-sha3
21590 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
21591 @item tme
21592 Enable the Transactional Memory Extension.
21593 @item i8mm
21594 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
21595 Advanced SIMD and floating-point instructions.  This option is enabled by
21596 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21597 prior to Armv8.2-A is not supported.
21598 @item f32mm
21599 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
21600 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21601 not supported.
21602 @item f64mm
21603 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
21604 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21605 not supported.
21606 @item bf16
21607 Enable brain half-precision floating-point instructions.  This also enables
21608 Advanced SIMD and floating-point instructions.  This option is enabled by
21609 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21610 prior to Armv8.2-A is not supported.
21611 @item ls64
21612 Enable the 64-byte atomic load and store instructions for accelerators.
21613 This option is enabled by default for @option{-march=armv8.7-a}.
21614 @item mops
21615 Enable the instructions to accelerate memory operations like @code{memcpy},
21616 @code{memmove}, @code{memset}.  This option is enabled by default for
21617 @option{-march=armv8.8-a}
21618 @item flagm
21619 Enable the Flag Manipulation instructions Extension.
21620 @item pauth
21621 Enable the Pointer Authentication Extension.
21622 @item cssc
21623 Enable the Common Short Sequence Compression instructions.
21624 @item sme
21625 Enable the Scalable Matrix Extension.
21626 @item sme-i16i64
21627 Enable the FEAT_SME_I16I64 extension to SME.
21628 @item sme-f64f64
21629 Enable the FEAT_SME_F64F64 extension to SME.
21630 +@item sme2
21631 Enable the Scalable Matrix Extension 2.  This also enables SME instructions.
21632 @item lse128
21633 Enable the LSE128 128-bit atomic instructions extension.  This also
21634 enables LSE instructions.
21635 @item d128
21636 Enable support for 128-bit system register read/write instructions.
21637 This also enables the LSE128 extension.
21638 @item gcs
21639 Enable support for Armv9.4-a Guarded Control Stack extension.
21640 @item the
21641 Enable support for Armv8.9-a/9.4-a translation hardening extension.
21642 @item rcpc3
21643 Enable the RCpc3 (Release Consistency) extension.
21645 @end table
21647 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
21648 which implies @option{fp}.
21649 Conversely, @option{nofp} implies @option{nosimd}, which implies
21650 @option{nocrypto}, @option{noaes} and @option{nosha2}.
21652 @node Adapteva Epiphany Options
21653 @subsection Adapteva Epiphany Options
21655 These @samp{-m} options are defined for Adapteva Epiphany:
21657 @table @gcctabopt
21658 @opindex mhalf-reg-file
21659 @item -mhalf-reg-file
21660 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
21661 That allows code to run on hardware variants that lack these registers.
21663 @opindex mprefer-short-insn-regs
21664 @item -mprefer-short-insn-regs
21665 Preferentially allocate registers that allow short instruction generation.
21666 This can result in increased instruction count, so this may either reduce or
21667 increase overall code size.
21669 @opindex mbranch-cost
21670 @item -mbranch-cost=@var{num}
21671 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21672 This cost is only a heuristic and is not guaranteed to produce
21673 consistent results across releases.
21675 @opindex mcmove
21676 @item -mcmove
21677 Enable the generation of conditional moves.
21679 @opindex mnops
21680 @item -mnops=@var{num}
21681 Emit @var{num} NOPs before every other generated instruction.
21683 @opindex mno-soft-cmpsf
21684 @opindex msoft-cmpsf
21685 @item -mno-soft-cmpsf
21686 For single-precision floating-point comparisons, emit an @code{fsub} instruction
21687 and test the flags.  This is faster than a software comparison, but can
21688 get incorrect results in the presence of NaNs, or when two different small
21689 numbers are compared such that their difference is calculated as zero.
21690 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
21691 software comparisons.
21693 @opindex mstack-offset
21694 @item -mstack-offset=@var{num}
21695 Set the offset between the top of the stack and the stack pointer.
21696 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
21697 can be used by leaf functions without stack allocation.
21698 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
21699 Note also that this option changes the ABI; compiling a program with a
21700 different stack offset than the libraries have been compiled with
21701 generally does not work.
21702 This option can be useful if you want to evaluate if a different stack
21703 offset would give you better code, but to actually use a different stack
21704 offset to build working programs, it is recommended to configure the
21705 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
21707 @opindex mno-round-nearest
21708 @opindex mround-nearest
21709 @item -mno-round-nearest
21710 Make the scheduler assume that the rounding mode has been set to
21711 truncating.  The default is @option{-mround-nearest}.
21713 @opindex mlong-calls
21714 @item -mlong-calls
21715 If not otherwise specified by an attribute, assume all calls might be beyond
21716 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
21717 function address into a register before performing a (otherwise direct) call.
21718 This is the default.
21720 @opindex short-calls
21721 @item -mshort-calls
21722 If not otherwise specified by an attribute, assume all direct calls are
21723 in the range of the @code{b} / @code{bl} instructions, so use these instructions
21724 for direct calls.  The default is @option{-mlong-calls}.
21726 @opindex msmall16
21727 @item -msmall16
21728 Assume addresses can be loaded as 16-bit unsigned values.  This does not
21729 apply to function addresses for which @option{-mlong-calls} semantics
21730 are in effect.
21732 @opindex mfp-mode
21733 @item -mfp-mode=@var{mode}
21734 Set the prevailing mode of the floating-point unit.
21735 This determines the floating-point mode that is provided and expected
21736 at function call and return time.  Making this mode match the mode you
21737 predominantly need at function start can make your programs smaller and
21738 faster by avoiding unnecessary mode switches.
21740 @var{mode} can be set to one the following values:
21742 @table @samp
21743 @item caller
21744 Any mode at function entry is valid, and retained or restored when
21745 the function returns, and when it calls other functions.
21746 This mode is useful for compiling libraries or other compilation units
21747 you might want to incorporate into different programs with different
21748 prevailing FPU modes, and the convenience of being able to use a single
21749 object file outweighs the size and speed overhead for any extra
21750 mode switching that might be needed, compared with what would be needed
21751 with a more specific choice of prevailing FPU mode.
21753 @item truncate
21754 This is the mode used for floating-point calculations with
21755 truncating (i.e.@: round towards zero) rounding mode.  That includes
21756 conversion from floating point to integer.
21758 @item round-nearest
21759 This is the mode used for floating-point calculations with
21760 round-to-nearest-or-even rounding mode.
21762 @item int
21763 This is the mode used to perform integer calculations in the FPU, e.g.@:
21764 integer multiply, or integer multiply-and-accumulate.
21765 @end table
21767 The default is @option{-mfp-mode=caller}
21769 @opindex mno-split-lohi
21770 @opindex msplit-lohi
21771 @opindex mno-postinc
21772 @opindex mpostinc
21773 @opindex mno-postmodify
21774 @opindex mpostmodify
21775 @item -mno-split-lohi
21776 @itemx -mno-postinc
21777 @itemx -mno-postmodify
21778 Code generation tweaks that disable, respectively, splitting of 32-bit
21779 loads, generation of post-increment addresses, and generation of
21780 post-modify addresses.  The defaults are @option{msplit-lohi},
21781 @option{-mpost-inc}, and @option{-mpost-modify}.
21783 @opindex mno-vect-double
21784 @opindex mvect-double
21785 @item -mnovect-double
21786 Change the preferred SIMD mode to SImode.  The default is
21787 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21789 @opindex max-vect-align
21790 @item -max-vect-align=@var{num}
21791 The maximum alignment for SIMD vector mode types.
21792 @var{num} may be 4 or 8.  The default is 8.
21793 Note that this is an ABI change, even though many library function
21794 interfaces are unaffected if they don't use SIMD vector modes
21795 in places that affect size and/or alignment of relevant types.
21797 @opindex msplit-vecmove-early
21798 @item -msplit-vecmove-early
21799 Split vector moves into single word moves before reload.  In theory this
21800 can give better register allocation, but so far the reverse seems to be
21801 generally the case.
21803 @opindex m1reg-
21804 @item -m1reg-@var{reg}
21805 Specify a register to hold the constant @minus{}1, which makes loading small negative
21806 constants and certain bitmasks faster.
21807 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21808 which specify use of that register as a fixed register,
21809 and @samp{none}, which means that no register is used for this
21810 purpose.  The default is @option{-m1reg-none}.
21812 @end table
21814 @node AMD GCN Options
21815 @subsection AMD GCN Options
21816 @cindex AMD GCN Options
21818 These options are defined specifically for the AMD GCN port.
21820 @table @gcctabopt
21822 @opindex march
21823 @opindex mtune
21824 @item -march=@var{gpu}
21825 @itemx -mtune=@var{gpu}
21826 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21829 @table @samp
21830 @item fiji
21831 Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
21832 depends on how GCC has been configured, see @option{--with-arch} and
21833 @option{--with-multilib-list}.
21835 @item gfx900
21836 Compile for GCN5 Vega 10 devices (gfx900).
21838 @item gfx906
21839 Compile for GCN5 Vega 20 devices (gfx906).
21841 @item gfx908
21842 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21844 @item gfx90a
21845 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21847 @item gfx90c
21848 Compile for GCN5 Vega 7 devices (gfx90c).
21850 @item gfx1030
21851 Compile for RDNA2 gfx1030 devices (GFX10 series).
21853 @item gfx1036
21854 Compile for RDNA2 gfx1036 devices (GFX10 series).
21856 @item gfx1100
21857 Compile for RDNA3 gfx1100 devices (GFX11 series).
21859 @item gfx1103
21860 Compile for RDNA3 gfx1103 devices (GFX11 series).
21862 @end table
21864 @opindex msram-ecc
21865 @item -msram-ecc=on
21866 @itemx -msram-ecc=off
21867 @itemx -msram-ecc=any
21868 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21869 disabled, or either mode.  This feature can be enabled per-process on some
21870 devices.  The compiled code must match the device mode. The default is
21871 @samp{any}, for devices that support it.
21873 @opindex mstack-size
21874 @item -mstack-size=@var{bytes}
21875 Specify how many @var{bytes} of stack space will be requested for each GPU
21876 thread (wave-front).  Beware that there may be many threads and limited memory
21877 available.  The size of the stack allocation may also have an impact on
21878 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21879 1MB otherwise.
21881 @opindex mxnack
21882 @item -mxnack=on
21883 @itemx -mxnack=off
21884 @itemx -mxnack=any
21885 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21886 or either mode.  Some devices always require XNACK and some allow the user to
21887 configure XNACK.  The compiled code must match the device mode.
21888 The default is @samp{-mxnack=any} on devices that support Unified Shared
21889 Memory, and @samp{-mxnack=no} otherwise.
21891 @end table
21893 @node ARC Options
21894 @subsection ARC Options
21895 @cindex ARC options
21897 The following options control the architecture variant for which code
21898 is being compiled:
21900 @c architecture variants
21901 @table @gcctabopt
21903 @opindex mbarrel-shifter
21904 @item -mbarrel-shifter
21905 Generate instructions supported by barrel shifter.  This is the default
21906 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21908 @opindex mjli-always
21909 @item -mjli-always
21910 Force to call a function using jli_s instruction.  This option is
21911 valid only for ARCv2 architecture.
21913 @opindex mcpu
21914 @item -mcpu=@var{cpu}
21915 Set architecture type, register usage, and instruction scheduling
21916 parameters for @var{cpu}.  There are also shortcut alias options
21917 available for backward compatibility and convenience.  Supported
21918 values for @var{cpu} are
21920 @table @samp
21921 @opindex mA6
21922 @opindex mARC600
21923 @item arc600
21924 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21926 @opindex mARC601
21927 @item arc601
21928 Compile for ARC601.  Alias: @option{-mARC601}.
21930 @opindex mA7
21931 @opindex mARC700
21932 @item arc700
21933 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21934 This is the default when configured with @option{--with-cpu=arc700}@.
21936 @item arcem
21937 Compile for ARC EM.
21939 @item archs
21940 Compile for ARC HS.
21942 @item em
21943 Compile for ARC EM CPU with no hardware extensions.
21945 @item em4
21946 Compile for ARC EM4 CPU.
21948 @item em4_dmips
21949 Compile for ARC EM4 DMIPS CPU.
21951 @item em4_fpus
21952 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21953 extension.
21955 @item em4_fpuda
21956 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21957 double assist instructions.
21959 @item hs
21960 Compile for ARC HS CPU with no hardware extensions except the atomic
21961 instructions.
21963 @item hs34
21964 Compile for ARC HS34 CPU.
21966 @item hs38
21967 Compile for ARC HS38 CPU.
21969 @item hs38_linux
21970 Compile for ARC HS38 CPU with all hardware extensions on.
21972 @item hs4x
21973 Compile for ARC HS4x CPU.
21975 @item hs4xd
21976 Compile for ARC HS4xD CPU.
21978 @item hs4x_rel31
21979 Compile for ARC HS4x CPU release 3.10a.
21981 @item arc600_norm
21982 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21984 @item arc600_mul32x16
21985 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21986 instructions enabled.
21988 @item arc600_mul64
21989 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21990 instructions enabled.
21992 @item arc601_norm
21993 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21995 @item arc601_mul32x16
21996 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21997 instructions enabled.
21999 @item arc601_mul64
22000 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
22001 instructions enabled.
22003 @item nps400
22004 Compile for ARC 700 on NPS400 chip.
22006 @item em_mini
22007 Compile for ARC EM minimalist configuration featuring reduced register
22008 set.
22010 @end table
22012 @opindex mdpfp
22013 @opindex mdpfp-compact
22014 @item -mdpfp
22015 @itemx -mdpfp-compact
22016 Generate double-precision FPX instructions, tuned for the compact
22017 implementation.
22019 @opindex mdpfp-fast
22020 @item -mdpfp-fast
22021 Generate double-precision FPX instructions, tuned for the fast
22022 implementation.
22024 @opindex mno-dpfp-lrsr
22025 @item -mno-dpfp-lrsr
22026 Disable @code{lr} and @code{sr} instructions from using FPX extension
22027 aux registers.
22029 @opindex mea
22030 @item -mea
22031 Generate extended arithmetic instructions.  Currently only
22032 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
22033 supported.  Only valid for @option{-mcpu=ARC700}.
22035 @opindex mno-mpy
22036 @opindex mmpy
22037 @item -mno-mpy
22038 Do not generate @code{mpy}-family instructions for ARC700.  This option is
22039 deprecated.
22041 @opindex mmul32x16
22042 @item -mmul32x16
22043 Generate 32x16-bit multiply and multiply-accumulate instructions.
22045 @opindex mmul64
22046 @item -mmul64
22047 Generate @code{mul64} and @code{mulu64} instructions.  
22048 Only valid for @option{-mcpu=ARC600}.
22050 @opindex mnorm
22051 @item -mnorm
22052 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
22053 is in effect.
22055 @opindex mspfp
22056 @opindex mspfp-compact
22057 @item -mspfp
22058 @itemx -mspfp-compact
22059 Generate single-precision FPX instructions, tuned for the compact
22060 implementation.
22062 @opindex mspfp-fast
22063 @item -mspfp-fast
22064 Generate single-precision FPX instructions, tuned for the fast
22065 implementation.
22067 @opindex msimd
22068 @item -msimd
22069 Enable generation of ARC SIMD instructions via target-specific
22070 builtins.  Only valid for @option{-mcpu=ARC700}.
22072 @opindex msoft-float
22073 @item -msoft-float
22074 This option ignored; it is provided for compatibility purposes only.
22075 Software floating-point code is emitted by default, and this default
22076 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
22077 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
22078 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
22080 @opindex mswap
22081 @item -mswap
22082 Generate @code{swap} instructions.
22084 @opindex matomic
22085 @item -matomic
22086 This enables use of the locked load/store conditional extension to implement
22087 atomic memory built-in functions.  Not available for ARC 6xx or ARC
22088 EM cores.
22090 @opindex mdiv-rem
22091 @item -mdiv-rem
22092 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
22094 @opindex mcode-density
22095 @item -mcode-density
22096 Enable code density instructions for ARC EM.  
22097 This option is on by default for ARC HS.
22099 @opindex mll64
22100 @item -mll64
22101 Enable double load/store operations for ARC HS cores.
22103 @opindex mtp-regno
22104 @item -mtp-regno=@var{regno}
22105 Specify thread pointer register number.
22107 @opindex mmpy-option
22108 @item -mmpy-option=@var{multo}
22109 Compile ARCv2 code with a multiplier design option.  You can specify 
22110 the option using either a string or numeric value for @var{multo}.  
22111 @samp{wlh1} is the default value.  The recognized values are:
22113 @table @samp
22114 @item 0
22115 @itemx none
22116 No multiplier available.
22118 @item 1
22119 @itemx w
22120 16x16 multiplier, fully pipelined.
22121 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
22123 @item 2
22124 @itemx wlh1
22125 32x32 multiplier, fully
22126 pipelined (1 stage).  The following instructions are additionally
22127 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22129 @item 3
22130 @itemx wlh2
22131 32x32 multiplier, fully pipelined
22132 (2 stages).  The following instructions are additionally enabled: @code{mpy},
22133 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22135 @item 4
22136 @itemx wlh3
22137 Two 16x16 multipliers, blocking,
22138 sequential.  The following instructions are additionally enabled: @code{mpy},
22139 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22141 @item 5
22142 @itemx wlh4
22143 One 16x16 multiplier, blocking,
22144 sequential.  The following instructions are additionally enabled: @code{mpy},
22145 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22147 @item 6
22148 @itemx wlh5
22149 One 32x4 multiplier, blocking,
22150 sequential.  The following instructions are additionally enabled: @code{mpy},
22151 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22153 @item 7
22154 @itemx plus_dmpy
22155 ARC HS SIMD support.
22157 @item 8
22158 @itemx plus_macd
22159 ARC HS SIMD support.
22161 @item 9
22162 @itemx plus_qmacw
22163 ARC HS SIMD support.
22165 @end table
22167 This option is only available for ARCv2 cores@.
22169 @opindex mfpu
22170 @item -mfpu=@var{fpu}
22171 Enables support for specific floating-point hardware extensions for ARCv2
22172 cores.  Supported values for @var{fpu} are:
22174 @table @samp
22176 @item fpus
22177 Enables support for single-precision floating-point hardware
22178 extensions@.
22180 @item fpud
22181 Enables support for double-precision floating-point hardware
22182 extensions.  The single-precision floating-point extension is also
22183 enabled.  Not available for ARC EM@.
22185 @item fpuda
22186 Enables support for double-precision floating-point hardware
22187 extensions using double-precision assist instructions.  The single-precision
22188 floating-point extension is also enabled.  This option is
22189 only available for ARC EM@.
22191 @item fpuda_div
22192 Enables support for double-precision floating-point hardware
22193 extensions using double-precision assist instructions.
22194 The single-precision floating-point, square-root, and divide 
22195 extensions are also enabled.  This option is
22196 only available for ARC EM@.
22198 @item fpuda_fma
22199 Enables support for double-precision floating-point hardware
22200 extensions using double-precision assist instructions.
22201 The single-precision floating-point and fused multiply and add 
22202 hardware extensions are also enabled.  This option is
22203 only available for ARC EM@.
22205 @item fpuda_all
22206 Enables support for double-precision floating-point hardware
22207 extensions using double-precision assist instructions.
22208 All single-precision floating-point hardware extensions are also
22209 enabled.  This option is only available for ARC EM@.
22211 @item fpus_div
22212 Enables support for single-precision floating-point, square-root and divide 
22213 hardware extensions@.
22215 @item fpud_div
22216 Enables support for double-precision floating-point, square-root and divide 
22217 hardware extensions.  This option
22218 includes option @samp{fpus_div}. Not available for ARC EM@.
22220 @item fpus_fma
22221 Enables support for single-precision floating-point and 
22222 fused multiply and add hardware extensions@.
22224 @item fpud_fma
22225 Enables support for double-precision floating-point and 
22226 fused multiply and add hardware extensions.  This option
22227 includes option @samp{fpus_fma}.  Not available for ARC EM@.
22229 @item fpus_all
22230 Enables support for all single-precision floating-point hardware
22231 extensions@.
22233 @item fpud_all
22234 Enables support for all single- and double-precision floating-point
22235 hardware extensions.  Not available for ARC EM@.
22237 @end table
22239 @opindex mirq-ctrl-saved
22240 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
22241 Specifies general-purposes registers that the processor automatically
22242 saves/restores on interrupt entry and exit.  @var{register-range} is
22243 specified as two registers separated by a dash.  The register range
22244 always starts with @code{r0}, the upper limit is @code{fp} register.
22245 @var{blink} and @var{lp_count} are optional.  This option is only
22246 valid for ARC EM and ARC HS cores.
22248 @opindex mrgf-banked-regs
22249 @item -mrgf-banked-regs=@var{number}
22250 Specifies the number of registers replicated in second register bank
22251 on entry to fast interrupt.  Fast interrupts are interrupts with the
22252 highest priority level P0.  These interrupts save only PC and STATUS32
22253 registers to avoid memory transactions during interrupt entry and exit
22254 sequences.  Use this option when you are using fast interrupts in an
22255 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
22257 @opindex mlpc-width
22258 @item -mlpc-width=@var{width}
22259 Specify the width of the @code{lp_count} register.  Valid values for
22260 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
22261 fixed to 32 bits.  If the width is less than 32, the compiler does not
22262 attempt to transform loops in your program to use the zero-delay loop
22263 mechanism unless it is known that the @code{lp_count} register can
22264 hold the required loop-counter value.  Depending on the width
22265 specified, the compiler and run-time library might continue to use the
22266 loop mechanism for various needs.  This option defines macro
22267 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
22269 @opindex mrf16
22270 @item -mrf16
22271 This option instructs the compiler to generate code for a 16-entry
22272 register file.  This option defines the @code{__ARC_RF16__}
22273 preprocessor macro.
22275 @opindex mbranch-index
22276 @item -mbranch-index
22277 Enable use of @code{bi} or @code{bih} instructions to implement jump
22278 tables.
22280 @end table
22282 The following options are passed through to the assembler, and also
22283 define preprocessor macro symbols.
22285 @c Flags used by the assembler, but for which we define preprocessor
22286 @c macro symbols as well.
22287 @table @gcctabopt
22288 @opindex mdsp-packa
22289 @item -mdsp-packa
22290 Passed down to the assembler to enable the DSP Pack A extensions.
22291 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
22292 deprecated.
22294 @opindex mdvbf
22295 @item -mdvbf
22296 Passed down to the assembler to enable the dual Viterbi butterfly
22297 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
22298 option is deprecated.
22300 @c ARC700 4.10 extension instruction
22301 @opindex mlock
22302 @item -mlock
22303 Passed down to the assembler to enable the locked load/store
22304 conditional extension.  Also sets the preprocessor symbol
22305 @code{__Xlock}.
22307 @opindex mmac-d16
22308 @item -mmac-d16
22309 Passed down to the assembler.  Also sets the preprocessor symbol
22310 @code{__Xxmac_d16}.  This option is deprecated.
22312 @opindex mmac-24
22313 @item -mmac-24
22314 Passed down to the assembler.  Also sets the preprocessor symbol
22315 @code{__Xxmac_24}.  This option is deprecated.
22317 @c ARC700 4.10 extension instruction
22318 @opindex mrtsc
22319 @item -mrtsc
22320 Passed down to the assembler to enable the 64-bit time-stamp counter
22321 extension instruction.  Also sets the preprocessor symbol
22322 @code{__Xrtsc}.  This option is deprecated.
22324 @c ARC700 4.10 extension instruction
22325 @opindex mswape
22326 @item -mswape
22327 Passed down to the assembler to enable the swap byte ordering
22328 extension instruction.  Also sets the preprocessor symbol
22329 @code{__Xswape}.
22331 @opindex mtelephony
22332 @item -mtelephony
22333 Passed down to the assembler to enable dual- and single-operand
22334 instructions for telephony.  Also sets the preprocessor symbol
22335 @code{__Xtelephony}.  This option is deprecated.
22337 @opindex mxy
22338 @item -mxy
22339 Passed down to the assembler to enable the XY memory extension.  Also
22340 sets the preprocessor symbol @code{__Xxy}.
22342 @end table
22344 The following options control how the assembly code is annotated:
22346 @c Assembly annotation options
22347 @table @gcctabopt
22348 @opindex misize
22349 @item -misize
22350 Annotate assembler instructions with estimated addresses.
22352 @opindex mannotate-align
22353 @item -mannotate-align
22354 Does nothing.  Preserved for backward compatibility.
22356 @end table
22358 The following options are passed through to the linker:
22360 @c options passed through to the linker
22361 @table @gcctabopt
22362 @opindex marclinux
22363 @item -marclinux
22364 Passed through to the linker, to specify use of the @code{arclinux} emulation.
22365 This option is enabled by default in tool chains built for
22366 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
22367 when profiling is not requested.
22369 @opindex marclinux_prof
22370 @item -marclinux_prof
22371 Passed through to the linker, to specify use of the
22372 @code{arclinux_prof} emulation.  This option is enabled by default in
22373 tool chains built for @w{@code{arc-linux-uclibc}} and
22374 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
22376 @end table
22378 The following options control the semantics of generated code:
22380 @c semantically relevant code generation options
22381 @table @gcctabopt
22382 @opindex mlong-calls
22383 @item -mlong-calls
22384 Generate calls as register indirect calls, thus providing access
22385 to the full 32-bit address range.
22387 @opindex mmedium-calls
22388 @item -mmedium-calls
22389 Don't use less than 25-bit addressing range for calls, which is the
22390 offset available for an unconditional branch-and-link
22391 instruction.  Conditional execution of function calls is suppressed, to
22392 allow use of the 25-bit range, rather than the 21-bit range with
22393 conditional branch-and-link.  This is the default for tool chains built
22394 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
22396 @opindex G
22397 @item -G @var{num}
22398 Put definitions of externally-visible data in a small data section if
22399 that data is no bigger than @var{num} bytes.  The default value of
22400 @var{num} is 4 for any ARC configuration, or 8 when we have double
22401 load/store operations.
22403 @opindex mno-sdata
22404 @opindex msdata
22405 @item -mno-sdata
22406 Do not generate sdata references.  This is the default for tool chains
22407 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
22408 targets.
22410 @opindex mvolatile-cache
22411 @item -mvolatile-cache
22412 Use ordinarily cached memory accesses for volatile references.  This is the
22413 default.
22415 @opindex mno-volatile-cache
22416 @opindex mvolatile-cache
22417 @item -mno-volatile-cache
22418 Enable cache bypass for volatile references.
22420 @end table
22422 The following options fine tune code generation:
22423 @c code generation tuning options
22424 @table @gcctabopt
22425 @opindex malign-call
22426 @item -malign-call
22427 Does nothing.  Preserved for backward compatibility.
22429 @opindex mauto-modify-reg
22430 @item -mauto-modify-reg
22431 Enable the use of pre/post modify with register displacement.
22433 @opindex mbbit-peephole
22434 @item -mbbit-peephole
22435 Does nothing.  Preserved for backward compatibility.
22437 @opindex mno-brcc
22438 @item -mno-brcc
22439 This option disables a target-specific pass in @file{arc_reorg} to
22440 generate compare-and-branch (@code{br@var{cc}}) instructions.  
22441 It has no effect on
22442 generation of these instructions driven by the combiner pass.
22444 @opindex mcase-vector-pcrel
22445 @item -mcase-vector-pcrel
22446 Use PC-relative switch case tables to enable case table shortening.
22447 This is the default for @option{-Os}.
22449 @opindex mcompact-casesi
22450 @item -mcompact-casesi
22451 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
22452 and only available for ARCv1 cores.  This option is deprecated.
22454 @opindex mno-cond-exec
22455 @item -mno-cond-exec
22456 Disable the ARCompact-specific pass to generate conditional 
22457 execution instructions.
22459 Due to delay slot scheduling and interactions between operand numbers,
22460 literal sizes, instruction lengths, and the support for conditional execution,
22461 the target-independent pass to generate conditional execution is often lacking,
22462 so the ARC port has kept a special pass around that tries to find more
22463 conditional execution generation opportunities after register allocation,
22464 branch shortening, and delay slot scheduling have been done.  This pass
22465 generally, but not always, improves performance and code size, at the cost of
22466 extra compilation time, which is why there is an option to switch it off.
22467 If you have a problem with call instructions exceeding their allowable
22468 offset range because they are conditionalized, you should consider using
22469 @option{-mmedium-calls} instead.
22471 @opindex mearly-cbranchsi
22472 @item -mearly-cbranchsi
22473 Enable pre-reload use of the @code{cbranchsi} pattern.
22475 @opindex mexpand-adddi
22476 @item -mexpand-adddi
22477 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
22478 @code{add.f}, @code{adc} etc.  This option is deprecated.
22480 @opindex mindexed-loads
22481 @item -mindexed-loads
22482 Enable the use of indexed loads.  This can be problematic because some
22483 optimizers then assume that indexed stores exist, which is not
22484 the case.
22486 @opindex mlra
22487 @item -mlra
22488 Enable Local Register Allocation.  This is still experimental for ARC,
22489 so by default the compiler uses standard reload
22490 (i.e.@: @option{-mno-lra}).
22492 @opindex mlra-priority-none
22493 @item -mlra-priority-none
22494 Don't indicate any priority for target registers.
22496 @opindex mlra-priority-compact
22497 @item -mlra-priority-compact
22498 Indicate target register priority for r0..r3 / r12..r15.
22500 @opindex mlra-priority-noncompact
22501 @item -mlra-priority-noncompact
22502 Reduce target register priority for r0..r3 / r12..r15.
22504 @opindex mmillicode
22505 @item -mmillicode
22506 When optimizing for size (using @option{-Os}), prologues and epilogues
22507 that have to save or restore a large number of registers are often
22508 shortened by using call to a special function in libgcc; this is
22509 referred to as a @emph{millicode} call.  As these calls can pose
22510 performance issues, and/or cause linking issues when linking in a
22511 nonstandard way, this option is provided to turn on or off millicode
22512 call generation.
22514 @opindex mcode-density-frame
22515 @item -mcode-density-frame
22516 This option enable the compiler to emit @code{enter} and @code{leave}
22517 instructions.  These instructions are only valid for CPUs with
22518 code-density feature.
22520 @opindex mmixed-code
22521 @item -mmixed-code
22522 Does nothing.  Preserved for backward compatibility.
22524 @opindex mq-class
22525 @item -mq-class
22526 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
22527 This is the default for @option{-Os}.
22529 @opindex mRcq
22530 @item -mRcq
22531 Does nothing.  Preserved for backward compatibility.
22533 @opindex mRcw
22534 @item -mRcw
22535 Does nothing.  Preserved for backward compatibility.
22537 @opindex msize-level
22538 @item -msize-level=@var{level}
22539 Fine-tune size optimization with regards to instruction lengths and alignment.
22540 The recognized values for @var{level} are:
22541 @table @samp
22542 @item 0
22543 No size optimization.  This level is deprecated and treated like @samp{1}.
22545 @item 1
22546 Short instructions are used opportunistically.
22548 @item 2
22549 In addition, alignment of loops and of code after barriers are dropped.
22551 @item 3
22552 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
22554 @end table
22556 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
22557 the behavior when this is not set is equivalent to level @samp{1}.
22559 @opindex mtune
22560 @item -mtune=@var{cpu}
22561 Set instruction scheduling parameters for @var{cpu}, overriding any implied
22562 by @option{-mcpu=}.
22564 Supported values for @var{cpu} are
22566 @table @samp
22567 @item ARC600
22568 Tune for ARC600 CPU.
22570 @item ARC601
22571 Tune for ARC601 CPU.
22573 @item ARC700
22574 Tune for ARC700 CPU with standard multiplier block.
22576 @item ARC700-xmac
22577 Tune for ARC700 CPU with XMAC block.
22579 @item ARC725D
22580 Tune for ARC725D CPU.
22582 @item ARC750D
22583 Tune for ARC750D CPU.
22585 @item core3
22586 Tune for ARCv2 core3 type CPU.  This option enable usage of
22587 @code{dbnz} instruction.
22589 @item release31a
22590 Tune for ARC4x release 3.10a.
22592 @end table
22594 @opindex mmultcost
22595 @item -mmultcost=@var{num}
22596 Cost to assume for a multiply instruction, with @samp{4} being equal to a
22597 normal instruction.
22599 @opindex munalign-prob-threshold
22600 @item -munalign-prob-threshold=@var{probability}
22601 Does nothing.  Preserved for backward compatibility.
22603 @end table
22605 The following options are maintained for backward compatibility, but
22606 are now deprecated and will be removed in a future release:
22608 @c Deprecated options
22609 @table @gcctabopt
22611 @opindex margonaut
22612 @item -margonaut
22613 Obsolete FPX.
22615 @opindex mbig-endian
22616 @opindex EB
22617 @item -mbig-endian
22618 @itemx -EB
22619 Compile code for big-endian targets.  Use of these options is now
22620 deprecated.  Big-endian code is supported by configuring GCC to build
22621 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
22622 for which big endian is the default.
22624 @opindex mlittle-endian
22625 @opindex EL
22626 @item -mlittle-endian
22627 @itemx -EL
22628 Compile code for little-endian targets.  Use of these options is now
22629 deprecated.  Little-endian code is supported by configuring GCC to build 
22630 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
22631 for which little endian is the default.
22633 @opindex mbarrel_shifter
22634 @item -mbarrel_shifter
22635 Replaced by @option{-mbarrel-shifter}.
22637 @opindex mdpfp_compact
22638 @item -mdpfp_compact
22639 Replaced by @option{-mdpfp-compact}.
22641 @opindex mdpfp_fast
22642 @item -mdpfp_fast
22643 Replaced by @option{-mdpfp-fast}.
22645 @opindex mdsp_packa
22646 @item -mdsp_packa
22647 Replaced by @option{-mdsp-packa}.
22649 @opindex mEA
22650 @item -mEA
22651 Replaced by @option{-mea}.
22653 @opindex mmac_24
22654 @item -mmac_24
22655 Replaced by @option{-mmac-24}.
22657 @opindex mmac_d16
22658 @item -mmac_d16
22659 Replaced by @option{-mmac-d16}.
22661 @opindex mspfp_compact
22662 @item -mspfp_compact
22663 Replaced by @option{-mspfp-compact}.
22665 @opindex mspfp_fast
22666 @item -mspfp_fast
22667 Replaced by @option{-mspfp-fast}.
22669 @opindex mtune
22670 @item -mtune=@var{cpu}
22671 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
22672 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
22673 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
22675 @opindex multcost
22676 @item -multcost=@var{num}
22677 Replaced by @option{-mmultcost}.
22679 @end table
22681 @node ARM Options
22682 @subsection ARM Options
22683 @cindex ARM options
22685 These @samp{-m} options are defined for the ARM port:
22687 @table @gcctabopt
22688 @opindex mabi
22689 @item -mabi=@var{name}
22690 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
22691 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
22693 @opindex mapcs-frame
22694 @item -mapcs-frame
22695 Generate a stack frame that is compliant with the ARM Procedure Call
22696 Standard for all functions, even if this is not strictly necessary for
22697 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
22698 with this option causes the stack frames not to be generated for
22699 leaf functions.  The default is @option{-mno-apcs-frame}.
22700 This option is deprecated.
22702 @opindex mapcs
22703 @item -mapcs
22704 This is a synonym for @option{-mapcs-frame} and is deprecated.
22706 @ignore
22707 @c not currently implemented
22708 @opindex mapcs-stack-check
22709 @item -mapcs-stack-check
22710 Generate code to check the amount of stack space available upon entry to
22711 every function (that actually uses some stack space).  If there is
22712 insufficient space available then either the function
22713 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
22714 called, depending upon the amount of stack space required.  The runtime
22715 system is required to provide these functions.  The default is
22716 @option{-mno-apcs-stack-check}, since this produces smaller code.
22718 @c not currently implemented
22719 @opindex mapcs-reentrant
22720 @item -mapcs-reentrant
22721 Generate reentrant, position-independent code.  The default is
22722 @option{-mno-apcs-reentrant}.
22723 @end ignore
22725 @opindex mthumb-interwork
22726 @item -mthumb-interwork
22727 Generate code that supports calling between the ARM and Thumb
22728 instruction sets.  Without this option, on pre-v5 architectures, the
22729 two instruction sets cannot be reliably used inside one program.  The
22730 default is @option{-mno-thumb-interwork}, since slightly larger code
22731 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
22732 configurations this option is meaningless.
22734 @opindex mno-sched-prolog
22735 @opindex msched-prolog
22736 @item -mno-sched-prolog
22737 Prevent the reordering of instructions in the function prologue, or the
22738 merging of those instruction with the instructions in the function's
22739 body.  This means that all functions start with a recognizable set
22740 of instructions (or in fact one of a choice from a small set of
22741 different function prologues), and this information can be used to
22742 locate the start of functions inside an executable piece of code.  The
22743 default is @option{-msched-prolog}.
22745 @opindex mfloat-abi
22746 @item -mfloat-abi=@var{name}
22747 Specifies which floating-point ABI to use.  Permissible values
22748 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22750 Specifying @samp{soft} causes GCC to generate output containing
22751 library calls for floating-point operations.
22752 @samp{softfp} allows the generation of code using hardware floating-point
22753 instructions, but still uses the soft-float calling conventions.
22754 @samp{hard} allows generation of floating-point instructions
22755 and uses FPU-specific calling conventions.
22757 The default depends on the specific target configuration.  Note that
22758 the hard-float and soft-float ABIs are not link-compatible; you must
22759 compile your entire program with the same ABI, and link with a
22760 compatible set of libraries.
22762 @opindex mgeneral-regs-only
22763 @item -mgeneral-regs-only
22764 Generate code which uses only the general-purpose registers.  This will prevent
22765 the compiler from using floating-point and Advanced SIMD registers but will not
22766 impose any restrictions on the assembler.
22768 @opindex mlittle-endian
22769 @item -mlittle-endian
22770 Generate code for a processor running in little-endian mode.  This is
22771 the default for all standard configurations.
22773 @opindex mbig-endian
22774 @item -mbig-endian
22775 Generate code for a processor running in big-endian mode; the default is
22776 to compile code for a little-endian processor.
22778 @opindex mbe8
22779 @item -mbe8
22780 @itemx -mbe32
22781 When linking a big-endian image select between BE8 and BE32 formats.
22782 The option has no effect for little-endian images and is ignored.  The
22783 default is dependent on the selected target architecture.  For ARMv6
22784 and later architectures the default is BE8, for older architectures
22785 the default is BE32.  BE32 format has been deprecated by ARM.
22787 @opindex march
22788 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
22789 This specifies the name of the target ARM architecture.  GCC uses this
22790 name to determine what kind of instructions it can emit when generating
22791 assembly code.  This option can be used in conjunction with or instead
22792 of the @option{-mcpu=} option.
22794 Permissible names are:
22795 @samp{armv4t},
22796 @samp{armv5t}, @samp{armv5te},
22797 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
22798 @samp{armv6z}, @samp{armv6zk},
22799 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22800 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22801 @samp{armv8.4-a},
22802 @samp{armv8.5-a},
22803 @samp{armv8.6-a},
22804 @samp{armv9-a},
22805 @samp{armv7-r},
22806 @samp{armv8-r},
22807 @samp{armv6-m}, @samp{armv6s-m},
22808 @samp{armv7-m}, @samp{armv7e-m},
22809 @samp{armv8-m.base}, @samp{armv8-m.main},
22810 @samp{armv8.1-m.main},
22811 @samp{armv9-a},
22812 @samp{iwmmxt} and @samp{iwmmxt2}.
22814 Additionally, the following architectures, which lack support for the
22815 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22817 Many of the architectures support extensions.  These can be added by
22818 appending @samp{+@var{extension}} to the architecture name.  Extension
22819 options are processed in order and capabilities accumulate.  An extension
22820 will also enable any necessary base extensions
22821 upon which it depends.  For example, the @samp{+crypto} extension
22822 will always enable the @samp{+simd} extension.  The exception to the
22823 additive construction is for extensions that are prefixed with
22824 @samp{+no@dots{}}: these extensions disable the specified option and
22825 any other extensions that may depend on the presence of that
22826 extension.
22828 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22829 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22830 entirely disabled by the @samp{+nofp} option that follows it.
22832 Most extension names are generically named, but have an effect that is
22833 dependent upon the architecture to which it is applied.  For example,
22834 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22835 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22836 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22837 variant for @samp{armv8-a}.
22839 The table below lists the supported extensions for each architecture.
22840 Architectures not mentioned do not support any extensions.
22842 @table @samp
22843 @item armv5te
22844 @itemx armv6
22845 @itemx armv6j
22846 @itemx armv6k
22847 @itemx armv6kz
22848 @itemx armv6t2
22849 @itemx armv6z
22850 @itemx armv6zk
22851 @table @samp
22852 @item +fp
22853 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22854 used as an alias for this extension.
22856 @item +nofp
22857 Disable the floating-point instructions.
22858 @end table
22860 @item armv7
22861 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22862 @table @samp
22863 @item +fp
22864 The VFPv3 floating-point instructions, with 16 double-precision
22865 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22866 for this extension.  Note that floating-point is not supported by the
22867 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22868 ARMv7-R architectures.
22870 @item +nofp
22871 Disable the floating-point instructions.
22872 @end table
22874 @item armv7-a
22875 @table @samp
22876 @item +mp
22877 The multiprocessing extension.
22879 @item +sec
22880 The security extension.
22882 @item +fp
22883 The VFPv3 floating-point instructions, with 16 double-precision
22884 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22885 for this extension.
22887 @item +simd
22888 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22889 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22890 for this extension.
22892 @item +vfpv3
22893 The VFPv3 floating-point instructions, with 32 double-precision
22894 registers.
22896 @item +vfpv3-d16-fp16
22897 The VFPv3 floating-point instructions, with 16 double-precision
22898 registers and the half-precision floating-point conversion operations.
22900 @item +vfpv3-fp16
22901 The VFPv3 floating-point instructions, with 32 double-precision
22902 registers and the half-precision floating-point conversion operations.
22904 @item +vfpv4-d16
22905 The VFPv4 floating-point instructions, with 16 double-precision
22906 registers.
22908 @item +vfpv4
22909 The VFPv4 floating-point instructions, with 32 double-precision
22910 registers.
22912 @item +neon-fp16
22913 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22914 the half-precision floating-point conversion operations.
22916 @item +neon-vfpv4
22917 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22919 @item +nosimd
22920 Disable the Advanced SIMD instructions (does not disable floating point).
22922 @item +nofp
22923 Disable the floating-point and Advanced SIMD instructions.
22924 @end table
22926 @item armv7ve
22927 The extended version of the ARMv7-A architecture with support for
22928 virtualization.
22929 @table @samp
22930 @item +fp
22931 The VFPv4 floating-point instructions, with 16 double-precision registers.
22932 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22934 @item +simd
22935 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22936 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22938 @item +vfpv3-d16
22939 The VFPv3 floating-point instructions, with 16 double-precision
22940 registers.
22942 @item +vfpv3
22943 The VFPv3 floating-point instructions, with 32 double-precision
22944 registers.
22946 @item +vfpv3-d16-fp16
22947 The VFPv3 floating-point instructions, with 16 double-precision
22948 registers and the half-precision floating-point conversion operations.
22950 @item +vfpv3-fp16
22951 The VFPv3 floating-point instructions, with 32 double-precision
22952 registers and the half-precision floating-point conversion operations.
22954 @item +vfpv4-d16
22955 The VFPv4 floating-point instructions, with 16 double-precision
22956 registers.
22958 @item +vfpv4
22959 The VFPv4 floating-point instructions, with 32 double-precision
22960 registers.
22962 @item +neon
22963 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22964 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22966 @item +neon-fp16
22967 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22968 the half-precision floating-point conversion operations.
22970 @item +nosimd
22971 Disable the Advanced SIMD instructions (does not disable floating point).
22973 @item +nofp
22974 Disable the floating-point and Advanced SIMD instructions.
22975 @end table
22977 @item armv8-a
22978 @table @samp
22979 @item +crc
22980 The Cyclic Redundancy Check (CRC) instructions.
22981 @item +simd
22982 The ARMv8-A Advanced SIMD and floating-point instructions.
22983 @item +crypto
22984 The cryptographic instructions.
22985 @item +nocrypto
22986 Disable the cryptographic instructions.
22987 @item +nofp
22988 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22989 @item +sb
22990 Speculation Barrier Instruction.
22991 @item +predres
22992 Execution and Data Prediction Restriction Instructions.
22993 @end table
22995 @item armv8.1-a
22996 @table @samp
22997 @item +simd
22998 The ARMv8.1-A Advanced SIMD and floating-point instructions.
23000 @item +crypto
23001 The cryptographic instructions.  This also enables the Advanced SIMD and
23002 floating-point instructions.
23004 @item +nocrypto
23005 Disable the cryptographic instructions.
23007 @item +nofp
23008 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23010 @item +sb
23011 Speculation Barrier Instruction.
23013 @item +predres
23014 Execution and Data Prediction Restriction Instructions.
23015 @end table
23017 @item armv8.2-a
23018 @itemx armv8.3-a
23019 @table @samp
23020 @item +fp16
23021 The half-precision floating-point data processing instructions.
23022 This also enables the Advanced SIMD and floating-point instructions.
23024 @item +fp16fml
23025 The half-precision floating-point fmla extension.  This also enables
23026 the half-precision floating-point extension and Advanced SIMD and
23027 floating-point instructions.
23029 @item +simd
23030 The ARMv8.1-A Advanced SIMD and floating-point instructions.
23032 @item +crypto
23033 The cryptographic instructions.  This also enables the Advanced SIMD and
23034 floating-point instructions.
23036 @item +dotprod
23037 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
23039 @item +nocrypto
23040 Disable the cryptographic extension.
23042 @item +nofp
23043 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23045 @item +sb
23046 Speculation Barrier Instruction.
23048 @item +predres
23049 Execution and Data Prediction Restriction Instructions.
23051 @item +i8mm
23052 8-bit Integer Matrix Multiply instructions.
23053 This also enables Advanced SIMD and floating-point instructions.
23055 @item +bf16
23056 Brain half-precision floating-point instructions.
23057 This also enables Advanced SIMD and floating-point instructions.
23058 @end table
23060 @item armv8.4-a
23061 @table @samp
23062 @item +fp16
23063 The half-precision floating-point data processing instructions.
23064 This also enables the Advanced SIMD and floating-point instructions as well
23065 as the Dot Product extension and the half-precision floating-point fmla
23066 extension.
23068 @item +simd
23069 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23070 Dot Product extension.
23072 @item +crypto
23073 The cryptographic instructions.  This also enables the Advanced SIMD and
23074 floating-point instructions as well as the Dot Product extension.
23076 @item +nocrypto
23077 Disable the cryptographic extension.
23079 @item +nofp
23080 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23082 @item +sb
23083 Speculation Barrier Instruction.
23085 @item +predres
23086 Execution and Data Prediction Restriction Instructions.
23088 @item +i8mm
23089 8-bit Integer Matrix Multiply instructions.
23090 This also enables Advanced SIMD and floating-point instructions.
23092 @item +bf16
23093 Brain half-precision floating-point instructions.
23094 This also enables Advanced SIMD and floating-point instructions.
23095 @end table
23097 @item armv8.5-a
23098 @table @samp
23099 @item +fp16
23100 The half-precision floating-point data processing instructions.
23101 This also enables the Advanced SIMD and floating-point instructions as well
23102 as the Dot Product extension and the half-precision floating-point fmla
23103 extension.
23105 @item +simd
23106 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23107 Dot Product extension.
23109 @item +crypto
23110 The cryptographic instructions.  This also enables the Advanced SIMD and
23111 floating-point instructions as well as the Dot Product extension.
23113 @item +nocrypto
23114 Disable the cryptographic extension.
23116 @item +nofp
23117 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23119 @item +i8mm
23120 8-bit Integer Matrix Multiply instructions.
23121 This also enables Advanced SIMD and floating-point instructions.
23123 @item +bf16
23124 Brain half-precision floating-point instructions.
23125 This also enables Advanced SIMD and floating-point instructions.
23126 @end table
23128 @item armv8.6-a
23129 @table @samp
23130 @item +fp16
23131 The half-precision floating-point data processing instructions.
23132 This also enables the Advanced SIMD and floating-point instructions as well
23133 as the Dot Product extension and the half-precision floating-point fmla
23134 extension.
23136 @item +simd
23137 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23138 Dot Product extension.
23140 @item +crypto
23141 The cryptographic instructions.  This also enables the Advanced SIMD and
23142 floating-point instructions as well as the Dot Product extension.
23144 @item +nocrypto
23145 Disable the cryptographic extension.
23147 @item +nofp
23148 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23150 @item +i8mm
23151 8-bit Integer Matrix Multiply instructions.
23152 This also enables Advanced SIMD and floating-point instructions.
23154 @item +bf16
23155 Brain half-precision floating-point instructions.
23156 This also enables Advanced SIMD and floating-point instructions.
23157 @end table
23159 @item armv7-r
23160 @table @samp
23161 @item +fp.sp
23162 The single-precision VFPv3 floating-point instructions.  The extension
23163 @samp{+vfpv3xd} can be used as an alias for this extension.
23165 @item +fp
23166 The VFPv3 floating-point instructions with 16 double-precision registers.
23167 The extension +vfpv3-d16 can be used as an alias for this extension.
23169 @item +vfpv3xd-d16-fp16
23170 The single-precision VFPv3 floating-point instructions with 16 double-precision
23171 registers and the half-precision floating-point conversion operations.
23173 @item +vfpv3-d16-fp16
23174 The VFPv3 floating-point instructions with 16 double-precision
23175 registers and the half-precision floating-point conversion operations.
23177 @item +nofp
23178 Disable the floating-point extension.
23180 @item +idiv
23181 The ARM-state integer division instructions.
23183 @item +noidiv
23184 Disable the ARM-state integer division extension.
23185 @end table
23187 @item armv7e-m
23188 @table @samp
23189 @item +fp
23190 The single-precision VFPv4 floating-point instructions.
23192 @item +fpv5
23193 The single-precision FPv5 floating-point instructions.
23195 @item +fp.dp
23196 The single- and double-precision FPv5 floating-point instructions.
23198 @item +nofp
23199 Disable the floating-point extensions.
23200 @end table
23202 @item  armv8.1-m.main
23203 @table @samp
23205 @item +dsp
23206 The DSP instructions.
23208 @item +mve
23209 The M-Profile Vector Extension (MVE) integer instructions.
23211 @item +mve.fp
23212 The M-Profile Vector Extension (MVE) integer and single precision
23213 floating-point instructions.
23215 @item +fp
23216 The single-precision floating-point instructions.
23218 @item +fp.dp
23219 The single- and double-precision floating-point instructions.
23221 @item +nofp
23222 Disable the floating-point extension.
23224 @item +cdecp0, +cdecp1, ... , +cdecp7
23225 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23226 to the numbers given in the options in the range 0 to 7.
23228 @item +pacbti
23229 Enable the Pointer Authentication and Branch Target Identification Extension.
23230 @end table
23232 @item  armv8-m.main
23233 @table @samp
23234 @item +dsp
23235 The DSP instructions.
23237 @item +nodsp
23238 Disable the DSP extension.
23240 @item +fp
23241 The single-precision floating-point instructions.
23243 @item +fp.dp
23244 The single- and double-precision floating-point instructions.
23246 @item +nofp
23247 Disable the floating-point extension.
23249 @item +cdecp0, +cdecp1, ... , +cdecp7
23250 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23251 to the numbers given in the options in the range 0 to 7.
23252 @end table
23254 @item armv8-r
23255 @table @samp
23256 @item +crc
23257 The Cyclic Redundancy Check (CRC) instructions.
23258 @item +fp.sp
23259 The single-precision FPv5 floating-point instructions.
23260 @item +simd
23261 The ARMv8-A Advanced SIMD and floating-point instructions.
23262 @item +crypto
23263 The cryptographic instructions.
23264 @item +nocrypto
23265 Disable the cryptographic instructions.
23266 @item +nofp
23267 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23268 @end table
23270 @end table
23272 @option{-march=native} causes the compiler to auto-detect the architecture
23273 of the build computer.  At present, this feature is only supported on
23274 GNU/Linux, and not all architectures are recognized.  If the auto-detect
23275 is unsuccessful the option has no effect.
23277 @opindex mtune
23278 @item -mtune=@var{name}
23279 This option specifies the name of the target ARM processor for
23280 which GCC should tune the performance of the code.
23281 For some ARM implementations better performance can be obtained by using
23282 this option.
23283 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
23284 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
23285 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
23286 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
23287 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
23288 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
23289 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
23290 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
23291 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
23292 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
23293 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
23294 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
23295 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
23296 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
23297 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
23298 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
23299 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
23300 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
23301 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
23302 @samp{cortex-m35p}, @samp{cortex-m52}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
23303 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
23304 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
23305 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
23306 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
23307 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
23308 @samp{xgene1}.
23310 Additionally, this option can specify that GCC should tune the performance
23311 of the code for a big.LITTLE system.  Permissible names are:
23312 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
23313 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
23314 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
23315 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
23317 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
23318 performance for a blend of processors within architecture @var{arch}.
23319 The aim is to generate code that run well on the current most popular
23320 processors, balancing between optimizations that benefit some CPUs in the
23321 range, and avoiding performance pitfalls of other CPUs.  The effects of
23322 this option may change in future GCC versions as CPU models come and go.
23324 @option{-mtune} permits the same extension options as @option{-mcpu}, but
23325 the extension options do not affect the tuning of the generated code.
23327 @option{-mtune=native} causes the compiler to auto-detect the CPU
23328 of the build computer.  At present, this feature is only supported on
23329 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
23330 unsuccessful the option has no effect.
23332 @opindex mcpu
23333 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
23334 This specifies the name of the target ARM processor.  GCC uses this name
23335 to derive the name of the target ARM architecture (as if specified
23336 by @option{-march}) and the ARM processor type for which to tune for
23337 performance (as if specified by @option{-mtune}).  Where this option
23338 is used in conjunction with @option{-march} or @option{-mtune},
23339 those options take precedence over the appropriate part of this option.
23341 Many of the supported CPUs implement optional architectural
23342 extensions.  Where this is so the architectural extensions are
23343 normally enabled by default.  If implementations that lack the
23344 extension exist, then the extension syntax can be used to disable
23345 those extensions that have been omitted.  For floating-point and
23346 Advanced SIMD (Neon) instructions, the settings of the options
23347 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
23348 floating-point and Advanced SIMD instructions will only be used if
23349 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
23350 @option{-mfpu} other than @samp{auto} will override the available
23351 floating-point and SIMD extension instructions.
23353 For example, @samp{cortex-a9} can be found in three major
23354 configurations: integer only, with just a floating-point unit or with
23355 floating-point and Advanced SIMD.  The default is to enable all the
23356 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
23357 be used to disable just the SIMD or both the SIMD and floating-point
23358 instructions respectively.
23360 Permissible names for this option are the same as those for
23361 @option{-mtune}.
23363 The following extension options are common to the listed CPUs:
23365 @table @samp
23366 @item +nodsp
23367 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
23368 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23369 Also disable the M-Profile Vector Extension (MVE) integer and
23370 single precision floating-point instructions on
23371 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23373 @item +nopacbti
23374 Disable the Pointer Authentication and Branch Target Identification Extension
23375 on @samp{cortex-m52} and @samp{cortex-m85}.
23377 @item +nomve
23378 Disable the M-Profile Vector Extension (MVE) integer and single precision
23379 floating-point instructions on @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23381 @item +nomve.fp
23382 Disable the M-Profile Vector Extension (MVE) single precision floating-point
23383 instructions on @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23385 @item +cdecp0, +cdecp1, ... , +cdecp7
23386 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23387 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m52} and @samp{cortex-m55}.
23389 @item  +nofp
23390 Disables the floating-point instructions on @samp{arm9e},
23391 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
23392 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
23393 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
23394 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
23395 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23396 Disables the floating-point and SIMD instructions on
23397 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
23398 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
23399 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
23400 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
23401 @samp{cortex-a53} and @samp{cortex-a55}.
23403 @item +nofp.dp
23404 Disables the double-precision component of the floating-point instructions
23405 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
23406 @samp{cortex-r52plus} and @samp{cortex-m7}.
23408 @item +nosimd
23409 Disables the SIMD (but not floating-point) instructions on
23410 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
23411 and @samp{cortex-a9}.
23413 @item +crypto
23414 Enables the cryptographic instructions on @samp{cortex-a32},
23415 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
23416 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
23417 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
23418 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
23419 @samp{cortex-a75.cortex-a55}.
23420 @end table
23422 Additionally the @samp{generic-armv7-a} pseudo target defaults to
23423 VFPv3 with 16 double-precision registers.  It supports the following
23424 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
23425 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
23426 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
23427 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
23428 the extensions to @option{-march=armv7-a}.
23430 @option{-mcpu=generic-@var{arch}} is also permissible, and is
23431 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
23432 See @option{-mtune} for more information.
23434 @option{-mcpu=native} causes the compiler to auto-detect the CPU
23435 of the build computer.  At present, this feature is only supported on
23436 GNU/Linux, and not all architectures are recognized.  If the auto-detect
23437 is unsuccessful the option has no effect.
23439 @opindex mfpu
23440 @item -mfpu=@var{name}
23441 This specifies what floating-point hardware (or hardware emulation) is
23442 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
23443 @samp{vfpv3},
23444 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
23445 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
23446 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
23447 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
23448 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
23449 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
23450 is an alias for @samp{vfpv2}.
23452 The setting @samp{auto} is the default and is special.  It causes the
23453 compiler to select the floating-point and Advanced SIMD instructions
23454 based on the settings of @option{-mcpu} and @option{-march}.
23456 If the selected floating-point hardware includes the NEON extension
23457 (e.g.@: @option{-mfpu=neon}), note that floating-point
23458 operations are not generated by GCC's auto-vectorization pass unless
23459 @option{-funsafe-math-optimizations} is also specified.  This is
23460 because NEON hardware does not fully implement the IEEE 754 standard for
23461 floating-point arithmetic (in particular denormal values are treated as
23462 zero), so the use of NEON instructions may lead to a loss of precision.
23464 You can also set the fpu name at function level by using the @code{target("fpu=")} function attributes (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
23466 @opindex mfp16-format
23467 @item -mfp16-format=@var{name}
23468 Specify the format of the @code{__fp16} half-precision floating-point type.
23469 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
23470 the default is @samp{none}, in which case the @code{__fp16} type is not
23471 defined.  @xref{Half-Precision}, for more information.
23473 @opindex mstructure-size-boundary
23474 @item -mstructure-size-boundary=@var{n}
23475 The sizes of all structures and unions are rounded up to a multiple
23476 of the number of bits set by this option.  Permissible values are 8, 32
23477 and 64.  The default value varies for different toolchains.  For the COFF
23478 targeted toolchain the default value is 8.  A value of 64 is only allowed
23479 if the underlying ABI supports it.
23481 Specifying a larger number can produce faster, more efficient code, but
23482 can also increase the size of the program.  Different values are potentially
23483 incompatible.  Code compiled with one value cannot necessarily expect to
23484 work with code or libraries compiled with another value, if they exchange
23485 information using structures or unions.
23487 This option is deprecated.
23489 @opindex mabort-on-noreturn
23490 @item -mabort-on-noreturn
23491 Generate a call to the function @code{abort} at the end of a
23492 @code{noreturn} function.  It is executed if the function tries to
23493 return.
23495 @opindex mlong-calls
23496 @opindex mno-long-calls
23497 @item -mlong-calls
23498 @itemx -mno-long-calls
23499 Tells the compiler to perform function calls by first loading the
23500 address of the function into a register and then performing a subroutine
23501 call on this register.  This switch is needed if the target function
23502 lies outside of the 64-megabyte addressing range of the offset-based
23503 version of subroutine call instruction.
23505 Even if this switch is enabled, not all function calls are turned
23506 into long calls.  The heuristic is that static functions, functions
23507 that have the @code{short_call} attribute, functions that are inside
23508 the scope of a @code{#pragma no_long_calls} directive, and functions whose
23509 definitions have already been compiled within the current compilation
23510 unit are not turned into long calls.  The exceptions to this rule are
23511 that weak function definitions, functions with the @code{long_call}
23512 attribute or the @code{section} attribute, and functions that are within
23513 the scope of a @code{#pragma long_calls} directive are always
23514 turned into long calls.
23516 This feature is not enabled by default.  Specifying
23517 @option{-mno-long-calls} restores the default behavior, as does
23518 placing the function calls within the scope of a @code{#pragma
23519 long_calls_off} directive.  Note these switches have no effect on how
23520 the compiler generates code to handle function calls via function
23521 pointers.
23523 @opindex msingle-pic-base
23524 @item -msingle-pic-base
23525 Treat the register used for PIC addressing as read-only, rather than
23526 loading it in the prologue for each function.  The runtime system is
23527 responsible for initializing this register with an appropriate value
23528 before execution begins.
23530 @opindex mpic-register
23531 @item -mpic-register=@var{reg}
23532 Specify the register to be used for PIC addressing.
23533 For standard PIC base case, the default is any suitable register
23534 determined by compiler.  For single PIC base case, the default is
23535 @samp{R9} if target is EABI based or stack-checking is enabled,
23536 otherwise the default is @samp{R10}.
23538 @opindex mpic-data-is-text-relative
23539 @item -mpic-data-is-text-relative
23540 Assume that the displacement between the text and data segments is fixed
23541 at static link time.  This permits using PC-relative addressing
23542 operations to access data known to be in the data segment.  For
23543 non-VxWorks RTP targets, this option is enabled by default.  When
23544 disabled on such targets, it will enable @option{-msingle-pic-base} by
23545 default.
23547 @opindex mpoke-function-name
23548 @item -mpoke-function-name
23549 Write the name of each function into the text section, directly
23550 preceding the function prologue.  The generated code is similar to this:
23552 @smallexample
23553      t0
23554          .ascii "arm_poke_function_name", 0
23555          .align
23556      t1
23557          .word 0xff000000 + (t1 - t0)
23558      arm_poke_function_name
23559          mov     ip, sp
23560          stmfd   sp!, @{fp, ip, lr, pc@}
23561          sub     fp, ip, #4
23562 @end smallexample
23564 When performing a stack backtrace, code can inspect the value of
23565 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
23566 location @code{pc - 12} and the top 8 bits are set, then we know that
23567 there is a function name embedded immediately preceding this location
23568 and has length @code{((pc[-3]) & 0xff000000)}.
23570 @opindex marm
23571 @opindex mthumb
23572 @item -mthumb
23573 @itemx -marm
23575 Select between generating code that executes in ARM and Thumb
23576 states.  The default for most configurations is to generate code
23577 that executes in ARM state, but the default can be changed by
23578 configuring GCC with the @option{--with-mode=}@var{state}
23579 configure option.
23581 You can also override the ARM and Thumb mode for each function
23582 by using the @code{target("thumb")} and @code{target("arm")} function attributes
23583 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
23585 @opindex mflip-thumb
23586 @item -mflip-thumb 
23587 Switch ARM/Thumb modes on alternating functions.
23588 This option is provided for regression testing of mixed Thumb/ARM code
23589 generation, and is not intended for ordinary use in compiling code.
23591 @opindex mtpcs-frame
23592 @item -mtpcs-frame
23593 Generate a stack frame that is compliant with the Thumb Procedure Call
23594 Standard for all non-leaf functions.  (A leaf function is one that does
23595 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
23597 @opindex mtpcs-leaf-frame
23598 @item -mtpcs-leaf-frame
23599 Generate a stack frame that is compliant with the Thumb Procedure Call
23600 Standard for all leaf functions.  (A leaf function is one that does
23601 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
23603 @opindex mcallee-super-interworking
23604 @item -mcallee-super-interworking
23605 Gives all externally visible functions in the file being compiled an ARM
23606 instruction set header which switches to Thumb mode before executing the
23607 rest of the function.  This allows these functions to be called from
23608 non-interworking code.  This option is not valid in AAPCS configurations
23609 because interworking is enabled by default.
23611 @opindex mcaller-super-interworking
23612 @item -mcaller-super-interworking
23613 Allows calls via function pointers (including virtual functions) to
23614 execute correctly regardless of whether the target code has been
23615 compiled for interworking or not.  There is a small overhead in the cost
23616 of executing a function pointer if this option is enabled.  This option
23617 is not valid in AAPCS configurations because interworking is enabled
23618 by default.
23620 @opindex mtp
23621 @item -mtp=@var{name}
23622 Specify the access model for the thread local storage pointer.  The model
23623 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
23624 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
23625 the thread pointer from the corresponding system register directly
23626 (supported from the arm6k architecture and later).  These system registers
23627 are accessed through the CP15 co-processor interface and the argument
23628 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
23629 The argument @samp{auto} uses the best available method for the selected
23630 processor.  The default setting is @samp{auto}.
23632 @opindex mtls-dialect
23633 @item -mtls-dialect=@var{dialect}
23634 Specify the dialect to use for accessing thread local storage.  Two
23635 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
23636 @samp{gnu} dialect selects the original GNU scheme for supporting
23637 local and global dynamic TLS models.  The @samp{gnu2} dialect
23638 selects the GNU descriptor scheme, which provides better performance
23639 for shared libraries.  The GNU descriptor scheme is compatible with
23640 the original scheme, but does require new assembler, linker and
23641 library support.  Initial and local exec TLS models are unaffected by
23642 this option and always use the original scheme.
23644 @opindex mword-relocations
23645 @item -mword-relocations
23646 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
23647 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
23648 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
23649 is specified. This option conflicts with @option{-mslow-flash-data}.
23651 @opindex mfix-cortex-m3-ldrd
23652 @item -mfix-cortex-m3-ldrd
23653 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
23654 with overlapping destination and base registers are used.  This option avoids
23655 generating these instructions.  This option is enabled by default when
23656 @option{-mcpu=cortex-m3} is specified.
23658 @item -mfix-cortex-a57-aes-1742098
23659 @itemx -mno-fix-cortex-a57-aes-1742098
23660 @itemx -mfix-cortex-a72-aes-1655431
23661 @itemx -mno-fix-cortex-a72-aes-1655431
23662 Enable (disable) mitigation for an erratum on Cortex-A57 and
23663 Cortex-A72 that affects the AES cryptographic instructions.  This
23664 option is enabled by default when either @option{-mcpu=cortex-a57} or
23665 @option{-mcpu=cortex-a72} is specified.
23667 @opindex munaligned-access
23668 @opindex mno-unaligned-access
23669 @item -munaligned-access
23670 @itemx -mno-unaligned-access
23671 Enables (or disables) reading and writing of 16- and 32- bit values
23672 from addresses that are not 16- or 32- bit aligned.  By default
23673 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
23674 ARMv8-M Baseline architectures, and enabled for all other
23675 architectures.  If unaligned access is not enabled then words in packed
23676 data structures are accessed a byte at a time.
23678 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
23679 generated object file to either true or false, depending upon the
23680 setting of this option.  If unaligned access is enabled then the
23681 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
23682 defined.
23684 @opindex mneon-for-64bits
23685 @item -mneon-for-64bits
23686 This option is deprecated and has no effect.
23688 @opindex mslow-flash-data
23689 @item -mslow-flash-data
23690 Assume loading data from flash is slower than fetching instruction.
23691 Therefore literal load is minimized for better performance.
23692 This option is only supported when compiling for ARMv7 M-profile and
23693 off by default. It conflicts with @option{-mword-relocations}.
23695 @opindex masm-syntax-unified
23696 @item -masm-syntax-unified
23697 Assume inline assembler is using unified asm syntax.  The default is
23698 currently off which implies divided syntax.  This option has no impact
23699 on Thumb2. However, this may change in future releases of GCC.
23700 Divided syntax should be considered deprecated.
23702 @opindex mrestrict-it
23703 @item -mrestrict-it
23704 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
23705 IT blocks can only contain a single 16-bit instruction from a select
23706 set of instructions. This option is on by default for ARMv8-A Thumb mode.
23708 @opindex mprint-tune-info
23709 @item -mprint-tune-info
23710 Print CPU tuning information as comment in assembler file.  This is
23711 an option used only for regression testing of the compiler and not
23712 intended for ordinary use in compiling code.  This option is disabled
23713 by default.
23715 @opindex mverbose-cost-dump
23716 @item -mverbose-cost-dump
23717 Enable verbose cost model dumping in the debug dump files.  This option is
23718 provided for use in debugging the compiler.
23720 @opindex mpure-code
23721 @item -mpure-code
23722 Do not allow constant data to be placed in code sections.
23723 Additionally, when compiling for ELF object format give all text sections the
23724 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
23725 is only available when generating non-pic code for M-profile targets.
23727 @opindex mcmse
23728 @item -mcmse
23729 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
23730 Development Tools Engineering Specification", which can be found on
23731 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
23733 @opindex mfix-cmse-cve-2021-35465
23734 @item -mfix-cmse-cve-2021-35465
23735 Mitigate against a potential security issue with the @code{VLLDM} instruction
23736 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
23737 enabled by default when the option @option{-mcpu=} is used with
23738 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m52}, @code{cortex-m55},
23739 @code{cortex-m85} or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465}
23740 can be used to disable the mitigation.
23742 @opindex mstack-protector-guard
23743 @opindex mstack-protector-guard-offset
23744 @item -mstack-protector-guard=@var{guard}
23745 @itemx -mstack-protector-guard-offset=@var{offset}
23746 Generate stack protection code using canary at @var{guard}.  Supported
23747 locations are @samp{global} for a global canary or @samp{tls} for a
23748 canary accessible via the TLS register. The option
23749 @option{-mstack-protector-guard-offset=} is for use with
23750 @option{-fstack-protector-guard=tls} and not for use in user-land code.
23752 @opindex mfdpic
23753 @opindex mno-fdpic
23754 @item -mfdpic
23755 @itemx -mno-fdpic
23756 Select the FDPIC ABI, which uses 64-bit function descriptors to
23757 represent pointers to functions.  When the compiler is configured for
23758 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
23759 and implies @option{-fPIE} if none of the PIC/PIE-related options is
23760 provided.  On other targets, it only enables the FDPIC-specific code
23761 generation features, and the user should explicitly provide the
23762 PIC/PIE-related options as needed.
23764 Note that static linking is not supported because it would still
23765 involve the dynamic linker when the program self-relocates.  If such
23766 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
23768 The opposite @option{-mno-fdpic} option is useful (and required) to
23769 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
23770 toolchain as the one used to build the userland programs.
23772 @opindex mbranch-protection
23773 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
23774 Enable branch protection features (armv8.1-m.main only).
23775 @samp{none} generate code without branch protection or return address
23776 signing.
23777 @samp{standard[+@var{leaf}]} generate code with all branch protection
23778 features enabled at their standard level.
23779 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
23780 set to its standard level, which is to sign all functions that save
23781 the return address to memory.
23782 @samp{leaf} When return address signing is enabled, also sign leaf
23783 functions even if they do not write the return address to memory.
23784 +@samp{bti} Add landing-pad instructions at the permitted targets of
23785 indirect branch instructions.
23787 If the @samp{+pacbti} architecture extension is not enabled, then all
23788 branch protection and return address signing operations are
23789 constrained to use only the instructions defined in the
23790 architectural-NOP space. The generated code will remain
23791 backwards-compatible with earlier versions of the architecture, but
23792 the additional security can be enabled at run time on processors that
23793 support the @samp{PACBTI} extension.
23795 Branch target enforcement using BTI can only be enabled at runtime if
23796 all code in the application has been compiled with at least
23797 @samp{-mbranch-protection=bti}.
23799 Any setting other than @samp{none} is supported only on armv8-m.main
23800 or later.
23802 The default is to generate code without branch protection or return
23803 address signing.
23805 @end table
23807 @node AVR Options
23808 @subsection AVR Options
23809 @cindex AVR Options
23811 These options are defined for AVR implementations:
23813 @table @gcctabopt
23814 @opindex mmcu
23815 @item -mmcu=@var{mcu}
23816 Specify the AVR instruction set architecture (ISA) or device type.
23817 The default for this option is@tie{}@code{avr2}.
23819 The following AVR devices and ISAs are supported.
23820 @emph{Note:} A complete device support consists of
23821 startup code @code{crt@var{mcu}.o}, a device header @code{avr/io*.h},
23822 a device library @code{lib@var{mcu}.a} and a
23823 @uref{https://gcc.gnu.org/wiki/avr-gcc#spec-files,device-specs} file
23824 @code{specs-@var{mcu}}. Only the latter is provided by the compiler
23825 according the supported @code{@var{mcu}}s below.  The rest is supported
23826 by @w{@uref{https://www.nongnu.org/avr-libc/,AVR-LibC}}, or by means of
23827 @uref{https://gcc.gnu.org/wiki/avr-gcc#atpack,@code{atpack}} files
23828 from the hardware manufacturer.
23830 @c Auto-generated.  Re-build when new devices are added to avr-mcus.def
23831 @c by running "make avr-mcus" in $builddir/gcc.
23832 @include avr-mmcu.texi
23834 @opindex mabsdata
23835 @item -mabsdata
23837 Assume that all data in static storage can be accessed by LDS / STS
23838 instructions.  This option has only an effect on reduced Tiny devices like
23839 ATtiny40.  See also the @code{absdata}
23840 @ref{AVR Variable Attributes,variable attribute}.
23842 @opindex maccumulate-args
23843 @item -maccumulate-args
23844 Accumulate outgoing function arguments and acquire/release the needed
23845 stack space for outgoing function arguments once in function
23846 prologue/epilogue.  Without this option, outgoing arguments are pushed
23847 before calling a function and popped afterwards.
23849 Popping the arguments after the function call can be expensive on
23850 AVR so that accumulating the stack space might lead to smaller
23851 executables because arguments need not be removed from the
23852 stack after such a function call.
23854 This option can lead to reduced code size for functions that perform
23855 several calls to functions that get their arguments on the stack like
23856 calls to printf-like functions.
23858 @opindex mbranch-cost
23859 @item -mbranch-cost=@var{cost}
23860 Set the branch costs for conditional branch instructions to
23861 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23862 integers. The default branch cost is 0.
23864 @opindex mcall-prologues
23865 @item -mcall-prologues
23866 Functions prologues/epilogues are expanded as calls to appropriate
23867 subroutines.  Code size is smaller.
23869 @opindex mfuse-add
23870 @item -mfuse-add
23871 @itemx -mno-fuse-add
23872 @itemx -mfuse-add=@var{level}
23873 Optimize indirect memory accesses on reduced Tiny devices.
23874 The default uses @code{@var{level}=1} for optimizations @option{-Og}
23875 and @option{-O1}, and @code{@var{level}=2} for higher optimizations.
23876 Valid values for @var{level} are @code{0}, @code{1} and @code{2}.
23878 @opindex mdouble
23879 @opindex mlong-double
23880 @item -mdouble=@var{bits}
23881 @itemx -mlong-double=@var{bits}
23882 Set the size (in bits) of the @code{double} or @code{long double} type,
23883 respectively.  Possible values for @var{bits} are 32 and 64.
23884 Whether or not a specific value for @var{bits} is allowed depends on
23885 the @code{--with-double=} and @code{--with-long-double=}
23886 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23887 and the same applies for the default values of the options.
23889 @opindex mgas-isr-prologues
23890 @item -mgas-isr-prologues
23891 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23892 instruction supported by GNU Binutils.
23893 If this option is on, the feature can still be disabled for individual
23894 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23895 function attribute.  This feature is activated per default
23896 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23897 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23899 @opindex mint8
23900 @item -mint8
23901 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23902 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23903 and @code{long long} is 4 bytes.  Please note that this option does not
23904 conform to the C standards, but it results in smaller code
23905 size.
23907 @opindex mmain-is-OS_task
23908 @item -mmain-is-OS_task
23909 Do not save registers in @code{main}.  The effect is the same like
23910 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23911 to @code{main}. It is activated per default if optimization is on.
23913 @opindex mno-interrupts
23914 @item -mno-interrupts
23915 Generated code is not compatible with hardware interrupts.
23916 Code size is smaller.
23918 @opindex mrelax
23919 @item -mrelax
23920 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23921 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23922 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23923 the assembler's command line and the @option{--relax} option to the
23924 linker's command line.
23926 Jump relaxing is performed by the linker because jump offsets are not
23927 known before code is located. Therefore, the assembler code generated by the
23928 compiler is the same, but the instructions in the executable may
23929 differ from instructions in the assembler code.
23931 Relaxing must be turned on if linker stubs are needed, see the
23932 section on @code{EIND} and linker stubs below.
23934 @opindex mrodata-in-ram
23935 @item -mrodata-in-ram
23936 @itemx -mno-rodata-in-ram
23937 Locate the @code{.rodata} sections for read-only data in RAM resp.@:
23938 in program memory.
23939 For most devices, there is no choice and this option acts rather
23940 like an assertion.
23942 Since v14 and for the AVR64* and AVR128* devices, @code{.rodata}
23943 is located in flash memory per default, provided the required GNU Binutils
23944 support (@w{@uref{https://sourceware.org/PR31124,PR31124}}) is available.
23945 In that case, @option{-mrodata-in-ram} can be used to return to the old
23946 layout with @code{.rodata} in RAM.
23948 @opindex mstrict-X
23949 @item -mstrict-X
23950 Use address register @code{X} in a way proposed by the hardware.  This means
23951 that @code{X} is only used in indirect, post-increment or
23952 pre-decrement addressing.
23954 Without this option, the @code{X} register may be used in the same way
23955 as @code{Y} or @code{Z} which then is emulated by additional
23956 instructions.  
23957 For example, loading a value with @code{X+const} addressing with a
23958 small non-negative @code{const < 64} to a register @var{Rn} is
23959 performed as
23961 @example
23962 adiw r26, const   ; X += const
23963 ld   @var{Rn}, X        ; @var{Rn} = *X
23964 sbiw r26, const   ; X -= const
23965 @end example
23967 @opindex mtiny-stack
23968 @item -mtiny-stack
23969 Only change the lower 8@tie{}bits of the stack pointer.
23971 @opindex mfract-convert-truncate
23972 @item -mfract-convert-truncate
23973 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23975 @opindex nodevicelib
23976 @item -nodevicelib
23977 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23979 @opindex nodevicespecs
23980 @item -nodevicespecs
23981 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23982 command line.  The user takes responsibility for supplying the sub-processes
23983 like compiler proper, assembler and linker with appropriate command line
23984 options.  This means that the user has to supply her private device specs
23985 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23986 more need for option @option{-mmcu=@var{mcu}}.
23988 This option can also serve as a replacement for the older way of
23989 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23990 which contains a folder named @code{device-specs} which contains a specs file named
23991 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23993 @opindex Waddr-space-convert
23994 @opindex Wno-addr-space-convert
23995 @item -Waddr-space-convert
23996 Warn about conversions between address spaces in the case where the
23997 resulting address space is not contained in the incoming address space.
23999 @opindex Wmisspelled-isr
24000 @opindex Wno-misspelled-isr
24001 @item -Wmisspelled-isr
24002 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
24003 Enabled by default.
24004 @end table
24006 @anchor{eind}
24007 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
24008 @cindex @code{EIND}
24009 Pointers in the implementation are 16@tie{}bits wide.
24010 The address of a function or label is represented as word address so
24011 that indirect jumps and calls can target any code address in the
24012 range of 64@tie{}Ki words.
24014 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
24015 bytes of program memory space, there is a special function register called
24016 @code{EIND} that serves as most significant part of the target address
24017 when @code{EICALL} or @code{EIJMP} instructions are used.
24019 Indirect jumps and calls on these devices are handled as follows by
24020 the compiler and are subject to some limitations:
24022 @itemize @bullet
24024 @item
24025 The compiler never sets @code{EIND}.
24027 @item
24028 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
24029 instructions or might read @code{EIND} directly in order to emulate an
24030 indirect call/jump by means of a @code{RET} instruction.
24032 @item
24033 The compiler assumes that @code{EIND} never changes during the startup
24034 code or during the application. In particular, @code{EIND} is not
24035 saved/restored in function or interrupt service routine
24036 prologue/epilogue.
24038 @item
24039 For indirect calls to functions and computed goto, the linker
24040 generates @emph{stubs}. Stubs are jump pads sometimes also called
24041 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
24042 The stub contains a direct jump to the desired address.
24044 @item
24045 Linker relaxation must be turned on so that the linker generates
24046 the stubs correctly in all situations. See the compiler option
24047 @option{-mrelax} and the linker option @option{--relax}.
24048 There are corner cases where the linker is supposed to generate stubs
24049 but aborts without relaxation and without a helpful error message.
24051 @item
24052 The default linker script is arranged for code with @code{EIND = 0}.
24053 If code is supposed to work for a setup with @code{EIND != 0}, a custom
24054 linker script has to be used in order to place the sections whose
24055 name start with @code{.trampolines} into the segment where @code{EIND}
24056 points to.
24058 @item
24059 The startup code from libgcc never sets @code{EIND}.
24060 Notice that startup code is a blend of code from libgcc and AVR-LibC.
24061 For the impact of AVR-LibC on @code{EIND}, see the
24062 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
24064 @item
24065 It is legitimate for user-specific startup code to set up @code{EIND}
24066 early, for example by means of initialization code located in
24067 section @code{.init3}. Such code runs prior to general startup code
24068 that initializes RAM and calls constructors, but after the bit
24069 of startup code from AVR-LibC that sets @code{EIND} to the segment
24070 where the vector table is located.
24071 @example
24072 #include <avr/io.h>
24074 static void
24075 __attribute__((section(".init3"),naked,used,no_instrument_function))
24076 init3_set_eind (void)
24078   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
24079                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
24081 @end example
24083 @noindent
24084 The @code{__trampolines_start} symbol is defined in the linker script.
24086 @item
24087 Stubs are generated automatically by the linker if
24088 the following two conditions are met:
24089 @itemize @minus
24091 @item The address of a label is taken by means of the @code{gs} modifier
24092 (short for @emph{generate stubs}) like so:
24093 @example
24094 LDI r24, lo8(gs(@var{func}))
24095 LDI r25, hi8(gs(@var{func}))
24096 @end example
24097 @item The final location of that label is in a code segment
24098 @emph{outside} the segment where the stubs are located.
24099 @end itemize
24101 @item
24102 The compiler emits such @code{gs} modifiers for code labels in the
24103 following situations:
24104 @itemize @minus
24105 @item Taking address of a function or code label.
24106 @item Computed goto.
24107 @item If prologue-save function is used, see @option{-mcall-prologues}
24108 command-line option.
24109 @item Switch/case dispatch tables. If you do not want such dispatch
24110 tables you can specify the @option{-fno-jump-tables} command-line option.
24111 @item C and C++ constructors/destructors called during startup/shutdown.
24112 @item If the tools hit a @code{gs()} modifier explained above.
24113 @end itemize
24115 @item
24116 Jumping to non-symbolic addresses like so is @emph{not} supported:
24118 @example
24119 int main (void)
24121     /* Call function at word address 0x2 */
24122     return ((int(*)(void)) 0x2)();
24124 @end example
24126 Instead, a stub has to be set up, i.e.@: the function has to be called
24127 through a symbol (@code{func_4} in the example):
24129 @example
24130 int main (void)
24132     extern int func_4 (void);
24134     /* Call function at byte address 0x4 */
24135     return func_4();
24137 @end example
24139 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
24140 Alternatively, @code{func_4} can be defined in the linker script.
24141 @end itemize
24143 @anchor{ramp}
24144 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
24145 @cindex @code{RAMPD}
24146 @cindex @code{RAMPX}
24147 @cindex @code{RAMPY}
24148 @cindex @code{RAMPZ}
24149 Some AVR devices support memories larger than the 64@tie{}KiB range
24150 that can be accessed with 16-bit pointers.  To access memory locations
24151 outside this 64@tie{}KiB range, the content of a @code{RAMP}
24152 register is used as high part of the address:
24153 The @code{X}, @code{Y}, @code{Z} address register is concatenated
24154 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
24155 register, respectively, to get a wide address. Similarly,
24156 @code{RAMPD} is used together with direct addressing.
24158 @itemize
24159 @item
24160 The startup code initializes the @code{RAMP} special function
24161 registers with zero.
24163 @item
24164 If a @ref{AVR Named Address Spaces,named address space} other than
24165 generic or @code{__flash} is used, then @code{RAMPZ} is set
24166 as needed before the operation.
24168 @item
24169 If the device supports RAM larger than 64@tie{}KiB and the compiler
24170 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
24171 is reset to zero after the operation.
24173 @item
24174 If the device comes with a specific @code{RAMP} register, the ISR
24175 prologue/epilogue saves/restores that SFR and initializes it with
24176 zero in case the ISR code might (implicitly) use it.
24178 @item
24179 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
24180 If you use inline assembler to read from locations outside the
24181 16-bit address range and change one of the @code{RAMP} registers,
24182 you must reset it to zero after the access.
24184 @end itemize
24186 @anchor{avr-macros}
24187 @subsubsection AVR Built-in Macros
24189 GCC defines several built-in macros so that the user code can test
24190 for the presence or absence of features.  Almost any of the following
24191 built-in macros are deduced from device capabilities and thus
24192 triggered by the @option{-mmcu=} command-line option.
24194 For even more AVR-specific built-in macros see
24195 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
24197 @table @code
24199 @item __AVR_ARCH__
24200 Build-in macro that resolves to a decimal number that identifies the
24201 architecture and depends on the @option{-mmcu=@var{mcu}} option.
24202 Possible values are:
24204 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
24205 @code{4}, @code{5}, @code{51}, @code{6}
24207 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
24208 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
24210 respectively and
24212 @code{100},
24213 @code{102}, @code{103}, @code{104},
24214 @code{105}, @code{106}, @code{107}
24216 for @var{mcu}=@code{avrtiny},
24217 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
24218 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
24219 If @var{mcu} specifies a device, this built-in macro is set
24220 accordingly. For example, with @option{-mmcu=atmega8} the macro is
24221 defined to @code{4}.
24223 @item __AVR_@var{Device}__
24224 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
24225 the device's name. For example, @option{-mmcu=atmega8} defines the
24226 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
24227 @code{__AVR_ATtiny261A__}, etc.
24229 The built-in macros' names follow
24230 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
24231 the device name as from the AVR user manual. The difference between
24232 @var{Device} in the built-in macro and @var{device} in
24233 @option{-mmcu=@var{device}} is that the latter is always lowercase.
24235 If @var{device} is not a device but only a core architecture like
24236 @samp{avr51}, this macro is not defined.
24238 @item __AVR_DEVICE_NAME__
24239 Setting @option{-mmcu=@var{device}} defines this built-in macro to
24240 the device's name. For example, with @option{-mmcu=atmega8} the macro
24241 is defined to @code{atmega8}.
24243 If @var{device} is not a device but only a core architecture like
24244 @samp{avr51}, this macro is not defined.
24246 @item __AVR_XMEGA__
24247 The device / architecture belongs to the XMEGA family of devices.
24249 @item __AVR_HAVE_ADIW__
24250 The device has the @code{ADIW} and @code{SBIW} instructions.
24252 @item __AVR_HAVE_ELPM__
24253 The device has the @code{ELPM} instruction.
24255 @item __AVR_HAVE_ELPMX__
24256 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
24257 R@var{n},Z+} instructions.
24259 @item __AVR_HAVE_LPMX__
24260 The device has the @code{LPM R@var{n},Z} and
24261 @code{LPM R@var{n},Z+} instructions.
24263 @item __AVR_HAVE_MOVW__
24264 The device has the @code{MOVW} instruction to perform 16-bit
24265 register-register moves.
24267 @item __AVR_HAVE_MUL__
24268 The device has a hardware multiplier. 
24270 @item __AVR_HAVE_JMP_CALL__
24271 The device has the @code{JMP} and @code{CALL} instructions.
24272 This is the case for devices with more than 8@tie{}KiB of program
24273 memory.
24275 @item __AVR_HAVE_EIJMP_EICALL__
24276 @itemx __AVR_3_BYTE_PC__
24277 The device has the @code{EIJMP} and @code{EICALL} instructions.
24278 This is the case for devices with more than 128@tie{}KiB of program memory.
24279 This also means that the program counter
24280 (PC) is 3@tie{}bytes wide.
24282 @item __AVR_2_BYTE_PC__
24283 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
24284 with up to 128@tie{}KiB of program memory.
24286 @item __AVR_HAVE_8BIT_SP__
24287 @itemx __AVR_HAVE_16BIT_SP__
24288 The stack pointer (SP) register is treated as 8-bit respectively
24289 16-bit register by the compiler.
24290 The definition of these macros is affected by @option{-mtiny-stack}.
24292 @item __AVR_HAVE_SPH__
24293 @itemx __AVR_SP8__
24294 The device has the SPH (high part of stack pointer) special function
24295 register or has an 8-bit stack pointer, respectively.
24296 The definition of these macros is affected by @option{-mmcu=} and
24297 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
24298 by @option{-msp8}.
24300 @item __AVR_HAVE_RAMPD__
24301 @itemx __AVR_HAVE_RAMPX__
24302 @itemx __AVR_HAVE_RAMPY__
24303 @itemx __AVR_HAVE_RAMPZ__
24304 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
24305 @code{RAMPZ} special function register, respectively.
24307 @item __NO_INTERRUPTS__
24308 This macro reflects the @option{-mno-interrupts} command-line option.
24310 @item __AVR_ERRATA_SKIP__
24311 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
24312 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
24313 instructions because of a hardware erratum.  Skip instructions are
24314 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
24315 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
24316 set.
24318 @item __AVR_ISA_RMW__
24319 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
24321 @item __AVR_SFR_OFFSET__=@var{offset}
24322 Instructions that can address I/O special function registers directly
24323 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
24324 address as if addressed by an instruction to access RAM like @code{LD}
24325 or @code{STS}. This offset depends on the device architecture and has
24326 to be subtracted from the RAM address in order to get the
24327 respective I/O@tie{}address.
24329 @item __AVR_SHORT_CALLS__
24330 The @option{-mshort-calls} command line option is set.
24332 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
24333 Some devices support reading from flash memory by means of @code{LD*}
24334 instructions.  The flash memory is seen in the data address space
24335 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
24336 is not defined, this feature is not available.  If defined,
24337 the address space is linear and there is no need to put
24338 @code{.rodata} into RAM.  This is handled by the default linker
24339 description file, and is currently available for
24340 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
24341 there is no need to use address spaces like @code{__flash} or
24342 features like attribute @code{progmem} and @code{pgm_read_*}.
24344 @item __AVR_HAVE_FLMAP__
24345 This macro is defined provided the following conditions are met:
24346 @itemize @bullet
24347 @item The device has the @code{NVMCTRL_CTRLB.FLMAP} bitfield.
24348 This applies to the AVR64* and AVR128* devices.
24349 @item It's not known at assembler-time which emulation will be used.
24350 @end itemize
24351 This implies the compiler was configured with GNU Binutils that implement
24352 @w{@uref{https://sourceware.org/PR31124,PR31124}}.
24354 @item __AVR_RODATA_IN_RAM__
24355 This macro is undefined when the code is compiled for a core architecture.
24357 When the code is compiled for a device, the macro is defined to@tie{}1
24358 when the @code{.rodata} sections for read-only data is located in RAM;
24359 and defined to@tie{}0, otherwise.
24361 @item __WITH_AVRLIBC__
24362 The compiler is configured to be used together with AVR-Libc.
24363 See the @option{--with-avrlibc} configure option.
24365 @item __HAVE_DOUBLE_MULTILIB__
24366 Defined if @option{-mdouble=} acts as a multilib option.
24368 @item __HAVE_DOUBLE32__
24369 @itemx __HAVE_DOUBLE64__
24370 Defined if the compiler supports 32-bit double resp. 64-bit double.
24371 The actual layout is specified by option @option{-mdouble=}.
24373 @item __DEFAULT_DOUBLE__
24374 The size in bits of @code{double} if @option{-mdouble=} is not set.
24375 To test the layout of @code{double} in a program, use the built-in
24376 macro @code{__SIZEOF_DOUBLE__}.
24378 @item __HAVE_LONG_DOUBLE32__
24379 @itemx __HAVE_LONG_DOUBLE64__
24380 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
24381 @itemx __DEFAULT_LONG_DOUBLE__
24382 Same as above, but for @code{long double} instead of @code{double}.
24384 @item __WITH_DOUBLE_COMPARISON__
24385 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
24386 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
24387 and is defined to @code{2} or @code{3}.
24389 @item __WITH_LIBF7_LIBGCC__
24390 @itemx __WITH_LIBF7_MATH__
24391 @itemx __WITH_LIBF7_MATH_SYMBOLS__
24392 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
24393 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
24395 @end table
24397 @subsubsection AVR Internal Options
24398 The following options are used internally by the compiler and to communicate
24399 between device specs files and the compiler proper. You don't need to set these
24400 options by hand, in particular they are not optimization options.
24401 Using these options in the wrong way may lead to sub-optimal or wrong code.
24402 They are documented for completeness, and in order to get a better
24403 understanding of
24404 @w{@uref{https://gcc.gnu.org/wiki/avr-gcc#spec-files,device specs}}
24405 files.
24407 @table @gcctabopt
24409 @opindex mn-flash
24410 @item -mn-flash=@var{num}
24411 Assume that the flash memory has a size of @var{num} times 64@tie{}KiB.
24412 This determines which @code{__flash@var{N}} address spaces are available.
24414 @opindex mflmap
24415 @item -mflmap
24416 The device has the @code{FLMAP} bit field located in special function
24417 register @code{NVMCTRL_CTRLB}.
24419 @opindex mrmw
24420 @item -mrmw
24421 Assume that the device supports the Read-Modify-Write
24422 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
24424 @opindex mshort-calls
24425 @item -mshort-calls
24427 Assume that @code{RJMP} and @code{RCALL} can target the whole
24428 program memory. This option is used for multilib generation and selection
24429 for the devices from architecture @code{avrxmega3}.
24431 @opindex mskip-bug
24432 @item -mskip-bug
24434 Generate code without skips (@code{CPSE}, @code{SBRS},
24435 @code{SBRC}, @code{SBIS}, @code{SBIC}) over 32-bit instructions.
24437 @opindex msp8
24438 @item -msp8
24439 Treat the stack pointer register as an 8-bit register,
24440 i.e.@: assume the high byte of the stack pointer is zero.
24441 This option is used by the compiler to select and
24442 build multilibs for architectures @code{avr2} and @code{avr25}.
24443 These architectures mix devices with and without @code{SPH}.
24445 @end table
24447 @node Blackfin Options
24448 @subsection Blackfin Options
24449 @cindex Blackfin Options
24451 @table @gcctabopt
24452 @opindex mcpu=
24453 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
24454 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
24455 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
24456 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
24457 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
24458 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
24459 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
24460 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
24461 @samp{bf561}, @samp{bf592}.
24463 The optional @var{sirevision} specifies the silicon revision of the target
24464 Blackfin processor.  Any workarounds available for the targeted silicon revision
24465 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
24466 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
24467 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
24468 hexadecimal digits representing the major and minor numbers in the silicon
24469 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
24470 is not defined.  If @var{sirevision} is @samp{any}, the
24471 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
24472 If this optional @var{sirevision} is not used, GCC assumes the latest known
24473 silicon revision of the targeted Blackfin processor.
24475 GCC defines a preprocessor macro for the specified @var{cpu}.
24476 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
24477 provided by libgloss to be linked in if @option{-msim} is not given.
24479 Without this option, @samp{bf532} is used as the processor by default.
24481 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
24482 only the preprocessor macro is defined.
24484 @opindex msim
24485 @item -msim
24486 Specifies that the program will be run on the simulator.  This causes
24487 the simulator BSP provided by libgloss to be linked in.  This option
24488 has effect only for @samp{bfin-elf} toolchain.
24489 Certain other options, such as @option{-mid-shared-library} and
24490 @option{-mfdpic}, imply @option{-msim}.
24492 @opindex momit-leaf-frame-pointer
24493 @item -momit-leaf-frame-pointer
24494 Don't keep the frame pointer in a register for leaf functions.  This
24495 avoids the instructions to save, set up and restore frame pointers and
24496 makes an extra register available in leaf functions.
24498 @opindex mspecld-anomaly
24499 @item -mspecld-anomaly
24500 When enabled, the compiler ensures that the generated code does not
24501 contain speculative loads after jump instructions. If this option is used,
24502 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
24504 @opindex mno-specld-anomaly
24505 @opindex mspecld-anomaly
24506 @item -mno-specld-anomaly
24507 Don't generate extra code to prevent speculative loads from occurring.
24509 @opindex mcsync-anomaly
24510 @item -mcsync-anomaly
24511 When enabled, the compiler ensures that the generated code does not
24512 contain CSYNC or SSYNC instructions too soon after conditional branches.
24513 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
24515 @opindex mno-csync-anomaly
24516 @opindex mcsync-anomaly
24517 @item -mno-csync-anomaly
24518 Don't generate extra code to prevent CSYNC or SSYNC instructions from
24519 occurring too soon after a conditional branch.
24521 @opindex mlow64k
24522 @item -mlow64k
24523 When enabled, the compiler is free to take advantage of the knowledge that
24524 the entire program fits into the low 64k of memory.
24526 @opindex mno-low64k
24527 @item -mno-low64k
24528 Assume that the program is arbitrarily large.  This is the default.
24530 @opindex mstack-check-l1
24531 @item -mstack-check-l1
24532 Do stack checking using information placed into L1 scratchpad memory by the
24533 uClinux kernel.
24535 @opindex mid-shared-library
24536 @item -mid-shared-library
24537 Generate code that supports shared libraries via the library ID method.
24538 This allows for execute in place and shared libraries in an environment
24539 without virtual memory management.  This option implies @option{-fPIC}.
24540 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24542 @opindex mno-id-shared-library
24543 @opindex mid-shared-library
24544 @item -mno-id-shared-library
24545 Generate code that doesn't assume ID-based shared libraries are being used.
24546 This is the default.
24548 @opindex mleaf-id-shared-library
24549 @item -mleaf-id-shared-library
24550 Generate code that supports shared libraries via the library ID method,
24551 but assumes that this library or executable won't link against any other
24552 ID shared libraries.  That allows the compiler to use faster code for jumps
24553 and calls.
24555 @opindex mno-leaf-id-shared-library
24556 @opindex mleaf-id-shared-library
24557 @item -mno-leaf-id-shared-library
24558 Do not assume that the code being compiled won't link against any ID shared
24559 libraries.  Slower code is generated for jump and call insns.
24561 @opindex mshared-library-id
24562 @item -mshared-library-id=n
24563 Specifies the identification number of the ID-based shared library being
24564 compiled.  Specifying a value of 0 generates more compact code; specifying
24565 other values forces the allocation of that number to the current
24566 library but is no more space- or time-efficient than omitting this option.
24568 @opindex msep-data
24569 @item -msep-data
24570 Generate code that allows the data segment to be located in a different
24571 area of memory from the text segment.  This allows for execute in place in
24572 an environment without virtual memory management by eliminating relocations
24573 against the text section.
24575 @opindex mno-sep-data
24576 @opindex msep-data
24577 @item -mno-sep-data
24578 Generate code that assumes that the data segment follows the text segment.
24579 This is the default.
24581 @opindex mlong-calls
24582 @opindex mno-long-calls
24583 @item -mlong-calls
24584 @itemx -mno-long-calls
24585 Tells the compiler to perform function calls by first loading the
24586 address of the function into a register and then performing a subroutine
24587 call on this register.  This switch is needed if the target function
24588 lies outside of the 24-bit addressing range of the offset-based
24589 version of subroutine call instruction.
24591 This feature is not enabled by default.  Specifying
24592 @option{-mno-long-calls} restores the default behavior.  Note these
24593 switches have no effect on how the compiler generates code to handle
24594 function calls via function pointers.
24596 @opindex mfast-fp
24597 @item -mfast-fp
24598 Link with the fast floating-point library. This library relaxes some of
24599 the IEEE floating-point standard's rules for checking inputs against
24600 Not-a-Number (NAN), in the interest of performance.
24602 @opindex minline-plt
24603 @item -minline-plt
24604 Enable inlining of PLT entries in function calls to functions that are
24605 not known to bind locally.  It has no effect without @option{-mfdpic}.
24607 @opindex mmulticore
24608 @item -mmulticore
24609 Build a standalone application for multicore Blackfin processors. 
24610 This option causes proper start files and link scripts supporting 
24611 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
24612 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
24614 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
24615 selects the one-application-per-core programming model.  Without
24616 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
24617 programming model is used. In this model, the main function of Core B
24618 should be named as @code{coreb_main}.
24620 If this option is not used, the single-core application programming
24621 model is used.
24623 @opindex mcorea
24624 @item -mcorea
24625 Build a standalone application for Core A of BF561 when using
24626 the one-application-per-core programming model. Proper start files
24627 and link scripts are used to support Core A, and the macro
24628 @code{__BFIN_COREA} is defined.
24629 This option can only be used in conjunction with @option{-mmulticore}.
24631 @opindex mcoreb
24632 @item -mcoreb
24633 Build a standalone application for Core B of BF561 when using
24634 the one-application-per-core programming model. Proper start files
24635 and link scripts are used to support Core B, and the macro
24636 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
24637 should be used instead of @code{main}. 
24638 This option can only be used in conjunction with @option{-mmulticore}.
24640 @opindex msdram
24641 @item -msdram
24642 Build a standalone application for SDRAM. Proper start files and
24643 link scripts are used to put the application into SDRAM, and the macro
24644 @code{__BFIN_SDRAM} is defined.
24645 The loader should initialize SDRAM before loading the application.
24647 @opindex micplb
24648 @item -micplb
24649 Assume that ICPLBs are enabled at run time.  This has an effect on certain
24650 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
24651 are enabled; for standalone applications the default is off.
24652 @end table
24654 @node C6X Options
24655 @subsection C6X Options
24656 @cindex C6X Options
24658 @table @gcctabopt
24659 @opindex march
24660 @item -march=@var{name}
24661 This specifies the name of the target architecture.  GCC uses this
24662 name to determine what kind of instructions it can emit when generating
24663 assembly code.  Permissible names are: @samp{c62x},
24664 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
24666 @opindex mbig-endian
24667 @item -mbig-endian
24668 Generate code for a big-endian target.
24670 @opindex mlittle-endian
24671 @item -mlittle-endian
24672 Generate code for a little-endian target.  This is the default.
24674 @opindex msim
24675 @item -msim
24676 Choose startup files and linker script suitable for the simulator.
24678 @opindex msdata=default
24679 @item -msdata=default
24680 Put small global and static data in the @code{.neardata} section,
24681 which is pointed to by register @code{B14}.  Put small uninitialized
24682 global and static data in the @code{.bss} section, which is adjacent
24683 to the @code{.neardata} section.  Put small read-only data into the
24684 @code{.rodata} section.  The corresponding sections used for large
24685 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
24687 @opindex msdata=all
24688 @item -msdata=all
24689 Put all data, not just small objects, into the sections reserved for
24690 small data, and use addressing relative to the @code{B14} register to
24691 access them.
24693 @opindex msdata=none
24694 @item -msdata=none
24695 Make no use of the sections reserved for small data, and use absolute
24696 addresses to access all data.  Put all initialized global and static
24697 data in the @code{.fardata} section, and all uninitialized data in the
24698 @code{.far} section.  Put all constant data into the @code{.const}
24699 section.
24700 @end table
24702 @node CRIS Options
24703 @subsection CRIS Options
24704 @cindex CRIS Options
24706 These options are defined specifically for the CRIS ports.
24708 @table @gcctabopt
24709 @opindex march
24710 @opindex mcpu
24711 @item -march=@var{architecture-type}
24712 @itemx -mcpu=@var{architecture-type}
24713 Generate code for the specified architecture.  The choices for
24714 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
24715 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
24716 Default is @samp{v0}.
24718 @opindex mtune
24719 @item -mtune=@var{architecture-type}
24720 Tune to @var{architecture-type} everything applicable about the generated
24721 code, except for the ABI and the set of available instructions.  The
24722 choices for @var{architecture-type} are the same as for
24723 @option{-march=@var{architecture-type}}.
24725 @opindex mmax-stack-frame
24726 @item -mmax-stack-frame=@var{n}
24727 Warn when the stack frame of a function exceeds @var{n} bytes.
24729 @opindex metrax4
24730 @opindex metrax100
24731 @item -metrax4
24732 @itemx -metrax100
24733 The options @option{-metrax4} and @option{-metrax100} are synonyms for
24734 @option{-march=v3} and @option{-march=v8} respectively.
24736 @opindex mmul-bug-workaround
24737 @opindex mno-mul-bug-workaround
24738 @item -mmul-bug-workaround
24739 @itemx -mno-mul-bug-workaround
24740 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
24741 models where it applies.  This option is disabled by default.
24743 @opindex mpdebug
24744 @item -mpdebug
24745 Enable CRIS-specific verbose debug-related information in the assembly
24746 code.  This option also has the effect of turning off the @samp{#NO_APP}
24747 formatted-code indicator to the assembler at the beginning of the
24748 assembly file.
24750 @opindex mcc-init
24751 @item -mcc-init
24752 Do not use condition-code results from previous instruction; always emit
24753 compare and test instructions before use of condition codes.
24755 @opindex mno-side-effects
24756 @opindex mside-effects
24757 @item -mno-side-effects
24758 Do not emit instructions with side effects in addressing modes other than
24759 post-increment.
24761 @opindex mstack-align
24762 @opindex mno-stack-align
24763 @opindex mdata-align
24764 @opindex mno-data-align
24765 @opindex mconst-align
24766 @opindex mno-const-align
24767 @item -mstack-align
24768 @itemx -mno-stack-align
24769 @itemx -mdata-align
24770 @itemx -mno-data-align
24771 @itemx -mconst-align
24772 @itemx -mno-const-align
24773 These options (@samp{no-} options) arrange (eliminate arrangements) for the
24774 stack frame, individual data and constants to be aligned for the maximum
24775 single data access size for the chosen CPU model.  The default is to
24776 arrange for 32-bit alignment.  ABI details such as structure layout are
24777 not affected by these options.
24779 @opindex m32-bit
24780 @opindex m16-bit
24781 @opindex m8-bit
24782 @item -m32-bit
24783 @itemx -m16-bit
24784 @itemx -m8-bit
24785 Similar to the stack- data- and const-align options above, these options
24786 arrange for stack frame, writable data and constants to all be 32-bit,
24787 16-bit or 8-bit aligned.  The default is 32-bit alignment.
24789 @opindex mno-prologue-epilogue
24790 @opindex mprologue-epilogue
24791 @item -mno-prologue-epilogue
24792 @itemx -mprologue-epilogue
24793 With @option{-mno-prologue-epilogue}, the normal function prologue and
24794 epilogue which set up the stack frame are omitted and no return
24795 instructions or return sequences are generated in the code.  Use this
24796 option only together with visual inspection of the compiled code: no
24797 warnings or errors are generated when call-saved registers must be saved,
24798 or storage for local variables needs to be allocated.
24800 @opindex melf
24801 @item -melf
24802 Legacy no-op option.
24804 @opindex sim
24805 @item -sim
24806 This option arranges
24807 to link with input-output functions from a simulator library.  Code,
24808 initialized data and zero-initialized data are allocated consecutively.
24810 @opindex sim2
24811 @item -sim2
24812 Like @option{-sim}, but pass linker options to locate initialized data at
24813 0x40000000 and zero-initialized data at 0x80000000.
24814 @end table
24816 @node C-SKY Options
24817 @subsection C-SKY Options
24818 @cindex C-SKY Options
24820 GCC supports these options when compiling for C-SKY V2 processors.
24822 @table @gcctabopt
24824 @opindex march=
24825 @item -march=@var{arch}
24826 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
24827 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
24828 The default is @samp{ck810}.
24830 @opindex mcpu=
24831 @item -mcpu=@var{cpu}
24832 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
24833 @samp{ck801}, @samp{ck801t},
24834 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
24835 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
24836 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
24837 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
24838 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
24839 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
24840 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
24841 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
24842 @samp{ck803eftr1}, @samp{ck803efhtr1},
24843 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
24844 @samp{ck803sef}, @samp{ck803seft},
24845 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
24846 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
24847 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
24848 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
24850 @opindex mbig-endian
24851 @opindex EB
24852 @opindex mlittle-endian
24853 @opindex EL
24854 @item -mbig-endian
24855 @itemx -EB
24856 @itemx -mlittle-endian
24857 @itemx -EL
24859 Select big- or little-endian code.  The default is little-endian.
24861 @opindex mfloat-abi
24862 @item -mfloat-abi=@var{name}
24863 Specifies which floating-point ABI to use.  Permissible values
24864 are: @samp{soft}, @samp{softfp} and @samp{hard}.
24866 Specifying @samp{soft} causes GCC to generate output containing
24867 library calls for floating-point operations.
24868 @samp{softfp} allows the generation of code using hardware floating-point
24869 instructions, but still uses the soft-float calling conventions.
24870 @samp{hard} allows generation of floating-point instructions
24871 and uses FPU-specific calling conventions.
24873 The default depends on the specific target configuration.  Note that
24874 the hard-float and soft-float ABIs are not link-compatible; you must
24875 compile your entire program with the same ABI, and link with a
24876 compatible set of libraries.
24878 @opindex mhard-float
24879 @opindex msoft-float
24880 @item -mhard-float
24881 @itemx -msoft-float
24883 Select hardware or software floating-point implementations.
24884 The default is soft float.
24886 @opindex mdouble-float
24887 @item -mdouble-float
24888 @itemx -mno-double-float
24889 When @option{-mhard-float} is in effect, enable generation of
24890 double-precision float instructions.  This is the default except
24891 when compiling for CK803.
24893 @opindex mfdivdu
24894 @item -mfdivdu
24895 @itemx -mno-fdivdu
24896 When @option{-mhard-float} is in effect, enable generation of
24897 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24898 This is the default except when compiling for CK803.
24900 @opindex mfpu=
24901 @item -mfpu=@var{fpu}
24902 Select the floating-point processor.  This option can only be used with
24903 @option{-mhard-float}.
24904 Values for @var{fpu} are
24905 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24906 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24907 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24909 @opindex melrw
24910 @item -melrw
24911 @itemx -mno-elrw
24912 Enable the extended @code{lrw} instruction.  This option defaults to on
24913 for CK801 and off otherwise.
24915 @opindex mistack
24916 @item -mistack
24917 @itemx -mno-istack
24918 Enable interrupt stack instructions; the default is off.
24920 The @option{-mistack} option is required to handle the
24921 @code{interrupt} and @code{isr} function attributes
24922 (@pxref{C-SKY Function Attributes}).
24924 @opindex mmp
24925 @item -mmp
24926 Enable multiprocessor instructions; the default is off.
24928 @opindex mcp
24929 @item -mcp
24930 Enable coprocessor instructions; the default is off.
24932 @opindex mcache
24933 @item -mcache
24934 Enable coprocessor instructions; the default is off.
24936 @opindex msecurity
24937 @item -msecurity
24938 Enable C-SKY security instructions; the default is off.
24940 @opindex mtrust
24941 @item -mtrust
24942 Enable C-SKY trust instructions; the default is off.
24944 @opindex mdsp
24945 @opindex medsp
24946 @opindex mvdsp
24947 @item -mdsp
24948 @itemx -medsp
24949 @itemx -mvdsp
24950 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24951 All of these options default to off.
24953 @opindex mdiv
24954 @item -mdiv
24955 @itemx -mno-div
24956 Generate divide instructions.  Default is off.
24958 @opindex msmart
24959 @item -msmart
24960 @itemx -mno-smart
24961 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24962 use of 16-bit instructions.  This option is ignored for CK801 where this
24963 is the required behavior, and it defaults to on for CK802.
24964 For other targets, the default is off.
24966 @opindex mhigh-registers
24967 @item -mhigh-registers
24968 @itemx -mno-high-registers
24969 Generate code using the high registers numbered 16-31.  This option
24970 is not supported on CK801, CK802, or CK803, and is enabled by default
24971 for other processors.
24973 @opindex manchor
24974 @item -manchor
24975 @itemx -mno-anchor
24976 Generate code using global anchor symbol addresses.
24978 @opindex mpushpop
24979 @item -mpushpop
24980 @itemx -mno-pushpop
24981 Generate code using @code{push} and @code{pop} instructions.  This option
24982 defaults to on.
24984 @opindex mmultiple-stld
24985 @item -mmultiple-stld
24986 @itemx -mstm
24987 @itemx -mno-multiple-stld
24988 @itemx -mno-stm
24989 Generate code using @code{stm} and @code{ldm} instructions.  This option
24990 isn't supported on CK801 but is enabled by default on other processors.
24992 @opindex mconstpool
24993 @item -mconstpool
24994 @itemx -mno-constpool
24995 Create constant pools in the compiler instead of deferring it to the
24996 assembler.  This option is the default and required for correct code
24997 generation on CK801 and CK802, and is optional on other processors.
24999 @opindex mstack-size
25000 @item -mstack-size
25001 @item -mno-stack-size
25002 Emit @code{.stack_size} directives for each function in the assembly
25003 output.  This option defaults to off.
25005 @opindex mccrt
25006 @item -mccrt
25007 @itemx -mno-ccrt
25008 Generate code for the C-SKY compiler runtime instead of libgcc.  This
25009 option defaults to off.
25011 @opindex mbranch-cost=
25012 @item -mbranch-cost=@var{n}
25013 Set the branch costs to roughly @code{n} instructions.  The default is 1.
25015 @opindex msched-prolog
25016 @item -msched-prolog
25017 @itemx -mno-sched-prolog
25018 Permit scheduling of function prologue and epilogue sequences.  Using
25019 this option can result in code that is not compliant with the C-SKY V2 ABI
25020 prologue requirements and that cannot be debugged or backtraced.
25021 It is disabled by default.
25023 @opindex msim
25024 @item -msim
25025 Links the library libsemi.a which is in compatible with simulator. Applicable
25026 to ELF compiler only.
25028 @end table
25030 @node Darwin Options
25031 @subsection Darwin Options
25032 @cindex Darwin options
25034 These options are defined for all architectures running the Darwin operating
25035 system.
25037 FSF GCC on Darwin does not create ``fat'' object files; it creates
25038 an object file for the single architecture that GCC was built to
25039 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
25040 @option{-arch} options are used; it does so by running the compiler or
25041 linker multiple times and joining the results together with
25042 @file{lipo}.
25044 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
25045 @samp{i686}) is determined by the flags that specify the ISA
25046 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
25047 @option{-force_cpusubtype_ALL} option can be used to override this.
25049 The Darwin tools vary in their behavior when presented with an ISA
25050 mismatch.  The assembler, @file{as}, only permits instructions to
25051 be used that are valid for the subtype of the file it is generating,
25052 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
25053 The linker for shared libraries, @file{/usr/bin/libtool}, fails
25054 and prints an error if asked to create a shared library with a less
25055 restrictive subtype than its input files (for instance, trying to put
25056 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
25057 for executables, @command{ld}, quietly gives the executable the most
25058 restrictive subtype of any of its input files.
25060 @table @gcctabopt
25061 @opindex F
25062 @item -F@var{dir}
25063 Add the framework directory @var{dir} to the head of the list of
25064 directories to be searched for header files.  These directories are
25065 interleaved with those specified by @option{-I} options and are
25066 scanned in a left-to-right order.
25068 A framework directory is a directory with frameworks in it.  A
25069 framework is a directory with a @file{Headers} and/or
25070 @file{PrivateHeaders} directory contained directly in it that ends
25071 in @file{.framework}.  The name of a framework is the name of this
25072 directory excluding the @file{.framework}.  Headers associated with
25073 the framework are found in one of those two directories, with
25074 @file{Headers} being searched first.  A subframework is a framework
25075 directory that is in a framework's @file{Frameworks} directory.
25076 Includes of subframework headers can only appear in a header of a
25077 framework that contains the subframework, or in a sibling subframework
25078 header.  Two subframeworks are siblings if they occur in the same
25079 framework.  A subframework should not have the same name as a
25080 framework; a warning is issued if this is violated.  Currently a
25081 subframework cannot have subframeworks; in the future, the mechanism
25082 may be extended to support this.  The standard frameworks can be found
25083 in @file{/System/Library/Frameworks} and
25084 @file{/Library/Frameworks}.  An example include looks like
25085 @code{#include <Framework/header.h>}, where @file{Framework} denotes
25086 the name of the framework and @file{header.h} is found in the
25087 @file{PrivateHeaders} or @file{Headers} directory.
25089 @opindex iframework
25090 @item -iframework@var{dir}
25091 Like @option{-F} except the directory is a treated as a system
25092 directory.  The main difference between this @option{-iframework} and
25093 @option{-F} is that with @option{-iframework} the compiler does not
25094 warn about constructs contained within header files found via
25095 @var{dir}.  This option is valid only for the C family of languages.
25097 @opindex gused
25098 @item -gused
25099 Emit debugging information for symbols that are used.  For stabs
25100 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
25101 This is by default ON@.
25103 @opindex gfull
25104 @item -gfull
25105 Emit debugging information for all symbols and types.
25107 @opindex fconstant-cfstrings
25108 @item -fconstant-cfstrings
25109 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
25111 @opindex mconstant-cfstrings
25112 @item -mconstant-cfstrings
25113 When the NeXT runtime is being used (the default on these systems), override
25114 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
25115 literals to be laid out as constant CoreFoundation strings.
25117 @opindex mmacosx-version-min
25118 @item -mmacosx-version-min=@var{version}
25119 The earliest version of MacOS X that this executable will run on is
25120 @var{version}.  Typical values supported for @var{version} include @code{12},
25121 @code{10.12}, and @code{10.5.8}.
25123 If the compiler was built to use the system's headers by default,
25124 then the default for this option is the system version on which the
25125 compiler is running, otherwise the default is to make choices that
25126 are compatible with as many systems and code bases as possible.
25128 @opindex mkernel
25129 @item -mkernel
25130 Enable kernel development mode.  The @option{-mkernel} option sets
25131 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
25132 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
25133 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
25134 applicable.  This mode also sets @option{-mno-altivec},
25135 @option{-msoft-float}, @option{-fno-builtin} and
25136 @option{-mlong-branch} for PowerPC targets.
25138 @opindex mone-byte-bool
25139 @item -mone-byte-bool
25140 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
25141 By default @code{sizeof(bool)} is @code{4} when compiling for
25142 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
25143 option has no effect on x86.
25145 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
25146 to generate code that is not binary compatible with code generated
25147 without that switch.  Using this switch may require recompiling all
25148 other modules in a program, including system libraries.  Use this
25149 switch to conform to a non-default data model.
25151 @opindex mfix-and-continue
25152 @opindex ffix-and-continue
25153 @opindex findirect-data
25154 @item -mfix-and-continue
25155 @itemx -ffix-and-continue
25156 @itemx -findirect-data
25157 Generate code suitable for fast turnaround development, such as to
25158 allow GDB to dynamically load @file{.o} files into already-running
25159 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
25160 are provided for backwards compatibility.
25162 @opindex all_load
25163 @item -all_load
25164 Loads all members of static archive libraries.
25165 See man ld(1) for more information.
25167 @opindex arch_errors_fatal
25168 @item -arch_errors_fatal
25169 Cause the errors having to do with files that have the wrong architecture
25170 to be fatal.
25172 @opindex bind_at_load
25173 @item -bind_at_load
25174 Causes the output file to be marked such that the dynamic linker will
25175 bind all undefined references when the file is loaded or launched.
25177 @opindex bundle
25178 @item -bundle
25179 Produce a Mach-o bundle format file.
25180 See man ld(1) for more information.
25182 @opindex bundle_loader
25183 @item -bundle_loader @var{executable}
25184 This option specifies the @var{executable} that will load the build
25185 output file being linked.  See man ld(1) for more information.
25187 @opindex dynamiclib
25188 @item -dynamiclib
25189 When passed this option, GCC produces a dynamic library instead of
25190 an executable when linking, using the Darwin @file{libtool} command.
25192 @opindex force_cpusubtype_ALL
25193 @item -force_cpusubtype_ALL
25194 This causes GCC's output file to have the @samp{ALL} subtype, instead of
25195 one controlled by the @option{-mcpu} or @option{-march} option.
25197 @opindex nodefaultrpaths
25198 @item -nodefaultrpaths
25199 Do not add default run paths for the compiler library directories to
25200 executables, modules or dynamic libraries. On macOS 10.5 and later,
25201 the embedded runpath is added by default unless the user adds
25202 @option{-nodefaultrpaths} to the link line. Run paths are needed
25203 (and therefore enforced) to build on macOS version 10.11 or later.
25205 @item -allowable_client  @var{client_name}
25206 @itemx -client_name
25207 @itemx -compatibility_version
25208 @itemx -current_version
25209 @itemx -dead_strip
25210 @itemx -dependency-file
25211 @itemx -dylib_file
25212 @itemx -dylinker_install_name
25213 @itemx -dynamic
25214 @itemx -exported_symbols_list
25215 @itemx -filelist
25216 @need 800
25217 @itemx -flat_namespace
25218 @itemx -force_flat_namespace
25219 @itemx -headerpad_max_install_names
25220 @itemx -image_base
25221 @itemx -init
25222 @itemx -install_name
25223 @itemx -keep_private_externs
25224 @itemx -multi_module
25225 @itemx -multiply_defined
25226 @itemx -multiply_defined_unused
25227 @need 800
25228 @itemx -noall_load
25229 @itemx -no_dead_strip_inits_and_terms
25230 @itemx -nofixprebinding
25231 @itemx -nomultidefs
25232 @itemx -noprebind
25233 @itemx -noseglinkedit
25234 @itemx -pagezero_size
25235 @itemx -prebind
25236 @itemx -prebind_all_twolevel_modules
25237 @itemx -private_bundle
25238 @need 800
25239 @itemx -read_only_relocs
25240 @itemx -sectalign
25241 @itemx -sectobjectsymbols
25242 @itemx -whyload
25243 @itemx -seg1addr
25244 @itemx -sectcreate
25245 @itemx -sectobjectsymbols
25246 @itemx -sectorder
25247 @itemx -segaddr
25248 @itemx -segs_read_only_addr
25249 @need 800
25250 @itemx -segs_read_write_addr
25251 @itemx -seg_addr_table
25252 @itemx -seg_addr_table_filename
25253 @itemx -seglinkedit
25254 @itemx -segprot
25255 @itemx -segs_read_only_addr
25256 @itemx -segs_read_write_addr
25257 @itemx -single_module
25258 @itemx -static
25259 @itemx -sub_library
25260 @need 800
25261 @opindex allowable_client
25262 @opindex client_name
25263 @opindex compatibility_version
25264 @opindex current_version
25265 @opindex dead_strip
25266 @opindex dependency-file
25267 @opindex dylib_file
25268 @opindex dylinker_install_name
25269 @opindex dynamic
25270 @opindex exported_symbols_list
25271 @opindex filelist
25272 @opindex flat_namespace
25273 @opindex force_flat_namespace
25274 @opindex headerpad_max_install_names
25275 @opindex image_base
25276 @opindex init
25277 @opindex install_name
25278 @opindex keep_private_externs
25279 @opindex multi_module
25280 @opindex multiply_defined
25281 @opindex multiply_defined_unused
25282 @opindex noall_load
25283 @opindex no_dead_strip_inits_and_terms
25284 @opindex nofixprebinding
25285 @opindex nomultidefs
25286 @opindex noprebind
25287 @opindex noseglinkedit
25288 @opindex pagezero_size
25289 @opindex prebind
25290 @opindex prebind_all_twolevel_modules
25291 @opindex private_bundle
25292 @opindex read_only_relocs
25293 @opindex sectalign
25294 @opindex sectobjectsymbols
25295 @opindex whyload
25296 @opindex seg1addr
25297 @opindex sectcreate
25298 @opindex sectobjectsymbols
25299 @opindex sectorder
25300 @opindex segaddr
25301 @opindex segs_read_only_addr
25302 @opindex segs_read_write_addr
25303 @opindex seg_addr_table
25304 @opindex seg_addr_table_filename
25305 @opindex seglinkedit
25306 @opindex segprot
25307 @opindex segs_read_only_addr
25308 @opindex segs_read_write_addr
25309 @opindex single_module
25310 @opindex static
25311 @opindex sub_library
25312 @opindex sub_umbrella
25313 @opindex twolevel_namespace
25314 @opindex umbrella
25315 @opindex undefined
25316 @opindex unexported_symbols_list
25317 @opindex weak_reference_mismatches
25318 @opindex whatsloaded
25319 @itemx -sub_umbrella
25320 @itemx -twolevel_namespace
25321 @itemx -umbrella
25322 @itemx -undefined
25323 @itemx -unexported_symbols_list
25324 @itemx -weak_reference_mismatches
25325 @itemx -whatsloaded
25326 These options are passed to the Darwin linker.  The Darwin linker man page
25327 describes them in detail.
25328 @end table
25330 @node DEC Alpha Options
25331 @subsection DEC Alpha Options
25333 These @samp{-m} options are defined for the DEC Alpha implementations:
25335 @table @gcctabopt
25336 @opindex mno-soft-float
25337 @opindex msoft-float
25338 @item -mno-soft-float
25339 @itemx -msoft-float
25340 Use (do not use) the hardware floating-point instructions for
25341 floating-point operations.  When @option{-msoft-float} is specified,
25342 functions in @file{libgcc.a} are used to perform floating-point
25343 operations.  Unless they are replaced by routines that emulate the
25344 floating-point operations, or compiled in such a way as to call such
25345 emulations routines, these routines issue floating-point
25346 operations.   If you are compiling for an Alpha without floating-point
25347 operations, you must ensure that the library is built so as not to call
25348 them.
25350 Note that Alpha implementations without floating-point operations are
25351 required to have floating-point registers.
25353 @opindex mfp-reg
25354 @opindex mno-fp-regs
25355 @item -mfp-reg
25356 @itemx -mno-fp-regs
25357 Generate code that uses (does not use) the floating-point register set.
25358 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
25359 register set is not used, floating-point operands are passed in integer
25360 registers as if they were integers and floating-point results are passed
25361 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
25362 so any function with a floating-point argument or return value called by code
25363 compiled with @option{-mno-fp-regs} must also be compiled with that
25364 option.
25366 A typical use of this option is building a kernel that does not use,
25367 and hence need not save and restore, any floating-point registers.
25369 @opindex mieee
25370 @item -mieee
25371 The Alpha architecture implements floating-point hardware optimized for
25372 maximum performance.  It is mostly compliant with the IEEE floating-point
25373 standard.  However, for full compliance, software assistance is
25374 required.  This option generates code fully IEEE-compliant code
25375 @emph{except} that the @var{inexact-flag} is not maintained (see below).
25376 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
25377 defined during compilation.  The resulting code is less efficient but is
25378 able to correctly support denormalized numbers and exceptional IEEE
25379 values such as not-a-number and plus/minus infinity.  Other Alpha
25380 compilers call this option @option{-ieee_with_no_inexact}.
25382 @opindex mieee-with-inexact
25383 @item -mieee-with-inexact
25384 This is like @option{-mieee} except the generated code also maintains
25385 the IEEE @var{inexact-flag}.  Turning on this option causes the
25386 generated code to implement fully-compliant IEEE math.  In addition to
25387 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
25388 macro.  On some Alpha implementations the resulting code may execute
25389 significantly slower than the code generated by default.  Since there is
25390 very little code that depends on the @var{inexact-flag}, you should
25391 normally not specify this option.  Other Alpha compilers call this
25392 option @option{-ieee_with_inexact}.
25394 @opindex mfp-trap-mode
25395 @item -mfp-trap-mode=@var{trap-mode}
25396 This option controls what floating-point related traps are enabled.
25397 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
25398 The trap mode can be set to one of four values:
25400 @table @samp
25401 @item n
25402 This is the default (normal) setting.  The only traps that are enabled
25403 are the ones that cannot be disabled in software (e.g., division by zero
25404 trap).
25406 @item u
25407 In addition to the traps enabled by @samp{n}, underflow traps are enabled
25408 as well.
25410 @item su
25411 Like @samp{u}, but the instructions are marked to be safe for software
25412 completion (see Alpha architecture manual for details).
25414 @item sui
25415 Like @samp{su}, but inexact traps are enabled as well.
25416 @end table
25418 @opindex mfp-rounding-mode
25419 @item -mfp-rounding-mode=@var{rounding-mode}
25420 Selects the IEEE rounding mode.  Other Alpha compilers call this option
25421 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
25424 @table @samp
25425 @item n
25426 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
25427 the nearest machine number or towards the even machine number in case
25428 of a tie.
25430 @item m
25431 Round towards minus infinity.
25433 @item c
25434 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
25436 @item d
25437 Dynamic rounding mode.  A field in the floating-point control register
25438 (@var{fpcr}, see Alpha architecture reference manual) controls the
25439 rounding mode in effect.  The C library initializes this register for
25440 rounding towards plus infinity.  Thus, unless your program modifies the
25441 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
25442 @end table
25444 @opindex mtrap-precision
25445 @item -mtrap-precision=@var{trap-precision}
25446 In the Alpha architecture, floating-point traps are imprecise.  This
25447 means without software assistance it is impossible to recover from a
25448 floating trap and program execution normally needs to be terminated.
25449 GCC can generate code that can assist operating system trap handlers
25450 in determining the exact location that caused a floating-point trap.
25451 Depending on the requirements of an application, different levels of
25452 precisions can be selected:
25454 @table @samp
25455 @item p
25456 Program precision.  This option is the default and means a trap handler
25457 can only identify which program caused a floating-point exception.
25459 @item f
25460 Function precision.  The trap handler can determine the function that
25461 caused a floating-point exception.
25463 @item i
25464 Instruction precision.  The trap handler can determine the exact
25465 instruction that caused a floating-point exception.
25466 @end table
25468 Other Alpha compilers provide the equivalent options called
25469 @option{-scope_safe} and @option{-resumption_safe}.
25471 @opindex mieee-conformant
25472 @item -mieee-conformant
25473 This option marks the generated code as IEEE conformant.  You must not
25474 use this option unless you also specify @option{-mtrap-precision=i} and either
25475 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
25476 is to emit the line @samp{.eflag 48} in the function prologue of the
25477 generated assembly file.
25479 @opindex mbuild-constants
25480 @item -mbuild-constants
25481 Normally GCC examines a 32- or 64-bit integer constant to
25482 see if it can construct it from smaller constants in two or three
25483 instructions.  If it cannot, it outputs the constant as a literal and
25484 generates code to load it from the data segment at run time.
25486 Use this option to require GCC to construct @emph{all} integer constants
25487 using code, even if it takes more instructions (the maximum is six).
25489 You typically use this option to build a shared library dynamic
25490 loader.  Itself a shared library, it must relocate itself in memory
25491 before it can find the variables and constants in its own data segment.
25493 @opindex mbwx
25494 @opindex mno-bwx
25495 @opindex mcix
25496 @opindex mno-cix
25497 @opindex mfix
25498 @opindex mno-fix
25499 @opindex mmax
25500 @opindex mno-max
25501 @item -mbwx
25502 @itemx -mno-bwx
25503 @itemx -mcix
25504 @itemx -mno-cix
25505 @itemx -mfix
25506 @itemx -mno-fix
25507 @itemx -mmax
25508 @itemx -mno-max
25509 Indicate whether GCC should generate code to use the optional BWX,
25510 CIX, FIX and MAX instruction sets.  The default is to use the instruction
25511 sets supported by the CPU type specified via @option{-mcpu=} option or that
25512 of the CPU on which GCC was built if none is specified.
25514 @opindex mfloat-vax
25515 @opindex mfloat-ieee
25516 @item -mfloat-vax
25517 @itemx -mfloat-ieee
25518 Generate code that uses (does not use) VAX F and G floating-point
25519 arithmetic instead of IEEE single and double precision.
25521 @opindex mexplicit-relocs
25522 @opindex mno-explicit-relocs
25523 @item -mexplicit-relocs
25524 @itemx -mno-explicit-relocs
25525 Older Alpha assemblers provided no way to generate symbol relocations
25526 except via assembler macros.  Use of these macros does not allow
25527 optimal instruction scheduling.  GNU binutils as of version 2.12
25528 supports a new syntax that allows the compiler to explicitly mark
25529 which relocations should apply to which instructions.  This option
25530 is mostly useful for debugging, as GCC detects the capabilities of
25531 the assembler when it is built and sets the default accordingly.
25533 @opindex msmall-data
25534 @opindex mlarge-data
25535 @item -msmall-data
25536 @itemx -mlarge-data
25537 When @option{-mexplicit-relocs} is in effect, static data is
25538 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
25539 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
25540 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
25541 16-bit relocations off of the @code{$gp} register.  This limits the
25542 size of the small data area to 64KB, but allows the variables to be
25543 directly accessed via a single instruction.
25545 The default is @option{-mlarge-data}.  With this option the data area
25546 is limited to just below 2GB@.  Programs that require more than 2GB of
25547 data must use @code{malloc} or @code{mmap} to allocate the data in the
25548 heap instead of in the program's data segment.
25550 When generating code for shared libraries, @option{-fpic} implies
25551 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
25553 @opindex msmall-text
25554 @opindex mlarge-text
25555 @item -msmall-text
25556 @itemx -mlarge-text
25557 When @option{-msmall-text} is used, the compiler assumes that the
25558 code of the entire program (or shared library) fits in 4MB, and is
25559 thus reachable with a branch instruction.  When @option{-msmall-data}
25560 is used, the compiler can assume that all local symbols share the
25561 same @code{$gp} value, and thus reduce the number of instructions
25562 required for a function call from 4 to 1.
25564 The default is @option{-mlarge-text}.
25566 @opindex mcpu
25567 @item -mcpu=@var{cpu_type}
25568 Set the instruction set and instruction scheduling parameters for
25569 machine type @var{cpu_type}.  You can specify either the @samp{EV}
25570 style name or the corresponding chip number.  GCC supports scheduling
25571 parameters for the EV4, EV5 and EV6 family of processors and
25572 chooses the default values for the instruction set from the processor
25573 you specify.  If you do not specify a processor type, GCC defaults
25574 to the processor on which the compiler was built.
25576 Supported values for @var{cpu_type} are
25578 @table @samp
25579 @item ev4
25580 @itemx ev45
25581 @itemx 21064
25582 Schedules as an EV4 and has no instruction set extensions.
25584 @item ev5
25585 @itemx 21164
25586 Schedules as an EV5 and has no instruction set extensions.
25588 @item ev56
25589 @itemx 21164a
25590 Schedules as an EV5 and supports the BWX extension.
25592 @item pca56
25593 @itemx 21164pc
25594 @itemx 21164PC
25595 Schedules as an EV5 and supports the BWX and MAX extensions.
25597 @item ev6
25598 @itemx 21264
25599 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
25601 @item ev67
25602 @itemx 21264a
25603 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
25604 @end table
25606 Native toolchains also support the value @samp{native},
25607 which selects the best architecture option for the host processor.
25608 @option{-mcpu=native} has no effect if GCC does not recognize
25609 the processor.
25611 @opindex mtune
25612 @item -mtune=@var{cpu_type}
25613 Set only the instruction scheduling parameters for machine type
25614 @var{cpu_type}.  The instruction set is not changed.
25616 Native toolchains also support the value @samp{native},
25617 which selects the best architecture option for the host processor.
25618 @option{-mtune=native} has no effect if GCC does not recognize
25619 the processor.
25621 @opindex mmemory-latency
25622 @item -mmemory-latency=@var{time}
25623 Sets the latency the scheduler should assume for typical memory
25624 references as seen by the application.  This number is highly
25625 dependent on the memory access patterns used by the application
25626 and the size of the external cache on the machine.
25628 Valid options for @var{time} are
25630 @table @samp
25631 @item @var{number}
25632 A decimal number representing clock cycles.
25634 @item L1
25635 @itemx L2
25636 @itemx L3
25637 @itemx main
25638 The compiler contains estimates of the number of clock cycles for
25639 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
25640 (also called Dcache, Scache, and Bcache), as well as to main memory.
25641 Note that L3 is only valid for EV5.
25643 @end table
25644 @end table
25646 @node eBPF Options
25647 @subsection eBPF Options
25648 @cindex eBPF Options
25650 @table @gcctabopt
25651 @item -mframe-limit=@var{bytes}
25652 This specifies the hard limit for frame sizes, in bytes.  Currently,
25653 the value that can be specified should be less than or equal to
25654 @samp{32767}.  Defaults to whatever limit is imposed by the version of
25655 the Linux kernel targeted.
25657 @opindex mbig-endian
25658 @item -mbig-endian
25659 Generate code for a big-endian target.
25661 @opindex mlittle-endian
25662 @item -mlittle-endian
25663 Generate code for a little-endian target.  This is the default.
25665 @opindex mjmpext
25666 @item -mjmpext
25667 @itemx -mno-jmpext
25668 Enable or disable generation of extra conditional-branch instructions.
25669 Enabled for CPU v2 and above.
25671 @opindex mjmp32
25672 @item -mjmp32
25673 @itemx -mno-jmp32
25674 Enable or disable generation of 32-bit jump instructions.
25675 Enabled for CPU v3 and above.
25677 @opindex malu32
25678 @item -malu32
25679 @itemx -mno-alu32
25680 Enable or disable generation of 32-bit ALU instructions.
25681 Enabled for CPU v3 and above.
25683 @opindex mv3-atomics
25684 @item -mv3-atomics
25685 @itemx -mno-v3-atomics
25686 Enable or disable instructions for general atomic operations introduced
25687 in CPU v3.  Enabled for CPU v3 and above.
25689 @opindex mbswap
25690 @item -mbswap
25691 @itemx -mno-bswap
25692 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
25694 @opindex msdiv
25695 @item -msdiv
25696 @itemx -mno-sdiv
25697 Enable or disable signed division and modulus instructions.  Enabled for
25698 CPU v4 and above.
25700 @opindex msmov
25701 @item -msmov
25702 @itemx -mno-smov
25703 Enable or disable sign-extending move and memory load instructions.
25704 Enabled for CPU v4 and above.
25706 @opindex mcpu
25707 @item -mcpu=@var{version}
25708 This specifies which version of the eBPF ISA to target. Newer versions
25709 may not be supported by all kernels. The default is @samp{v4}.
25711 Supported values for @var{version} are:
25713 @table @samp
25714 @item v1
25715 The first stable eBPF ISA with no special features or extensions.
25717 @item v2
25718 Supports the jump extensions, as in @option{-mjmpext}.
25720 @item v3
25721 All features of v2, plus:
25722 @itemize @minus
25723 @item 32-bit jump operations, as in @option{-mjmp32}
25724 @item 32-bit ALU operations, as in @option{-malu32}
25725 @item general atomic operations, as in @option{-mv3-atomics}
25726 @end itemize
25728 @item v4
25729 All features of v3, plus:
25730 @itemize @minus
25731 @item Byte swap instructions, as in @option{-mbswap}
25732 @item Signed division and modulus instructions, as in @option{-msdiv}
25733 @item Sign-extending move and memory load instructions, as in @option{-msmov}
25734 @end itemize
25735 @end table
25737 @opindex mco-re
25738 @item -mco-re
25739 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
25740 is implied by @option{-gbtf}.
25742 @opindex mno-co-re
25743 @item -mno-co-re
25744 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
25745 support is enabled by default when generating BTF debug information for
25746 the BPF target.
25748 @item -mxbpf
25749 Generate code for an expanded version of BPF, which relaxes some of
25750 the restrictions imposed by the BPF architecture:
25751 @itemize @minus
25752 @item Save and restore callee-saved registers at function entry and
25753 exit, respectively.
25754 @end itemize
25756 @opindex masm=@var{dialect}
25757 @item -masm=@var{dialect}
25758 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
25759 is @samp{pseudoc}.
25761 Supported values for @var{dialect} are:
25763 @table @samp
25764 @item normal
25765 Outputs normal assembly dialect.
25767 @item pseudoc
25768 Outputs pseudo-c assembly dialect.
25770 @end table
25772 @opindex -minline-memops-threshold
25773 @item -minline-memops-threshold=@var{bytes}
25774 Specifies a size threshold in bytes at or below which memmove, memcpy
25775 and memset shall always be expanded inline.  Operations dealing with
25776 sizes larger than this threshold would have to be implemented using
25777 a library call instead of being expanded inline, but since BPF doesn't
25778 allow libcalls, exceeding this threshold results in a compile-time
25779 error.  The default is @samp{1024} bytes.
25781 @end table
25783 @node FR30 Options
25784 @subsection FR30 Options
25785 @cindex FR30 Options
25787 These options are defined specifically for the FR30 port.
25789 @table @gcctabopt
25791 @opindex msmall-model
25792 @item -msmall-model
25793 Use the small address space model.  This can produce smaller code, but
25794 it does assume that all symbolic values and addresses fit into a
25795 20-bit range.
25797 @opindex mno-lsim
25798 @item -mno-lsim
25799 Assume that runtime support has been provided and so there is no need
25800 to include the simulator library (@file{libsim.a}) on the linker
25801 command line.
25803 @end table
25805 @node FT32 Options
25806 @subsection FT32 Options
25807 @cindex FT32 Options
25809 These options are defined specifically for the FT32 port.
25811 @table @gcctabopt
25813 @opindex msim
25814 @item -msim
25815 Specifies that the program will be run on the simulator.  This causes
25816 an alternate runtime startup and library to be linked.
25817 You must not use this option when generating programs that will run on
25818 real hardware; you must provide your own runtime library for whatever
25819 I/O functions are needed.
25821 @opindex mlra
25822 @item -mlra
25823 Enable Local Register Allocation.  This is still experimental for FT32,
25824 so by default the compiler uses standard reload.
25826 @opindex mnodiv
25827 @item -mnodiv
25828 Do not use div and mod instructions.
25830 @opindex mft32b
25831 @item -mft32b
25832 Enable use of the extended instructions of the FT32B processor.
25834 @opindex mcompress
25835 @item -mcompress
25836 Compress all code using the Ft32B code compression scheme.
25838 @opindex  mnopm
25839 @item -mnopm
25840 Do not generate code that reads program memory.
25842 @end table
25844 @node FRV Options
25845 @subsection FRV Options
25846 @cindex FRV Options
25848 @table @gcctabopt
25849 @opindex mgpr-32
25850 @item -mgpr-32
25852 Only use the first 32 general-purpose registers.
25854 @opindex mgpr-64
25855 @item -mgpr-64
25857 Use all 64 general-purpose registers.
25859 @opindex mfpr-32
25860 @item -mfpr-32
25862 Use only the first 32 floating-point registers.
25864 @opindex mfpr-64
25865 @item -mfpr-64
25867 Use all 64 floating-point registers.
25869 @opindex mhard-float
25870 @item -mhard-float
25872 Use hardware instructions for floating-point operations.
25874 @opindex msoft-float
25875 @item -msoft-float
25877 Use library routines for floating-point operations.
25879 @opindex malloc-cc
25880 @item -malloc-cc
25882 Dynamically allocate condition code registers.
25884 @opindex mfixed-cc
25885 @item -mfixed-cc
25887 Do not try to dynamically allocate condition code registers, only
25888 use @code{icc0} and @code{fcc0}.
25890 @opindex mdword
25891 @item -mdword
25893 Change ABI to use double word insns.
25895 @opindex mno-dword
25896 @opindex mdword
25897 @item -mno-dword
25899 Do not use double word instructions.
25901 @opindex mdouble
25902 @item -mdouble
25904 Use floating-point double instructions.
25906 @opindex mno-double
25907 @item -mno-double
25909 Do not use floating-point double instructions.
25911 @opindex mmedia
25912 @item -mmedia
25914 Use media instructions.
25916 @opindex mno-media
25917 @item -mno-media
25919 Do not use media instructions.
25921 @opindex mmuladd
25922 @item -mmuladd
25924 Use multiply and add/subtract instructions.
25926 @opindex mno-muladd
25927 @item -mno-muladd
25929 Do not use multiply and add/subtract instructions.
25931 @opindex mfdpic
25932 @item -mfdpic
25934 Select the FDPIC ABI, which uses function descriptors to represent
25935 pointers to functions.  Without any PIC/PIE-related options, it
25936 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25937 assumes GOT entries and small data are within a 12-bit range from the
25938 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25939 are computed with 32 bits.
25940 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25942 @opindex minline-plt
25943 @item -minline-plt
25945 Enable inlining of PLT entries in function calls to functions that are
25946 not known to bind locally.  It has no effect without @option{-mfdpic}.
25947 It's enabled by default if optimizing for speed and compiling for
25948 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25949 optimization option such as @option{-O3} or above is present in the
25950 command line.
25952 @opindex mTLS
25953 @item -mTLS
25955 Assume a large TLS segment when generating thread-local code.
25957 @opindex mtls
25958 @item -mtls
25960 Do not assume a large TLS segment when generating thread-local code.
25962 @opindex mgprel-ro
25963 @item -mgprel-ro
25965 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25966 that is known to be in read-only sections.  It's enabled by default,
25967 except for @option{-fpic} or @option{-fpie}: even though it may help
25968 make the global offset table smaller, it trades 1 instruction for 4.
25969 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25970 one of which may be shared by multiple symbols, and it avoids the need
25971 for a GOT entry for the referenced symbol, so it's more likely to be a
25972 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25974 @opindex multilib-library-pic
25975 @item -multilib-library-pic
25977 Link with the (library, not FD) pic libraries.  It's implied by
25978 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25979 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25980 it explicitly.
25982 @opindex mlinked-fp
25983 @item -mlinked-fp
25985 Follow the EABI requirement of always creating a frame pointer whenever
25986 a stack frame is allocated.  This option is enabled by default and can
25987 be disabled with @option{-mno-linked-fp}.
25989 @opindex mlong-calls
25990 @item -mlong-calls
25992 Use indirect addressing to call functions outside the current
25993 compilation unit.  This allows the functions to be placed anywhere
25994 within the 32-bit address space.
25996 @opindex malign-labels
25997 @item -malign-labels
25999 Try to align labels to an 8-byte boundary by inserting NOPs into the
26000 previous packet.  This option only has an effect when VLIW packing
26001 is enabled.  It doesn't create new packets; it merely adds NOPs to
26002 existing ones.
26004 @opindex mlibrary-pic
26005 @item -mlibrary-pic
26007 Generate position-independent EABI code.
26009 @opindex macc-4
26010 @item -macc-4
26012 Use only the first four media accumulator registers.
26014 @opindex macc-8
26015 @item -macc-8
26017 Use all eight media accumulator registers.
26019 @opindex mpack
26020 @item -mpack
26022 Pack VLIW instructions.
26024 @opindex mno-pack
26025 @item -mno-pack
26027 Do not pack VLIW instructions.
26029 @opindex mno-eflags
26030 @item -mno-eflags
26032 Do not mark ABI switches in e_flags.
26034 @opindex mcond-move
26035 @item -mcond-move
26037 Enable the use of conditional-move instructions (default).
26039 This switch is mainly for debugging the compiler and will likely be removed
26040 in a future version.
26042 @opindex mno-cond-move
26043 @item -mno-cond-move
26045 Disable the use of conditional-move instructions.
26047 This switch is mainly for debugging the compiler and will likely be removed
26048 in a future version.
26050 @opindex mscc
26051 @item -mscc
26053 Enable the use of conditional set instructions (default).
26055 This switch is mainly for debugging the compiler and will likely be removed
26056 in a future version.
26058 @opindex mno-scc
26059 @item -mno-scc
26061 Disable the use of conditional set instructions.
26063 This switch is mainly for debugging the compiler and will likely be removed
26064 in a future version.
26066 @opindex mcond-exec
26067 @item -mcond-exec
26069 Enable the use of conditional execution (default).
26071 This switch is mainly for debugging the compiler and will likely be removed
26072 in a future version.
26074 @opindex mno-cond-exec
26075 @item -mno-cond-exec
26077 Disable the use of conditional execution.
26079 This switch is mainly for debugging the compiler and will likely be removed
26080 in a future version.
26082 @opindex mvliw-branch
26083 @item -mvliw-branch
26085 Run a pass to pack branches into VLIW instructions (default).
26087 This switch is mainly for debugging the compiler and will likely be removed
26088 in a future version.
26090 @opindex mno-vliw-branch
26091 @item -mno-vliw-branch
26093 Do not run a pass to pack branches into VLIW instructions.
26095 This switch is mainly for debugging the compiler and will likely be removed
26096 in a future version.
26098 @opindex mmulti-cond-exec
26099 @item -mmulti-cond-exec
26101 Enable optimization of @code{&&} and @code{||} in conditional execution
26102 (default).
26104 This switch is mainly for debugging the compiler and will likely be removed
26105 in a future version.
26107 @opindex mno-multi-cond-exec
26108 @item -mno-multi-cond-exec
26110 Disable optimization of @code{&&} and @code{||} in conditional execution.
26112 This switch is mainly for debugging the compiler and will likely be removed
26113 in a future version.
26115 @opindex mnested-cond-exec
26116 @item -mnested-cond-exec
26118 Enable nested conditional execution optimizations (default).
26120 This switch is mainly for debugging the compiler and will likely be removed
26121 in a future version.
26123 @opindex mno-nested-cond-exec
26124 @item -mno-nested-cond-exec
26126 Disable nested conditional execution optimizations.
26128 This switch is mainly for debugging the compiler and will likely be removed
26129 in a future version.
26131 @opindex moptimize-membar
26132 @item -moptimize-membar
26134 This switch removes redundant @code{membar} instructions from the
26135 compiler-generated code.  It is enabled by default.
26137 @opindex mno-optimize-membar
26138 @opindex moptimize-membar
26139 @item -mno-optimize-membar
26141 This switch disables the automatic removal of redundant @code{membar}
26142 instructions from the generated code.
26144 @opindex mtomcat-stats
26145 @item -mtomcat-stats
26147 Cause gas to print out tomcat statistics.
26149 @opindex mcpu
26150 @item -mcpu=@var{cpu}
26152 Select the processor type for which to generate code.  Possible values are
26153 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
26154 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
26156 @end table
26158 @node GNU/Linux Options
26159 @subsection GNU/Linux Options
26161 These @samp{-m} options are defined for GNU/Linux targets:
26163 @table @gcctabopt
26164 @opindex mglibc
26165 @item -mglibc
26166 Use the GNU C library.  This is the default except
26167 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
26168 @samp{*-*-linux-*android*} targets.
26170 @opindex muclibc
26171 @item -muclibc
26172 Use uClibc C library.  This is the default on
26173 @samp{*-*-linux-*uclibc*} targets.
26175 @opindex mmusl
26176 @item -mmusl
26177 Use the musl C library.  This is the default on
26178 @samp{*-*-linux-*musl*} targets.
26180 @opindex mbionic
26181 @item -mbionic
26182 Use Bionic C library.  This is the default on
26183 @samp{*-*-linux-*android*} targets.
26185 @opindex mandroid
26186 @item -mandroid
26187 Compile code compatible with Android platform.  This is the default on
26188 @samp{*-*-linux-*android*} targets.
26190 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
26191 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
26192 this option makes the GCC driver pass Android-specific options to the linker.
26193 Finally, this option causes the preprocessor macro @code{__ANDROID__}
26194 to be defined.
26196 @opindex tno-android-cc
26197 @item -tno-android-cc
26198 Disable compilation effects of @option{-mandroid}, i.e., do not enable
26199 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
26200 @option{-fno-rtti} by default.
26202 @opindex tno-android-ld
26203 @item -tno-android-ld
26204 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
26205 linking options to the linker.
26207 @end table
26209 @node H8/300 Options
26210 @subsection H8/300 Options
26212 These @samp{-m} options are defined for the H8/300 implementations:
26214 @table @gcctabopt
26215 @opindex mrelax
26216 @item -mrelax
26217 Shorten some address references at link time, when possible; uses the
26218 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
26219 ld, Using ld}, for a fuller description.
26221 @opindex mh
26222 @item -mh
26223 Generate code for the H8/300H@.
26225 @opindex ms
26226 @item -ms
26227 Generate code for the H8S@.
26229 @opindex mn
26230 @item -mn
26231 Generate code for the H8S and H8/300H in the normal mode.  This switch
26232 must be used either with @option{-mh} or @option{-ms}.
26234 @opindex ms2600
26235 @item -ms2600
26236 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
26238 @opindex mexr
26239 @item -mexr
26240 Extended registers are stored on stack before execution of function
26241 with monitor attribute. Default option is @option{-mexr}.
26242 This option is valid only for H8S targets.
26244 @opindex mno-exr
26245 @opindex mexr
26246 @item -mno-exr
26247 Extended registers are not stored on stack before execution of function 
26248 with monitor attribute. Default option is @option{-mno-exr}. 
26249 This option is valid only for H8S targets.
26251 @opindex mint32
26252 @item -mint32
26253 Make @code{int} data 32 bits by default.
26255 @opindex malign-300
26256 @item -malign-300
26257 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
26258 The default for the H8/300H and H8S is to align longs and floats on
26259 4-byte boundaries.
26260 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
26261 This option has no effect on the H8/300.
26262 @end table
26264 @node HPPA Options
26265 @subsection HPPA Options
26266 @cindex HPPA Options
26268 These @samp{-m} options are defined for the HPPA family of computers:
26270 @table @gcctabopt
26271 @opindex march
26272 @item -march=@var{architecture-type}
26273 Generate code for the specified architecture.  The choices for
26274 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
26275 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
26276 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
26277 architecture option for your machine.  Code compiled for lower numbered
26278 architectures runs on higher numbered architectures, but not the
26279 other way around.
26281 @opindex mpa-risc-1-0
26282 @opindex mpa-risc-1-1
26283 @opindex mpa-risc-2-0
26284 @item -mpa-risc-1-0
26285 @itemx -mpa-risc-1-1
26286 @itemx -mpa-risc-2-0
26287 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
26289 @opindex matomic-libcalls
26290 @opindex mno-atomic-libcalls
26291 @item -matomic-libcalls
26292 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
26293 This option is enabled by default.  It only affects the generation of
26294 atomic libcalls by the HPPA backend.
26296 Both the sync and @file{libatomic} libcall implementations use locking.
26297 As a result, processor stores are not atomic with respect to other
26298 atomic operations.  Processor loads up to DImode are atomic with
26299 respect to other atomic operations provided they are implemented as
26300 a single access.
26302 The PA-RISC architecture does not support any atomic operations in
26303 hardware except for the @code{ldcw} instruction.  Thus, all atomic
26304 support is implemented using sync and atomic libcalls.  Sync libcall
26305 support is in @file{libgcc.a}.  Atomic libcall support is in
26306 @file{libatomic}.
26308 This option generates @code{__atomic_exchange} calls for atomic stores.
26309 It also provides special handling for atomic DImode accesses on 32-bit
26310 targets.
26312 @opindex mbig-switch
26313 @item -mbig-switch
26314 Does nothing.  Preserved for backward compatibility.
26316 @opindex mcaller-copies
26317 @item -mcaller-copies
26318 The caller copies function arguments passed by hidden reference.  This
26319 option should be used with care as it is not compatible with the default
26320 32-bit runtime.  However, only aggregates larger than eight bytes are
26321 passed by hidden reference and the option provides better compatibility
26322 with OpenMP.
26324 @opindex mcoherent-ldcw
26325 @item -mcoherent-ldcw
26326 Use ldcw/ldcd coherent cache-control hint.
26328 @opindex mdisable-fpregs
26329 @item -mdisable-fpregs
26330 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
26332 @opindex mdisable-indexing
26333 @item -mdisable-indexing
26334 Prevent the compiler from using indexing address modes.  This avoids some
26335 rather obscure problems when compiling MIG generated code under MACH@.
26337 @opindex mfast-indirect-calls
26338 @item -mfast-indirect-calls
26339 Generate code that assumes calls never cross space boundaries.  This
26340 allows GCC to emit code that performs faster indirect calls.
26342 This option does not work in the presence of shared libraries or nested
26343 functions.
26345 @opindex mfixed-range
26346 @item -mfixed-range=@var{register-range}
26347 Generate code treating the given register range as fixed registers.
26348 A fixed register is one that the register allocator cannot use.  This is
26349 useful when compiling kernel code.  A register range is specified as
26350 two registers separated by a dash.  Multiple register ranges can be
26351 specified separated by a comma.
26353 @opindex mgas
26354 @item -mgas
26355 Enable the use of assembler directives only GAS understands.
26357 @opindex mgnu-ld
26358 @item -mgnu-ld
26359 Use options specific to GNU @command{ld}.
26360 This passes @option{-shared} to @command{ld} when
26361 building a shared library.  It is the default when GCC is configured,
26362 explicitly or implicitly, with the GNU linker.  This option does not
26363 affect which @command{ld} is called; it only changes what parameters
26364 are passed to that @command{ld}.
26365 The @command{ld} that is called is determined by the
26366 @option{--with-ld} configure option, GCC's program search path, and
26367 finally by the user's @env{PATH}.  The linker used by GCC can be printed
26368 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
26369 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
26371 @opindex mhp-ld
26372 @item -mhp-ld
26373 Use options specific to HP @command{ld}.
26374 This passes @option{-b} to @command{ld} when building
26375 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
26376 links.  It is the default when GCC is configured, explicitly or
26377 implicitly, with the HP linker.  This option does not affect
26378 which @command{ld} is called; it only changes what parameters are passed to that
26379 @command{ld}.
26380 The @command{ld} that is called is determined by the @option{--with-ld}
26381 configure option, GCC's program search path, and finally by the user's
26382 @env{PATH}.  The linker used by GCC can be printed using @samp{which
26383 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
26384 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
26386 @opindex mlinker-opt
26387 @item -mlinker-opt
26388 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
26389 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
26390 linkers in which they give bogus error messages when linking some programs.
26392 @opindex mno-long-calls
26393 @opindex mlong-calls
26394 @item -mlong-calls
26395 Generate code that uses long call sequences.  This ensures that a call
26396 is always able to reach linker generated stubs.  The default is to generate
26397 long calls only when the distance from the call site to the beginning
26398 of the function or translation unit, as the case may be, exceeds a
26399 predefined limit set by the branch type being used.  The limits for
26400 normal calls are 7,600,000 and 240,000 bytes, respectively for the
26401 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
26402 240,000 bytes.
26404 Distances are measured from the beginning of functions when using the
26405 @option{-ffunction-sections} option, or when using the @option{-mgas}
26406 and @option{-mno-portable-runtime} options together under HP-UX with
26407 the SOM linker.
26409 It is normally not desirable to use this option as it degrades
26410 performance.  However, it may be useful in large applications,
26411 particularly when partial linking is used to build the application.
26413 The types of long calls used depends on the capabilities of the
26414 assembler and linker, and the type of code being generated.  The
26415 impact on systems that support long absolute calls, and long pic
26416 symbol-difference or pc-relative calls should be relatively small.
26417 However, an indirect call is used on 32-bit ELF systems in pic code
26418 and it is quite long.
26420 @opindex mlong-load-store
26421 @item -mlong-load-store
26422 Generate 3-instruction load and store sequences as sometimes required by
26423 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
26424 the HP compilers.
26426 @opindex mjump-in-delay
26427 @item -mjump-in-delay
26428 This option is ignored and provided for compatibility purposes only.
26430 @opindex mno-space-regs
26431 @opindex mspace-regs
26432 @item -mno-space-regs
26433 Generate code that assumes the target has no space registers.  This allows
26434 GCC to generate faster indirect calls and use unscaled index address modes.
26436 Such code is suitable for level 0 PA systems and kernels.
26438 @opindex mordered
26439 @item -mordered
26440 Assume memory references are ordered and barriers are not needed.
26442 @opindex mportable-runtime
26443 @item -mportable-runtime
26444 Use the portable calling conventions proposed by HP for ELF systems.
26446 @opindex mschedule
26447 @item -mschedule=@var{cpu-type}
26448 Schedule code according to the constraints for the machine type
26449 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
26450 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
26451 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
26452 proper scheduling option for your machine.  The default scheduling is
26453 @samp{8000}.
26455 @opindex msio
26456 @item -msio
26457 Generate the predefine, @code{_SIO}, for server IO@.  The default is
26458 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
26459 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
26460 options are available under HP-UX and HI-UX@.
26462 @opindex msoft-float
26463 @item -msoft-float
26464 Generate output containing library calls for floating point.
26465 @strong{Warning:} the requisite libraries are not available for all HPPA
26466 targets.  Normally the facilities of the machine's usual C compiler are
26467 used, but this cannot be done directly in cross-compilation.  You must make
26468 your own arrangements to provide suitable library functions for
26469 cross-compilation.
26471 @option{-msoft-float} changes the calling convention in the output file;
26472 therefore, it is only useful if you compile @emph{all} of a program with
26473 this option.  In particular, you need to compile @file{libgcc.a}, the
26474 library that comes with GCC, with @option{-msoft-float} in order for
26475 this to work.
26477 @opindex msoft-mult
26478 @item -msoft-mult
26479 Use software integer multiplication.
26481 This disables the use of the @code{xmpyu} instruction.
26483 @opindex march
26484 @item -munix=@var{unix-std}
26485 Generate compiler predefines and select a startfile for the specified
26486 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
26487 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
26488 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
26489 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
26490 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
26491 and later.
26493 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
26494 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
26495 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
26496 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
26497 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
26498 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
26500 It is @emph{important} to note that this option changes the interfaces
26501 for various library routines.  It also affects the operational behavior
26502 of the C library.  Thus, @emph{extreme} care is needed in using this
26503 option.
26505 Library code that is intended to operate with more than one UNIX
26506 standard must test, set and restore the variable @code{__xpg4_extended_mask}
26507 as appropriate.  Most GNU software doesn't provide this capability.
26509 @opindex nolibdld
26510 @item -nolibdld
26511 Suppress the generation of link options to search libdld.sl when the
26512 @option{-static} option is specified on HP-UX 10 and later.
26514 @opindex static
26515 @item -static
26516 The HP-UX implementation of setlocale in libc has a dependency on
26517 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
26518 when the @option{-static} option is specified, special link options
26519 are needed to resolve this dependency.
26521 On HP-UX 10 and later, the GCC driver adds the necessary options to
26522 link with libdld.sl when the @option{-static} option is specified.
26523 This causes the resulting binary to be dynamic.  On the 64-bit port,
26524 the linkers generate dynamic binaries by default in any case.  The
26525 @option{-nolibdld} option can be used to prevent the GCC driver from
26526 adding these link options.
26528 @opindex threads
26529 @item -threads
26530 Add support for multithreading with the @dfn{dce thread} library
26531 under HP-UX@.  This option sets flags for both the preprocessor and
26532 linker.
26533 @end table
26535 @node IA-64 Options
26536 @subsection IA-64 Options
26537 @cindex IA-64 Options
26539 These are the @samp{-m} options defined for the Intel IA-64 architecture.
26541 @table @gcctabopt
26542 @opindex mbig-endian
26543 @item -mbig-endian
26544 Generate code for a big-endian target.  This is the default for HP-UX@.
26546 @opindex mlittle-endian
26547 @item -mlittle-endian
26548 Generate code for a little-endian target.  This is the default for AIX5
26549 and GNU/Linux.
26551 @opindex mgnu-as
26552 @opindex mno-gnu-as
26553 @item -mgnu-as
26554 @itemx -mno-gnu-as
26555 Generate (or don't) code for the GNU assembler.  This is the default.
26556 @c Also, this is the default if the configure option @option{--with-gnu-as}
26557 @c is used.
26559 @opindex mgnu-ld
26560 @opindex mno-gnu-ld
26561 @item -mgnu-ld
26562 @itemx -mno-gnu-ld
26563 Generate (or don't) code for the GNU linker.  This is the default.
26564 @c Also, this is the default if the configure option @option{--with-gnu-ld}
26565 @c is used.
26567 @opindex mno-pic
26568 @item -mno-pic
26569 Generate code that does not use a global pointer register.  The result
26570 is not position independent code, and violates the IA-64 ABI@.
26572 @opindex mvolatile-asm-stop
26573 @opindex mno-volatile-asm-stop
26574 @item -mvolatile-asm-stop
26575 @itemx -mno-volatile-asm-stop
26576 Generate (or don't) a stop bit immediately before and after volatile asm
26577 statements.
26579 @opindex mregister-names
26580 @opindex mno-register-names
26581 @item -mregister-names
26582 @itemx -mno-register-names
26583 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
26584 the stacked registers.  This may make assembler output more readable.
26586 @opindex mno-sdata
26587 @opindex msdata
26588 @item -mno-sdata
26589 @itemx -msdata
26590 Disable (or enable) optimizations that use the small data section.  This may
26591 be useful for working around optimizer bugs.
26593 @opindex mconstant-gp
26594 @item -mconstant-gp
26595 Generate code that uses a single constant global pointer value.  This is
26596 useful when compiling kernel code.
26598 @opindex mauto-pic
26599 @item -mauto-pic
26600 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
26601 This is useful when compiling firmware code.
26603 @opindex minline-float-divide-min-latency
26604 @item -minline-float-divide-min-latency
26605 Generate code for inline divides of floating-point values
26606 using the minimum latency algorithm.
26608 @opindex minline-float-divide-max-throughput
26609 @item -minline-float-divide-max-throughput
26610 Generate code for inline divides of floating-point values
26611 using the maximum throughput algorithm.
26613 @opindex mno-inline-float-divide
26614 @item -mno-inline-float-divide
26615 Do not generate inline code for divides of floating-point values.
26617 @opindex minline-int-divide-min-latency
26618 @item -minline-int-divide-min-latency
26619 Generate code for inline divides of integer values
26620 using the minimum latency algorithm.
26622 @opindex minline-int-divide-max-throughput
26623 @item -minline-int-divide-max-throughput
26624 Generate code for inline divides of integer values
26625 using the maximum throughput algorithm.
26627 @opindex mno-inline-int-divide
26628 @opindex minline-int-divide
26629 @item -mno-inline-int-divide
26630 Do not generate inline code for divides of integer values.
26632 @opindex minline-sqrt-min-latency
26633 @item -minline-sqrt-min-latency
26634 Generate code for inline square roots
26635 using the minimum latency algorithm.
26637 @opindex minline-sqrt-max-throughput
26638 @item -minline-sqrt-max-throughput
26639 Generate code for inline square roots
26640 using the maximum throughput algorithm.
26642 @opindex mno-inline-sqrt
26643 @item -mno-inline-sqrt
26644 Do not generate inline code for @code{sqrt}.
26646 @opindex mfused-madd
26647 @opindex mno-fused-madd
26648 @item -mfused-madd
26649 @itemx -mno-fused-madd
26650 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
26651 instructions.  The default is to use these instructions.
26653 @opindex mno-dwarf2-asm
26654 @opindex mdwarf2-asm
26655 @item -mno-dwarf2-asm
26656 @itemx -mdwarf2-asm
26657 Don't (or do) generate assembler code for the DWARF line number debugging
26658 info.  This may be useful when not using the GNU assembler.
26660 @opindex mearly-stop-bits
26661 @opindex mno-early-stop-bits
26662 @item -mearly-stop-bits
26663 @itemx -mno-early-stop-bits
26664 Allow stop bits to be placed earlier than immediately preceding the
26665 instruction that triggered the stop bit.  This can improve instruction
26666 scheduling, but does not always do so.
26668 @opindex mfixed-range
26669 @item -mfixed-range=@var{register-range}
26670 Generate code treating the given register range as fixed registers.
26671 A fixed register is one that the register allocator cannot use.  This is
26672 useful when compiling kernel code.  A register range is specified as
26673 two registers separated by a dash.  Multiple register ranges can be
26674 specified separated by a comma.
26676 @opindex mtls-size
26677 @item -mtls-size=@var{tls-size}
26678 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
26681 @opindex mtune
26682 @item -mtune=@var{cpu-type}
26683 Tune the instruction scheduling for a particular CPU, Valid values are
26684 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
26685 and @samp{mckinley}.
26687 @opindex milp32
26688 @opindex mlp64
26689 @item -milp32
26690 @itemx -mlp64
26691 Generate code for a 32-bit or 64-bit environment.
26692 The 32-bit environment sets int, long and pointer to 32 bits.
26693 The 64-bit environment sets int to 32 bits and long and pointer
26694 to 64 bits.  These are HP-UX specific flags.
26696 @opindex mno-sched-br-data-spec
26697 @opindex msched-br-data-spec
26698 @item -mno-sched-br-data-spec
26699 @itemx -msched-br-data-spec
26700 (Dis/En)able data speculative scheduling before reload.
26701 This results in generation of @code{ld.a} instructions and
26702 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26703 The default setting is disabled.
26705 @opindex msched-ar-data-spec
26706 @opindex mno-sched-ar-data-spec
26707 @item -msched-ar-data-spec
26708 @itemx -mno-sched-ar-data-spec
26709 (En/Dis)able data speculative scheduling after reload.
26710 This results in generation of @code{ld.a} instructions and
26711 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26712 The default setting is enabled.
26714 @opindex mno-sched-control-spec
26715 @opindex msched-control-spec
26716 @item -mno-sched-control-spec
26717 @itemx -msched-control-spec
26718 (Dis/En)able control speculative scheduling.  This feature is
26719 available only during region scheduling (i.e.@: before reload).
26720 This results in generation of the @code{ld.s} instructions and
26721 the corresponding check instructions @code{chk.s}.
26722 The default setting is disabled.
26724 @opindex msched-br-in-data-spec
26725 @opindex mno-sched-br-in-data-spec
26726 @item -msched-br-in-data-spec
26727 @itemx -mno-sched-br-in-data-spec
26728 (En/Dis)able speculative scheduling of the instructions that
26729 are dependent on the data speculative loads before reload.
26730 This is effective only with @option{-msched-br-data-spec} enabled.
26731 The default setting is enabled.
26733 @opindex msched-ar-in-data-spec
26734 @opindex mno-sched-ar-in-data-spec
26735 @item -msched-ar-in-data-spec
26736 @itemx -mno-sched-ar-in-data-spec
26737 (En/Dis)able speculative scheduling of the instructions that
26738 are dependent on the data speculative loads after reload.
26739 This is effective only with @option{-msched-ar-data-spec} enabled.
26740 The default setting is enabled.
26742 @opindex msched-in-control-spec
26743 @opindex mno-sched-in-control-spec
26744 @item -msched-in-control-spec
26745 @itemx -mno-sched-in-control-spec
26746 (En/Dis)able speculative scheduling of the instructions that
26747 are dependent on the control speculative loads.
26748 This is effective only with @option{-msched-control-spec} enabled.
26749 The default setting is enabled.
26751 @opindex mno-sched-prefer-non-data-spec-insns
26752 @opindex msched-prefer-non-data-spec-insns
26753 @item -mno-sched-prefer-non-data-spec-insns
26754 @itemx -msched-prefer-non-data-spec-insns
26755 If enabled, data-speculative instructions are chosen for schedule
26756 only if there are no other choices at the moment.  This makes
26757 the use of the data speculation much more conservative.
26758 The default setting is disabled.
26760 @opindex mno-sched-prefer-non-control-spec-insns
26761 @opindex msched-prefer-non-control-spec-insns
26762 @item -mno-sched-prefer-non-control-spec-insns
26763 @itemx -msched-prefer-non-control-spec-insns
26764 If enabled, control-speculative instructions are chosen for schedule
26765 only if there are no other choices at the moment.  This makes
26766 the use of the control speculation much more conservative.
26767 The default setting is disabled.
26769 @opindex mno-sched-count-spec-in-critical-path
26770 @opindex msched-count-spec-in-critical-path
26771 @item -mno-sched-count-spec-in-critical-path
26772 @itemx -msched-count-spec-in-critical-path
26773 If enabled, speculative dependencies are considered during
26774 computation of the instructions priorities.  This makes the use of the
26775 speculation a bit more conservative.
26776 The default setting is disabled.
26778 @opindex msched-spec-ldc
26779 @item -msched-spec-ldc
26780 Use a simple data speculation check.  This option is on by default.
26782 @opindex msched-spec-ldc
26783 @item -msched-control-spec-ldc
26784 Use a simple check for control speculation.  This option is on by default.
26786 @opindex msched-stop-bits-after-every-cycle
26787 @item -msched-stop-bits-after-every-cycle
26788 Place a stop bit after every cycle when scheduling.  This option is on
26789 by default.
26791 @opindex msched-fp-mem-deps-zero-cost
26792 @item -msched-fp-mem-deps-zero-cost
26793 Assume that floating-point stores and loads are not likely to cause a conflict
26794 when placed into the same instruction group.  This option is disabled by
26795 default.
26797 @opindex msel-sched-dont-check-control-spec
26798 @item -msel-sched-dont-check-control-spec
26799 Generate checks for control speculation in selective scheduling.
26800 This flag is disabled by default.
26802 @opindex msched-max-memory-insns
26803 @item -msched-max-memory-insns=@var{max-insns}
26804 Limit on the number of memory insns per instruction group, giving lower
26805 priority to subsequent memory insns attempting to schedule in the same
26806 instruction group. Frequently useful to prevent cache bank conflicts.
26807 The default value is 1.
26809 @opindex msched-max-memory-insns-hard-limit
26810 @item -msched-max-memory-insns-hard-limit
26811 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
26812 disallowing more than that number in an instruction group.
26813 Otherwise, the limit is ``soft'', meaning that non-memory operations
26814 are preferred when the limit is reached, but memory operations may still
26815 be scheduled.
26817 @end table
26819 @node LM32 Options
26820 @subsection LM32 Options
26821 @cindex LM32 options
26823 These @option{-m} options are defined for the LatticeMico32 architecture:
26825 @table @gcctabopt
26826 @opindex mbarrel-shift-enabled
26827 @item -mbarrel-shift-enabled
26828 Enable barrel-shift instructions.
26830 @opindex mdivide-enabled
26831 @item -mdivide-enabled
26832 Enable divide and modulus instructions.
26834 @opindex multiply-enabled
26835 @item -mmultiply-enabled
26836 Enable multiply instructions.
26838 @opindex msign-extend-enabled
26839 @item -msign-extend-enabled
26840 Enable sign extend instructions.
26842 @opindex muser-enabled
26843 @item -muser-enabled
26844 Enable user-defined instructions.
26846 @end table
26848 @node LoongArch Options
26849 @subsection LoongArch Options
26850 @cindex LoongArch Options
26852 These command-line options are defined for LoongArch targets:
26854 @table @gcctabopt
26855 @opindex march
26856 @item -march=@var{arch-type}
26857 Generate instructions for the machine type @var{arch-type}.
26858 @option{-march=@var{arch-type}} allows GCC to generate code that
26859 may not run at all on processors other than the one indicated.
26861 The choices for @var{arch-type} are:
26863 @table @samp
26864 @item native
26865 Local processor type detected by the native compiler.
26866 @item loongarch64
26867 Generic LoongArch 64-bit processor.
26868 @item la464
26869 LoongArch LA464-based processor with LSX, LASX.
26870 @item la664
26871 LoongArch LA664-based processor with LSX, LASX
26872 and all LoongArch v1.1 instructions.
26873 @item la64v1.0
26874 LoongArch64 ISA version 1.0.
26875 @item la64v1.1
26876 LoongArch64 ISA version 1.1.
26877 @end table
26879 More information about LoongArch ISA versions can be found at
26880 @uref{https://github.com/loongson/la-toolchain-conventions}.
26882 @opindex mtune
26883 @item -mtune=@var{tune-type}
26884 Optimize the generated code for the given processor target.
26886 The choices for @var{tune-type} are:
26888 @table @samp
26889 @item native
26890 Local processor type detected by the native compiler.
26891 @item generic
26892 Generic LoongArch processor.
26893 @item loongarch64
26894 Generic LoongArch 64-bit processor.
26895 @item la464
26896 LoongArch LA464 core.
26897 @item la664
26898 LoongArch LA664 core.
26899 @end table
26902 @opindex mabi
26903 @item -mabi=@var{base-abi-type}
26904 Generate code for the specified calling convention.
26905 @var{base-abi-type} can be one of:
26906 @table @samp
26907 @item lp64d
26908 Uses 64-bit general purpose registers and 32/64-bit floating-point
26909 registers for parameter passing.  Data model is LP64, where @samp{int}
26910 is 32 bits, while @samp{long int} and pointers are 64 bits.
26911 @item lp64f
26912 Uses 64-bit general purpose registers and 32-bit floating-point
26913 registers for parameter passing.  Data model is LP64, where @samp{int}
26914 is 32 bits, while @samp{long int} and pointers are 64 bits.
26915 @item lp64s
26916 Uses 64-bit general purpose registers and no floating-point
26917 registers for parameter passing.  Data model is LP64, where @samp{int}
26918 is 32 bits, while @samp{long int} and pointers are 64 bits.
26919 @end table
26921 @opindex mfpu
26922 @item -mfpu=@var{fpu-type}
26923 Generate code for the specified FPU type, which can be one of:
26924 @table @samp
26925 @item 64
26926 Allow the use of hardware floating-point instructions for 32-bit
26927 and 64-bit operations.
26928 @item 32
26929 Allow the use of hardware floating-point instructions for 32-bit
26930 operations.
26931 @item none
26932 @item 0
26933 Prevent the use of hardware floating-point instructions.
26934 @end table
26936 @opindex msimd
26937 @item -msimd=@var{simd-type}
26938 Enable generation of LoongArch SIMD instructions for vectorization
26939 and via builtin functions.  The value can be one of:
26940 @table @samp
26941 @item lasx
26942 Enable generating instructions from the 256-bit LoongArch Advanced
26943 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26944 @item lsx
26945 Enable generating instructions from the 128-bit LoongArch SIMD
26946 Extension (LSX).
26947 @item none
26948 No LoongArch SIMD instruction may be generated.
26949 @end table
26951 @opindex msoft-float
26952 @item -msoft-float
26953 Force @option{-mfpu=none} and prevents the use of floating-point
26954 registers for parameter passing.  This option may change the target
26955 ABI.
26957 @opindex msingle-float
26958 @item -msingle-float
26959 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26960 registers for parameter passing.  This option may change the target
26961 ABI.
26963 @opindex mdouble-float
26964 @item -mdouble-float
26965 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26966 registers for parameter passing.  This option may change the target
26967 ABI.
26969 @opindex ml[a]sx
26970 @item -mlasx
26971 @itemx -mno-lasx
26972 @item -mlsx
26973 @itemx -mno-lsx
26974 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26975 that can be used by the compiler for code generation.  Enabling LASX with
26976 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26977 automatically disables LASX.  These driver-only options act upon the final
26978 @option{msimd} configuration state and make incremental chagnes in the order
26979 they appear on the GCC driver's command line, deriving the final / canonicalized
26980 @option{msimd} option that is passed to the compiler proper.
26982 @opindex mbranch-cost
26983 @item -mbranch-cost=@var{n}
26984 Set the cost of branches to roughly @var{n} instructions.
26986 @opindex mcheck-zero-division
26987 @item -mcheck-zero-division
26988 @itemx -mno-check-zero-divison
26989 Trap (do not trap) on integer division by zero.  The default is
26990 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26991 @option{-mno-check-zero-division} for other optimization levels.
26993 @opindex mcond-move-int
26994 @item -mcond-move-int
26995 @itemx -mno-cond-move-int
26996 Conditional moves for integral data in general-purpose registers
26997 are enabled (disabled).  The default is @option{-mcond-move-int}.
26999 @opindex mcond-move-float
27000 @item -mcond-move-float
27001 @itemx -mno-cond-move-float
27002 Conditional moves for floating-point registers are enabled (disabled).
27003 The default is @option{-mcond-move-float}.
27005 @opindex mmemcpy
27006 @item -mmemcpy
27007 @itemx -mno-memcpy
27008 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
27009 The default is @option{-mno-memcpy}, which allows GCC to inline most
27010 constant-sized copies.  Setting optimization level to @option{-Os} also
27011 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
27012 behavior if explicitly specified, regardless of the order these options on
27013 the command line.
27015 @opindex mstrict-align
27016 @item -mstrict-align
27017 @itemx -mno-strict-align
27018 Avoid or allow generating memory accesses that may not be aligned on a natural
27019 object boundary as described in the architecture specification. The default is
27020 @option{-mno-strict-align}.
27022 @opindex msmall-data-limit
27023 @item -msmall-data-limit=@var{number}
27024 Put global and static data smaller than @var{number} bytes into a special
27025 section (on some targets).  The default value is 0.
27027 @opindex mmax-inline-memcpy-size
27028 @item -mmax-inline-memcpy-size=@var{n}
27029 Inline all block moves (such as calls to @code{memcpy} or structure copies)
27030 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
27032 @opindex mcmodel
27033 @item -mcmodel=@var{code-model}
27034 Set the code model to one of:
27035 @table @samp
27036 @item tiny-static (Not implemented yet)
27037 @item tiny (Not implemented yet)
27039 @item normal
27040 The text segment must be within 128MB addressing space.  The data segment must
27041 be within 2GB addressing space.
27043 @item medium
27044 The text segment and data segment must be within 2GB addressing space.
27046 @item large (Not implemented yet)
27048 @item extreme
27049 This mode does not limit the size of the code segment and data segment.
27050 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt}
27051 and/or @option{-mexplicit-relocs=none}.
27052 @end table
27053 The default code model is @code{normal}.
27055 @item -mexplicit-relocs=@var{style}
27056 Set when to use assembler relocation operators when dealing with symbolic
27057 addresses.  The alternative is to use assembler macros instead, which may
27058 limit instruction scheduling but allow linker relaxation.
27059 with @option{-mexplicit-relocs=none} the assembler macros are always used,
27060 with @option{-mexplicit-relocs=always} the assembler relocation operators
27061 are always used, with @option{-mexplicit-relocs=auto} the compiler will
27062 use the relocation operators where the linker relaxation is impossible to
27063 improve the code quality, and macros elsewhere.  The default
27064 value for the option is determined with the assembler capability detected
27065 during GCC build-time and the setting of @option{-mrelax}:
27066 @option{-mexplicit-relocs=none} if the assembler does not support
27067 relocation operators at all,
27068 @option{-mexplicit-relocs=always} if the assembler supports relocation
27069 operators but @option{-mrelax} is not enabled,
27070 @option{-mexplicit-relocs=auto} if the assembler supports relocation
27071 operators and @option{-mrelax} is enabled.
27073 @opindex mexplicit-relocs
27074 @item -mexplicit-relocs
27075 An alias of @option{-mexplicit-relocs=always} for backward compatibility.
27077 @opindex mno-explicit-relocs
27078 @item -mno-explicit-relocs
27079 An alias of @option{-mexplicit-relocs=none} for backward compatibility.
27081 @opindex mdirect-extern-access
27082 @item -mdirect-extern-access
27083 @itemx -mno-direct-extern-access
27084 Do not use or use GOT to access external symbols.  The default is
27085 @option{-mno-direct-extern-access}: GOT is used for external symbols with
27086 default visibility, but not used for other external symbols.
27088 With @option{-mdirect-extern-access}, GOT is not used and all external
27089 symbols are PC-relatively addressed.  It is @strong{only} suitable for
27090 environments where no dynamic link is performed, like firmwares, OS
27091 kernels, executables linked with @option{-static} or @option{-static-pie}.
27092 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
27093 @option{-fpic}.
27095 @opindex mrelax
27096 @opindex mno-relax
27097 @item -mrelax
27098 @itemx -mno-relax
27099 Take (do not take) advantage of linker relaxations.  If
27100 @option{-mpass-mrelax-to-as} is enabled, this option is also passed to
27101 the assembler.  The default is determined during GCC build-time by
27102 detecting corresponding assembler support:
27103 @option{-mrelax} if the assembler supports both the @option{-mrelax}
27104 option and the conditional branch relaxation (it's required or the
27105 @code{.align} directives and conditional branch instructions in the
27106 assembly code outputted by GCC may be rejected by the assembler because
27107 of a relocation overflow), @option{-mno-relax} otherwise.
27109 @opindex mpass-mrelax-to-as
27110 @opindex mno-pass-mrelax-to-as
27111 @item -mpass-mrelax-to-as
27112 @itemx -mno-pass-mrelax-to-as
27113 Pass (do not pass) the @option{-mrelax} or @option{-mno-relax} option
27114 to the assembler.  The default is determined during GCC build-time by
27115 detecting corresponding assembler support:
27116 @option{-mpass-mrelax-to-as} if the assembler supports the
27117 @option{-mrelax} option, @option{-mno-pass-mrelax-to-as} otherwise.
27118 This option is mostly useful for debugging, or interoperation with
27119 assemblers different from the build-time one.
27121 @opindex mrecip
27122 @item -mrecip
27123 This option enables use of the reciprocal estimate and reciprocal square
27124 root estimate instructions with additional Newton-Raphson steps to increase
27125 precision instead of doing a divide or square root and divide for
27126 floating-point arguments.
27127 These instructions are generated only when @option{-funsafe-math-optimizations}
27128 is enabled together with @option{-ffinite-math-only} and
27129 @option{-fno-trapping-math}.
27130 This option is off by default. Before you can use this option, you must sure the
27131 target CPU supports frecipe and frsqrte instructions.
27132 Note that while the throughput of the sequence is higher than the throughput of
27133 the non-reciprocal instruction, the precision of the sequence can be decreased
27134 by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27136 @opindex mrecip=opt
27137 @item -mrecip=@var{opt}
27138 This option controls which reciprocal estimate instructions
27139 may be used.  @var{opt} is a comma-separated list of options, which may
27140 be preceded by a @samp{!} to invert the option:
27142 @table @samp
27143 @item all
27144 Enable all estimate instructions.
27146 @item default
27147 Enable the default instructions, equivalent to @option{-mrecip}.
27149 @item none
27150 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27152 @item div
27153 Enable the approximation for scalar division.
27155 @item vec-div
27156 Enable the approximation for vectorized division.
27158 @item sqrt
27159 Enable the approximation for scalar square root.
27161 @item vec-sqrt
27162 Enable the approximation for vectorized square root.
27164 @item rsqrt
27165 Enable the approximation for scalar reciprocal square root.
27167 @item vec-rsqrt
27168 Enable the approximation for vectorized reciprocal square root.
27169 @end table
27171 So, for example, @option{-mrecip=all,!sqrt} enables
27172 all of the reciprocal approximations, except for scalar square root.
27174 @opindex mfrecipe
27175 @opindex mno-frecipe
27176 @item -mfrecipe
27177 @itemx -mno-frecipe
27178 Use (do not use) @code{frecipe.@{s/d@}} and @code{frsqrte.@{s/d@}}
27179 instructions.  When build with @option{-march=la664}, it is enabled by default.
27180 The default is @option{-mno-frecipe}.
27182 @opindex mdiv32
27183 @opindex mno-div32
27184 @item -mdiv32
27185 @itemx -mno-div32
27186 Use (do not use) @code{div.w[u]} and @code{mod.w[u]} instructions with input
27187 not sign-extended.  When build with @option{-march=la664}, it is enabled by
27188 default.  The default is @option{-mno-div32}.
27190 @opindex mlam-bh
27191 @opindex mno-lam-bh
27192 @item -mlam-bh
27193 @itemx -mno-lam-bh
27194 Use (do not use) @code{am@{swap/add@}[_db].@{b/h@}} instructions.  When build
27195 with @option{-march=la664}, it is enabled by default.  The default is
27196 @option{-mno-lam-bh}.
27198 @opindex mlamcas
27199 @opindex mno-lamcas
27200 @item -mlamcas
27201 @itemx -mno-lamcas
27202 Use (do not use) @code{amcas[_db].@{b/h/w/d@}} instructions.  When build with
27203 @option{-march=la664}, it is enabled by default.  The default is
27204 @option{-mno-lamcas}.
27206 @opindex mld-seq-sa
27207 @opindex mno-ld-seq-sa
27208 @item -mld-seq-sa
27209 @itemx -mno-ld-seq-sa
27210 Whether a load-load barrier (@code{dbar 0x700}) is needed.  When build with
27211 @option{-march=la664}, it is enabled by default.  The default is
27212 @option{-mno-ld-seq-sa}, the load-load barrier is needed.
27214 @opindex mtls-dialect
27215 @item -mtls-dialect=@var{opt}
27216 This option controls which tls dialect may be used for general dynamic and
27217 local dynamic TLS models.
27219 @table @samp
27220 @item trad
27221 Use traditional TLS. This is the default.
27223 @item desc
27224 Use TLS descriptors.
27225 @end table
27227 @item --param loongarch-vect-unroll-limit=@var{n}
27228 The vectorizer will use available tuning information to determine whether it
27229 would be beneficial to unroll the main vectorized loop and by how much.  This
27230 parameter set's the upper bound of how much the vectorizer will unroll the main
27231 loop.  The default value is six.
27233 @end table
27236 @node M32C Options
27237 @subsection M32C Options
27238 @cindex M32C options
27240 @table @gcctabopt
27241 @opindex mcpu=
27242 @item -mcpu=@var{name}
27243 Select the CPU for which code is generated.  @var{name} may be one of
27244 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
27245 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
27246 the M32C/80 series.
27248 @opindex msim
27249 @item -msim
27250 Specifies that the program will be run on the simulator.  This causes
27251 an alternate runtime library to be linked in which supports, for
27252 example, file I/O@.  You must not use this option when generating
27253 programs that will run on real hardware; you must provide your own
27254 runtime library for whatever I/O functions are needed.
27256 @opindex memregs=
27257 @item -memregs=@var{number}
27258 Specifies the number of memory-based pseudo-registers GCC uses
27259 during code generation.  These pseudo-registers are used like real
27260 registers, so there is a tradeoff between GCC's ability to fit the
27261 code into available registers, and the performance penalty of using
27262 memory instead of registers.  Note that all modules in a program must
27263 be compiled with the same value for this option.  Because of that, you
27264 must not use this option with GCC's default runtime libraries.
27266 @end table
27268 @node M32R/D Options
27269 @subsection M32R/D Options
27270 @cindex M32R/D options
27272 These @option{-m} options are defined for Renesas M32R/D architectures:
27274 @table @gcctabopt
27275 @opindex m32r2
27276 @item -m32r2
27277 Generate code for the M32R/2@.
27279 @opindex m32rx
27280 @item -m32rx
27281 Generate code for the M32R/X@.
27283 @opindex m32r
27284 @item -m32r
27285 Generate code for the M32R@.  This is the default.
27287 @opindex mmodel=small
27288 @item -mmodel=small
27289 Assume all objects live in the lower 16MB of memory (so that their addresses
27290 can be loaded with the @code{ld24} instruction), and assume all subroutines
27291 are reachable with the @code{bl} instruction.
27292 This is the default.
27294 The addressability of a particular object can be set with the
27295 @code{model} attribute.
27297 @opindex mmodel=medium
27298 @item -mmodel=medium
27299 Assume objects may be anywhere in the 32-bit address space (the compiler
27300 generates @code{seth/add3} instructions to load their addresses), and
27301 assume all subroutines are reachable with the @code{bl} instruction.
27303 @opindex mmodel=large
27304 @item -mmodel=large
27305 Assume objects may be anywhere in the 32-bit address space (the compiler
27306 generates @code{seth/add3} instructions to load their addresses), and
27307 assume subroutines may not be reachable with the @code{bl} instruction
27308 (the compiler generates the much slower @code{seth/add3/jl}
27309 instruction sequence).
27311 @opindex msdata=none
27312 @item -msdata=none
27313 Disable use of the small data area.  Variables are put into
27314 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
27315 @code{section} attribute has been specified).
27316 This is the default.
27318 The small data area consists of sections @code{.sdata} and @code{.sbss}.
27319 Objects may be explicitly put in the small data area with the
27320 @code{section} attribute using one of these sections.
27322 @opindex msdata=sdata
27323 @item -msdata=sdata
27324 Put small global and static data in the small data area, but do not
27325 generate special code to reference them.
27327 @opindex msdata=use
27328 @item -msdata=use
27329 Put small global and static data in the small data area, and generate
27330 special instructions to reference them.
27332 @opindex G
27333 @cindex smaller data references
27334 @item -G @var{num}
27335 Put global and static objects less than or equal to @var{num} bytes
27336 into the small data or BSS sections instead of the normal data or BSS
27337 sections.  The default value of @var{num} is 8.
27338 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
27339 for this option to have any effect.
27341 All modules should be compiled with the same @option{-G @var{num}} value.
27342 Compiling with different values of @var{num} may or may not work; if it
27343 doesn't the linker gives an error message---incorrect code is not
27344 generated.
27346 @opindex mdebug
27347 @item -mdebug
27348 Makes the M32R-specific code in the compiler display some statistics
27349 that might help in debugging programs.
27351 @opindex malign-loops
27352 @item -malign-loops
27353 Align all loops to a 32-byte boundary.
27355 @opindex mno-align-loops
27356 @item -mno-align-loops
27357 Do not enforce a 32-byte alignment for loops.  This is the default.
27359 @opindex missue-rate=@var{number}
27360 @item -missue-rate=@var{number}
27361 Issue @var{number} instructions per cycle.  @var{number} can only be 1
27362 or 2.
27364 @opindex mbranch-cost=@var{number}
27365 @item -mbranch-cost=@var{number}
27366 @var{number} can only be 1 or 2.  If it is 1 then branches are
27367 preferred over conditional code, if it is 2, then the opposite applies.
27369 @opindex mflush-trap=@var{number}
27370 @item -mflush-trap=@var{number}
27371 Specifies the trap number to use to flush the cache.  The default is
27372 12.  Valid numbers are between 0 and 15 inclusive.
27374 @opindex mno-flush-trap
27375 @item -mno-flush-trap
27376 Specifies that the cache cannot be flushed by using a trap.
27378 @opindex mflush-func=@var{name}
27379 @item -mflush-func=@var{name}
27380 Specifies the name of the operating system function to call to flush
27381 the cache.  The default is @samp{_flush_cache}, but a function call
27382 is only used if a trap is not available.
27384 @opindex mno-flush-func
27385 @item -mno-flush-func
27386 Indicates that there is no OS function for flushing the cache.
27388 @end table
27390 @node M680x0 Options
27391 @subsection M680x0 Options
27392 @cindex M680x0 options
27394 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
27395 The default settings depend on which architecture was selected when
27396 the compiler was configured; the defaults for the most common choices
27397 are given below.
27399 @table @gcctabopt
27400 @opindex march
27401 @item -march=@var{arch}
27402 Generate code for a specific M680x0 or ColdFire instruction set
27403 architecture.  Permissible values of @var{arch} for M680x0
27404 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
27405 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
27406 architectures are selected according to Freescale's ISA classification
27407 and the permissible values are: @samp{isaa}, @samp{isaaplus},
27408 @samp{isab} and @samp{isac}.
27410 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
27411 code for a ColdFire target.  The @var{arch} in this macro is one of the
27412 @option{-march} arguments given above.
27414 When used together, @option{-march} and @option{-mtune} select code
27415 that runs on a family of similar processors but that is optimized
27416 for a particular microarchitecture.
27418 @opindex mcpu
27419 @item -mcpu=@var{cpu}
27420 Generate code for a specific M680x0 or ColdFire processor.
27421 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
27422 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
27423 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
27424 below, which also classifies the CPUs into families:
27426 @multitable @columnfractions 0.20 0.80
27427 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
27428 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51ag} @samp{51cn} @samp{51em} @samp{51je} @samp{51jf} @samp{51jg} @samp{51jm} @samp{51mm} @samp{51qe} @samp{51qm}
27429 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
27430 @item @samp{5206e} @tab @samp{5206e}
27431 @item @samp{5208} @tab @samp{5207} @samp{5208}
27432 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
27433 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
27434 @item @samp{5216} @tab @samp{5214} @samp{5216}
27435 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
27436 @item @samp{5225} @tab @samp{5224} @samp{5225}
27437 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
27438 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
27439 @item @samp{5249} @tab @samp{5249}
27440 @item @samp{5250} @tab @samp{5250}
27441 @item @samp{5271} @tab @samp{5270} @samp{5271}
27442 @item @samp{5272} @tab @samp{5272}
27443 @item @samp{5275} @tab @samp{5274} @samp{5275}
27444 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
27445 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
27446 @item @samp{5307} @tab @samp{5307}
27447 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
27448 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
27449 @item @samp{5407} @tab @samp{5407}
27450 @item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485}
27451 @end multitable
27453 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
27454 @var{arch} is compatible with @var{cpu}.  Other combinations of
27455 @option{-mcpu} and @option{-march} are rejected.
27457 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
27458 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
27459 where the value of @var{family} is given by the table above.
27461 @opindex mtune
27462 @item -mtune=@var{tune}
27463 Tune the code for a particular microarchitecture within the
27464 constraints set by @option{-march} and @option{-mcpu}.
27465 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
27466 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
27467 and @samp{cpu32}.  The ColdFire microarchitectures
27468 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
27470 You can also use @option{-mtune=68020-40} for code that needs
27471 to run relatively well on 68020, 68030 and 68040 targets.
27472 @option{-mtune=68020-60} is similar but includes 68060 targets
27473 as well.  These two options select the same tuning decisions as
27474 @option{-m68020-40} and @option{-m68020-60} respectively.
27476 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
27477 when tuning for 680x0 architecture @var{arch}.  It also defines
27478 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
27479 option is used.  If GCC is tuning for a range of architectures,
27480 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
27481 it defines the macros for every architecture in the range.
27483 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
27484 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
27485 of the arguments given above.
27487 @opindex m68000
27488 @opindex mc68000
27489 @item -m68000
27490 @itemx -mc68000
27491 Generate output for a 68000.  This is the default
27492 when the compiler is configured for 68000-based systems.
27493 It is equivalent to @option{-march=68000}.
27495 Use this option for microcontrollers with a 68000 or EC000 core,
27496 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
27498 @opindex m68010
27499 @item -m68010
27500 Generate output for a 68010.  This is the default
27501 when the compiler is configured for 68010-based systems.
27502 It is equivalent to @option{-march=68010}.
27504 @opindex m68020
27505 @opindex mc68020
27506 @item -m68020
27507 @itemx -mc68020
27508 Generate output for a 68020.  This is the default
27509 when the compiler is configured for 68020-based systems.
27510 It is equivalent to @option{-march=68020}.
27512 @opindex m68030
27513 @item -m68030
27514 Generate output for a 68030.  This is the default when the compiler is
27515 configured for 68030-based systems.  It is equivalent to
27516 @option{-march=68030}.
27518 @opindex m68040
27519 @item -m68040
27520 Generate output for a 68040.  This is the default when the compiler is
27521 configured for 68040-based systems.  It is equivalent to
27522 @option{-march=68040}.
27524 This option inhibits the use of 68881/68882 instructions that have to be
27525 emulated by software on the 68040.  Use this option if your 68040 does not
27526 have code to emulate those instructions.
27528 @opindex m68060
27529 @item -m68060
27530 Generate output for a 68060.  This is the default when the compiler is
27531 configured for 68060-based systems.  It is equivalent to
27532 @option{-march=68060}.
27534 This option inhibits the use of 68020 and 68881/68882 instructions that
27535 have to be emulated by software on the 68060.  Use this option if your 68060
27536 does not have code to emulate those instructions.
27538 @opindex mcpu32
27539 @item -mcpu32
27540 Generate output for a CPU32.  This is the default
27541 when the compiler is configured for CPU32-based systems.
27542 It is equivalent to @option{-march=cpu32}.
27544 Use this option for microcontrollers with a
27545 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
27546 68336, 68340, 68341, 68349 and 68360.
27548 @opindex m5200
27549 @item -m5200
27550 Generate output for a 520X ColdFire CPU@.  This is the default
27551 when the compiler is configured for 520X-based systems.
27552 It is equivalent to @option{-mcpu=5206}, and is now deprecated
27553 in favor of that option.
27555 Use this option for microcontroller with a 5200 core, including
27556 the MCF5202, MCF5203, MCF5204 and MCF5206.
27558 @opindex m5206e
27559 @item -m5206e
27560 Generate output for a 5206e ColdFire CPU@.  The option is now
27561 deprecated in favor of the equivalent @option{-mcpu=5206e}.
27563 @opindex m528x
27564 @item -m528x
27565 Generate output for a member of the ColdFire 528X family.
27566 The option is now deprecated in favor of the equivalent
27567 @option{-mcpu=528x}.
27569 @opindex m5307
27570 @item -m5307
27571 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
27572 in favor of the equivalent @option{-mcpu=5307}.
27574 @opindex m5407
27575 @item -m5407
27576 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
27577 in favor of the equivalent @option{-mcpu=5407}.
27579 @opindex mcfv4e
27580 @item -mcfv4e
27581 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
27582 This includes use of hardware floating-point instructions.
27583 The option is equivalent to @option{-mcpu=547x}, and is now
27584 deprecated in favor of that option.
27586 @opindex m68020-40
27587 @item -m68020-40
27588 Generate output for a 68040, without using any of the new instructions.
27589 This results in code that can run relatively efficiently on either a
27590 68020/68881 or a 68030 or a 68040.  The generated code does use the
27591 68881 instructions that are emulated on the 68040.
27593 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
27595 @opindex m68020-60
27596 @item -m68020-60
27597 Generate output for a 68060, without using any of the new instructions.
27598 This results in code that can run relatively efficiently on either a
27599 68020/68881 or a 68030 or a 68040.  The generated code does use the
27600 68881 instructions that are emulated on the 68060.
27602 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
27604 @opindex mhard-float
27605 @opindex m68881
27606 @item -mhard-float
27607 @itemx -m68881
27608 Generate floating-point instructions.  This is the default for 68020
27609 and above, and for ColdFire devices that have an FPU@.  It defines the
27610 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
27611 on ColdFire targets.
27613 @opindex msoft-float
27614 @item -msoft-float
27615 Do not generate floating-point instructions; use library calls instead.
27616 This is the default for 68000, 68010, and 68832 targets.  It is also
27617 the default for ColdFire devices that have no FPU.
27619 @opindex mdiv
27620 @opindex mno-div
27621 @item -mdiv
27622 @itemx -mno-div
27623 Generate (do not generate) ColdFire hardware divide and remainder
27624 instructions.  If @option{-march} is used without @option{-mcpu},
27625 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
27626 architectures.  Otherwise, the default is taken from the target CPU
27627 (either the default CPU, or the one specified by @option{-mcpu}).  For
27628 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
27629 @option{-mcpu=5206e}.
27631 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
27633 @opindex mshort
27634 @item -mshort
27635 Consider type @code{int} to be 16 bits wide, like @code{short int}.
27636 Additionally, parameters passed on the stack are also aligned to a
27637 16-bit boundary even on targets whose API mandates promotion to 32-bit.
27639 @opindex mno-short
27640 @item -mno-short
27641 Do not consider type @code{int} to be 16 bits wide.  This is the default.
27643 @opindex mnobitfield
27644 @opindex mno-bitfield
27645 @item -mnobitfield
27646 @itemx -mno-bitfield
27647 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
27648 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
27650 @opindex mbitfield
27651 @item -mbitfield
27652 Do use the bit-field instructions.  The @option{-m68020} option implies
27653 @option{-mbitfield}.  This is the default if you use a configuration
27654 designed for a 68020.
27656 @opindex mrtd
27657 @item -mrtd
27658 Use a different function-calling convention, in which functions
27659 that take a fixed number of arguments return with the @code{rtd}
27660 instruction, which pops their arguments while returning.  This
27661 saves one instruction in the caller since there is no need to pop
27662 the arguments there.
27664 This calling convention is incompatible with the one normally
27665 used on Unix, so you cannot use it if you need to call libraries
27666 compiled with the Unix compiler.
27668 Also, you must provide function prototypes for all functions that
27669 take variable numbers of arguments (including @code{printf});
27670 otherwise incorrect code is generated for calls to those
27671 functions.
27673 In addition, seriously incorrect code results if you call a
27674 function with too many arguments.  (Normally, extra arguments are
27675 harmlessly ignored.)
27677 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
27678 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
27680 The default is @option{-mno-rtd}.
27682 @opindex malign-int
27683 @opindex mno-align-int
27684 @item -malign-int
27685 @itemx -mno-align-int
27686 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
27687 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
27688 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
27689 Aligning variables on 32-bit boundaries produces code that runs somewhat
27690 faster on processors with 32-bit busses at the expense of more memory.
27692 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
27693 aligns structures containing the above types differently than
27694 most published application binary interface specifications for the m68k.
27696 @opindex mpcrel
27697 Use the pc-relative addressing mode of the 68000 directly, instead of
27698 using a global offset table.  At present, this option implies @option{-fpic},
27699 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
27700 not presently supported with @option{-mpcrel}, though this could be supported for
27701 68020 and higher processors.
27703 @opindex mno-strict-align
27704 @opindex mstrict-align
27705 @item -mno-strict-align
27706 @itemx -mstrict-align
27707 Do not (do) assume that unaligned memory references are handled by
27708 the system.
27710 @item -msep-data
27711 Generate code that allows the data segment to be located in a different
27712 area of memory from the text segment.  This allows for execute-in-place in
27713 an environment without virtual memory management.  This option implies
27714 @option{-fPIC}.
27716 @item -mno-sep-data
27717 Generate code that assumes that the data segment follows the text segment.
27718 This is the default.
27720 @item -mid-shared-library
27721 Generate code that supports shared libraries via the library ID method.
27722 This allows for execute-in-place and shared libraries in an environment
27723 without virtual memory management.  This option implies @option{-fPIC}.
27725 @item -mno-id-shared-library
27726 Generate code that doesn't assume ID-based shared libraries are being used.
27727 This is the default.
27729 @item -mshared-library-id=n
27730 Specifies the identification number of the ID-based shared library being
27731 compiled.  Specifying a value of 0 generates more compact code; specifying
27732 other values forces the allocation of that number to the current
27733 library, but is no more space- or time-efficient than omitting this option.
27735 @opindex mxgot
27736 @opindex mno-xgot
27737 @item -mxgot
27738 @itemx -mno-xgot
27739 When generating position-independent code for ColdFire, generate code
27740 that works if the GOT has more than 8192 entries.  This code is
27741 larger and slower than code generated without this option.  On M680x0
27742 processors, this option is not needed; @option{-fPIC} suffices.
27744 GCC normally uses a single instruction to load values from the GOT@.
27745 While this is relatively efficient, it only works if the GOT
27746 is smaller than about 64k.  Anything larger causes the linker
27747 to report an error such as:
27749 @cindex relocation truncated to fit (ColdFire)
27750 @smallexample
27751 relocation truncated to fit: R_68K_GOT16O foobar
27752 @end smallexample
27754 If this happens, you should recompile your code with @option{-mxgot}.
27755 It should then work with very large GOTs.  However, code generated with
27756 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
27757 the value of a global symbol.
27759 Note that some linkers, including newer versions of the GNU linker,
27760 can create multiple GOTs and sort GOT entries.  If you have such a linker,
27761 you should only need to use @option{-mxgot} when compiling a single
27762 object file that accesses more than 8192 GOT entries.  Very few do.
27764 These options have no effect unless GCC is generating
27765 position-independent code.
27767 @opindex mlong-jump-table-offsets
27768 @item -mlong-jump-table-offsets
27769 Use 32-bit offsets in @code{switch} tables.  The default is to use
27770 16-bit offsets.
27772 @end table
27774 @node MCore Options
27775 @subsection MCore Options
27776 @cindex MCore options
27778 These are the @samp{-m} options defined for the Motorola M*Core
27779 processors.
27781 @table @gcctabopt
27783 @opindex mhardlit
27784 @opindex mno-hardlit
27785 @item -mhardlit
27786 @itemx -mno-hardlit
27787 Inline constants into the code stream if it can be done in two
27788 instructions or less.
27790 @opindex mdiv
27791 @opindex mno-div
27792 @item -mdiv
27793 @itemx -mno-div
27794 Use the divide instruction.  (Enabled by default).
27796 @opindex mrelax-immediate
27797 @opindex mno-relax-immediate
27798 @item -mrelax-immediate
27799 @itemx -mno-relax-immediate
27800 Allow arbitrary-sized immediates in bit operations.
27802 @opindex mwide-bitfields
27803 @opindex mno-wide-bitfields
27804 @item -mwide-bitfields
27805 @itemx -mno-wide-bitfields
27806 Always treat bit-fields as @code{int}-sized.
27808 @opindex m4byte-functions
27809 @opindex mno-4byte-functions
27810 @item -m4byte-functions
27811 @itemx -mno-4byte-functions
27812 Force all functions to be aligned to a 4-byte boundary.
27814 @opindex mcallgraph-data
27815 @opindex mno-callgraph-data
27816 @item -mcallgraph-data
27817 @itemx -mno-callgraph-data
27818 Emit callgraph information.
27820 @opindex mslow-bytes
27821 @opindex mno-slow-bytes
27822 @item -mslow-bytes
27823 @itemx -mno-slow-bytes
27824 Prefer word access when reading byte quantities.
27826 @opindex mlittle-endian
27827 @opindex mbig-endian
27828 @item -mlittle-endian
27829 @itemx -mbig-endian
27830 Generate code for a little-endian target.
27832 @opindex m210
27833 @opindex m340
27834 @item -m210
27835 @itemx -m340
27836 Generate code for the 210 processor.
27838 @opindex mno-lsim
27839 @item -mno-lsim
27840 Assume that runtime support has been provided and so omit the
27841 simulator library (@file{libsim.a)} from the linker command line.
27843 @opindex mstack-increment
27844 @item -mstack-increment=@var{size}
27845 Set the maximum amount for a single stack increment operation.  Large
27846 values can increase the speed of programs that contain functions
27847 that need a large amount of stack space, but they can also trigger a
27848 segmentation fault if the stack is extended too much.  The default
27849 value is 0x1000.
27851 @end table
27853 @node MicroBlaze Options
27854 @subsection MicroBlaze Options
27855 @cindex MicroBlaze Options
27857 @table @gcctabopt
27859 @opindex msoft-float
27860 @item -msoft-float
27861 Use software emulation for floating point (default).
27863 @opindex mhard-float
27864 @item -mhard-float
27865 Use hardware floating-point instructions.
27867 @opindex mmemcpy
27868 @item -mmemcpy
27869 Do not optimize block moves, use @code{memcpy}.
27871 @opindex mno-clearbss
27872 @item -mno-clearbss
27873 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
27875 @opindex mcpu=
27876 @item -mcpu=@var{cpu-type}
27877 Use features of, and schedule code for, the given CPU.
27878 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
27879 where @var{X} is a major version, @var{YY} is the minor version, and
27880 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
27881 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
27883 @opindex mxl-soft-mul
27884 @item -mxl-soft-mul
27885 Use software multiply emulation (default).
27887 @opindex mxl-soft-div
27888 @item -mxl-soft-div
27889 Use software emulation for divides (default).
27891 @opindex mxl-barrel-shift
27892 @item -mxl-barrel-shift
27893 Use the hardware barrel shifter.
27895 @opindex mxl-pattern-compare
27896 @item -mxl-pattern-compare
27897 Use pattern compare instructions.
27899 @opindex msmall-divides
27900 @item -msmall-divides
27901 Use table lookup optimization for small signed integer divisions.
27903 @opindex mxl-stack-check
27904 @item -mxl-stack-check
27905 This option is deprecated.  Use @option{-fstack-check} instead.
27907 @opindex mxl-gp-opt
27908 @item -mxl-gp-opt
27909 Use GP-relative @code{.sdata}/@code{.sbss} sections.
27911 @opindex mxl-multiply-high
27912 @item -mxl-multiply-high
27913 Use multiply high instructions for high part of 32x32 multiply.
27915 @opindex mxl-float-convert
27916 @item -mxl-float-convert
27917 Use hardware floating-point conversion instructions.
27919 @opindex mxl-float-sqrt
27920 @item -mxl-float-sqrt
27921 Use hardware floating-point square root instruction.
27923 @opindex mbig-endian
27924 @item -mbig-endian
27925 Generate code for a big-endian target.
27927 @opindex mlittle-endian
27928 @item -mlittle-endian
27929 Generate code for a little-endian target.
27931 @opindex mxl-reorder
27932 @item -mxl-reorder
27933 Use reorder instructions (swap and byte reversed load/store).
27935 @item -mxl-mode-@var{app-model}
27936 Select application model @var{app-model}.  Valid models are
27937 @table @samp
27938 @item executable
27939 normal executable (default), uses startup code @file{crt0.o}.
27941 @item xmdstub
27942 for use with Xilinx Microprocessor Debugger (XMD) based
27943 software intrusive debug agent called xmdstub. This uses startup file
27944 @file{crt1.o} and sets the start address of the program to 0x800.
27946 @item bootstrap
27947 for applications that are loaded using a bootloader.
27948 This model uses startup file @file{crt2.o} which does not contain a processor
27949 reset vector handler. This is suitable for transferring control on a
27950 processor reset to the bootloader rather than the application.
27952 @item novectors
27953 for applications that do not require any of the
27954 MicroBlaze vectors. This option may be useful for applications running
27955 within a monitoring application. This model uses @file{crt3.o} as a startup file.
27956 @end table
27958 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
27959 @option{-mxl-mode-@var{app-model}}.
27961 @opindex mpic-data-is-text-relative
27962 @item -mpic-data-is-text-relative
27963 Assume that the displacement between the text and data segments is fixed
27964 at static link time.  This allows data to be referenced by offset from start of
27965 text address instead of GOT since PC-relative addressing is not supported.
27967 @end table
27969 @node MIPS Options
27970 @subsection MIPS Options
27971 @cindex MIPS options
27973 @table @gcctabopt
27975 @opindex EB
27976 @item -EB
27977 Generate big-endian code.
27979 @opindex EL
27980 @item -EL
27981 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
27982 configurations.
27984 @opindex march
27985 @item -march=@var{arch}
27986 Generate code that runs on @var{arch}, which can be the name of a
27987 generic MIPS ISA, or the name of a particular processor.
27988 The ISA names are:
27989 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
27990 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
27991 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
27992 @samp{mips64r5} and @samp{mips64r6}.
27993 The processor names are:
27994 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
27995 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
27996 @samp{5kc}, @samp{5kf},
27997 @samp{20kc},
27998 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
27999 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
28000 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
28001 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
28002 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
28003 @samp{i6400}, @samp{i6500},
28004 @samp{interaptiv},
28005 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
28006 @samp{gs464e}, @samp{gs264e},
28007 @samp{m4k},
28008 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
28009 @samp{m5100}, @samp{m5101},
28010 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
28011 @samp{orion},
28012 @samp{p5600}, @samp{p6600},
28013 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
28014 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
28015 @samp{r6000}, @samp{r8000},
28016 @samp{rm7000}, @samp{rm9000},
28017 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
28018 @samp{sb1},
28019 @samp{sr71000},
28020 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
28021 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
28022 @samp{xlr} and @samp{xlp}.
28023 The special value @samp{from-abi} selects the
28024 most compatible architecture for the selected ABI (that is,
28025 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
28027 The native Linux/GNU toolchain also supports the value @samp{native},
28028 which selects the best architecture option for the host processor.
28029 @option{-march=native} has no effect if GCC does not recognize
28030 the processor.
28032 In processor names, a final @samp{000} can be abbreviated as @samp{k}
28033 (for example, @option{-march=r2k}).  Prefixes are optional, and
28034 @samp{vr} may be written @samp{r}.
28036 Names of the form @samp{@var{n}f2_1} refer to processors with
28037 FPUs clocked at half the rate of the core, names of the form
28038 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
28039 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
28040 processors with FPUs clocked a ratio of 3:2 with respect to the core.
28041 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
28042 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
28043 accepted as synonyms for @samp{@var{n}f1_1}.
28045 GCC defines two macros based on the value of this option.  The first
28046 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
28047 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
28048 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
28049 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
28050 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
28052 Note that the @code{_MIPS_ARCH} macro uses the processor names given
28053 above.  In other words, it has the full prefix and does not
28054 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
28055 the macro names the resolved architecture (either @code{"mips1"} or
28056 @code{"mips3"}).  It names the default architecture when no
28057 @option{-march} option is given.
28059 @opindex mtune
28060 @item -mtune=@var{arch}
28061 Optimize for @var{arch}.  Among other things, this option controls
28062 the way instructions are scheduled, and the perceived cost of arithmetic
28063 operations.  The list of @var{arch} values is the same as for
28064 @option{-march}.
28066 When this option is not used, GCC optimizes for the processor
28067 specified by @option{-march}.  By using @option{-march} and
28068 @option{-mtune} together, it is possible to generate code that
28069 runs on a family of processors, but optimize the code for one
28070 particular member of that family.
28072 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
28073 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
28074 @option{-march} ones described above.
28076 @opindex mips1
28077 @item -mips1
28078 Equivalent to @option{-march=mips1}.
28080 @opindex mips2
28081 @item -mips2
28082 Equivalent to @option{-march=mips2}.
28084 @opindex mips3
28085 @item -mips3
28086 Equivalent to @option{-march=mips3}.
28088 @opindex mips4
28089 @item -mips4
28090 Equivalent to @option{-march=mips4}.
28092 @opindex mips32
28093 @item -mips32
28094 Equivalent to @option{-march=mips32}.
28096 @opindex mips32r3
28097 @item -mips32r3
28098 Equivalent to @option{-march=mips32r3}.
28100 @opindex mips32r5
28101 @item -mips32r5
28102 Equivalent to @option{-march=mips32r5}.
28104 @opindex mips32r6
28105 @item -mips32r6
28106 Equivalent to @option{-march=mips32r6}.
28108 @opindex mips64
28109 @item -mips64
28110 Equivalent to @option{-march=mips64}.
28112 @opindex mips64r2
28113 @item -mips64r2
28114 Equivalent to @option{-march=mips64r2}.
28116 @opindex mips64r3
28117 @item -mips64r3
28118 Equivalent to @option{-march=mips64r3}.
28120 @opindex mips64r5
28121 @item -mips64r5
28122 Equivalent to @option{-march=mips64r5}.
28124 @opindex mips64r6
28125 @item -mips64r6
28126 Equivalent to @option{-march=mips64r6}.
28128 @opindex mips16
28129 @opindex mno-mips16
28130 @item -mips16
28131 @itemx -mno-mips16
28132 Generate (do not generate) MIPS16 code.  If GCC is targeting a
28133 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
28135 MIPS16 code generation can also be controlled on a per-function basis
28136 by means of @code{mips16} and @code{nomips16} attributes.
28137 @xref{Function Attributes}, for more information.
28139 @opindex mmips16e2
28140 @opindex mno-mips16e2
28141 @item -mmips16e2
28142 @itemx -mno-mips16e2
28143 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
28144 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
28146 @opindex mflip-mips16
28147 @item -mflip-mips16
28148 Generate MIPS16 code on alternating functions.  This option is provided
28149 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
28150 not intended for ordinary use in compiling user code.
28152 @opindex minterlink-compressed
28153 @opindex mno-interlink-compressed
28154 @item -minterlink-compressed
28155 @itemx -mno-interlink-compressed
28156 Require (do not require) that code using the standard (uncompressed) MIPS ISA
28157 be link-compatible with MIPS16 and microMIPS code, and vice versa.
28159 For example, code using the standard ISA encoding cannot jump directly
28160 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
28161 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
28162 knows that the target of the jump is not compressed.
28164 @opindex minterlink-mips16
28165 @opindex mno-interlink-mips16
28166 @item -minterlink-mips16
28167 @itemx -mno-interlink-mips16
28168 Aliases of @option{-minterlink-compressed} and
28169 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
28170 and are retained for backwards compatibility.
28172 @opindex mabi
28173 @item -mabi=32
28174 @itemx -mabi=o64
28175 @itemx -mabi=n32
28176 @itemx -mabi=64
28177 @itemx -mabi=eabi
28178 Generate code for the given ABI@.
28180 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
28181 generates 64-bit code when you select a 64-bit architecture, but you
28182 can use @option{-mgp32} to get 32-bit code instead.
28184 For information about the O64 ABI, see
28185 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
28187 GCC supports a variant of the o32 ABI in which floating-point registers
28188 are 64 rather than 32 bits wide.  You can select this combination with
28189 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
28190 and @code{mfhc1} instructions and is therefore only supported for
28191 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
28193 The register assignments for arguments and return values remain the
28194 same, but each scalar value is passed in a single 64-bit register
28195 rather than a pair of 32-bit registers.  For example, scalar
28196 floating-point values are returned in @samp{$f0} only, not a
28197 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
28198 remains the same in that the even-numbered double-precision registers
28199 are saved.
28201 Two additional variants of the o32 ABI are supported to enable
28202 a transition from 32-bit to 64-bit registers.  These are FPXX
28203 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
28204 The FPXX extension mandates that all code must execute correctly
28205 when run using 32-bit or 64-bit registers.  The code can be interlinked
28206 with either FP32 or FP64, but not both.
28207 The FP64A extension is similar to the FP64 extension but forbids the
28208 use of odd-numbered single-precision registers.  This can be used
28209 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
28210 processors and allows both FP32 and FP64A code to interlink and
28211 run in the same process without changing FPU modes.
28213 @opindex mabicalls
28214 @opindex mno-abicalls
28215 @item -mabicalls
28216 @itemx -mno-abicalls
28217 Generate (do not generate) code that is suitable for SVR4-style
28218 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
28219 systems.
28221 @item -mshared
28222 @itemx -mno-shared
28223 Generate (do not generate) code that is fully position-independent,
28224 and that can therefore be linked into shared libraries.  This option
28225 only affects @option{-mabicalls}.
28227 All @option{-mabicalls} code has traditionally been position-independent,
28228 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
28229 as an extension, the GNU toolchain allows executables to use absolute
28230 accesses for locally-binding symbols.  It can also use shorter GP
28231 initialization sequences and generate direct calls to locally-defined
28232 functions.  This mode is selected by @option{-mno-shared}.
28234 @option{-mno-shared} depends on binutils 2.16 or higher and generates
28235 objects that can only be linked by the GNU linker.  However, the option
28236 does not affect the ABI of the final executable; it only affects the ABI
28237 of relocatable objects.  Using @option{-mno-shared} generally makes
28238 executables both smaller and quicker.
28240 @option{-mshared} is the default.
28242 @opindex mplt
28243 @opindex mno-plt
28244 @item -mplt
28245 @itemx -mno-plt
28246 Assume (do not assume) that the static and dynamic linkers
28247 support PLTs and copy relocations.  This option only affects
28248 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
28249 has no effect without @option{-msym32}.
28251 You can make @option{-mplt} the default by configuring
28252 GCC with @option{--with-mips-plt}.  The default is
28253 @option{-mno-plt} otherwise.
28255 @opindex mxgot
28256 @opindex mno-xgot
28257 @item -mxgot
28258 @itemx -mno-xgot
28259 Lift (do not lift) the usual restrictions on the size of the global
28260 offset table.
28262 GCC normally uses a single instruction to load values from the GOT@.
28263 While this is relatively efficient, it only works if the GOT
28264 is smaller than about 64k.  Anything larger causes the linker
28265 to report an error such as:
28267 @cindex relocation truncated to fit (MIPS)
28268 @smallexample
28269 relocation truncated to fit: R_MIPS_GOT16 foobar
28270 @end smallexample
28272 If this happens, you should recompile your code with @option{-mxgot}.
28273 This works with very large GOTs, although the code is also
28274 less efficient, since it takes three instructions to fetch the
28275 value of a global symbol.
28277 Note that some linkers can create multiple GOTs.  If you have such a
28278 linker, you should only need to use @option{-mxgot} when a single object
28279 file accesses more than 64k's worth of GOT entries.  Very few do.
28281 These options have no effect unless GCC is generating position
28282 independent code.
28284 @opindex mgp32
28285 @item -mgp32
28286 Assume that general-purpose registers are 32 bits wide.
28288 @opindex mgp64
28289 @item -mgp64
28290 Assume that general-purpose registers are 64 bits wide.
28292 @opindex mfp32
28293 @item -mfp32
28294 Assume that floating-point registers are 32 bits wide.
28296 @opindex mfp64
28297 @item -mfp64
28298 Assume that floating-point registers are 64 bits wide.
28300 @opindex mfpxx
28301 @item -mfpxx
28302 Do not assume the width of floating-point registers.
28304 @opindex mhard-float
28305 @item -mhard-float
28306 Use floating-point coprocessor instructions.
28308 @opindex msoft-float
28309 @item -msoft-float
28310 Do not use floating-point coprocessor instructions.  Implement
28311 floating-point calculations using library calls instead.
28313 @opindex mno-float
28314 @item -mno-float
28315 Equivalent to @option{-msoft-float}, but additionally asserts that the
28316 program being compiled does not perform any floating-point operations.
28317 This option is presently supported only by some bare-metal MIPS
28318 configurations, where it may select a special set of libraries
28319 that lack all floating-point support (including, for example, the
28320 floating-point @code{printf} formats).  
28321 If code compiled with @option{-mno-float} accidentally contains
28322 floating-point operations, it is likely to suffer a link-time
28323 or run-time failure.
28325 @opindex msingle-float
28326 @item -msingle-float
28327 Assume that the floating-point coprocessor only supports single-precision
28328 operations.
28330 @opindex mdouble-float
28331 @item -mdouble-float
28332 Assume that the floating-point coprocessor supports double-precision
28333 operations.  This is the default.
28335 @opindex modd-spreg
28336 @opindex mno-odd-spreg
28337 @item -modd-spreg
28338 @itemx -mno-odd-spreg
28339 Enable the use of odd-numbered single-precision floating-point registers
28340 for the o32 ABI.  This is the default for processors that are known to
28341 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
28342 is set by default.
28344 @opindex mabs=2008
28345 @opindex mabs=legacy
28346 @item -mabs=2008
28347 @itemx -mabs=legacy
28348 These options control the treatment of the special not-a-number (NaN)
28349 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
28350 @code{neg.@i{fmt}} machine instructions.
28352 By default or when @option{-mabs=legacy} is used the legacy
28353 treatment is selected.  In this case these instructions are considered
28354 arithmetic and avoided where correct operation is required and the
28355 input operand might be a NaN.  A longer sequence of instructions that
28356 manipulate the sign bit of floating-point datum manually is used
28357 instead unless the @option{-ffinite-math-only} option has also been
28358 specified.
28360 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
28361 this case these instructions are considered non-arithmetic and therefore
28362 operating correctly in all cases, including in particular where the
28363 input operand is a NaN.  These instructions are therefore always used
28364 for the respective operations.
28366 @opindex mnan=2008
28367 @opindex mnan=legacy
28368 @item -mnan=2008
28369 @itemx -mnan=legacy
28370 These options control the encoding of the special not-a-number (NaN)
28371 IEEE 754 floating-point data.
28373 The @option{-mnan=legacy} option selects the legacy encoding.  In this
28374 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
28375 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
28376 by the first bit of their trailing significand field being 1.
28378 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
28379 this case qNaNs are denoted by the first bit of their trailing
28380 significand field being 1, whereas sNaNs are denoted by the first bit of
28381 their trailing significand field being 0.
28383 The default is @option{-mnan=legacy} unless GCC has been configured with
28384 @option{--with-nan=2008}.
28386 @opindex mllsc
28387 @opindex mno-llsc
28388 @item -mllsc
28389 @itemx -mno-llsc
28390 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
28391 implement atomic memory built-in functions.  When neither option is
28392 specified, GCC uses the instructions if the target architecture
28393 supports them.
28395 @option{-mllsc} is useful if the runtime environment can emulate the
28396 instructions and @option{-mno-llsc} can be useful when compiling for
28397 nonstandard ISAs.  You can make either option the default by
28398 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
28399 respectively.  @option{--with-llsc} is the default for some
28400 configurations; see the installation documentation for details.
28402 @opindex mdsp
28403 @opindex mno-dsp
28404 @item -mdsp
28405 @itemx -mno-dsp
28406 Use (do not use) revision 1 of the MIPS DSP ASE@.
28407 @xref{MIPS DSP Built-in Functions}.  This option defines the
28408 preprocessor macro @code{__mips_dsp}.  It also defines
28409 @code{__mips_dsp_rev} to 1.
28411 @opindex mdspr2
28412 @opindex mno-dspr2
28413 @item -mdspr2
28414 @itemx -mno-dspr2
28415 Use (do not use) revision 2 of the MIPS DSP ASE@.
28416 @xref{MIPS DSP Built-in Functions}.  This option defines the
28417 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
28418 It also defines @code{__mips_dsp_rev} to 2.
28420 @opindex msmartmips
28421 @opindex mno-smartmips
28422 @item -msmartmips
28423 @itemx -mno-smartmips
28424 Use (do not use) the MIPS SmartMIPS ASE.
28426 @opindex mpaired-single
28427 @opindex mno-paired-single
28428 @item -mpaired-single
28429 @itemx -mno-paired-single
28430 Use (do not use) paired-single floating-point instructions.
28431 @xref{MIPS Paired-Single Support}.  This option requires
28432 hardware floating-point support to be enabled.
28434 @opindex mdmx
28435 @opindex mno-mdmx
28436 @item -mdmx
28437 @itemx -mno-mdmx
28438 Use (do not use) MIPS Digital Media Extension instructions.
28439 This option can only be used when generating 64-bit code and requires
28440 hardware floating-point support to be enabled.
28442 @opindex mips3d
28443 @opindex mno-mips3d
28444 @item -mips3d
28445 @itemx -mno-mips3d
28446 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
28447 The option @option{-mips3d} implies @option{-mpaired-single}.
28449 @opindex mmicromips
28450 @opindex mno-mmicromips
28451 @item -mmicromips
28452 @itemx -mno-micromips
28453 Generate (do not generate) microMIPS code.
28455 MicroMIPS code generation can also be controlled on a per-function basis
28456 by means of @code{micromips} and @code{nomicromips} attributes.
28457 @xref{Function Attributes}, for more information.
28459 @opindex mmt
28460 @opindex mno-mt
28461 @item -mmt
28462 @itemx -mno-mt
28463 Use (do not use) MT Multithreading instructions.
28465 @opindex mmcu
28466 @opindex mno-mcu
28467 @item -mmcu
28468 @itemx -mno-mcu
28469 Use (do not use) the MIPS MCU ASE instructions.
28471 @opindex meva
28472 @opindex mno-eva
28473 @item -meva
28474 @itemx -mno-eva
28475 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
28477 @opindex mvirt
28478 @opindex mno-virt
28479 @item -mvirt
28480 @itemx -mno-virt
28481 Use (do not use) the MIPS Virtualization (VZ) instructions.
28483 @opindex mxpa
28484 @opindex mno-xpa
28485 @item -mxpa
28486 @itemx -mno-xpa
28487 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
28489 @opindex mcrc
28490 @opindex mno-crc
28491 @item -mcrc
28492 @itemx -mno-crc
28493 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
28495 @opindex mginv
28496 @opindex mno-ginv
28497 @item -mginv
28498 @itemx -mno-ginv
28499 Use (do not use) the MIPS Global INValidate (GINV) instructions.
28501 @opindex mloongson-mmi
28502 @opindex mno-loongson-mmi
28503 @item -mloongson-mmi
28504 @itemx -mno-loongson-mmi
28505 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
28507 @opindex mloongson-ext
28508 @opindex mno-loongson-ext
28509 @item -mloongson-ext
28510 @itemx -mno-loongson-ext
28511 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
28513 @opindex mloongson-ext2
28514 @opindex mno-loongson-ext2
28515 @item -mloongson-ext2
28516 @itemx -mno-loongson-ext2
28517 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
28519 @opindex mlong64
28520 @item -mlong64
28521 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
28522 an explanation of the default and the way that the pointer size is
28523 determined.
28525 @opindex mlong32
28526 @item -mlong32
28527 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
28529 The default size of @code{int}s, @code{long}s and pointers depends on
28530 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
28531 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
28532 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
28533 or the same size as integer registers, whichever is smaller.
28535 @opindex msym32
28536 @opindex mno-sym32
28537 @item -msym32
28538 @itemx -mno-sym32
28539 Assume (do not assume) that all symbols have 32-bit values, regardless
28540 of the selected ABI@.  This option is useful in combination with
28541 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
28542 to generate shorter and faster references to symbolic addresses.
28544 @opindex G
28545 @item -G @var{num}
28546 Put definitions of externally-visible data in a small data section
28547 if that data is no bigger than @var{num} bytes.  GCC can then generate
28548 more efficient accesses to the data; see @option{-mgpopt} for details.
28550 The default @option{-G} option depends on the configuration.
28552 @opindex mlocal-sdata
28553 @opindex mno-local-sdata
28554 @item -mlocal-sdata
28555 @itemx -mno-local-sdata
28556 Extend (do not extend) the @option{-G} behavior to local data too,
28557 such as to static variables in C@.  @option{-mlocal-sdata} is the
28558 default for all configurations.
28560 If the linker complains that an application is using too much small data,
28561 you might want to try rebuilding the less performance-critical parts with
28562 @option{-mno-local-sdata}.  You might also want to build large
28563 libraries with @option{-mno-local-sdata}, so that the libraries leave
28564 more room for the main program.
28566 @opindex mextern-sdata
28567 @opindex mno-extern-sdata
28568 @item -mextern-sdata
28569 @itemx -mno-extern-sdata
28570 Assume (do not assume) that externally-defined data is in
28571 a small data section if the size of that data is within the @option{-G} limit.
28572 @option{-mextern-sdata} is the default for all configurations.
28574 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
28575 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
28576 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
28577 is placed in a small data section.  If @var{Var} is defined by another
28578 module, you must either compile that module with a high-enough
28579 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
28580 definition.  If @var{Var} is common, you must link the application
28581 with a high-enough @option{-G} setting.
28583 The easiest way of satisfying these restrictions is to compile
28584 and link every module with the same @option{-G} option.  However,
28585 you may wish to build a library that supports several different
28586 small data limits.  You can do this by compiling the library with
28587 the highest supported @option{-G} setting and additionally using
28588 @option{-mno-extern-sdata} to stop the library from making assumptions
28589 about externally-defined data.
28591 @opindex mgpopt
28592 @opindex mno-gpopt
28593 @item -mgpopt
28594 @itemx -mno-gpopt
28595 Use (do not use) GP-relative accesses for symbols that are known to be
28596 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
28597 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
28598 configurations.
28600 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
28601 might not hold the value of @code{_gp}.  For example, if the code is
28602 part of a library that might be used in a boot monitor, programs that
28603 call boot monitor routines pass an unknown value in @code{$gp}.
28604 (In such situations, the boot monitor itself is usually compiled
28605 with @option{-G0}.)
28607 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
28608 @option{-mno-extern-sdata}.
28610 @opindex membedded-data
28611 @opindex mno-embedded-data
28612 @item -membedded-data
28613 @itemx -mno-embedded-data
28614 Allocate variables to the read-only data section first if possible, then
28615 next in the small data section if possible, otherwise in data.  This gives
28616 slightly slower code than the default, but reduces the amount of RAM required
28617 when executing, and thus may be preferred for some embedded systems.
28619 @opindex muninit-const-in-rodata
28620 @opindex mno-uninit-const-in-rodata
28621 @item -muninit-const-in-rodata
28622 @itemx -mno-uninit-const-in-rodata
28623 Put uninitialized @code{const} variables in the read-only data section.
28624 This option is only meaningful in conjunction with @option{-membedded-data}.
28626 @opindex mcode-readable
28627 @item -mcode-readable=@var{setting}
28628 Specify whether GCC may generate code that reads from executable sections.
28629 There are three possible settings:
28631 @table @gcctabopt
28632 @item -mcode-readable=yes
28633 Instructions may freely access executable sections.  This is the
28634 default setting.
28636 @item -mcode-readable=pcrel
28637 MIPS16 PC-relative load instructions can access executable sections,
28638 but other instructions must not do so.  This option is useful on 4KSc
28639 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
28640 It is also useful on processors that can be configured to have a dual
28641 instruction/data SRAM interface and that, like the M4K, automatically
28642 redirect PC-relative loads to the instruction RAM.
28644 @item -mcode-readable=no
28645 Instructions must not access executable sections.  This option can be
28646 useful on targets that are configured to have a dual instruction/data
28647 SRAM interface but that (unlike the M4K) do not automatically redirect
28648 PC-relative loads to the instruction RAM.
28649 @end table
28651 @opindex msplit-addresses
28652 @opindex mno-split-addresses
28653 @item -msplit-addresses
28654 @itemx -mno-split-addresses
28655 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
28656 relocation operators.  This option has been superseded by
28657 @option{-mexplicit-relocs} but is retained for backwards compatibility.
28659 @opindex mexplicit-relocs
28660 @opindex mno-explicit-relocs
28661 @item -mexplicit-relocs=none
28662 @itemx -mexplicit-relocs=base
28663 @itemx -mexplicit-relocs=pcrel
28664 @itemx -mexplicit-relocs
28665 @itemx -mno-explicit-relocs
28666 These options control whether explicit relocs (such as %gp_rel) are used.
28667 The default value depends on the version of GAS when GCC itself was built.
28669 The @code{base} explicit-relocs support introdunced into GAS in 2001.
28670 The @code{pcrel} explicit-relocs support introdunced into GAS in 2014,
28671 which supports @code{%pcrel_hi} and @code{%pcrel_lo}.
28673 @opindex mcheck-zero-division
28674 @opindex mno-check-zero-division
28675 @item -mcheck-zero-division
28676 @itemx -mno-check-zero-division
28677 Trap (do not trap) on integer division by zero.
28679 The default is @option{-mcheck-zero-division}.
28681 @opindex mdivide-traps
28682 @opindex mdivide-breaks
28683 @item -mdivide-traps
28684 @itemx -mdivide-breaks
28685 MIPS systems check for division by zero by generating either a
28686 conditional trap or a break instruction.  Using traps results in
28687 smaller code, but is only supported on MIPS II and later.  Also, some
28688 versions of the Linux kernel have a bug that prevents trap from
28689 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
28690 allow conditional traps on architectures that support them and
28691 @option{-mdivide-breaks} to force the use of breaks.
28693 The default is usually @option{-mdivide-traps}, but this can be
28694 overridden at configure time using @option{--with-divide=breaks}.
28695 Divide-by-zero checks can be completely disabled using
28696 @option{-mno-check-zero-division}.
28698 @opindex mload-store-pairs
28699 @opindex mno-load-store-pairs
28700 @item -mload-store-pairs
28701 @itemx -mno-load-store-pairs
28702 Enable (disable) an optimization that pairs consecutive load or store
28703 instructions to enable load/store bonding.  This option is enabled by
28704 default but only takes effect when the selected architecture is known
28705 to support bonding.
28707 @opindex mstrict-align
28708 @opindex mno-strict-align
28709 @opindex munaligned-access
28710 @opindex mno-unaligned-access
28711 @item -mstrict-align
28712 @itemx -mno-strict-align
28713 @itemx -munaligned-access
28714 @itemx -mno-unaligned-access
28715 Disable (enable) direct unaligned access for MIPS Release 6.
28716 MIPSr6 requires load/store unaligned-access support, by hardware or
28717 trap&emulate.  So @option{-mstrict-align} may be needed by kernel.  The
28718 options @option{-munaligned-access} and @option{-mno-unaligned-access}
28719 are obsoleted, and only for backward-compatible.
28721 @opindex mmemcpy
28722 @opindex mno-memcpy
28723 @item -mmemcpy
28724 @itemx -mno-memcpy
28725 Force (do not force) the use of @code{memcpy} for non-trivial block
28726 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
28727 most constant-sized copies.
28729 @opindex mlong-calls
28730 @opindex mno-long-calls
28731 @item -mlong-calls
28732 @itemx -mno-long-calls
28733 Disable (do not disable) use of the @code{jal} instruction.  Calling
28734 functions using @code{jal} is more efficient but requires the caller
28735 and callee to be in the same 256 megabyte segment.
28737 This option has no effect on abicalls code.  The default is
28738 @option{-mno-long-calls}.
28740 @opindex mmad
28741 @opindex mno-mad
28742 @item -mmad
28743 @itemx -mno-mad
28744 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
28745 instructions, as provided by the R4650 ISA@.
28747 @opindex mimadd
28748 @opindex mno-imadd
28749 @item -mimadd
28750 @itemx -mno-imadd
28751 Enable (disable) use of the @code{madd} and @code{msub} integer
28752 instructions.  The default is @option{-mimadd} on architectures
28753 that support @code{madd} and @code{msub} except for the 74k 
28754 architecture where it was found to generate slower code.
28756 @opindex mfused-madd
28757 @opindex mno-fused-madd
28758 @item -mfused-madd
28759 @itemx -mno-fused-madd
28760 Enable (disable) use of the floating-point multiply-accumulate
28761 instructions, when they are available.  The default is
28762 @option{-mfused-madd}.
28764 On the R8000 CPU when multiply-accumulate instructions are used,
28765 the intermediate product is calculated to infinite precision
28766 and is not subject to the FCSR Flush to Zero bit.  This may be
28767 undesirable in some circumstances.  On other processors the result
28768 is numerically identical to the equivalent computation using
28769 separate multiply, add, subtract and negate instructions.
28771 @opindex nocpp
28772 @item -nocpp
28773 Tell the MIPS assembler to not run its preprocessor over user
28774 assembler files (with a @samp{.s} suffix) when assembling them.
28776 @opindex mfix-24k
28777 @opindex mno-fix-24k
28778 @item -mfix-24k
28779 @itemx -mno-fix-24k
28780 Work around the 24K E48 (lost data on stores during refill) errata.
28781 The workarounds are implemented by the assembler rather than by GCC@.
28783 @opindex mfix-r4000
28784 @opindex mno-fix-r4000
28785 @item -mfix-r4000
28786 @itemx -mno-fix-r4000
28787 Work around certain R4000 CPU errata:
28788 @itemize @minus
28789 @item
28790 A double-word or a variable shift may give an incorrect result if executed
28791 immediately after starting an integer division.
28792 @item
28793 A double-word or a variable shift may give an incorrect result if executed
28794 while an integer multiplication is in progress.
28795 @item
28796 An integer division may give an incorrect result if started in a delay slot
28797 of a taken branch or a jump.
28798 @end itemize
28800 @opindex mfix-r4400
28801 @opindex mno-fix-r4400
28802 @item -mfix-r4400
28803 @itemx -mno-fix-r4400
28804 Work around certain R4400 CPU errata:
28805 @itemize @minus
28806 @item
28807 A double-word or a variable shift may give an incorrect result if executed
28808 immediately after starting an integer division.
28809 @end itemize
28811 @opindex mfix-r10000
28812 @opindex mno-fix-r10000
28813 @item -mfix-r10000
28814 @itemx -mno-fix-r10000
28815 Work around certain R10000 errata:
28816 @itemize @minus
28817 @item
28818 @code{ll}/@code{sc} sequences may not behave atomically on revisions
28819 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
28820 @end itemize
28822 This option can only be used if the target architecture supports
28823 branch-likely instructions.  @option{-mfix-r10000} is the default when
28824 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
28825 otherwise.
28827 @opindex mfix-r5900
28828 @item -mfix-r5900
28829 @itemx -mno-fix-r5900
28830 Do not attempt to schedule the preceding instruction into the delay slot
28831 of a branch instruction placed at the end of a short loop of six
28832 instructions or fewer and always schedule a @code{nop} instruction there
28833 instead.  The short loop bug under certain conditions causes loops to
28834 execute only once or twice, due to a hardware bug in the R5900 chip.  The
28835 workaround is implemented by the assembler rather than by GCC@.
28837 @opindex mfix-rm7000
28838 @item -mfix-rm7000
28839 @itemx -mno-fix-rm7000
28840 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
28841 workarounds are implemented by the assembler rather than by GCC@.
28843 @opindex mfix-vr4120
28844 @item -mfix-vr4120
28845 @itemx -mno-fix-vr4120
28846 Work around certain VR4120 errata:
28847 @itemize @minus
28848 @item
28849 @code{dmultu} does not always produce the correct result.
28850 @item
28851 @code{div} and @code{ddiv} do not always produce the correct result if one
28852 of the operands is negative.
28853 @end itemize
28854 The workarounds for the division errata rely on special functions in
28855 @file{libgcc.a}.  At present, these functions are only provided by
28856 the @code{mips64vr*-elf} configurations.
28858 Other VR4120 errata require a NOP to be inserted between certain pairs of
28859 instructions.  These errata are handled by the assembler, not by GCC itself.
28861 @opindex mfix-vr4130
28862 @item -mfix-vr4130
28863 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
28864 workarounds are implemented by the assembler rather than by GCC,
28865 although GCC avoids using @code{mflo} and @code{mfhi} if the
28866 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
28867 instructions are available instead.
28869 @opindex mfix-sb1
28870 @item -mfix-sb1
28871 @itemx -mno-fix-sb1
28872 Work around certain SB-1 CPU core errata.
28873 (This flag currently works around the SB-1 revision 2
28874 ``F1'' and ``F2'' floating-point errata.)
28876 @opindex mr10k-cache-barrier
28877 @item -mr10k-cache-barrier=@var{setting}
28878 Specify whether GCC should insert cache barriers to avoid the
28879 side effects of speculation on R10K processors.
28881 In common with many processors, the R10K tries to predict the outcome
28882 of a conditional branch and speculatively executes instructions from
28883 the ``taken'' branch.  It later aborts these instructions if the
28884 predicted outcome is wrong.  However, on the R10K, even aborted
28885 instructions can have side effects.
28887 This problem only affects kernel stores and, depending on the system,
28888 kernel loads.  As an example, a speculatively-executed store may load
28889 the target memory into cache and mark the cache line as dirty, even if
28890 the store itself is later aborted.  If a DMA operation writes to the
28891 same area of memory before the ``dirty'' line is flushed, the cached
28892 data overwrites the DMA-ed data.  See the R10K processor manual
28893 for a full description, including other potential problems.
28895 One workaround is to insert cache barrier instructions before every memory
28896 access that might be speculatively executed and that might have side
28897 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
28898 controls GCC's implementation of this workaround.  It assumes that
28899 aborted accesses to any byte in the following regions does not have
28900 side effects:
28902 @enumerate
28903 @item
28904 the memory occupied by the current function's stack frame;
28906 @item
28907 the memory occupied by an incoming stack argument;
28909 @item
28910 the memory occupied by an object with a link-time-constant address.
28911 @end enumerate
28913 It is the kernel's responsibility to ensure that speculative
28914 accesses to these regions are indeed safe.
28916 If the input program contains a function declaration such as:
28918 @smallexample
28919 void foo (void);
28920 @end smallexample
28922 then the implementation of @code{foo} must allow @code{j foo} and
28923 @code{jal foo} to be executed speculatively.  GCC honors this
28924 restriction for functions it compiles itself.  It expects non-GCC
28925 functions (such as hand-written assembly code) to do the same.
28927 The option has three forms:
28929 @table @gcctabopt
28930 @item -mr10k-cache-barrier=load-store
28931 Insert a cache barrier before a load or store that might be
28932 speculatively executed and that might have side effects even
28933 if aborted.
28935 @item -mr10k-cache-barrier=store
28936 Insert a cache barrier before a store that might be speculatively
28937 executed and that might have side effects even if aborted.
28939 @item -mr10k-cache-barrier=none
28940 Disable the insertion of cache barriers.  This is the default setting.
28941 @end table
28943 @opindex mflush-func
28944 @opindex mno-flush-func
28945 @item -mflush-func=@var{func}
28946 @itemx -mno-flush-func
28947 Specifies the function to call to flush the I and D caches, or to not
28948 call any such function.  If called, the function must take the same
28949 arguments as the common @code{_flush_func}, that is, the address of the
28950 memory range for which the cache is being flushed, the size of the
28951 memory range, and the number 3 (to flush both caches).  The default
28952 depends on the target GCC was configured for, but commonly is either
28953 @code{_flush_func} or @code{__cpu_flush}.
28955 @opindex mbranch-cost
28956 @item -mbranch-cost=@var{num}
28957 Set the cost of branches to roughly @var{num} ``simple'' instructions.
28958 This cost is only a heuristic and is not guaranteed to produce
28959 consistent results across releases.  A zero cost redundantly selects
28960 the default, which is based on the @option{-mtune} setting.
28962 @opindex mbranch-likely
28963 @opindex mno-branch-likely
28964 @item -mbranch-likely
28965 @itemx -mno-branch-likely
28966 Enable or disable use of Branch Likely instructions, regardless of the
28967 default for the selected architecture.  By default, Branch Likely
28968 instructions may be generated if they are supported by the selected
28969 architecture.  An exception is for the MIPS32 and MIPS64 architectures
28970 and processors that implement those architectures; for those, Branch
28971 Likely instructions are not be generated by default because the MIPS32
28972 and MIPS64 architectures specifically deprecate their use.
28974 @opindex mcompact-branches=never
28975 @opindex mcompact-branches=optimal
28976 @opindex mcompact-branches=always
28977 @item -mcompact-branches=never
28978 @itemx -mcompact-branches=optimal
28979 @itemx -mcompact-branches=always
28980 These options control which form of branches will be generated.  The
28981 default is @option{-mcompact-branches=optimal}.
28983 The @option{-mcompact-branches=never} option ensures that compact branch
28984 instructions will never be generated.
28986 The @option{-mcompact-branches=always} option ensures that a compact
28987 branch instruction will be generated if available for MIPS Release 6 onwards.
28988 If a compact branch instruction is not available (or pre-R6),
28989 a delay slot form of the branch will be used instead.
28991 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
28992 The behaviour for MIPS16/microMIPS may change in future,
28993 since they do have some compact branch instructions.
28995 The @option{-mcompact-branches=optimal} option will cause a delay slot
28996 branch to be used if one is available in the current ISA and the delay
28997 slot is successfully filled.  If the delay slot is not filled, a compact
28998 branch will be chosen if one is available.
29000 @opindex mfp-exceptions
29001 @item -mfp-exceptions
29002 @itemx -mno-fp-exceptions
29003 Specifies whether FP exceptions are enabled.  This affects how
29004 FP instructions are scheduled for some processors.
29005 The default is that FP exceptions are
29006 enabled.
29008 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
29009 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
29010 FP pipe.
29012 @opindex mvr4130-align
29013 @item -mvr4130-align
29014 @itemx -mno-vr4130-align
29015 The VR4130 pipeline is two-way superscalar, but can only issue two
29016 instructions together if the first one is 8-byte aligned.  When this
29017 option is enabled, GCC aligns pairs of instructions that it
29018 thinks should execute in parallel.
29020 This option only has an effect when optimizing for the VR4130.
29021 It normally makes code faster, but at the expense of making it bigger.
29022 It is enabled by default at optimization level @option{-O3}.
29024 @opindex msynci
29025 @item -msynci
29026 @itemx -mno-synci
29027 Enable (disable) generation of @code{synci} instructions on
29028 architectures that support it.  The @code{synci} instructions (if
29029 enabled) are generated when @code{__builtin___clear_cache} is
29030 compiled.
29032 This option defaults to @option{-mno-synci}, but the default can be
29033 overridden by configuring GCC with @option{--with-synci}.
29035 When compiling code for single processor systems, it is generally safe
29036 to use @code{synci}.  However, on many multi-core (SMP) systems, it
29037 does not invalidate the instruction caches on all cores and may lead
29038 to undefined behavior.
29040 @opindex mrelax-pic-calls
29041 @item -mrelax-pic-calls
29042 @itemx -mno-relax-pic-calls
29043 Try to turn PIC calls that are normally dispatched via register
29044 @code{$25} into direct calls.  This is only possible if the linker can
29045 resolve the destination at link time and if the destination is within
29046 range for a direct call.
29048 @option{-mrelax-pic-calls} is the default if GCC was configured to use
29049 an assembler and a linker that support the @code{.reloc} assembly
29050 directive and @option{-mexplicit-relocs} is in effect.  With
29051 @option{-mno-explicit-relocs}, this optimization can be performed by the
29052 assembler and the linker alone without help from the compiler.
29054 @opindex mmcount-ra-address
29055 @opindex mno-mcount-ra-address
29056 @item -mmcount-ra-address
29057 @itemx -mno-mcount-ra-address
29058 Emit (do not emit) code that allows @code{_mcount} to modify the
29059 calling function's return address.  When enabled, this option extends
29060 the usual @code{_mcount} interface with a new @var{ra-address}
29061 parameter, which has type @code{intptr_t *} and is passed in register
29062 @code{$12}.  @code{_mcount} can then modify the return address by
29063 doing both of the following:
29064 @itemize
29065 @item
29066 Returning the new address in register @code{$31}.
29067 @item
29068 Storing the new address in @code{*@var{ra-address}},
29069 if @var{ra-address} is nonnull.
29070 @end itemize
29072 The default is @option{-mno-mcount-ra-address}.
29074 @opindex mframe-header-opt
29075 @item -mframe-header-opt
29076 @itemx -mno-frame-header-opt
29077 Enable (disable) frame header optimization in the o32 ABI.  When using the
29078 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
29079 function to write out register arguments.  When enabled, this optimization
29080 will suppress the allocation of the frame header if it can be determined that
29081 it is unused.
29083 This optimization is off by default at all optimization levels.
29085 @opindex mlxc1-sxc1
29086 @item -mlxc1-sxc1
29087 @itemx -mno-lxc1-sxc1
29088 When applicable, enable (disable) the generation of @code{lwxc1},
29089 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
29091 @opindex mmadd4
29092 @item -mmadd4
29093 @itemx -mno-madd4
29094 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
29095 @code{madd.d} and related instructions.  Enabled by default.
29097 @end table
29099 @node MMIX Options
29100 @subsection MMIX Options
29101 @cindex MMIX Options
29103 These options are defined for the MMIX:
29105 @table @gcctabopt
29106 @opindex mlibfuncs
29107 @opindex mno-libfuncs
29108 @item -mlibfuncs
29109 @itemx -mno-libfuncs
29110 Specify that intrinsic library functions are being compiled, passing all
29111 values in registers, no matter the size.
29113 @opindex mepsilon
29114 @opindex mno-epsilon
29115 @item -mepsilon
29116 @itemx -mno-epsilon
29117 Generate floating-point comparison instructions that compare with respect
29118 to the @code{rE} epsilon register.
29120 @opindex mabi=mmixware
29121 @opindex mabi=gnu
29122 @item -mabi=mmixware
29123 @itemx -mabi=gnu
29124 Generate code that passes function parameters and return values that (in
29125 the called function) are seen as registers @code{$0} and up, as opposed to
29126 the GNU ABI which uses global registers @code{$231} and up.
29128 @opindex mzero-extend
29129 @opindex mno-zero-extend
29130 @item -mzero-extend
29131 @itemx -mno-zero-extend
29132 When reading data from memory in sizes shorter than 64 bits, use (do not
29133 use) zero-extending load instructions by default, rather than
29134 sign-extending ones.
29136 @opindex mknuthdiv
29137 @opindex mno-knuthdiv
29138 @item -mknuthdiv
29139 @itemx -mno-knuthdiv
29140 Make the result of a division yielding a remainder have the same sign as
29141 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
29142 remainder follows the sign of the dividend.  Both methods are
29143 arithmetically valid, the latter being almost exclusively used.
29145 @opindex mtoplevel-symbols
29146 @opindex mno-toplevel-symbols
29147 @item -mtoplevel-symbols
29148 @itemx -mno-toplevel-symbols
29149 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
29150 code can be used with the @code{PREFIX} assembly directive.
29152 @opindex melf
29153 @item -melf
29154 Generate an executable in the ELF format, rather than the default
29155 @samp{mmo} format used by the @command{mmix} simulator.
29157 @opindex mbranch-predict
29158 @opindex mno-branch-predict
29159 @item -mbranch-predict
29160 @itemx -mno-branch-predict
29161 Use (do not use) the probable-branch instructions, when static branch
29162 prediction indicates a probable branch.
29164 @opindex mbase-addresses
29165 @opindex mno-base-addresses
29166 @item -mbase-addresses
29167 @itemx -mno-base-addresses
29168 Generate (do not generate) code that uses @emph{base addresses}.  Using a
29169 base address automatically generates a request (handled by the assembler
29170 and the linker) for a constant to be set up in a global register.  The
29171 register is used for one or more base address requests within the range 0
29172 to 255 from the value held in the register.  The generally leads to short
29173 and fast code, but the number of different data items that can be
29174 addressed is limited.  This means that a program that uses lots of static
29175 data may require @option{-mno-base-addresses}.
29177 @opindex msingle-exit
29178 @opindex mno-single-exit
29179 @item -msingle-exit
29180 @itemx -mno-single-exit
29181 Force (do not force) generated code to have a single exit point in each
29182 function.
29183 @end table
29185 @node MN10300 Options
29186 @subsection MN10300 Options
29187 @cindex MN10300 options
29189 These @option{-m} options are defined for Matsushita MN10300 architectures:
29191 @table @gcctabopt
29192 @opindex mmult-bug
29193 @item -mmult-bug
29194 Generate code to avoid bugs in the multiply instructions for the MN10300
29195 processors.  This is the default.
29197 @opindex mno-mult-bug
29198 @item -mno-mult-bug
29199 Do not generate code to avoid bugs in the multiply instructions for the
29200 MN10300 processors.
29202 @opindex mam33
29203 @item -mam33
29204 Generate code using features specific to the AM33 processor.
29206 @opindex mno-am33
29207 @item -mno-am33
29208 Do not generate code using features specific to the AM33 processor.  This
29209 is the default.
29211 @opindex mam33-2
29212 @item -mam33-2
29213 Generate code using features specific to the AM33/2.0 processor.
29215 @opindex mam34
29216 @item -mam34
29217 Generate code using features specific to the AM34 processor.
29219 @opindex mtune
29220 @item -mtune=@var{cpu-type}
29221 Use the timing characteristics of the indicated CPU type when
29222 scheduling instructions.  This does not change the targeted processor
29223 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
29224 @samp{am33-2} or @samp{am34}.
29226 @opindex mreturn-pointer-on-d0
29227 @item -mreturn-pointer-on-d0
29228 When generating a function that returns a pointer, return the pointer
29229 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
29230 only in @code{a0}, and attempts to call such functions without a prototype
29231 result in errors.  Note that this option is on by default; use
29232 @option{-mno-return-pointer-on-d0} to disable it.
29234 @opindex mno-crt0
29235 @item -mno-crt0
29236 Do not link in the C run-time initialization object file.
29238 @opindex mrelax
29239 @item -mrelax
29240 Indicate to the linker that it should perform a relaxation optimization pass
29241 to shorten branches, calls and absolute memory addresses.  This option only
29242 has an effect when used on the command line for the final link step.
29244 This option makes symbolic debugging impossible.
29246 @opindex mliw
29247 @item -mliw
29248 Allow the compiler to generate @emph{Long Instruction Word}
29249 instructions if the target is the @samp{AM33} or later.  This is the
29250 default.  This option defines the preprocessor macro @code{__LIW__}.
29252 @opindex mno-liw
29253 @item -mno-liw
29254 Do not allow the compiler to generate @emph{Long Instruction Word}
29255 instructions.  This option defines the preprocessor macro
29256 @code{__NO_LIW__}.
29258 @opindex msetlb
29259 @item -msetlb
29260 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
29261 instructions if the target is the @samp{AM33} or later.  This is the
29262 default.  This option defines the preprocessor macro @code{__SETLB__}.
29264 @opindex mno-setlb
29265 @item -mno-setlb
29266 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
29267 instructions.  This option defines the preprocessor macro
29268 @code{__NO_SETLB__}.
29270 @end table
29272 @node Moxie Options
29273 @subsection Moxie Options
29274 @cindex Moxie Options
29276 @table @gcctabopt
29278 @opindex meb
29279 @item -meb
29280 Generate big-endian code.  This is the default for @samp{moxie-*-*}
29281 configurations.
29283 @opindex mel
29284 @item -mel
29285 Generate little-endian code.
29287 @opindex mmul.x
29288 @item -mmul.x
29289 Generate mul.x and umul.x instructions.  This is the default for
29290 @samp{moxiebox-*-*} configurations.
29292 @opindex mno-crt0
29293 @item -mno-crt0
29294 Do not link in the C run-time initialization object file.
29296 @end table
29298 @node MSP430 Options
29299 @subsection MSP430 Options
29300 @cindex MSP430 Options
29302 These options are defined for the MSP430:
29304 @table @gcctabopt
29306 @opindex masm-hex
29307 @item -masm-hex
29308 Force assembly output to always use hex constants.  Normally such
29309 constants are signed decimals, but this option is available for
29310 testsuite and/or aesthetic purposes.
29312 @opindex mmcu=
29313 @item -mmcu=
29314 Select the MCU to target.  This is used to create a C preprocessor
29315 symbol based upon the MCU name, converted to upper case and pre- and
29316 post-fixed with @samp{__}.  This in turn is used by the
29317 @file{msp430.h} header file to select an MCU-specific supplementary
29318 header file.
29320 The option also sets the ISA to use.  If the MCU name is one that is
29321 known to only support the 430 ISA then that is selected, otherwise the
29322 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
29323 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
29324 name selects the 430X ISA.
29326 In addition an MCU-specific linker script is added to the linker
29327 command line.  The script's name is the name of the MCU with
29328 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
29329 command line defines the C preprocessor symbol @code{__XXX__} and
29330 cause the linker to search for a script called @file{xxx.ld}.
29332 The ISA and hardware multiply supported for the different MCUs is hard-coded
29333 into GCC.  However, an external @samp{devices.csv} file can be used to
29334 extend device support beyond those that have been hard-coded.
29336 GCC searches for the @samp{devices.csv} file using the following methods in the
29337 given precedence order, where the first method takes precendence over the
29338 second which takes precedence over the third.
29340 @table @asis
29341 @item Include path specified with @code{-I} and @code{-L}
29342 @samp{devices.csv} will be searched for in each of the directories specified by
29343 include paths and linker library search paths.
29344 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
29345 Define the value of the global environment variable
29346 @samp{MSP430_GCC_INCLUDE_DIR}
29347 to the full path to the directory containing devices.csv, and GCC will search
29348 this directory for devices.csv.  If devices.csv is found, this directory will
29349 also be registered as an include path, and linker library path.  Header files
29350 and linker scripts in this directory can therefore be used without manually
29351 specifying @code{-I} and @code{-L} on the command line.
29352 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
29353 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
29354 toolchain root directory.  This directory does not exist in a default
29355 installation, but if the user has created it and copied @samp{devices.csv}
29356 there, then the MCU data will be read.  As above, this directory will
29357 also be registered as an include path, and linker library path.
29359 @end table
29360 If none of the above search methods find @samp{devices.csv}, then the
29361 hard-coded MCU data is used.
29364 @opindex mwarn-mcu
29365 @opindex mno-warn-mcu
29366 @item -mwarn-mcu
29367 @itemx -mno-warn-mcu
29368 This option enables or disables warnings about conflicts between the
29369 MCU name specified by the @option{-mmcu} option and the ISA set by the
29370 @option{-mcpu} option and/or the hardware multiply support set by the
29371 @option{-mhwmult} option.  It also toggles warnings about unrecognized
29372 MCU names.  This option is on by default.
29374 @opindex mcpu=
29375 @item -mcpu=
29376 Specifies the ISA to use.  Accepted values are @samp{msp430},
29377 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
29378 @option{-mmcu=} option should be used to select the ISA.
29380 @opindex msim
29381 @item -msim
29382 Link to the simulator runtime libraries and linker script.  Overrides
29383 any scripts that would be selected by the @option{-mmcu=} option.
29385 @opindex mlarge
29386 @item -mlarge
29387 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
29389 @opindex msmall
29390 @item -msmall
29391 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
29393 @opindex mrelax
29394 @item -mrelax
29395 This option is passed to the assembler and linker, and allows the
29396 linker to perform certain optimizations that cannot be done until
29397 the final link.
29399 @opindex mhwmult=
29400 @item mhwmult=
29401 Describes the type of hardware multiply supported by the target.
29402 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
29403 for the original 16-bit-only multiply supported by early MCUs.
29404 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
29405 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
29406 A value of @samp{auto} can also be given.  This tells GCC to deduce
29407 the hardware multiply support based upon the MCU name provided by the
29408 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
29409 the MCU name is not recognized then no hardware multiply support is
29410 assumed.  @code{auto} is the default setting.
29412 Hardware multiplies are normally performed by calling a library
29413 routine.  This saves space in the generated code.  When compiling at
29414 @option{-O3} or higher however the hardware multiplier is invoked
29415 inline.  This makes for bigger, but faster code.
29417 The hardware multiply routines disable interrupts whilst running and
29418 restore the previous interrupt state when they finish.  This makes
29419 them safe to use inside interrupt handlers as well as in normal code.
29421 @opindex minrt
29422 @item -minrt
29423 Enable the use of a minimum runtime environment - no static
29424 initializers or constructors.  This is intended for memory-constrained
29425 devices.  The compiler includes special symbols in some objects
29426 that tell the linker and runtime which code fragments are required.
29428 @opindex mtiny-printf
29429 @item -mtiny-printf
29430 Enable reduced code size @code{printf} and @code{puts} library functions.
29431 The @samp{tiny} implementations of these functions are not reentrant, so
29432 must be used with caution in multi-threaded applications.
29434 Support for streams has been removed and the string to be printed will
29435 always be sent to stdout via the @code{write} syscall.  The string is not
29436 buffered before it is sent to write.
29438 This option requires Newlib Nano IO, so GCC must be configured with
29439 @samp{--enable-newlib-nano-formatted-io}.
29441 @opindex mmax-inline-shift=
29442 @item -mmax-inline-shift=
29443 This option takes an integer between 0 and 64 inclusive, and sets
29444 the maximum number of inline shift instructions which should be emitted to
29445 perform a shift operation by a constant amount.  When this value needs to be
29446 exceeded, an mspabi helper function is used instead.  The default value is 4.
29448 This only affects cases where a shift by multiple positions cannot be
29449 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
29451 Shifts of a 32-bit value are at least twice as costly, so the value passed for
29452 this option is divided by 2 and the resulting value used instead.
29454 @opindex mcode-region
29455 @opindex mdata-region
29456 @item -mcode-region=
29457 @itemx -mdata-region=
29458 These options tell the compiler where to place functions and data that
29459 do not have one of the @code{lower}, @code{upper}, @code{either} or
29460 @code{section} attributes.  Possible values are @code{lower},
29461 @code{upper}, @code{either} or @code{any}.  The first three behave
29462 like the corresponding attribute.  The fourth possible value -
29463 @code{any} - is the default.  It leaves placement entirely up to the
29464 linker script and how it assigns the standard sections
29465 (@code{.text}, @code{.data}, etc) to the memory regions.
29467 @opindex msilicon-errata
29468 @item -msilicon-errata=
29469 This option passes on a request to assembler to enable the fixes for
29470 the named silicon errata.
29472 @opindex msilicon-errata-warn
29473 @item -msilicon-errata-warn=
29474 This option passes on a request to the assembler to enable warning
29475 messages when a silicon errata might need to be applied.
29477 @opindex mwarn-devices-csv
29478 @opindex mno-warn-devices-csv
29479 @item -mwarn-devices-csv
29480 @itemx -mno-warn-devices-csv
29481 Warn if @samp{devices.csv} is not found or there are problem parsing it
29482 (default: on).
29484 @end table
29486 @node NDS32 Options
29487 @subsection NDS32 Options
29488 @cindex NDS32 Options
29490 These options are defined for NDS32 implementations:
29492 @table @gcctabopt
29494 @opindex mbig-endian
29495 @item -mbig-endian
29496 Generate code in big-endian mode.
29498 @opindex mlittle-endian
29499 @item -mlittle-endian
29500 Generate code in little-endian mode.
29502 @opindex mreduced-regs
29503 @item -mreduced-regs
29504 Use reduced-set registers for register allocation.
29506 @opindex mfull-regs
29507 @item -mfull-regs
29508 Use full-set registers for register allocation.
29510 @opindex mcmov
29511 @item -mcmov
29512 Generate conditional move instructions.
29514 @opindex mno-cmov
29515 @item -mno-cmov
29516 Do not generate conditional move instructions.
29518 @opindex mext-perf
29519 @item -mext-perf
29520 Generate performance extension instructions.
29522 @opindex mno-ext-perf
29523 @item -mno-ext-perf
29524 Do not generate performance extension instructions.
29526 @opindex mext-perf2
29527 @item -mext-perf2
29528 Generate performance extension 2 instructions.
29530 @opindex mno-ext-perf2
29531 @item -mno-ext-perf2
29532 Do not generate performance extension 2 instructions.
29534 @opindex mext-string
29535 @item -mext-string
29536 Generate string extension instructions.
29538 @opindex mno-ext-string
29539 @item -mno-ext-string
29540 Do not generate string extension instructions.
29542 @opindex mv3push
29543 @item -mv3push
29544 Generate v3 push25/pop25 instructions.
29546 @opindex mno-v3push
29547 @item -mno-v3push
29548 Do not generate v3 push25/pop25 instructions.
29550 @opindex m16-bit
29551 @item -m16-bit
29552 Generate 16-bit instructions.
29554 @opindex mno-16-bit
29555 @item -mno-16-bit
29556 Do not generate 16-bit instructions.
29558 @opindex misr-vector-size
29559 @item -misr-vector-size=@var{num}
29560 Specify the size of each interrupt vector, which must be 4 or 16.
29562 @opindex mcache-block-size
29563 @item -mcache-block-size=@var{num}
29564 Specify the size of each cache block,
29565 which must be a power of 2 between 4 and 512.
29567 @opindex march
29568 @item -march=@var{arch}
29569 Specify the name of the target architecture.
29571 @opindex mcmodel
29572 @item -mcmodel=@var{code-model}
29573 Set the code model to one of
29574 @table @asis
29575 @item @samp{small}
29576 All the data and read-only data segments must be within 512KB addressing space.
29577 The text segment must be within 16MB addressing space.
29578 @item @samp{medium}
29579 The data segment must be within 512KB while the read-only data segment can be
29580 within 4GB addressing space.  The text segment should be still within 16MB
29581 addressing space.
29582 @item @samp{large}
29583 All the text and data segments can be within 4GB addressing space.
29584 @end table
29586 @opindex mctor-dtor
29587 @item -mctor-dtor
29588 Enable constructor/destructor feature.
29590 @opindex mrelax
29591 @item -mrelax
29592 Guide linker to relax instructions.
29594 @end table
29596 @node Nios II Options
29597 @subsection Nios II Options
29598 @cindex Nios II options
29599 @cindex Altera Nios II options
29601 These are the options defined for the Altera Nios II processor.
29603 @table @gcctabopt
29605 @opindex G
29606 @cindex smaller data references
29607 @item -G @var{num}
29608 Put global and static objects less than or equal to @var{num} bytes
29609 into the small data or BSS sections instead of the normal data or BSS
29610 sections.  The default value of @var{num} is 8.
29612 @opindex mgpopt
29613 @opindex mno-gpopt
29614 @item -mgpopt=@var{option}
29615 @itemx -mgpopt
29616 @itemx -mno-gpopt
29617 Generate (do not generate) GP-relative accesses.  The following 
29618 @var{option} names are recognized:
29620 @table @samp
29622 @item none
29623 Do not generate GP-relative accesses.
29625 @item local
29626 Generate GP-relative accesses for small data objects that are not 
29627 external, weak, or uninitialized common symbols.  
29628 Also use GP-relative addressing for objects that
29629 have been explicitly placed in a small data section via a @code{section}
29630 attribute.
29632 @item global
29633 As for @samp{local}, but also generate GP-relative accesses for
29634 small data objects that are external, weak, or common.  If you use this option,
29635 you must ensure that all parts of your program (including libraries) are
29636 compiled with the same @option{-G} setting.
29638 @item data
29639 Generate GP-relative accesses for all data objects in the program.  If you
29640 use this option, the entire data and BSS segments
29641 of your program must fit in 64K of memory and you must use an appropriate
29642 linker script to allocate them within the addressable range of the
29643 global pointer.
29645 @item all
29646 Generate GP-relative addresses for function pointers as well as data
29647 pointers.  If you use this option, the entire text, data, and BSS segments
29648 of your program must fit in 64K of memory and you must use an appropriate
29649 linker script to allocate them within the addressable range of the
29650 global pointer.
29652 @end table
29654 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
29655 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
29657 The default is @option{-mgpopt} except when @option{-fpic} or
29658 @option{-fPIC} is specified to generate position-independent code.
29659 Note that the Nios II ABI does not permit GP-relative accesses from
29660 shared libraries.
29662 You may need to specify @option{-mno-gpopt} explicitly when building
29663 programs that include large amounts of small data, including large
29664 GOT data sections.  In this case, the 16-bit offset for GP-relative
29665 addressing may not be large enough to allow access to the entire 
29666 small data section.
29668 @opindex mgprel-sec
29669 @item -mgprel-sec=@var{regexp}
29670 This option specifies additional section names that can be accessed via
29671 GP-relative addressing.  It is most useful in conjunction with 
29672 @code{section} attributes on variable declarations 
29673 (@pxref{Common Variable Attributes}) and a custom linker script.  
29674 The @var{regexp} is a POSIX Extended Regular Expression.
29676 This option does not affect the behavior of the @option{-G} option, and 
29677 the specified sections are in addition to the standard @code{.sdata}
29678 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
29680 @opindex mr0rel-sec
29681 @item -mr0rel-sec=@var{regexp}
29682 This option specifies names of sections that can be accessed via a 
29683 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
29684 of the 32-bit address space.  It is most useful in conjunction with 
29685 @code{section} attributes on variable declarations 
29686 (@pxref{Common Variable Attributes}) and a custom linker script.  
29687 The @var{regexp} is a POSIX Extended Regular Expression.
29689 In contrast to the use of GP-relative addressing for small data, 
29690 zero-based addressing is never generated by default and there are no 
29691 conventional section names used in standard linker scripts for sections
29692 in the low or high areas of memory.
29694 @opindex mel
29695 @opindex meb
29696 @item -mel
29697 @itemx -meb
29698 Generate little-endian (default) or big-endian (experimental) code,
29699 respectively.
29701 @opindex march
29702 @item -march=@var{arch}
29703 This specifies the name of the target Nios II architecture.  GCC uses this
29704 name to determine what kind of instructions it can emit when generating
29705 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
29707 The preprocessor macro @code{__nios2_arch__} is available to programs,
29708 with value 1 or 2, indicating the targeted ISA level.
29710 @opindex mno-bypass-cache
29711 @opindex mbypass-cache
29712 @item -mbypass-cache
29713 @itemx -mno-bypass-cache
29714 Force all load and store instructions to always bypass cache by 
29715 using I/O variants of the instructions. The default is not to
29716 bypass the cache.
29718 @opindex mcache-volatile 
29719 @opindex mno-cache-volatile
29720 @item -mno-cache-volatile 
29721 @itemx -mcache-volatile       
29722 Volatile memory access bypass the cache using the I/O variants of 
29723 the load and store instructions. The default is not to bypass the cache.
29725 @opindex mno-fast-sw-div
29726 @opindex mfast-sw-div
29727 @item -mno-fast-sw-div
29728 @itemx -mfast-sw-div
29729 Do not use table-based fast divide for small numbers. The default 
29730 is to use the fast divide at @option{-O3} and above.
29732 @opindex mno-hw-mul
29733 @opindex mhw-mul
29734 @opindex mno-hw-mulx
29735 @opindex mhw-mulx
29736 @opindex mno-hw-div
29737 @opindex mhw-div
29738 @item -mno-hw-mul
29739 @itemx -mhw-mul
29740 @itemx -mno-hw-mulx
29741 @itemx -mhw-mulx
29742 @itemx -mno-hw-div
29743 @itemx -mhw-div
29744 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
29745 instructions by the compiler. The default is to emit @code{mul}
29746 and not emit @code{div} and @code{mulx}.
29748 @item -mbmx
29749 @itemx -mno-bmx
29750 @itemx -mcdx
29751 @itemx -mno-cdx
29752 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
29753 CDX (code density) instructions.  Enabling these instructions also
29754 requires @option{-march=r2}.  Since these instructions are optional
29755 extensions to the R2 architecture, the default is not to emit them.
29757 @opindex mcustom-@var{insn}
29758 @opindex mno-custom-@var{insn}
29759 @item -mcustom-@var{insn}=@var{N}
29760 @itemx -mno-custom-@var{insn}
29761 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
29762 custom instruction with encoding @var{N} when generating code that uses 
29763 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
29764 instruction 253 for single-precision floating-point add operations instead
29765 of the default behavior of using a library call.
29767 The following values of @var{insn} are supported.  Except as otherwise
29768 noted, floating-point operations are expected to be implemented with
29769 normal IEEE 754 semantics and correspond directly to the C operators or the
29770 equivalent GCC built-in functions (@pxref{Other Builtins}).
29772 Single-precision floating point:
29773 @table @asis
29775 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
29776 Binary arithmetic operations.
29778 @item @samp{fnegs}
29779 Unary negation.
29781 @item @samp{fabss}
29782 Unary absolute value.
29784 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
29785 Comparison operations.
29787 @item @samp{fmins}, @samp{fmaxs}
29788 Floating-point minimum and maximum.  These instructions are only
29789 generated if @option{-ffinite-math-only} is specified.
29791 @item @samp{fsqrts}
29792 Unary square root operation.
29794 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
29795 Floating-point trigonometric and exponential functions.  These instructions
29796 are only generated if @option{-funsafe-math-optimizations} is also specified.
29798 @end table
29800 Double-precision floating point:
29801 @table @asis
29803 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
29804 Binary arithmetic operations.
29806 @item @samp{fnegd}
29807 Unary negation.
29809 @item @samp{fabsd}
29810 Unary absolute value.
29812 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
29813 Comparison operations.
29815 @item @samp{fmind}, @samp{fmaxd}
29816 Double-precision minimum and maximum.  These instructions are only
29817 generated if @option{-ffinite-math-only} is specified.
29819 @item @samp{fsqrtd}
29820 Unary square root operation.
29822 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
29823 Double-precision trigonometric and exponential functions.  These instructions
29824 are only generated if @option{-funsafe-math-optimizations} is also specified.
29826 @end table
29828 Conversions:
29829 @table @asis
29830 @item @samp{fextsd}
29831 Conversion from single precision to double precision.
29833 @item @samp{ftruncds}
29834 Conversion from double precision to single precision.
29836 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
29837 Conversion from floating point to signed or unsigned integer types, with
29838 truncation towards zero.
29840 @item @samp{round}
29841 Conversion from single-precision floating point to signed integer,
29842 rounding to the nearest integer and ties away from zero.
29843 This corresponds to the @code{__builtin_lroundf} function when
29844 @option{-fno-math-errno} is used.
29846 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
29847 Conversion from signed or unsigned integer types to floating-point types.
29849 @end table
29851 In addition, all of the following transfer instructions for internal
29852 registers X and Y must be provided to use any of the double-precision
29853 floating-point instructions.  Custom instructions taking two
29854 double-precision source operands expect the first operand in the
29855 64-bit register X.  The other operand (or only operand of a unary
29856 operation) is given to the custom arithmetic instruction with the
29857 least significant half in source register @var{src1} and the most
29858 significant half in @var{src2}.  A custom instruction that returns a
29859 double-precision result returns the most significant 32 bits in the
29860 destination register and the other half in 32-bit register Y.  
29861 GCC automatically generates the necessary code sequences to write
29862 register X and/or read register Y when double-precision floating-point
29863 instructions are used.
29865 @table @asis
29867 @item @samp{fwrx}
29868 Write @var{src1} into the least significant half of X and @var{src2} into
29869 the most significant half of X.
29871 @item @samp{fwry}
29872 Write @var{src1} into Y.
29874 @item @samp{frdxhi}, @samp{frdxlo}
29875 Read the most or least (respectively) significant half of X and store it in
29876 @var{dest}.
29878 @item @samp{frdy}
29879 Read the value of Y and store it into @var{dest}.
29880 @end table
29882 Note that you can gain more local control over generation of Nios II custom
29883 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
29884 and @code{target("no-custom-@var{insn}")} function attributes
29885 (@pxref{Function Attributes})
29886 or pragmas (@pxref{Function Specific Option Pragmas}).
29888 @opindex mcustom-fpu-cfg
29889 @item -mcustom-fpu-cfg=@var{name}
29891 This option enables a predefined, named set of custom instruction encodings
29892 (see @option{-mcustom-@var{insn}} above).  
29893 Currently, the following sets are defined:
29895 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
29896 @gccoptlist{-mcustom-fmuls=252
29897 -mcustom-fadds=253
29898 -mcustom-fsubs=254
29899 -fsingle-precision-constant}
29901 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
29902 @gccoptlist{-mcustom-fmuls=252
29903 -mcustom-fadds=253
29904 -mcustom-fsubs=254
29905 -mcustom-fdivs=255
29906 -fsingle-precision-constant}
29908 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
29909 @gccoptlist{-mcustom-floatus=243
29910 -mcustom-fixsi=244
29911 -mcustom-floatis=245
29912 -mcustom-fcmpgts=246
29913 -mcustom-fcmples=249
29914 -mcustom-fcmpeqs=250
29915 -mcustom-fcmpnes=251
29916 -mcustom-fmuls=252
29917 -mcustom-fadds=253
29918 -mcustom-fsubs=254
29919 -mcustom-fdivs=255
29920 -fsingle-precision-constant}
29922 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
29923 @gccoptlist{-mcustom-fabss=224
29924 -mcustom-fnegs=225
29925 -mcustom-fcmpnes=226
29926 -mcustom-fcmpeqs=227
29927 -mcustom-fcmpges=228
29928 -mcustom-fcmpgts=229
29929 -mcustom-fcmples=230
29930 -mcustom-fcmplts=231
29931 -mcustom-fmaxs=232
29932 -mcustom-fmins=233
29933 -mcustom-round=248
29934 -mcustom-fixsi=249
29935 -mcustom-floatis=250
29936 -mcustom-fsqrts=251
29937 -mcustom-fmuls=252
29938 -mcustom-fadds=253
29939 -mcustom-fsubs=254
29940 -mcustom-fdivs=255}
29942 Custom instruction assignments given by individual
29943 @option{-mcustom-@var{insn}=} options override those given by
29944 @option{-mcustom-fpu-cfg=}, regardless of the
29945 order of the options on the command line.
29947 Note that you can gain more local control over selection of a FPU
29948 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
29949 function attribute (@pxref{Function Attributes})
29950 or pragma (@pxref{Function Specific Option Pragmas}).
29952 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
29953 Hardware 2 Component}.  Please note that the custom instructions enabled by
29954 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
29955 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
29956 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
29957 specified.  In contrast to the other configurations,
29958 @option{-fsingle-precision-constant} is not set.
29960 @end table
29962 These additional @samp{-m} options are available for the Altera Nios II
29963 ELF (bare-metal) target:
29965 @table @gcctabopt
29967 @opindex mhal
29968 @item -mhal
29969 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
29970 startup and termination code, and is typically used in conjunction with
29971 @option{-msys-crt0=} to specify the location of the alternate startup code
29972 provided by the HAL BSP.
29974 @opindex msmallc
29975 @item -msmallc
29976 Link with a limited version of the C library, @option{-lsmallc}, rather than
29977 Newlib.
29979 @opindex msys-crt0
29980 @item -msys-crt0=@var{startfile}
29981 @var{startfile} is the file name of the startfile (crt0) to use 
29982 when linking.  This option is only useful in conjunction with @option{-mhal}.
29984 @opindex msys-lib
29985 @item -msys-lib=@var{systemlib}
29986 @var{systemlib} is the library name of the library that provides
29987 low-level system calls required by the C library,
29988 e.g.@: @code{read} and @code{write}.
29989 This option is typically used to link with a library provided by a HAL BSP.
29991 @end table
29993 @node Nvidia PTX Options
29994 @subsection Nvidia PTX Options
29995 @cindex Nvidia PTX options
29996 @cindex nvptx options
29998 These options are defined for Nvidia PTX:
30000 @table @gcctabopt
30002 @opindex m64
30003 @item -m64
30004 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
30005 supported.
30007 @opindex march
30008 @item -march=@var{architecture-string}
30009 Generate code for the specified PTX ISA target architecture
30010 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
30011 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
30012 @samp{sm_80}.
30013 The default depends on how the compiler has been configured, see
30014 @option{--with-arch}.
30016 This option sets the value of the preprocessor macro
30017 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
30018 @samp{350}.
30020 @opindex misa
30021 @item -misa=@var{architecture-string}
30022 Alias of @option{-march=}.
30024 @opindex march
30025 @item -march-map=@var{architecture-string}
30026 Select the closest available @option{-march=} value that is not more
30027 capable.  For instance, for @option{-march-map=sm_50} select
30028 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
30029 @option{-march=sm_53}.
30031 @opindex mptx
30032 @item -mptx=@var{version-string}
30033 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
30034 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
30035 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
30036 version is required for specified PTX ISA target architecture via
30037 option @option{-march=}.
30039 This option sets the values of the preprocessor macros
30040 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
30041 for instance, for @samp{3.1} the macros have the values @samp{3} and
30042 @samp{1}, respectively.
30044 @opindex mmainkernel
30045 @item -mmainkernel
30046 Link in code for a __main kernel.  This is for stand-alone instead of
30047 offloading execution.
30049 @opindex moptimize
30050 @item -moptimize
30051 Apply partitioned execution optimizations.  This is the default when any
30052 level of optimization is selected.
30054 @opindex msoft-stack
30055 @item -msoft-stack
30056 Generate code that does not use @code{.local} memory
30057 directly for stack storage. Instead, a per-warp stack pointer is
30058 maintained explicitly. This enables variable-length stack allocation (with
30059 variable-length arrays or @code{alloca}), and when global memory is used for
30060 underlying storage, makes it possible to access automatic variables from other
30061 threads, or with atomic instructions. This code generation variant is used
30062 for OpenMP offloading, but the option is exposed on its own for the purpose
30063 of testing the compiler; to generate code suitable for linking into programs
30064 using OpenMP offloading, use option @option{-mgomp}.
30066 @opindex muniform-simt
30067 @item -muniform-simt
30068 Switch to code generation variant that allows to execute all threads in each
30069 warp, while maintaining memory state and side effects as if only one thread
30070 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
30071 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
30072 current lane index equals the master lane index), and the register being
30073 assigned is copied via a shuffle instruction from the master lane.  Outside of
30074 SIMD regions lane 0 is the master; inside, each thread sees itself as the
30075 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
30076 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
30077 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
30078 with current lane index to compute the master lane index.
30080 @opindex mgomp
30081 @item -mgomp
30082 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
30083 @option{-muniform-simt} options, and selects corresponding multilib variant.
30085 @end table
30087 @node OpenRISC Options
30088 @subsection OpenRISC Options
30089 @cindex OpenRISC Options
30091 These options are defined for OpenRISC:
30093 @table @gcctabopt
30095 @opindex mboard
30096 @item -mboard=@var{name}
30097 Configure a board specific runtime.  This will be passed to the linker for
30098 newlib board library linking.  The default is @code{or1ksim}.
30100 @opindex mnewlib
30101 @item -mnewlib
30102 This option is ignored; it is for compatibility purposes only.  This used to
30103 select linker and preprocessor options for use with newlib.
30105 @opindex msoft-div
30106 @opindex mhard-div
30107 @item -msoft-div
30108 @itemx -mhard-div
30109 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
30110 This default is hardware divide.
30112 @opindex msoft-mul
30113 @opindex mhard-mul
30114 @item -msoft-mul
30115 @itemx -mhard-mul
30116 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
30117 This default is hardware multiply.
30119 @opindex msoft-float
30120 @opindex mhard-float
30121 @item -msoft-float
30122 @itemx -mhard-float
30123 Select software or hardware for floating point operations.
30124 The default is software.
30126 @opindex mdouble-float
30127 @item -mdouble-float
30128 When @option{-mhard-float} is selected, enables generation of double-precision
30129 floating point instructions.  By default functions from @file{libgcc} are used
30130 to perform double-precision floating point operations.
30132 @opindex munordered-float
30133 @item -munordered-float
30134 When @option{-mhard-float} is selected, enables generation of unordered
30135 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
30136 functions from @file{libgcc} are used to perform unordered floating point
30137 compare and set flag operations.
30139 @opindex mcmov
30140 @item -mcmov
30141 Enable generation of conditional move (@code{l.cmov}) instructions.  By
30142 default the equivalent will be generated using set and branch.
30144 @opindex mror
30145 @item -mror
30146 Enable generation of rotate right (@code{l.ror}) instructions.  By default
30147 functions from @file{libgcc} are used to perform rotate right operations.
30149 @opindex mrori
30150 @item -mrori
30151 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
30152 By default functions from @file{libgcc} are used to perform rotate right with
30153 immediate operations.
30155 @opindex msext
30156 @item -msext
30157 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
30158 memory loads are used to perform sign extension.
30160 @opindex msfimm
30161 @item -msfimm
30162 Enable generation of compare and set flag with immediate (@code{l.sf*i})
30163 instructions.  By default extra instructions will be generated to store the
30164 immediate to a register first.
30166 @opindex mshftimm
30167 @item -mshftimm
30168 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
30169 @code{l.slli}) instructions.  By default extra instructions will be generated
30170 to store the immediate to a register first.
30172 @opindex mcmodel=small
30173 @item -mcmodel=small
30174 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
30175 the default model.
30177 @opindex mcmodel=large
30178 @item -mcmodel=large
30179 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
30182 @end table
30184 @node PDP-11 Options
30185 @subsection PDP-11 Options
30186 @cindex PDP-11 Options
30188 These options are defined for the PDP-11:
30190 @table @gcctabopt
30191 @opindex mfpu
30192 @item -mfpu
30193 Use hardware FPP floating point.  This is the default.  (FIS floating
30194 point on the PDP-11/40 is not supported.)  Implies -m45.
30196 @opindex msoft-float
30197 @item -msoft-float
30198 Do not use hardware floating point.
30200 @opindex mac0
30201 @item -mac0
30202 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
30204 @opindex mno-ac0
30205 @item -mno-ac0
30206 Return floating-point results in memory.  This is the default.
30208 @opindex m40
30209 @item -m40
30210 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
30212 @opindex m45
30213 @item -m45
30214 Generate code for a PDP-11/45.  This is the default.
30216 @opindex m10
30217 @item -m10
30218 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
30220 @opindex mint16
30221 @opindex mno-int32
30222 @item -mint16
30223 @itemx -mno-int32
30224 Use 16-bit @code{int}.  This is the default.
30226 @opindex mint32
30227 @opindex mno-int16
30228 @item -mint32
30229 @itemx -mno-int16
30230 Use 32-bit @code{int}.
30232 @opindex msplit
30233 @item -msplit
30234 Target has split instruction and data space.  Implies -m45.
30236 @opindex munix-asm
30237 @item -munix-asm
30238 Use Unix assembler syntax.
30240 @opindex mdec-asm
30241 @item -mdec-asm
30242 Use DEC assembler syntax.
30244 @opindex mgnu-asm
30245 @item -mgnu-asm
30246 Use GNU assembler syntax.  This is the default.
30248 @opindex mlra
30249 @item -mlra
30250 Use the new LRA register allocator.  By default, the old ``reload''
30251 allocator is used.
30252 @end table
30254 @node PowerPC Options
30255 @subsection PowerPC Options
30256 @cindex PowerPC options
30258 These are listed under @xref{RS/6000 and PowerPC Options}.
30260 @node PRU Options
30261 @subsection PRU Options
30262 @cindex PRU Options
30264 These command-line options are defined for PRU target:
30266 @table @gcctabopt
30267 @opindex minrt
30268 @item -minrt
30269 Link with a minimum runtime environment.  This can significantly reduce
30270 the size of the final ELF binary, but some standard C runtime features
30271 are removed.
30273 This option disables support for static initializers and constructors.
30274 Beware that the compiler could still generate code with static initializers
30275 and constructors.  It is up to the programmer to ensure that the source
30276 program will not use those features.
30278 The minimal startup code would not pass @code{argc} and @code{argv} arguments
30279 to @code{main}, so the latter must be declared as @code{int main (void)}.
30280 This is already the norm for most firmware projects.
30282 @opindex mmcu
30283 @item -mmcu=@var{mcu}
30284 Specify the PRU hardware variant to use.  A correspondingly named
30285 spec file would be loaded, passing the memory region sizes to
30286 the linker and defining hardware-specific C macros.
30288 Newlib provides only the @code{sim} spec, intended for running
30289 regression tests using a simulator.  Specs for real hardware can be
30290 obtained by installing the
30291 @w{@uref{https://github.com/dinuxbg/gnuprumcu/,GnuPruMcu}} package.
30293 @opindex mno-relax
30294 @item -mno-relax
30295 Make GCC pass the @option{--no-relax} command-line option to the linker
30296 instead of the @option{--relax} option.
30298 @opindex mloop
30299 @item -mloop
30300 Allow (or do not allow) GCC to use the LOOP instruction.
30302 @opindex mabi
30303 @item -mabi=@var{variant}
30304 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
30305 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
30306 more naturally with certain GCC assumptions.  These are the differences:
30308 @table @samp
30309 @item Function Pointer Size
30310 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
30311 supports only 32-bit data and code pointers.
30313 @item Optional Return Value Pointer
30314 Function return values larger than 64 bits are passed by using a hidden
30315 pointer as the first argument of the function.  TI ABI, though, mandates that
30316 the pointer can be NULL in case the caller is not using the returned value.
30317 GNU always passes and expects a valid return value pointer.
30319 @end table
30321 The current @option{-mabi=ti} implementation simply raises a compile error
30322 when any of the above code constructs is detected.  As a consequence
30323 the standard C library cannot be built and it is omitted when linking with
30324 @option{-mabi=ti}.
30326 Relaxation is a GNU feature and for safety reasons is disabled when using
30327 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
30328 instructions, so the GNU linker cannot adjust them when shortening adjacent
30329 LDI32 pseudo instructions.
30331 @end table
30333 @node RISC-V Options
30334 @subsection RISC-V Options
30335 @cindex RISC-V Options
30337 These command-line options are defined for RISC-V targets:
30339 @table @gcctabopt
30340 @opindex mbranch-cost
30341 @item -mbranch-cost=@var{n}
30342 Set the cost of branches to roughly @var{n} instructions.
30344 @opindex plt
30345 @item -mplt
30346 @itemx -mno-plt
30347 When generating PIC code, do or don't allow the use of PLTs. Ignored for
30348 non-PIC.  The default is @option{-mplt}.
30350 @opindex mabi
30351 @item -mabi=@var{ABI-string}
30352 Specify integer and floating-point calling convention.  @var{ABI-string}
30353 contains two parts: the size of integer types and the registers used for
30354 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
30355 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
30356 32-bit), and that floating-point values up to 64 bits wide are passed in F
30357 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
30358 allows the compiler to generate code that uses the F and D extensions but only
30359 allows floating-point values up to 32 bits long to be passed in registers; or
30360 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
30361 passed in registers.
30363 The default for this argument is system dependent, users who want a specific
30364 calling convention should specify one explicitly.  The valid calling
30365 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
30366 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
30367 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
30368 invalid because the ABI requires 64-bit values be passed in F registers, but F
30369 registers are only 32 bits wide.  There are also the @samp{ilp32e} ABI that can
30370 only be used with the @samp{rv32e} architecture and the @samp{lp64e} ABI that
30371 can only be used with the @samp{rv64e}.  Those ABIs are not well specified at
30372 present, and are subject to change.
30374 @opindex mfdiv
30375 @item -mfdiv
30376 @itemx -mno-fdiv
30377 Do or don't use hardware floating-point divide and square root instructions.
30378 This requires the F or D extensions for floating-point registers.  The default
30379 is to use them if the specified architecture has these instructions.
30381 @opindex mdiv
30382 @item -mdiv
30383 @itemx -mno-div
30384 Do or don't use hardware instructions for integer division.  This requires the
30385 M extension.  The default is to use them if the specified architecture has
30386 these instructions.
30388 @opindex misa-spec
30389 @item -misa-spec=@var{ISA-spec-string}
30390 Specify the version of the RISC-V Unprivileged (formerly User-Level)
30391 ISA specification to produce code conforming to.  The possibilities
30392 for @var{ISA-spec-string} are:
30393 @table @code
30394 @item 2.2
30395 Produce code conforming to version 2.2.
30396 @item 20190608
30397 Produce code conforming to version 20190608.
30398 @item 20191213
30399 Produce code conforming to version 20191213.
30400 @end table
30401 The default is @option{-misa-spec=20191213} unless GCC has been configured
30402 with @option{--with-isa-spec=} specifying a different default version.
30404 @opindex march
30405 @item -march=@var{ISA-string}
30406 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
30407 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
30408 @samp{rv32imaf}. Additionally, a special value @option{help}
30409 (@option{-march=help}) is accepted to list all supported extensions.
30411 The syntax of the ISA string is defined as follows:
30413 @table @code
30414 @item The string must start with @samp{rv32} or @samp{rv64}, followed by
30415 @samp{i}, @samp{e}, or @samp{g}, referred to as the base ISA.
30416 @item The subsequent part of the string is a list of extension names. Extension
30417 names can be categorized as multi-letter (e.g.@: @samp{zba}) and single-letter
30418 (e.g.@: @samp{v}). Single-letter extensions can appear consecutively,
30419 but multi-letter extensions must be separated by underscores.
30420 @item An underscore can appear anywhere after the base ISA. It has no specific
30421 effect but is used to improve readability and can act as a separator.
30422 @item Extension names may include an optional version number, following the
30423 syntax @samp{<major>p<minor>} or @samp{<major>}, (e.g.@: @samp{m2p1} or
30424 @samp{m2}).
30425 @end table
30427 Supported extension are listed below:
30428 @multitable @columnfractions .10 .10 .80
30429 @headitem Extension Name @tab Supported Version @tab Description
30430 @item i
30431 @tab 2.0, 2.1
30432 @tab Base integer extension.
30434 @item e
30435 @tab 2.0
30436 @tab Reduced base integer extension.
30438 @item g
30439 @tab -
30440 @tab General-purpose computing base extension, @samp{g} will expand to
30441 @samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and
30442 @samp{zifencei}.
30444 @item m
30445 @tab 2.0
30446 @tab Integer multiplication and division extension.
30448 @item a
30449 @tab 2.0, 2.1
30450 @tab Atomic extension.
30452 @item f
30453 @tab 2.0, 2.2
30454 @tab Single-precision floating-point extension.
30456 @item d
30457 @tab 2.0, 2.2
30458 @tab Double-precision floating-point extension.
30460 @item c
30461 @tab 2.0
30462 @tab Compressed extension.
30464 @item h
30465 @tab 1.0
30466 @tab Hypervisor extension.
30468 @item v
30469 @tab 1.0
30470 @tab Vector extension.
30472 @item zicsr
30473 @tab 2.0
30474 @tab Control and status register access extension.
30476 @item zifencei
30477 @tab 2.0
30478 @tab Instruction-fetch fence extension.
30480 @item zicond
30481 @tab 1.0
30482 @tab Integer conditional operations extension.
30484 @item za64rs
30485 @tab 1.0
30486 @tab Reservation set size of 64 bytes.
30488 @item za128rs
30489 @tab 1.0
30490 @tab Reservation set size of 128 bytes.
30492 @item zawrs
30493 @tab 1.0
30494 @tab Wait-on-reservation-set extension.
30496 @item zba
30497 @tab 1.0
30498 @tab Address calculation extension.
30500 @item zbb
30501 @tab 1.0
30502 @tab Basic bit manipulation extension.
30504 @item zbc
30505 @tab 1.0
30506 @tab Carry-less multiplication extension.
30508 @item zbs
30509 @tab 1.0
30510 @tab Single-bit operation extension.
30512 @item zfinx
30513 @tab 1.0
30514 @tab Single-precision floating-point in integer registers extension.
30516 @item zdinx
30517 @tab 1.0
30518 @tab Double-precision floating-point in integer registers extension.
30520 @item zhinx
30521 @tab 1.0
30522 @tab Half-precision floating-point in integer registers extension.
30524 @item zhinxmin
30525 @tab 1.0
30526 @tab Minimal half-precision floating-point in integer registers extension.
30528 @item zbkb
30529 @tab 1.0
30530 @tab Cryptography bit-manipulation extension.
30532 @item zbkc
30533 @tab 1.0
30534 @tab Cryptography carry-less multiply extension.
30536 @item zbkx
30537 @tab 1.0
30538 @tab Cryptography crossbar permutation extension.
30540 @item zkne
30541 @tab 1.0
30542 @tab AES Encryption extension.
30544 @item zknd
30545 @tab 1.0
30546 @tab AES Decryption extension.
30548 @item zknh
30549 @tab 1.0
30550 @tab Hash function extension.
30552 @item zkr
30553 @tab 1.0
30554 @tab Entropy source extension.
30556 @item zksed
30557 @tab 1.0
30558 @tab SM4 block cipher extension.
30560 @item zksh
30561 @tab 1.0
30562 @tab SM3 hash function extension.
30564 @item zkt
30565 @tab 1.0
30566 @tab Data independent execution latency extension.
30568 @item zk
30569 @tab 1.0
30570 @tab Standard scalar cryptography extension.
30572 @item zkn
30573 @tab 1.0
30574 @tab NIST algorithm suite extension.
30576 @item zks
30577 @tab 1.0
30578 @tab ShangMi algorithm suite extension.
30580 @item zihintntl
30581 @tab 1.0
30582 @tab Non-temporal locality hints extension.
30584 @item zihintpause
30585 @tab 1.0
30586 @tab Pause hint extension.
30588 @item zicboz
30589 @tab 1.0
30590 @tab Cache-block zero extension.
30592 @item zicbom
30593 @tab 1.0
30594 @tab Cache-block management extension.
30596 @item zicbop
30597 @tab 1.0
30598 @tab Cache-block prefetch extension.
30600 @item zic64b
30601 @tab 1.0
30602 @tab Cache block size isf 64 bytes.
30604 @item ziccamoa
30605 @tab 1.0
30606 @tab Main memory supports all atomics in A.
30608 @item ziccif
30609 @tab 1.0
30610 @tab Main memory supports instruction fetch with atomicity requirement.
30612 @item zicclsm
30613 @tab 1.0
30614 @tab Main memory supports misaligned loads/stores.
30616 @item ziccrse
30617 @tab 1.0
30618 @tab Main memory supports forward progress on LR/SC sequences.
30620 @item zicntr
30621 @tab 2.0
30622 @tab Standard extension for base counters and timers.
30624 @item zihpm
30625 @tab 2.0
30626 @tab Standard extension for hardware performance counters.
30628 @item ztso
30629 @tab 1.0
30630 @tab Total store ordering extension.
30632 @item zve32x
30633 @tab 1.0
30634 @tab Vector extensions for embedded processors.
30636 @item zve32f
30637 @tab 1.0
30638 @tab Vector extensions for embedded processors.
30640 @item zve64x
30641 @tab 1.0
30642 @tab Vector extensions for embedded processors.
30644 @item zve64f
30645 @tab 1.0
30646 @tab Vector extensions for embedded processors.
30648 @item zve64d
30649 @tab 1.0
30650 @tab Vector extensions for embedded processors.
30652 @item zvl32b
30653 @tab 1.0
30654 @tab Minimum vector length standard extensions
30656 @item zvl64b
30657 @tab 1.0
30658 @tab Minimum vector length standard extensions
30660 @item zvl128b
30661 @tab 1.0
30662 @tab Minimum vector length standard extensions
30664 @item zvl256b
30665 @tab 1.0
30666 @tab Minimum vector length standard extensions
30668 @item zvl512b
30669 @tab 1.0
30670 @tab Minimum vector length standard extensions
30672 @item zvl1024b
30673 @tab 1.0
30674 @tab Minimum vector length standard extensions
30676 @item zvl2048b
30677 @tab 1.0
30678 @tab Minimum vector length standard extensions
30680 @item zvl4096b
30681 @tab 1.0
30682 @tab Minimum vector length standard extensions
30684 @item zvbb
30685 @tab 1.0
30686 @tab Vector basic bit-manipulation extension.
30688 @item zvbc
30689 @tab 1.0
30690 @tab Vector carryless multiplication extension.
30692 @item zvkb
30693 @tab 1.0
30694 @tab Vector cryptography bit-manipulation extension.
30696 @item zvkg
30697 @tab 1.0
30698 @tab Vector GCM/GMAC extension.
30700 @item zvkned
30701 @tab 1.0
30702 @tab Vector AES block cipher extension.
30704 @item zvknha
30705 @tab 1.0
30706 @tab Vector SHA-2 secure hash extension.
30708 @item zvknhb
30709 @tab 1.0
30710 @tab Vector SHA-2 secure hash extension.
30712 @item zvksed
30713 @tab 1.0
30714 @tab Vector SM4 Block Cipher extension.
30716 @item zvksh
30717 @tab 1.0
30718 @tab Vector SM3 Secure Hash extension.
30720 @item zvkn
30721 @tab 1.0
30722 @tab Vector NIST Algorithm Suite extension, @samp{zvkn} will expand to
30723 @samp{zvkned}, @samp{zvknhb}, @samp{zvkb} and @samp{zvkt}.
30725 @item zvknc
30726 @tab 1.0
30727 @tab Vector NIST Algorithm Suite with carryless multiply extension, @samp{zvknc}
30728 will expand to @samp{zvkn} and @samp{zvbc}.
30730 @item zvkng
30731 @tab 1.0
30732 @tab Vector NIST Algorithm Suite with GCM extension, @samp{zvkng} will expand
30733 to @samp{zvkn} and @samp{zvkg}.
30735 @item zvks
30736 @tab 1.0
30737 @tab Vector ShangMi algorithm suite extension, @samp{zvks} will expand
30738 to @samp{zvksed}, @samp{zvksh}, @samp{zvkb} and @samp{zvkt}.
30740 @item zvksc
30741 @tab 1.0
30742 @tab Vector ShangMi algorithm suite with carryless multiplication extension,
30743 @samp{zvksc} will expand to @samp{zvks} and @samp{zvbc}.
30745 @item zvksg
30746 @tab 1.0
30747 @tab Vector ShangMi algorithm suite with GCM extension, @samp{zvksg} will expand
30748 to @samp{zvks} and @samp{zvkg}.
30750 @item zvkt
30751 @tab 1.0
30752 @tab Vector data independent execution latency extension.
30754 @item zfh
30755 @tab 1.0
30756 @tab Half-precision floating-point extension.
30758 @item zfhmin
30759 @tab 1.0
30760 @tab Minimal half-precision floating-point extension.
30762 @item zvfh
30763 @tab 1.0
30764 @tab Vector half-precision floating-point extension.
30766 @item zvfhmin
30767 @tab 1.0
30768 @tab Vector minimal half-precision floating-point extension.
30770 @item zvfbfmin
30771 @tab 1.0
30772 @tab Vector BF16 converts extension.
30774 @item zfa
30775 @tab 1.0
30776 @tab Additional floating-point extension.
30778 @item zmmul
30779 @tab 1.0
30780 @tab Integer multiplication extension.
30782 @item zca
30783 @tab 1.0
30784 @tab Integer compressed instruction extension.
30786 @item zcf
30787 @tab 1.0
30788 @tab Compressed single-precision floating point loads and stores extension.
30790 @item zcd
30791 @tab 1.0
30792 @tab Compressed double-precision floating point loads and stores extension.
30794 @item zcb
30795 @tab 1.0
30796 @tab Simple compressed instruction extension.
30798 @item zce
30799 @tab 1.0
30800 @tab Compressed instruction extensions for embedded processors.
30802 @item zcmp
30803 @tab 1.0
30804 @tab Compressed push pop extension.
30806 @item zcmt
30807 @tab 1.0
30808 @tab Table jump instruction extension.
30810 @item smaia
30811 @tab 1.0
30812 @tab Advanced interrupt architecture extension.
30814 @item smepmp
30815 @tab 1.0
30816 @tab PMP Enhancements for memory access and execution prevention on Machine mode.
30818 @item smstateen
30819 @tab 1.0
30820 @tab State enable extension.
30822 @item ssaia
30823 @tab 1.0
30824 @tab Advanced interrupt architecture extension for supervisor-mode.
30826 @item sscofpmf
30827 @tab 1.0
30828 @tab Count overflow & filtering extension.
30830 @item ssstateen
30831 @tab 1.0
30832 @tab State-enable extension for supervisor-mode.
30834 @item sstc
30835 @tab 1.0
30836 @tab Supervisor-mode timer interrupts extension.
30838 @item svinval
30839 @tab 1.0
30840 @tab Fine-grained address-translation cache invalidation extension.
30842 @item svnapot
30843 @tab 1.0
30844 @tab NAPOT translation contiguity extension.
30846 @item svpbmt
30847 @tab 1.0
30848 @tab Page-based memory types extension.
30850 @item xcvmac
30851 @tab 1.0
30852 @tab Core-V multiply-accumulate extension.
30854 @item xcvalu
30855 @tab 1.0
30856 @tab Core-V miscellaneous ALU extension.
30858 @item xcvelw
30859 @tab 1.0
30860 @tab Core-V event load word extension.
30862 @item xtheadba
30863 @tab 1.0
30864 @tab T-head address calculation extension.
30866 @item xtheadbb
30867 @tab 1.0
30868 @tab T-head basic bit-manipulation extension.
30870 @item xtheadbs
30871 @tab 1.0
30872 @tab T-head single-bit instructions extension.
30874 @item xtheadcmo
30875 @tab 1.0
30876 @tab T-head cache management operations extension.
30878 @item xtheadcondmov
30879 @tab 1.0
30880 @tab T-head conditional move extension.
30882 @item xtheadfmemidx
30883 @tab 1.0
30884 @tab T-head indexed memory operations for floating-point registers extension.
30886 @item xtheadfmv
30887 @tab 1.0
30888 @tab T-head double floating-point high-bit data transmission extension.
30890 @item xtheadint
30891 @tab 1.0
30892 @tab T-head acceleration interruption extension.
30894 @item xtheadmac
30895 @tab 1.0
30896 @tab T-head multiply-accumulate extension.
30898 @item xtheadmemidx
30899 @tab 1.0
30900 @tab T-head indexed memory operation extension.
30902 @item xtheadmempair
30903 @tab 1.0
30904 @tab T-head two-GPR memory operation extension.
30906 @item xtheadsync
30907 @tab 1.0
30908 @tab T-head multi-core synchronization extension.
30910 @item xventanacondops
30911 @tab 1.0
30912 @tab Ventana integer conditional operations extension.
30914 @end multitable
30916 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
30918 If both @option{-march} and @option{-mcpu=} are not specified, the default for
30919 this argument is system dependent, users who want a specific architecture
30920 extensions should specify one explicitly.
30922 @opindex mcpu
30923 @item -mcpu=@var{processor-string}
30924 Use architecture of and optimize the output for the given processor, specified
30925 by particular CPU name.
30926 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
30927 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
30928 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
30929 @samp{sifive-u54}, @samp{sifive-u74}, @samp{sifive-x280}, @samp{sifive-xp450},
30930 @samp{sifive-x670}.
30932 Note that @option{-mcpu} does not override @option{-march} or @option{-mtune}.
30934 @opindex mtune
30935 @item -mtune=@var{processor-string}
30936 Optimize the output for the given processor, specified by microarchitecture or
30937 particular CPU name.  Permissible values for this option are: @samp{rocket},
30938 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
30939 @samp{thead-c906}, @samp{size}, @samp{sifive-p400-series},
30940 @samp{sifive-p600-series}, and all valid options for @option{-mcpu=}.
30942 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
30943 the default is @samp{rocket} if both are not specified.
30945 The @samp{size} choice is not intended for use by end-users.  This is used
30946 when @option{-Os} is specified.  It overrides the instruction cost info
30947 provided by @option{-mtune=}, but does not override the pipeline info.  This
30948 helps reduce code size while still giving good performance.
30950 @opindex mpreferred-stack-boundary
30951 @item -mpreferred-stack-boundary=@var{num}
30952 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
30953 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
30954 the default is 4 (16 bytes or 128-bits).
30956 @strong{Warning:} If you use this switch, then you must build all modules with
30957 the same value, including any libraries.  This includes the system libraries
30958 and startup modules.
30960 @opindex msmall-data-limit
30961 @item -msmall-data-limit=@var{n}
30962 Put global and static data smaller than @var{n} bytes into a special section
30963 (on some targets).
30965 @opindex msave-restore
30966 @item -msave-restore
30967 @itemx -mno-save-restore
30968 Do or don't use smaller but slower prologue and epilogue code that uses
30969 library function calls.  The default is to use fast inline prologues and
30970 epilogues.
30972 @opindex mmovcc
30973 @item -mmovcc
30974 @itemx -mno-movcc
30975 Do or don't produce branchless conditional-move code sequences even with
30976 targets that do not have specific instructions for conditional operations.
30977 If enabled, sequences of ALU operations are produced using base integer
30978 ISA instructions where profitable.
30980 @opindex minline-atomics
30981 @item -minline-atomics
30982 @itemx -mno-inline-atomics
30983 Do or don't use smaller but slower subword atomic emulation code that uses
30984 libatomic function calls.  The default is to use fast inline subword atomics
30985 that do not require libatomic.
30987 @opindex minline-strlen
30988 @item -minline-strlen
30989 @itemx -mno-inline-strlen
30990 Do or do not attempt to inline strlen calls if possible.
30991 Inlining will only be done if the string is properly aligned
30992 and instructions for accelerated processing are available.
30993 The default is to not inline strlen calls.
30995 @opindex minline-strcmp
30996 @item -minline-strcmp
30997 @itemx -mno-inline-strcmp
30998 Do or do not attempt to inline strcmp calls if possible.
30999 Inlining will only be done if the strings are properly aligned
31000 and instructions for accelerated processing are available.
31001 The default is to not inline strcmp calls.
31003 The @option{--param riscv-strcmp-inline-limit=@var{n}} parameter controls
31004 the maximum number of bytes compared by the inlined code.
31005 The default value is 64.
31007 @opindex minline-strncmp
31008 @item -minline-strncmp
31009 @itemx -mno-inline-strncmp
31010 Do or do not attempt to inline strncmp calls if possible.
31011 Inlining will only be done if the strings are properly aligned
31012 and instructions for accelerated processing are available.
31013 The default is to not inline strncmp calls.
31015 The @option{--param riscv-strcmp-inline-limit=@var{n}} parameter controls
31016 the maximum number of bytes compared by the inlined code.
31017 The default value is 64.
31019 @opindex mshorten-memrefs
31020 @item -mshorten-memrefs
31021 @itemx -mno-shorten-memrefs
31022 Do or do not attempt to make more use of compressed load/store instructions by
31023 replacing a load/store of 'base register + large offset' with a new load/store
31024 of 'new base + small offset'.  If the new base gets stored in a compressed
31025 register, then the new load/store can be compressed.  Currently targets 32-bit
31026 integer load/stores only.
31028 @opindex mstrict-align
31029 @item -mstrict-align
31030 @itemx -mno-strict-align
31031 Do not or do generate unaligned memory accesses.  The default is set depending
31032 on whether the processor we are optimizing for supports fast unaligned access
31033 or not.
31035 @opindex mcmodel=medlow
31036 @item -mcmodel=medlow
31037 Generate code for the medium-low code model. The program and its statically
31038 defined symbols must lie within a single 2 GiB address range and must lie
31039 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
31040 statically or dynamically linked. This is the default code model.
31042 @opindex mcmodel=medany
31043 @item -mcmodel=medany
31044 Generate code for the medium-any code model. The program and its statically
31045 defined symbols must be within any single 2 GiB address range. Programs can be
31046 statically or dynamically linked.
31048 The code generated by the medium-any code model is position-independent, but is
31049 not guaranteed to function correctly when linked into position-independent
31050 executables or libraries.
31052 @opindex -mcmodel=large
31053 @item -mcmodel=large
31054 Generate code for a large code model, which has no restrictions on size or
31055 placement of symbols.
31057 @item -mexplicit-relocs
31058 @itemx -mno-exlicit-relocs
31059 Use or do not use assembler relocation operators when dealing with symbolic
31060 addresses.  The alternative is to use assembler macros instead, which may
31061 limit optimization.
31063 @opindex mrelax
31064 @item -mrelax
31065 @itemx -mno-relax
31066 Take advantage of linker relaxations to reduce the number of instructions
31067 required to materialize symbol addresses. The default is to take advantage of
31068 linker relaxations.
31070 @opindex mriscv-attribute
31071 @item -mriscv-attribute
31072 @itemx -mno-riscv-attribute
31073 Emit (do not emit) RISC-V attribute to record extra information into ELF
31074 objects.  This feature requires at least binutils 2.32.
31076 @opindex mcsr-check
31077 @item -mcsr-check
31078 @itemx -mno-csr-check
31079 Enables or disables the CSR checking.
31081 @opindex malign-data
31082 @item -malign-data=@var{type}
31083 Control how GCC aligns variables and constants of array, structure, or union
31084 types.  Supported values for @var{type} are @samp{xlen} which uses x register
31085 width as the alignment value, and @samp{natural} which uses natural alignment.
31086 @samp{xlen} is the default.
31088 @opindex mbig-endian
31089 @item -mbig-endian
31090 Generate big-endian code.  This is the default when GCC is configured for a
31091 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
31093 @opindex mlittle-endian
31094 @item -mlittle-endian
31095 Generate little-endian code.  This is the default when GCC is configured for a
31096 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
31097 @samp{riscv32be-*-*} target.
31099 @opindex mstack-protector-guard
31100 @opindex mstack-protector-guard-reg
31101 @opindex mstack-protector-guard-offset
31102 @item -mstack-protector-guard=@var{guard}
31103 @itemx -mstack-protector-guard-reg=@var{reg}
31104 @itemx -mstack-protector-guard-offset=@var{offset}
31105 Generate stack protection code using canary at @var{guard}.  Supported
31106 locations are @samp{global} for a global canary or @samp{tls} for per-thread
31107 canary in the TLS block.
31109 With the latter choice the options
31110 @option{-mstack-protector-guard-reg=@var{reg}} and
31111 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
31112 which register to use as base register for reading the canary,
31113 and from what offset from that base register. There is no default
31114 register or offset as this is entirely for use within the Linux
31115 kernel.
31117 @opindex mtls-dialect=desc
31118 @item -mtls-dialect=desc
31119 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
31120 of TLS variables.
31122 @opindex mtls-dialect=trad
31123 @item -mtls-dialect=trad
31124 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
31125 of TLS variables.  This is the default.
31126 @end table
31128 @node RL78 Options
31129 @subsection RL78 Options
31130 @cindex RL78 Options
31132 @table @gcctabopt
31134 @opindex msim
31135 @item -msim
31136 Links in additional target libraries to support operation within a
31137 simulator.
31139 @opindex mmul
31140 @item -mmul=none
31141 @itemx -mmul=g10
31142 @itemx -mmul=g13
31143 @itemx -mmul=g14
31144 @itemx -mmul=rl78
31145 Specifies the type of hardware multiplication and division support to
31146 be used.  The simplest is @code{none}, which uses software for both
31147 multiplication and division.  This is the default.  The @code{g13}
31148 value is for the hardware multiply/divide peripheral found on the
31149 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
31150 the multiplication and division instructions supported by the RL78/G14
31151 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
31152 the value @code{mg10} is an alias for @code{none}.
31154 In addition a C preprocessor macro is defined, based upon the setting
31155 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
31156 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
31158 @opindex mcpu
31159 @item -mcpu=g10
31160 @itemx -mcpu=g13
31161 @itemx -mcpu=g14
31162 @itemx -mcpu=rl78
31163 Specifies the RL78 core to target.  The default is the G14 core, also
31164 known as an S3 core or just RL78.  The G13 or S2 core does not have
31165 multiply or divide instructions, instead it uses a hardware peripheral
31166 for these operations.  The G10 or S1 core does not have register
31167 banks, so it uses a different calling convention.
31169 If this option is set it also selects the type of hardware multiply
31170 support to use, unless this is overridden by an explicit
31171 @option{-mmul=none} option on the command line.  Thus specifying
31172 @option{-mcpu=g13} enables the use of the G13 hardware multiply
31173 peripheral and specifying @option{-mcpu=g10} disables the use of
31174 hardware multiplications altogether.
31176 Note, although the RL78/G14 core is the default target, specifying
31177 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
31178 change the behavior of the toolchain since it also enables G14
31179 hardware multiply support.  If these options are not specified on the
31180 command line then software multiplication routines will be used even
31181 though the code targets the RL78 core.  This is for backwards
31182 compatibility with older toolchains which did not have hardware
31183 multiply and divide support.
31185 In addition a C preprocessor macro is defined, based upon the setting
31186 of this option.  Possible values are: @code{__RL78_G10__},
31187 @code{__RL78_G13__} or @code{__RL78_G14__}.
31189 @opindex mg10
31190 @opindex mg13
31191 @opindex mg14
31192 @opindex mrl78
31193 @item -mg10
31194 @itemx -mg13
31195 @itemx -mg14
31196 @itemx -mrl78
31197 These are aliases for the corresponding @option{-mcpu=} option.  They
31198 are provided for backwards compatibility.
31200 @opindex mallregs
31201 @item -mallregs
31202 Allow the compiler to use all of the available registers.  By default
31203 registers @code{r24..r31} are reserved for use in interrupt handlers.
31204 With this option enabled these registers can be used in ordinary
31205 functions as well.
31207 @opindex m64bit-doubles
31208 @opindex m32bit-doubles
31209 @item -m64bit-doubles
31210 @itemx -m32bit-doubles
31211 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
31212 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
31213 @option{-m32bit-doubles}.
31215 @opindex msave-mduc-in-interrupts
31216 @opindex mno-save-mduc-in-interrupts
31217 @item -msave-mduc-in-interrupts
31218 @itemx -mno-save-mduc-in-interrupts
31219 Specifies that interrupt handler functions should preserve the
31220 MDUC registers.  This is only necessary if normal code might use
31221 the MDUC registers, for example because it performs multiplication
31222 and division operations.  The default is to ignore the MDUC registers
31223 as this makes the interrupt handlers faster.  The target option -mg13
31224 needs to be passed for this to work as this feature is only available
31225 on the G13 target (S2 core).  The MDUC registers will only be saved
31226 if the interrupt handler performs a multiplication or division
31227 operation or it calls another function.
31229 @end table
31231 @node RS/6000 and PowerPC Options
31232 @subsection IBM RS/6000 and PowerPC Options
31233 @cindex RS/6000 and PowerPC Options
31234 @cindex IBM RS/6000 and PowerPC Options
31236 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
31237 @table @gcctabopt
31238 @item -mpowerpc-gpopt
31239 @itemx -mno-powerpc-gpopt
31240 @itemx -mpowerpc-gfxopt
31241 @itemx -mno-powerpc-gfxopt
31242 @need 800
31243 @itemx -mpowerpc64
31244 @itemx -mno-powerpc64
31245 @itemx -mmfcrf
31246 @itemx -mno-mfcrf
31247 @itemx -mpopcntb
31248 @itemx -mno-popcntb
31249 @itemx -mpopcntd
31250 @itemx -mno-popcntd
31251 @itemx -mfprnd
31252 @itemx -mno-fprnd
31253 @need 800
31254 @opindex mpowerpc-gpopt
31255 @opindex mno-powerpc-gpopt
31256 @opindex mpowerpc-gfxopt
31257 @opindex mno-powerpc-gfxopt
31258 @opindex mpowerpc64
31259 @opindex mno-powerpc64
31260 @opindex mmfcrf
31261 @opindex mno-mfcrf
31262 @opindex mpopcntb
31263 @opindex mno-popcntb
31264 @opindex mpopcntd
31265 @opindex mno-popcntd
31266 @opindex mfprnd
31267 @opindex mno-fprnd
31268 @opindex mcmpb
31269 @opindex mno-cmpb
31270 @opindex mhard-dfp
31271 @opindex mno-hard-dfp
31272 @itemx -mcmpb
31273 @itemx -mno-cmpb
31274 @itemx -mhard-dfp
31275 @itemx -mno-hard-dfp
31276 You use these options to specify which instructions are available on the
31277 processor you are using.  The default value of these options is
31278 determined when configuring GCC@.  Specifying the
31279 @option{-mcpu=@var{cpu_type}} overrides the specification of these
31280 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
31281 rather than the options listed above.
31283 Specifying @option{-mpowerpc-gpopt} allows
31284 GCC to use the optional PowerPC architecture instructions in the
31285 General Purpose group, including floating-point square root.  Specifying
31286 @option{-mpowerpc-gfxopt} allows GCC to
31287 use the optional PowerPC architecture instructions in the Graphics
31288 group, including floating-point select.
31290 The @option{-mmfcrf} option allows GCC to generate the move from
31291 condition register field instruction implemented on the POWER4
31292 processor and other processors that support the PowerPC V2.01
31293 architecture.
31294 The @option{-mpopcntb} option allows GCC to generate the popcount and
31295 double-precision FP reciprocal estimate instruction implemented on the
31296 POWER5 processor and other processors that support the PowerPC V2.02
31297 architecture.
31298 The @option{-mpopcntd} option allows GCC to generate the popcount
31299 instruction implemented on the POWER7 processor and other processors
31300 that support the PowerPC V2.06 architecture.
31301 The @option{-mfprnd} option allows GCC to generate the FP round to
31302 integer instructions implemented on the POWER5+ processor and other
31303 processors that support the PowerPC V2.03 architecture.
31304 The @option{-mcmpb} option allows GCC to generate the compare bytes
31305 instruction implemented on the POWER6 processor and other processors
31306 that support the PowerPC V2.05 architecture.
31307 The @option{-mhard-dfp} option allows GCC to generate the decimal
31308 floating-point instructions implemented on some POWER processors.
31310 The @option{-mpowerpc64} option allows GCC to generate the additional
31311 64-bit instructions that are found in the full PowerPC64 architecture
31312 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
31313 @option{-mno-powerpc64}.
31315 @opindex mcpu
31316 @item -mcpu=@var{cpu_type}
31317 Set architecture type, register usage, and
31318 instruction scheduling parameters for machine type @var{cpu_type}.
31319 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
31320 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
31321 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
31322 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
31323 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
31324 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
31325 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
31326 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
31327 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
31328 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
31329 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
31330 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
31332 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
31333 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
31334 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
31335 architecture machine types, with an appropriate, generic processor
31336 model assumed for scheduling purposes.
31338 Specifying @samp{native} as cpu type detects and selects the
31339 architecture option that corresponds to the host processor of the
31340 system performing the compilation.
31341 @option{-mcpu=native} has no effect if GCC does not recognize the
31342 processor.
31344 The other options specify a specific processor.  Code generated under
31345 those options runs best on that processor, and may not run at all on
31346 others.
31348 The @option{-mcpu} options automatically enable or disable the
31349 following options:
31351 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
31352 -mpopcntb  -mpopcntd  -mpowerpc64
31353 -mpowerpc-gpopt  -mpowerpc-gfxopt
31354 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
31355 -mcrypto  -mhtm  -mpower8-fusion
31356 -mquad-memory  -mquad-memory-atomic  -mfloat128
31357 -mfloat128-hardware -mprefixed -mpcrel -mmma
31358 -mrop-protect}
31360 The particular options set for any particular CPU varies between
31361 compiler versions, depending on what setting seems to produce optimal
31362 code for that CPU; it doesn't necessarily reflect the actual hardware's
31363 capabilities.  If you wish to set an individual option to a particular
31364 value, you may specify it after the @option{-mcpu} option, like
31365 @option{-mcpu=970 -mno-altivec}.
31367 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
31368 not enabled or disabled by the @option{-mcpu} option at present because
31369 AIX does not have full support for these options.  You may still
31370 enable or disable them individually if you're sure it'll work in your
31371 environment.
31373 @opindex mtune
31374 @item -mtune=@var{cpu_type}
31375 Set the instruction scheduling parameters for machine type
31376 @var{cpu_type}, but do not set the architecture type or register usage,
31377 as @option{-mcpu=@var{cpu_type}} does.  The same
31378 values for @var{cpu_type} are used for @option{-mtune} as for
31379 @option{-mcpu}.  If both are specified, the code generated uses the
31380 architecture and registers set by @option{-mcpu}, but the
31381 scheduling parameters set by @option{-mtune}.
31383 @opindex mcmodel=small
31384 @item -mcmodel=small
31385 Generate PowerPC64 code for the small model: The TOC is limited to
31386 64k.
31388 @opindex mcmodel=medium
31389 @item -mcmodel=medium
31390 Generate PowerPC64 code for the medium model: The TOC and other static
31391 data may be up to a total of 4G in size.  This is the default for 64-bit
31392 Linux.
31394 @opindex mcmodel=large
31395 @item -mcmodel=large
31396 Generate PowerPC64 code for the large model: The TOC may be up to 4G
31397 in size.  Other data and code is only limited by the 64-bit address
31398 space.
31400 @opindex maltivec
31401 @opindex mno-altivec
31402 @item -maltivec
31403 @itemx -mno-altivec
31404 Generate code that uses (does not use) AltiVec instructions, and also
31405 enable the use of built-in functions that allow more direct access to
31406 the AltiVec instruction set.  You may also need to set
31407 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
31408 enhancements.
31410 When @option{-maltivec} is used, the element order for AltiVec intrinsics
31411 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
31412 match array element order corresponding to the endianness of the
31413 target.  That is, element zero identifies the leftmost element in a
31414 vector register when targeting a big-endian platform, and identifies
31415 the rightmost element in a vector register when targeting a
31416 little-endian platform.
31418 @opindex mvrsave
31419 @opindex mno-vrsave
31420 @item -mvrsave
31421 @itemx -mno-vrsave
31422 Generate VRSAVE instructions when generating AltiVec code.
31424 @opindex msecure-plt
31425 @item -msecure-plt
31426 Generate code that allows @command{ld} and @command{ld.so}
31427 to build executables and shared
31428 libraries with non-executable @code{.plt} and @code{.got} sections.
31429 This is a PowerPC
31430 32-bit SYSV ABI option.
31432 @opindex mbss-plt
31433 @item -mbss-plt
31434 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
31435 fills in, and
31436 requires @code{.plt} and @code{.got}
31437 sections that are both writable and executable.
31438 This is a PowerPC 32-bit SYSV ABI option.
31440 @opindex misel
31441 @opindex mno-isel
31442 @item -misel
31443 @itemx -mno-isel
31444 This switch enables or disables the generation of ISEL instructions.
31446 @opindex mvsx
31447 @opindex mno-vsx
31448 @item -mvsx
31449 @itemx -mno-vsx
31450 Generate code that uses (does not use) vector/scalar (VSX)
31451 instructions, and also enable the use of built-in functions that allow
31452 more direct access to the VSX instruction set.
31454 @opindex mcrypto
31455 @opindex mno-crypto
31456 @item -mcrypto
31457 @itemx -mno-crypto
31458 Enable the use (disable) of the built-in functions that allow direct
31459 access to the cryptographic instructions that were added in version
31460 2.07 of the PowerPC ISA.
31462 @opindex mhtm
31463 @opindex mno-htm
31464 @item -mhtm
31465 @itemx -mno-htm
31466 Enable (disable) the use of the built-in functions that allow direct
31467 access to the Hardware Transactional Memory (HTM) instructions that
31468 were added in version 2.07 of the PowerPC ISA.
31470 @opindex mpower8-fusion
31471 @opindex mno-power8-fusion
31472 @item -mpower8-fusion
31473 @itemx -mno-power8-fusion
31474 Generate code that keeps (does not keeps) some integer operations
31475 adjacent so that the instructions can be fused together on power8 and
31476 later processors.
31478 @opindex mquad-memory
31479 @opindex mno-quad-memory
31480 @item -mquad-memory
31481 @itemx -mno-quad-memory
31482 Generate code that uses (does not use) the non-atomic quad word memory
31483 instructions.  The @option{-mquad-memory} option requires use of
31484 64-bit mode.
31486 @opindex mquad-memory-atomic
31487 @opindex mno-quad-memory-atomic
31488 @item -mquad-memory-atomic
31489 @itemx -mno-quad-memory-atomic
31490 Generate code that uses (does not use) the atomic quad word memory
31491 instructions.  The @option{-mquad-memory-atomic} option requires use of
31492 64-bit mode.
31494 @opindex mfloat128
31495 @opindex mno-float128
31496 @item -mfloat128
31497 @itemx -mno-float128
31498 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
31499 and use either software emulation for IEEE 128-bit floating point or
31500 hardware instructions.
31502 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
31503 128-bit floating point support.  The IEEE 128-bit floating point is only
31504 supported on Linux.
31506 The default for @option{-mfloat128} is enabled on PowerPC Linux
31507 systems using the VSX instruction set, and disabled on other systems.
31509 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}) on a
31510 64-bit system, the IEEE 128-bit floating point support will also enable
31511 the generation of ISA 3.0 IEEE 128-bit floating point instructions.
31512 Otherwise, if you do not specify to generate ISA 3.0 instructions or you
31513 are targeting a 32-bit big endian system, IEEE 128-bit floating point
31514 will be done with software emulation.
31516 @opindex mfloat128-hardware
31517 @opindex mno-float128-hardware
31518 @item -mfloat128-hardware
31519 @itemx -mno-float128-hardware
31520 Enable/disable using ISA 3.0 hardware instructions to support the
31521 @var{__float128} data type.
31523 The default for @option{-mfloat128-hardware} is enabled on PowerPC
31524 Linux systems using the ISA 3.0 instruction set, and disabled on other
31525 systems.
31527 @opindex m32
31528 @opindex m64
31529 @item -m32
31530 @itemx -m64
31531 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
31532 targets (including GNU/Linux).  The 32-bit environment sets int, long
31533 and pointer to 32 bits and generates code that runs on any PowerPC
31534 variant.  The 64-bit environment sets int to 32 bits and long and
31535 pointer to 64 bits, and generates code for PowerPC64, as for
31536 @option{-mpowerpc64}.
31538 @opindex mfull-toc
31539 @opindex mno-fp-in-toc
31540 @opindex mno-sum-in-toc
31541 @opindex mminimal-toc
31542 @item -mfull-toc
31543 @itemx -mno-fp-in-toc
31544 @itemx -mno-sum-in-toc
31545 @itemx -mminimal-toc
31546 Modify generation of the TOC (Table Of Contents), which is created for
31547 every executable file.  The @option{-mfull-toc} option is selected by
31548 default.  In that case, GCC allocates at least one TOC entry for
31549 each unique non-automatic variable reference in your program.  GCC
31550 also places floating-point constants in the TOC@.  However, only
31551 16,384 entries are available in the TOC@.
31553 If you receive a linker error message that saying you have overflowed
31554 the available TOC space, you can reduce the amount of TOC space used
31555 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
31556 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
31557 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
31558 generate code to calculate the sum of an address and a constant at
31559 run time instead of putting that sum into the TOC@.  You may specify one
31560 or both of these options.  Each causes GCC to produce very slightly
31561 slower and larger code at the expense of conserving TOC space.
31563 If you still run out of space in the TOC even when you specify both of
31564 these options, specify @option{-mminimal-toc} instead.  This option causes
31565 GCC to make only one TOC entry for every file.  When you specify this
31566 option, GCC produces code that is slower and larger but which
31567 uses extremely little TOC space.  You may wish to use this option
31568 only on files that contain less frequently-executed code.
31570 @opindex maix64
31571 @opindex maix32
31572 @item -maix64
31573 @itemx -maix32
31574 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
31575 @code{long} type, and the infrastructure needed to support them.
31576 Specifying @option{-maix64} implies @option{-mpowerpc64},
31577 while @option{-maix32} disables the 64-bit ABI and
31578 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
31580 @opindex mxl-compat
31581 @opindex mno-xl-compat
31582 @item -mxl-compat
31583 @itemx -mno-xl-compat
31584 Produce code that conforms more closely to IBM XL compiler semantics
31585 when using AIX-compatible ABI@.  Pass floating-point arguments to
31586 prototyped functions beyond the register save area (RSA) on the stack
31587 in addition to argument FPRs.  Do not assume that most significant
31588 double in 128-bit long double value is properly rounded when comparing
31589 values and converting to double.  Use XL symbol names for long double
31590 support routines.
31592 The AIX calling convention was extended but not initially documented to
31593 handle an obscure K&R C case of calling a function that takes the
31594 address of its arguments with fewer arguments than declared.  IBM XL
31595 compilers access floating-point arguments that do not fit in the
31596 RSA from the stack when a subroutine is compiled without
31597 optimization.  Because always storing floating-point arguments on the
31598 stack is inefficient and rarely needed, this option is not enabled by
31599 default and only is necessary when calling subroutines compiled by IBM
31600 XL compilers without optimization.
31602 @opindex mpe
31603 @item -mpe
31604 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
31605 application written to use message passing with special startup code to
31606 enable the application to run.  The system must have PE installed in the
31607 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
31608 must be overridden with the @option{-specs=} option to specify the
31609 appropriate directory location.  The Parallel Environment does not
31610 support threads, so the @option{-mpe} option and the @option{-pthread}
31611 option are incompatible.
31613 @opindex malign-natural
31614 @opindex malign-power
31615 @item -malign-natural
31616 @itemx -malign-power
31617 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
31618 @option{-malign-natural} overrides the ABI-defined alignment of larger
31619 types, such as floating-point doubles, on their natural size-based boundary.
31620 The option @option{-malign-power} instructs GCC to follow the ABI-specified
31621 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
31623 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
31624 is not supported.
31626 @opindex msoft-float
31627 @opindex mhard-float
31628 @item -msoft-float
31629 @itemx -mhard-float
31630 Generate code that does not use (uses) the floating-point register set.
31631 Software floating-point emulation is provided if you use the
31632 @option{-msoft-float} option, and pass the option to GCC when linking.
31634 @opindex mmultiple
31635 @opindex mno-multiple
31636 @item -mmultiple
31637 @itemx -mno-multiple
31638 Generate code that uses (does not use) the load multiple word
31639 instructions and the store multiple word instructions.  These
31640 instructions are generated by default on POWER systems, and not
31641 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
31642 PowerPC systems, since those instructions do not work when the
31643 processor is in little-endian mode.  The exceptions are PPC740 and
31644 PPC750 which permit these instructions in little-endian mode.
31646 @opindex mupdate
31647 @opindex mno-update
31648 @item -mupdate
31649 @itemx -mno-update
31650 Generate code that uses (does not use) the load or store instructions
31651 that update the base register to the address of the calculated memory
31652 location.  These instructions are generated by default.  If you use
31653 @option{-mno-update}, there is a small window between the time that the
31654 stack pointer is updated and the address of the previous frame is
31655 stored, which means code that walks the stack frame across interrupts or
31656 signals may get corrupted data.
31658 @opindex mavoid-indexed-addresses
31659 @opindex mno-avoid-indexed-addresses
31660 @item -mavoid-indexed-addresses
31661 @itemx -mno-avoid-indexed-addresses
31662 Generate code that tries to avoid (not avoid) the use of indexed load
31663 or store instructions. These instructions can incur a performance
31664 penalty on Power6 processors in certain situations, such as when
31665 stepping through large arrays that cross a 16M boundary.  This option
31666 is enabled by default when targeting Power6 and disabled otherwise.
31668 @opindex mfused-madd
31669 @opindex mno-fused-madd
31670 @item -mfused-madd
31671 @itemx -mno-fused-madd
31672 Generate code that uses (does not use) the floating-point multiply and
31673 accumulate instructions.  These instructions are generated by default
31674 if hardware floating point is used.  The machine-dependent
31675 @option{-mfused-madd} option is now mapped to the machine-independent
31676 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31677 mapped to @option{-ffp-contract=off}.
31679 @opindex mmulhw
31680 @opindex mno-mulhw
31681 @item -mmulhw
31682 @itemx -mno-mulhw
31683 Generate code that uses (does not use) the half-word multiply and
31684 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
31685 These instructions are generated by default when targeting those
31686 processors.
31688 @opindex mdlmzb
31689 @opindex mno-dlmzb
31690 @item -mdlmzb
31691 @itemx -mno-dlmzb
31692 Generate code that uses (does not use) the string-search @samp{dlmzb}
31693 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
31694 generated by default when targeting those processors.
31696 @opindex mno-bit-align
31697 @opindex mbit-align
31698 @item -mno-bit-align
31699 @itemx -mbit-align
31700 On System V.4 and embedded PowerPC systems do not (do) force structures
31701 and unions that contain bit-fields to be aligned to the base type of the
31702 bit-field.
31704 For example, by default a structure containing nothing but 8
31705 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
31706 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
31707 the structure is aligned to a 1-byte boundary and is 1 byte in
31708 size.
31710 @opindex mno-strict-align
31711 @opindex mstrict-align
31712 @item -mno-strict-align
31713 @itemx -mstrict-align
31714 On System V.4 and embedded PowerPC systems do not (do) assume that
31715 unaligned memory references are handled by the system.
31717 @opindex mrelocatable
31718 @opindex mno-relocatable
31719 @item -mrelocatable
31720 @itemx -mno-relocatable
31721 Generate code that allows (does not allow) a static executable to be
31722 relocated to a different address at run time.  A simple embedded
31723 PowerPC system loader should relocate the entire contents of
31724 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
31725 a table of 32-bit addresses generated by this option.  For this to
31726 work, all objects linked together must be compiled with
31727 @option{-mrelocatable} or @option{-mrelocatable-lib}.
31728 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
31730 @opindex mrelocatable-lib
31731 @opindex mno-relocatable-lib
31732 @item -mrelocatable-lib
31733 @itemx -mno-relocatable-lib
31734 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
31735 @code{.fixup} section to allow static executables to be relocated at
31736 run time, but @option{-mrelocatable-lib} does not use the smaller stack
31737 alignment of @option{-mrelocatable}.  Objects compiled with
31738 @option{-mrelocatable-lib} may be linked with objects compiled with
31739 any combination of the @option{-mrelocatable} options.
31741 @opindex mno-toc
31742 @opindex mtoc
31743 @item -mno-toc
31744 @itemx -mtoc
31745 On System V.4 and embedded PowerPC systems do not (do) assume that
31746 register 2 contains a pointer to a global area pointing to the addresses
31747 used in the program.
31749 @opindex mlittle
31750 @opindex mlittle-endian
31751 @item -mlittle
31752 @itemx -mlittle-endian
31753 On System V.4 and embedded PowerPC systems compile code for the
31754 processor in little-endian mode.  The @option{-mlittle-endian} option is
31755 the same as @option{-mlittle}.
31757 @opindex mbig
31758 @opindex mbig-endian
31759 @item -mbig
31760 @itemx -mbig-endian
31761 On System V.4 and embedded PowerPC systems compile code for the
31762 processor in big-endian mode.  The @option{-mbig-endian} option is
31763 the same as @option{-mbig}.
31765 @opindex mdynamic-no-pic
31766 @item -mdynamic-no-pic
31767 On Darwin / macOS systems, compile code so that it is not
31768 relocatable, but that its external references are relocatable.  The
31769 resulting code is suitable for applications, but not shared
31770 libraries.
31772 @opindex msingle-pic-base
31773 @item -msingle-pic-base
31774 Treat the register used for PIC addressing as read-only, rather than
31775 loading it in the prologue for each function.  The runtime system is
31776 responsible for initializing this register with an appropriate value
31777 before execution begins.
31779 @opindex mprioritize-restricted-insns
31780 @item -mprioritize-restricted-insns=@var{priority}
31781 This option controls the priority that is assigned to
31782 dispatch-slot restricted instructions during the second scheduling
31783 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
31784 or @samp{2} to assign no, highest, or second-highest (respectively) 
31785 priority to dispatch-slot restricted
31786 instructions.
31788 @opindex msched-costly-dep
31789 @item -msched-costly-dep=@var{dependence_type}
31790 This option controls which dependences are considered costly
31791 by the target during instruction scheduling.  The argument
31792 @var{dependence_type} takes one of the following values:
31794 @table @asis
31795 @item @samp{no}
31796 No dependence is costly.
31798 @item @samp{all}
31799 All dependences are costly.
31801 @item @samp{true_store_to_load}
31802 A true dependence from store to load is costly.
31804 @item @samp{store_to_load}
31805 Any dependence from store to load is costly.
31807 @item @var{number}
31808 Any dependence for which the latency is greater than or equal to 
31809 @var{number} is costly.
31810 @end table
31812 @opindex minsert-sched-nops
31813 @item -minsert-sched-nops=@var{scheme}
31814 This option controls which NOP insertion scheme is used during
31815 the second scheduling pass.  The argument @var{scheme} takes one of the
31816 following values:
31818 @table @asis
31819 @item @samp{no}
31820 Don't insert NOPs.
31822 @item @samp{pad}
31823 Pad with NOPs any dispatch group that has vacant issue slots,
31824 according to the scheduler's grouping.
31826 @item @samp{regroup_exact}
31827 Insert NOPs to force costly dependent insns into
31828 separate groups.  Insert exactly as many NOPs as needed to force an insn
31829 to a new group, according to the estimated processor grouping.
31831 @item @var{number}
31832 Insert NOPs to force costly dependent insns into
31833 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
31834 @end table
31836 @opindex mcall-sysv
31837 @item -mcall-sysv
31838 On System V.4 and embedded PowerPC systems compile code using calling
31839 conventions that adhere to the March 1995 draft of the System V
31840 Application Binary Interface, PowerPC processor supplement.  This is the
31841 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
31843 @opindex mcall-sysv-eabi
31844 @opindex mcall-eabi
31845 @item -mcall-sysv-eabi
31846 @itemx -mcall-eabi
31847 Specify both @option{-mcall-sysv} and @option{-meabi} options.
31849 @opindex mcall-sysv-noeabi
31850 @item -mcall-sysv-noeabi
31851 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
31853 @opindex mcall-aixdesc
31854 @item -mcall-aixdesc
31855 On System V.4 and embedded PowerPC systems compile code for the AIX
31856 operating system.
31858 @opindex mcall-linux
31859 @item -mcall-linux
31860 On System V.4 and embedded PowerPC systems compile code for the
31861 Linux-based GNU system.
31863 @opindex mcall-freebsd
31864 @item -mcall-freebsd
31865 On System V.4 and embedded PowerPC systems compile code for the
31866 FreeBSD operating system.
31868 @opindex mcall-netbsd
31869 @item -mcall-netbsd
31870 On System V.4 and embedded PowerPC systems compile code for the
31871 NetBSD operating system.
31873 @opindex mcall-openbsd
31874 @item -mcall-openbsd
31875 On System V.4 and embedded PowerPC systems compile code for the
31876 OpenBSD operating system.
31878 @opindex mtraceback
31879 @item -mtraceback=@var{traceback_type}
31880 Select the type of traceback table. Valid values for @var{traceback_type}
31881 are @samp{full}, @samp{part}, and @samp{no}.
31883 @opindex maix-struct-return
31884 @item -maix-struct-return
31885 Return all structures in memory (as specified by the AIX ABI)@.
31887 @opindex msvr4-struct-return
31888 @item -msvr4-struct-return
31889 Return structures smaller than 8 bytes in registers (as specified by the
31890 SVR4 ABI)@.
31892 @opindex mabi
31893 @item -mabi=@var{abi-type}
31894 Extend the current ABI with a particular extension, or remove such extension.
31895 Valid values are: @samp{altivec}, @samp{no-altivec},
31896 @samp{ibmlongdouble}, @samp{ieeelongdouble},
31897 @samp{elfv1}, @samp{elfv2},
31898 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
31900 @opindex mabi=ibmlongdouble
31901 @item -mabi=ibmlongdouble
31902 Change the current ABI to use IBM extended-precision long double.
31903 This is not likely to work if your system defaults to using IEEE
31904 extended-precision long double.  If you change the long double type
31905 from IEEE extended-precision, the compiler will issue a warning unless
31906 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
31907 to be enabled.
31909 @opindex mabi=ieeelongdouble
31910 @item -mabi=ieeelongdouble
31911 Change the current ABI to use IEEE extended-precision long double.
31912 This is not likely to work if your system defaults to using IBM
31913 extended-precision long double.  If you change the long double type
31914 from IBM extended-precision, the compiler will issue a warning unless
31915 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
31916 to be enabled.
31918 @opindex mabi=elfv1
31919 @item -mabi=elfv1
31920 Change the current ABI to use the ELFv1 ABI.
31921 This is the default ABI for big-endian PowerPC 64-bit Linux.
31922 Overriding the default ABI requires special system support and is
31923 likely to fail in spectacular ways.
31925 @opindex mabi=elfv2
31926 @item -mabi=elfv2
31927 Change the current ABI to use the ELFv2 ABI.
31928 This is the default ABI for little-endian PowerPC 64-bit Linux.
31929 Overriding the default ABI requires special system support and is
31930 likely to fail in spectacular ways.
31932 @opindex mgnu-attribute
31933 @opindex mno-gnu-attribute
31934 @item -mgnu-attribute
31935 @itemx -mno-gnu-attribute
31936 Emit .gnu_attribute assembly directives to set tag/value pairs in a
31937 .gnu.attributes section that specify ABI variations in function
31938 parameters or return values.
31940 @opindex mprototype
31941 @opindex mno-prototype
31942 @item -mprototype
31943 @itemx -mno-prototype
31944 On System V.4 and embedded PowerPC systems assume that all calls to
31945 variable argument functions are properly prototyped.  Otherwise, the
31946 compiler must insert an instruction before every non-prototyped call to
31947 set or clear bit 6 of the condition code register (@code{CR}) to
31948 indicate whether floating-point values are passed in the floating-point
31949 registers in case the function takes variable arguments.  With
31950 @option{-mprototype}, only calls to prototyped variable argument functions
31951 set or clear the bit.
31953 @opindex msim
31954 @item -msim
31955 On embedded PowerPC systems, assume that the startup module is called
31956 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
31957 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
31958 configurations.
31960 @opindex mmvme
31961 @item -mmvme
31962 On embedded PowerPC systems, assume that the startup module is called
31963 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
31964 @file{libc.a}.
31966 @opindex mads
31967 @item -mads
31968 On embedded PowerPC systems, assume that the startup module is called
31969 @file{crt0.o} and the standard C libraries are @file{libads.a} and
31970 @file{libc.a}.
31972 @opindex myellowknife
31973 @item -myellowknife
31974 On embedded PowerPC systems, assume that the startup module is called
31975 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
31976 @file{libc.a}.
31978 @opindex mvxworks
31979 @item -mvxworks
31980 On System V.4 and embedded PowerPC systems, specify that you are
31981 compiling for a VxWorks system.
31983 @opindex memb
31984 @item -memb
31985 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
31986 header to indicate that @samp{eabi} extended relocations are used.
31988 @opindex meabi
31989 @opindex mno-eabi
31990 @item -meabi
31991 @itemx -mno-eabi
31992 On System V.4 and embedded PowerPC systems do (do not) adhere to the
31993 Embedded Applications Binary Interface (EABI), which is a set of
31994 modifications to the System V.4 specifications.  Selecting @option{-meabi}
31995 means that the stack is aligned to an 8-byte boundary, a function
31996 @code{__eabi} is called from @code{main} to set up the EABI
31997 environment, and the @option{-msdata} option can use both @code{r2} and
31998 @code{r13} to point to two separate small data areas.  Selecting
31999 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
32000 no EABI initialization function is called from @code{main}, and the
32001 @option{-msdata} option only uses @code{r13} to point to a single
32002 small data area.  The @option{-meabi} option is on by default if you
32003 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
32005 @opindex msdata=eabi
32006 @item -msdata=eabi
32007 On System V.4 and embedded PowerPC systems, put small initialized
32008 @code{const} global and static data in the @code{.sdata2} section, which
32009 is pointed to by register @code{r2}.  Put small initialized
32010 non-@code{const} global and static data in the @code{.sdata} section,
32011 which is pointed to by register @code{r13}.  Put small uninitialized
32012 global and static data in the @code{.sbss} section, which is adjacent to
32013 the @code{.sdata} section.  The @option{-msdata=eabi} option is
32014 incompatible with the @option{-mrelocatable} option.  The
32015 @option{-msdata=eabi} option also sets the @option{-memb} option.
32017 @opindex msdata=sysv
32018 @item -msdata=sysv
32019 On System V.4 and embedded PowerPC systems, put small global and static
32020 data in the @code{.sdata} section, which is pointed to by register
32021 @code{r13}.  Put small uninitialized global and static data in the
32022 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
32023 The @option{-msdata=sysv} option is incompatible with the
32024 @option{-mrelocatable} option.
32026 @opindex msdata=default
32027 @opindex msdata
32028 @item -msdata=default
32029 @itemx -msdata
32030 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
32031 compile code the same as @option{-msdata=eabi}, otherwise compile code the
32032 same as @option{-msdata=sysv}.
32034 @opindex msdata=data
32035 @item -msdata=data
32036 On System V.4 and embedded PowerPC systems, put small global
32037 data in the @code{.sdata} section.  Put small uninitialized global
32038 data in the @code{.sbss} section.  Do not use register @code{r13}
32039 to address small data however.  This is the default behavior unless
32040 other @option{-msdata} options are used.
32042 @opindex msdata=none
32043 @opindex mno-sdata
32044 @item -msdata=none
32045 @itemx -mno-sdata
32046 On embedded PowerPC systems, put all initialized global and static data
32047 in the @code{.data} section, and all uninitialized data in the
32048 @code{.bss} section.
32050 @opindex mreadonly-in-sdata
32051 @opindex mno-readonly-in-sdata
32052 @item -mreadonly-in-sdata
32053 Put read-only objects in the @code{.sdata} section as well.  This is the
32054 default.
32056 @opindex mblock-move-inline-limit
32057 @item -mblock-move-inline-limit=@var{num}
32058 Inline all block moves (such as calls to @code{memcpy} or structure
32059 copies) less than or equal to @var{num} bytes.  The minimum value for
32060 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
32061 targets.  The default value is target-specific.
32063 @opindex mblock-compare-inline-limit
32064 @item -mblock-compare-inline-limit=@var{num}
32065 Generate non-looping inline code for all block compares (such as calls
32066 to @code{memcmp} or structure compares) less than or equal to @var{num}
32067 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
32068 block compare is disabled. The default value is target-specific.
32070 @opindex mblock-compare-inline-loop-limit
32071 @item -mblock-compare-inline-loop-limit=@var{num}
32072 Generate an inline expansion using loop code for all block compares that
32073 are less than or equal to @var{num} bytes, but greater than the limit
32074 for non-loop inline block compare expansion. If the block length is not
32075 constant, at most @var{num} bytes will be compared before @code{memcmp}
32076 is called to compare the remainder of the block. The default value is
32077 target-specific.
32079 @opindex mstring-compare-inline-limit
32080 @item -mstring-compare-inline-limit=@var{num}
32081 Compare at most @var{num} string bytes with inline code.
32082 If the difference or end of string is not found at the
32083 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
32084 take care of the rest of the comparison. The default is 64 bytes.
32086 @opindex G
32087 @cindex smaller data references (PowerPC)
32088 @cindex .sdata/.sdata2 references (PowerPC)
32089 @item -G @var{num}
32090 On embedded PowerPC systems, put global and static items less than or
32091 equal to @var{num} bytes into the small data or BSS sections instead of
32092 the normal data or BSS section.  By default, @var{num} is 8.  The
32093 @option{-G @var{num}} switch is also passed to the linker.
32094 All modules should be compiled with the same @option{-G @var{num}} value.
32096 @opindex mregnames
32097 @opindex mno-regnames
32098 @item -mregnames
32099 @itemx -mno-regnames
32100 On System V.4 and embedded PowerPC systems do (do not) emit register
32101 names in the assembly language output using symbolic forms.
32103 @opindex mlongcall
32104 @opindex mno-longcall
32105 @item -mlongcall
32106 @itemx -mno-longcall
32107 By default assume that all calls are far away so that a longer and more
32108 expensive calling sequence is required.  This is required for calls
32109 farther than 32 megabytes (33,554,432 bytes) from the current location.
32110 A short call is generated if the compiler knows
32111 the call cannot be that far away.  This setting can be overridden by
32112 the @code{shortcall} function attribute, or by @code{#pragma
32113 longcall(0)}.
32115 Some linkers are capable of detecting out-of-range calls and generating
32116 glue code on the fly.  On these systems, long calls are unnecessary and
32117 generate slower code.  As of this writing, the AIX linker can do this,
32118 as can the GNU linker for PowerPC/64.  It is planned to add this feature
32119 to the GNU linker for 32-bit PowerPC systems as well.
32121 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
32122 GCC can generate long calls using an inline PLT call sequence (see
32123 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
32124 ELFv1 (big-endian) do not support inline PLT calls.
32126 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
32127 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
32128 addresses represent the callee and the branch island.  The
32129 Darwin/PPC linker prefers the first address and generates a @code{bl
32130 callee} if the PPC @code{bl} instruction reaches the callee directly;
32131 otherwise, the linker generates @code{bl L42} to call the branch
32132 island.  The branch island is appended to the body of the
32133 calling function; it computes the full 32-bit address of the callee
32134 and jumps to it.
32136 On Mach-O (Darwin) systems, this option directs the compiler emit to
32137 the glue for every direct call, and the Darwin linker decides whether
32138 to use or discard it.
32140 In the future, GCC may ignore all longcall specifications
32141 when the linker is known to generate glue.
32143 @opindex mpltseq
32144 @opindex mno-pltseq
32145 @item -mpltseq
32146 @itemx -mno-pltseq
32147 Implement (do not implement) -fno-plt and long calls using an inline
32148 PLT call sequence that supports lazy linking and long calls to
32149 functions in dlopen'd shared libraries.  Inline PLT calls are only
32150 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
32151 linkers, and are enabled by default if the support is detected when
32152 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
32153 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
32154 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
32155 linked together.
32157 @opindex mtls-markers
32158 @opindex mno-tls-markers
32159 @item -mtls-markers
32160 @itemx -mno-tls-markers
32161 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
32162 specifying the function argument.  The relocation allows the linker to
32163 reliably associate function call with argument setup instructions for
32164 TLS optimization, which in turn allows GCC to better schedule the
32165 sequence.
32167 @opindex mrecip
32168 @item -mrecip
32169 @itemx -mno-recip
32170 This option enables use of the reciprocal estimate and
32171 reciprocal square root estimate instructions with additional
32172 Newton-Raphson steps to increase precision instead of doing a divide or
32173 square root and divide for floating-point arguments.  You should use
32174 the @option{-ffast-math} option when using @option{-mrecip} (or at
32175 least @option{-funsafe-math-optimizations},
32176 @option{-ffinite-math-only}, @option{-freciprocal-math} and
32177 @option{-fno-trapping-math}).  Note that while the throughput of the
32178 sequence is generally higher than the throughput of the non-reciprocal
32179 instruction, the precision of the sequence can be decreased by up to 2
32180 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
32181 roots.
32183 @opindex mrecip=opt
32184 @item -mrecip=@var{opt}
32185 This option controls which reciprocal estimate instructions
32186 may be used.  @var{opt} is a comma-separated list of options, which may
32187 be preceded by a @code{!} to invert the option:
32189 @table @samp
32191 @item all
32192 Enable all estimate instructions.
32194 @item default 
32195 Enable the default instructions, equivalent to @option{-mrecip}.
32197 @item none 
32198 Disable all estimate instructions, equivalent to @option{-mno-recip}.
32200 @item div 
32201 Enable the reciprocal approximation instructions for both 
32202 single and double precision.
32204 @item divf 
32205 Enable the single-precision reciprocal approximation instructions.
32207 @item divd 
32208 Enable the double-precision reciprocal approximation instructions.
32210 @item rsqrt 
32211 Enable the reciprocal square root approximation instructions for both
32212 single and double precision.
32214 @item rsqrtf 
32215 Enable the single-precision reciprocal square root approximation instructions.
32217 @item rsqrtd 
32218 Enable the double-precision reciprocal square root approximation instructions.
32220 @end table
32222 So, for example, @option{-mrecip=all,!rsqrtd} enables
32223 all of the reciprocal estimate instructions, except for the
32224 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
32225 which handle the double-precision reciprocal square root calculations.
32227 @opindex mrecip-precision
32228 @item -mrecip-precision
32229 @itemx -mno-recip-precision
32230 Assume (do not assume) that the reciprocal estimate instructions
32231 provide higher-precision estimates than is mandated by the PowerPC
32232 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
32233 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
32234 The double-precision square root estimate instructions are not generated by
32235 default on low-precision machines, since they do not provide an
32236 estimate that converges after three steps.
32238 @opindex mveclibabi
32239 @item -mveclibabi=@var{type}
32240 Specifies the ABI type to use for vectorizing intrinsics using an
32241 external library.  The only type supported at present is @samp{mass},
32242 which specifies to use IBM's Mathematical Acceleration Subsystem
32243 (MASS) libraries for vectorizing intrinsics using external libraries.
32244 GCC currently emits calls to @code{acosd2}, @code{acosf4},
32245 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
32246 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
32247 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
32248 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
32249 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
32250 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
32251 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
32252 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
32253 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
32254 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
32255 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
32256 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
32257 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
32258 for power7.  Both @option{-ftree-vectorize} and
32259 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
32260 libraries must be specified at link time.
32262 @opindex mfriz
32263 @item -mfriz
32264 @itemx -mno-friz
32265 Generate (do not generate) the @code{friz} instruction when the
32266 @option{-funsafe-math-optimizations} option is used to optimize
32267 rounding of floating-point values to 64-bit integer and back to floating
32268 point.  The @code{friz} instruction does not return the same value if
32269 the floating-point number is too large to fit in an integer.
32271 @opindex mpointers-to-nested-functions
32272 @item -mpointers-to-nested-functions
32273 @itemx -mno-pointers-to-nested-functions
32274 Generate (do not generate) code to load up the static chain register
32275 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
32276 systems where a function pointer points to a 3-word descriptor giving
32277 the function address, TOC value to be loaded in register @code{r2}, and
32278 static chain value to be loaded in register @code{r11}.  The
32279 @option{-mpointers-to-nested-functions} is on by default.  You cannot
32280 call through pointers to nested functions or pointers
32281 to functions compiled in other languages that use the static chain if
32282 you use @option{-mno-pointers-to-nested-functions}.
32284 @opindex msave-toc-indirect
32285 @item -msave-toc-indirect
32286 @itemx -mno-save-toc-indirect
32287 Generate (do not generate) code to save the TOC value in the reserved
32288 stack location in the function prologue if the function calls through
32289 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
32290 saved in the prologue, it is saved just before the call through the
32291 pointer.  The @option{-mno-save-toc-indirect} option is the default.
32293 @opindex mcompat-align-parm
32294 @item -mcompat-align-parm
32295 @itemx -mno-compat-align-parm
32296 Generate (do not generate) code to pass structure parameters with a
32297 maximum alignment of 64 bits, for compatibility with older versions
32298 of GCC.
32300 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
32301 structure parameter on a 128-bit boundary when that structure contained
32302 a member requiring 128-bit alignment.  This is corrected in more
32303 recent versions of GCC.  This option may be used to generate code
32304 that is compatible with functions compiled with older versions of
32305 GCC.
32307 The @option{-mno-compat-align-parm} option is the default.
32309 @opindex mstack-protector-guard
32310 @opindex mstack-protector-guard-reg
32311 @opindex mstack-protector-guard-offset
32312 @opindex mstack-protector-guard-symbol
32313 @item -mstack-protector-guard=@var{guard}
32314 @itemx -mstack-protector-guard-reg=@var{reg}
32315 @itemx -mstack-protector-guard-offset=@var{offset}
32316 @itemx -mstack-protector-guard-symbol=@var{symbol}
32317 Generate stack protection code using canary at @var{guard}.  Supported
32318 locations are @samp{global} for global canary or @samp{tls} for per-thread
32319 canary in the TLS block (the default with GNU libc version 2.4 or later).
32321 With the latter choice the options
32322 @option{-mstack-protector-guard-reg=@var{reg}} and
32323 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32324 which register to use as base register for reading the canary, and from what
32325 offset from that base register. The default for those is as specified in the
32326 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
32327 the offset with a symbol reference to a canary in the TLS block.
32329 @opindex mpcrel
32330 @opindex mno-pcrel
32331 @item -mpcrel
32332 @itemx -mno-pcrel
32333 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
32334 option requires that the medium code model (@option{-mcmodel=medium})
32335 and prefixed addressing (@option{-mprefixed}) options are enabled.
32337 @opindex mprefixed
32338 @opindex mno-prefixed
32339 @item -mprefixed
32340 @itemx -mno-prefixed
32341 Generate (do not generate) addressing modes using prefixed load and
32342 store instructions.  The @option{-mprefixed} option requires that
32343 the option @option{-mcpu=power10} (or later) is enabled.
32345 @opindex mmma
32346 @opindex mno-mma
32347 @item -mmma
32348 @itemx -mno-mma
32349 Generate (do not generate) the MMA instructions.  The @option{-mma}
32350 option requires that the option @option{-mcpu=power10} (or later)
32351 is enabled.
32353 @opindex mrop-protect
32354 @opindex mno-rop-protect
32355 @item -mrop-protect
32356 @itemx -mno-rop-protect
32357 Generate (do not generate) ROP protection instructions when the target
32358 processor supports them.  Currently this option disables the shrink-wrap
32359 optimization (@option{-fshrink-wrap}).
32361 @opindex mprivileged
32362 @opindex mno-privileged
32363 @item -mprivileged
32364 @itemx -mno-privileged
32365 Generate (do not generate) code that will run in privileged state.
32367 @opindex block-ops-unaligned-vsx
32368 @opindex no-block-ops-unaligned-vsx
32369 @item -mblock-ops-unaligned-vsx
32370 @itemx -mno-block-ops-unaligned-vsx
32371 Generate (do not generate) unaligned vsx loads and stores for
32372 inline expansion of @code{memcpy} and @code{memmove}.
32374 @item --param rs6000-vect-unroll-limit=
32375 The vectorizer will check with target information to determine whether it
32376 would be beneficial to unroll the main vectorized loop and by how much.  This
32377 parameter sets the upper bound of how much the vectorizer will unroll the main
32378 loop.  The default value is four.
32380 @end table
32382 @node RX Options
32383 @subsection RX Options
32384 @cindex RX Options
32386 These command-line options are defined for RX targets:
32388 @table @gcctabopt
32389 @opindex m64bit-doubles
32390 @opindex m32bit-doubles
32391 @item -m64bit-doubles
32392 @itemx -m32bit-doubles
32393 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
32394 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
32395 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
32396 works on 32-bit values, which is why the default is
32397 @option{-m32bit-doubles}.
32399 @opindex fpu
32400 @opindex nofpu
32401 @item -fpu
32402 @itemx -nofpu
32403 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
32404 floating-point hardware.  The default is enabled for the RX600
32405 series and disabled for the RX200 series.
32407 Floating-point instructions are only generated for 32-bit floating-point 
32408 values, however, so the FPU hardware is not used for doubles if the
32409 @option{-m64bit-doubles} option is used.
32411 @emph{Note} If the @option{-fpu} option is enabled then
32412 @option{-funsafe-math-optimizations} is also enabled automatically.
32413 This is because the RX FPU instructions are themselves unsafe.
32415 @opindex mcpu
32416 @item -mcpu=@var{name}
32417 Selects the type of RX CPU to be targeted.  Currently three types are
32418 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
32419 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
32421 The only difference between @samp{RX600} and @samp{RX610} is that the
32422 @samp{RX610} does not support the @code{MVTIPL} instruction.
32424 The @samp{RX200} series does not have a hardware floating-point unit
32425 and so @option{-nofpu} is enabled by default when this type is
32426 selected.
32428 @opindex mbig-endian-data
32429 @opindex mlittle-endian-data
32430 @item -mbig-endian-data
32431 @itemx -mlittle-endian-data
32432 Store data (but not code) in the big-endian format.  The default is
32433 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
32434 format.
32436 @opindex msmall-data-limit
32437 @item -msmall-data-limit=@var{N}
32438 Specifies the maximum size in bytes of global and static variables
32439 which can be placed into the small data area.  Using the small data
32440 area can lead to smaller and faster code, but the size of area is
32441 limited and it is up to the programmer to ensure that the area does
32442 not overflow.  Also when the small data area is used one of the RX's
32443 registers (usually @code{r13}) is reserved for use pointing to this
32444 area, so it is no longer available for use by the compiler.  This
32445 could result in slower and/or larger code if variables are pushed onto
32446 the stack instead of being held in this register.
32448 Note, common variables (variables that have not been initialized) and
32449 constants are not placed into the small data area as they are assigned
32450 to other sections in the output executable.
32452 The default value is zero, which disables this feature.  Note, this
32453 feature is not enabled by default with higher optimization levels
32454 (@option{-O2} etc) because of the potentially detrimental effects of
32455 reserving a register.  It is up to the programmer to experiment and
32456 discover whether this feature is of benefit to their program.  See the
32457 description of the @option{-mpid} option for a description of how the
32458 actual register to hold the small data area pointer is chosen.
32460 @opindex msim
32461 @opindex mno-sim
32462 @item -msim
32463 @itemx -mno-sim
32464 Use the simulator runtime.  The default is to use the libgloss
32465 board-specific runtime.
32467 @opindex mas100-syntax
32468 @opindex mno-as100-syntax
32469 @item -mas100-syntax
32470 @itemx -mno-as100-syntax
32471 When generating assembler output use a syntax that is compatible with
32472 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
32473 assembler, but it has some restrictions so it is not generated by default.
32475 @opindex mmax-constant-size
32476 @item -mmax-constant-size=@var{N}
32477 Specifies the maximum size, in bytes, of a constant that can be used as
32478 an operand in a RX instruction.  Although the RX instruction set does
32479 allow constants of up to 4 bytes in length to be used in instructions,
32480 a longer value equates to a longer instruction.  Thus in some
32481 circumstances it can be beneficial to restrict the size of constants
32482 that are used in instructions.  Constants that are too big are instead
32483 placed into a constant pool and referenced via register indirection.
32485 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
32486 or 4 means that constants of any size are allowed.
32488 @opindex mrelax
32489 @item -mrelax
32490 Enable linker relaxation.  Linker relaxation is a process whereby the
32491 linker attempts to reduce the size of a program by finding shorter
32492 versions of various instructions.  Disabled by default.
32494 @opindex mint-register
32495 @item -mint-register=@var{N}
32496 Specify the number of registers to reserve for fast interrupt handler
32497 functions.  The value @var{N} can be between 0 and 4.  A value of 1
32498 means that register @code{r13} is reserved for the exclusive use
32499 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
32500 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
32501 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
32502 A value of 0, the default, does not reserve any registers.
32504 @opindex msave-acc-in-interrupts
32505 @item -msave-acc-in-interrupts
32506 Specifies that interrupt handler functions should preserve the
32507 accumulator register.  This is only necessary if normal code might use
32508 the accumulator register, for example because it performs 64-bit
32509 multiplications.  The default is to ignore the accumulator as this
32510 makes the interrupt handlers faster.
32512 @opindex mpid
32513 @opindex mno-pid
32514 @item -mpid
32515 @itemx -mno-pid
32516 Enables the generation of position independent data.  When enabled any
32517 access to constant data is done via an offset from a base address
32518 held in a register.  This allows the location of constant data to be
32519 determined at run time without requiring the executable to be
32520 relocated, which is a benefit to embedded applications with tight
32521 memory constraints.  Data that can be modified is not affected by this
32522 option.
32524 Note, using this feature reserves a register, usually @code{r13}, for
32525 the constant data base address.  This can result in slower and/or
32526 larger code, especially in complicated functions.
32528 The actual register chosen to hold the constant data base address
32529 depends upon whether the @option{-msmall-data-limit} and/or the
32530 @option{-mint-register} command-line options are enabled.  Starting
32531 with register @code{r13} and proceeding downwards, registers are
32532 allocated first to satisfy the requirements of @option{-mint-register},
32533 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
32534 is possible for the small data area register to be @code{r8} if both
32535 @option{-mint-register=4} and @option{-mpid} are specified on the
32536 command line.
32538 By default this feature is not enabled.  The default can be restored
32539 via the @option{-mno-pid} command-line option.
32541 @opindex mno-warn-multiple-fast-interrupts
32542 @opindex mwarn-multiple-fast-interrupts
32543 @item -mno-warn-multiple-fast-interrupts
32544 @itemx -mwarn-multiple-fast-interrupts
32545 Prevents GCC from issuing a warning message if it finds more than one
32546 fast interrupt handler when it is compiling a file.  The default is to
32547 issue a warning for each extra fast interrupt handler found, as the RX
32548 only supports one such interrupt.
32550 @opindex mallow-string-insns
32551 @opindex mno-allow-string-insns
32552 @item -mallow-string-insns
32553 @itemx -mno-allow-string-insns
32554 Enables or disables the use of the string manipulation instructions
32555 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
32556 @code{SWHILE} and also the @code{RMPA} instruction.  These
32557 instructions may prefetch data, which is not safe to do if accessing
32558 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
32559 for more information).
32561 The default is to allow these instructions, but it is not possible for
32562 GCC to reliably detect all circumstances where a string instruction
32563 might be used to access an I/O register, so their use cannot be
32564 disabled automatically.  Instead it is reliant upon the programmer to
32565 use the @option{-mno-allow-string-insns} option if their program
32566 accesses I/O space.
32568 When the instructions are enabled GCC defines the C preprocessor
32569 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
32570 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
32572 @opindex mjsr
32573 @opindex mno-jsr
32574 @item -mjsr
32575 @itemx -mno-jsr
32576 Use only (or not only) @code{JSR} instructions to access functions.
32577 This option can be used when code size exceeds the range of @code{BSR}
32578 instructions.  Note that @option{-mno-jsr} does not mean to not use
32579 @code{JSR} but instead means that any type of branch may be used.
32580 @end table
32582 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
32583 has special significance to the RX port when used with the
32584 @code{interrupt} function attribute.  This attribute indicates a
32585 function intended to process fast interrupts.  GCC ensures
32586 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
32587 and/or @code{r13} and only provided that the normal use of the
32588 corresponding registers have been restricted via the
32589 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
32590 options.
32592 @node S/390 and zSeries Options
32593 @subsection S/390 and zSeries Options
32594 @cindex S/390 and zSeries Options
32596 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
32598 @table @gcctabopt
32599 @opindex mhard-float
32600 @opindex msoft-float
32601 @item -mhard-float
32602 @itemx -msoft-float
32603 Use (do not use) the hardware floating-point instructions and registers
32604 for floating-point operations.  When @option{-msoft-float} is specified,
32605 functions in @file{libgcc.a} are used to perform floating-point
32606 operations.  When @option{-mhard-float} is specified, the compiler
32607 generates IEEE floating-point instructions.  This is the default.
32609 @opindex mhard-dfp
32610 @opindex mno-hard-dfp
32611 @item -mhard-dfp
32612 @itemx -mno-hard-dfp
32613 Use (do not use) the hardware decimal-floating-point instructions for
32614 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
32615 specified, functions in @file{libgcc.a} are used to perform
32616 decimal-floating-point operations.  When @option{-mhard-dfp} is
32617 specified, the compiler generates decimal-floating-point hardware
32618 instructions.  This is the default for @option{-march=z9-ec} or higher.
32620 @opindex mlong-double-64
32621 @opindex mlong-double-128
32622 @item -mlong-double-64
32623 @itemx -mlong-double-128
32624 These switches control the size of @code{long double} type. A size
32625 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32626 type. This is the default.
32628 @opindex mbackchain
32629 @opindex mno-backchain
32630 @item -mbackchain
32631 @itemx -mno-backchain
32632 Store (do not store) the address of the caller's frame as backchain pointer
32633 into the callee's stack frame.
32634 A backchain may be needed to allow debugging using tools that do not understand
32635 DWARF call frame information.
32636 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
32637 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
32638 the backchain is placed into the topmost word of the 96/160 byte register
32639 save area.
32641 In general, code compiled with @option{-mbackchain} is call-compatible with
32642 code compiled with @option{-mno-backchain}; however, use of the backchain
32643 for debugging purposes usually requires that the whole binary is built with
32644 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
32645 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
32646 to build a linux kernel use @option{-msoft-float}.
32648 The default is to not maintain the backchain.
32650 @opindex mpacked-stack
32651 @opindex mno-packed-stack
32652 @item -mpacked-stack
32653 @itemx -mno-packed-stack
32654 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
32655 specified, the compiler uses the all fields of the 96/160 byte register save
32656 area only for their default purpose; unused fields still take up stack space.
32657 When @option{-mpacked-stack} is specified, register save slots are densely
32658 packed at the top of the register save area; unused space is reused for other
32659 purposes, allowing for more efficient use of the available stack space.
32660 However, when @option{-mbackchain} is also in effect, the topmost word of
32661 the save area is always used to store the backchain, and the return address
32662 register is always saved two words below the backchain.
32664 As long as the stack frame backchain is not used, code generated with
32665 @option{-mpacked-stack} is call-compatible with code generated with
32666 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
32667 S/390 or zSeries generated code that uses the stack frame backchain at run
32668 time, not just for debugging purposes.  Such code is not call-compatible
32669 with code compiled with @option{-mpacked-stack}.  Also, note that the
32670 combination of @option{-mbackchain},
32671 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
32672 to build a linux kernel use @option{-msoft-float}.
32674 The default is to not use the packed stack layout.
32676 @opindex msmall-exec
32677 @opindex mno-small-exec
32678 @item -msmall-exec
32679 @itemx -mno-small-exec
32680 Generate (or do not generate) code using the @code{bras} instruction
32681 to do subroutine calls.
32682 This only works reliably if the total executable size does not
32683 exceed 64k.  The default is to use the @code{basr} instruction instead,
32684 which does not have this limitation.
32686 @opindex m64
32687 @opindex m31
32688 @item -m64
32689 @itemx -m31
32690 When @option{-m31} is specified, generate code compliant to the
32691 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
32692 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
32693 particular to generate 64-bit instructions.  For the @samp{s390}
32694 targets, the default is @option{-m31}, while the @samp{s390x}
32695 targets default to @option{-m64}.
32697 @opindex mzarch
32698 @opindex mesa
32699 @item -mzarch
32700 @itemx -mesa
32701 When @option{-mzarch} is specified, generate code using the
32702 instructions available on z/Architecture.
32703 When @option{-mesa} is specified, generate code using the
32704 instructions available on ESA/390.  Note that @option{-mesa} is
32705 not possible with @option{-m64}.
32706 When generating code compliant to the GNU/Linux for S/390 ABI,
32707 the default is @option{-mesa}.  When generating code compliant
32708 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
32710 @opindex mhtm
32711 @opindex mno-htm
32712 @item -mhtm
32713 @itemx -mno-htm
32714 The @option{-mhtm} option enables a set of builtins making use of
32715 instructions available with the transactional execution facility
32716 introduced with the IBM zEnterprise EC12 machine generation
32717 @ref{S/390 System z Built-in Functions}.
32718 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
32720 @opindex mvx
32721 @opindex mno-vx
32722 @item -mvx
32723 @itemx -mno-vx
32724 When @option{-mvx} is specified, generate code using the instructions
32725 available with the vector extension facility introduced with the IBM
32726 z13 machine generation.
32727 This option changes the ABI for some vector type values with regard to
32728 alignment and calling conventions.  In case vector type values are
32729 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
32730 command will be added to mark the resulting binary with the ABI used.
32731 @option{-mvx} is enabled by default when using @option{-march=z13}.
32733 @opindex mzvector
32734 @opindex mno-zvector
32735 @item -mzvector
32736 @itemx -mno-zvector
32737 The @option{-mzvector} option enables vector language extensions and
32738 builtins using instructions available with the vector extension
32739 facility introduced with the IBM z13 machine generation.
32740 This option adds support for @samp{vector} to be used as a keyword to
32741 define vector type variables and arguments.  @samp{vector} is only
32742 available when GNU extensions are enabled.  It will not be expanded
32743 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
32744 In addition to the GCC low-level builtins @option{-mzvector} enables
32745 a set of builtins added for compatibility with AltiVec-style
32746 implementations like Power and Cell.  In order to make use of these
32747 builtins the header file @file{vecintrin.h} needs to be included.
32748 @option{-mzvector} is disabled by default.
32750 @opindex mmvcle
32751 @opindex mno-mvcle
32752 @item -mmvcle
32753 @itemx -mno-mvcle
32754 Generate (or do not generate) code using the @code{mvcle} instruction
32755 to perform block moves.  When @option{-mno-mvcle} is specified,
32756 use a @code{mvc} loop instead.  This is the default unless optimizing for
32757 size.
32759 @opindex mdebug
32760 @opindex mno-debug
32761 @item -mdebug
32762 @itemx -mno-debug
32763 Print (or do not print) additional debug information when compiling.
32764 The default is to not print debug information.
32766 @opindex march
32767 @item -march=@var{cpu-type}
32768 Generate code that runs on @var{cpu-type}, which is the name of a
32769 system representing a certain processor type.  Possible values for
32770 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
32771 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
32772 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
32773 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
32774 @samp{z16}/@samp{arch14}, and @samp{native}.
32776 The default is @option{-march=z900}.
32778 Specifying @samp{native} as cpu type can be used to select the best
32779 architecture option for the host processor.
32780 @option{-march=native} has no effect if GCC does not recognize the
32781 processor.
32783 @opindex mtune
32784 @item -mtune=@var{cpu-type}
32785 Tune to @var{cpu-type} everything applicable about the generated code,
32786 except for the ABI and the set of available instructions.
32787 The list of @var{cpu-type} values is the same as for @option{-march}.
32788 The default is the value used for @option{-march}.
32790 @opindex mtpf-trace
32791 @opindex mno-tpf-trace
32792 @item -mtpf-trace
32793 @itemx -mno-tpf-trace
32794 Generate code that adds (does not add) in TPF OS specific branches to trace
32795 routines in the operating system.  This option is off by default, even
32796 when compiling for the TPF OS@.
32798 @opindex mtpf-trace-skip
32799 @opindex mno-tpf-trace-skip
32800 @item -mtpf-trace-skip
32801 @itemx -mno-tpf-trace-skip
32802 Generate code that changes (does not change) the default branch
32803 targets enabled by @option{-mtpf-trace} to point to specialized trace
32804 routines providing the ability of selectively skipping function trace
32805 entries for the TPF OS.  This option is off by default, even when
32806 compiling for the TPF OS and specifying @option{-mtpf-trace}.
32808 @opindex mfused-madd
32809 @opindex mno-fused-madd
32810 @item -mfused-madd
32811 @itemx -mno-fused-madd
32812 Generate code that uses (does not use) the floating-point multiply and
32813 accumulate instructions.  These instructions are generated by default if
32814 hardware floating point is used.
32816 @opindex mwarn-framesize
32817 @item -mwarn-framesize=@var{framesize}
32818 Emit a warning if the current function exceeds the given frame size.  Because
32819 this is a compile-time check it doesn't need to be a real problem when the program
32820 runs.  It is intended to identify functions that most probably cause
32821 a stack overflow.  It is useful to be used in an environment with limited stack
32822 size e.g.@: the linux kernel.
32824 @opindex mwarn-dynamicstack
32825 @item -mwarn-dynamicstack
32826 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
32827 arrays.  This is generally a bad idea with a limited stack size.
32829 @opindex mstack-guard
32830 @opindex mstack-size
32831 @item -mstack-guard=@var{stack-guard}
32832 @itemx -mstack-size=@var{stack-size}
32833 If these options are provided the S/390 back end emits additional instructions in
32834 the function prologue that trigger a trap if the stack size is @var{stack-guard}
32835 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
32836 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
32837 the frame size of the compiled function is chosen.
32838 These options are intended to be used to help debugging stack overflow problems.
32839 The additionally emitted code causes only little overhead and hence can also be
32840 used in production-like systems without greater performance degradation.  The given
32841 values have to be exact powers of 2 and @var{stack-size} has to be greater than
32842 @var{stack-guard} without exceeding 64k.
32843 In order to be efficient the extra code makes the assumption that the stack starts
32844 at an address aligned to the value given by @var{stack-size}.
32845 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
32847 @opindex mhotpatch
32848 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
32849 If the hotpatch option is enabled, a ``hot-patching'' function
32850 prologue is generated for all functions in the compilation unit.
32851 The funtion label is prepended with the given number of two-byte
32852 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
32853 the label, 2 * @var{post-halfwords} bytes are appended, using the
32854 largest NOP like instructions the architecture allows (maximum
32855 1000000).
32857 If both arguments are zero, hotpatching is disabled.
32859 This option can be overridden for individual functions with the
32860 @code{hotpatch} attribute.
32861 @end table
32863 @node SH Options
32864 @subsection SH Options
32866 These @samp{-m} options are defined for the SH implementations:
32868 @table @gcctabopt
32869 @opindex m1
32870 @item -m1
32871 Generate code for the SH1.
32873 @opindex m2
32874 @item -m2
32875 Generate code for the SH2.
32877 @item -m2e
32878 Generate code for the SH2e.
32880 @opindex m2a-nofpu
32881 @item -m2a-nofpu
32882 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
32883 that the floating-point unit is not used.
32885 @opindex m2a-single-only
32886 @item -m2a-single-only
32887 Generate code for the SH2a-FPU, in such a way that no double-precision
32888 floating-point operations are used.
32890 @opindex m2a-single
32891 @item -m2a-single
32892 Generate code for the SH2a-FPU assuming the floating-point unit is in
32893 single-precision mode by default.
32895 @opindex m2a
32896 @item -m2a
32897 Generate code for the SH2a-FPU assuming the floating-point unit is in
32898 double-precision mode by default.
32900 @opindex m3
32901 @item -m3
32902 Generate code for the SH3.
32904 @opindex m3e
32905 @item -m3e
32906 Generate code for the SH3e.
32908 @opindex m4-nofpu
32909 @item -m4-nofpu
32910 Generate code for the SH4 without a floating-point unit.
32912 @opindex m4-single-only
32913 @item -m4-single-only
32914 Generate code for the SH4 with a floating-point unit that only
32915 supports single-precision arithmetic.
32917 @opindex m4-single
32918 @item -m4-single
32919 Generate code for the SH4 assuming the floating-point unit is in
32920 single-precision mode by default.
32922 @opindex m4
32923 @item -m4
32924 Generate code for the SH4.
32926 @opindex m4-100
32927 @item -m4-100
32928 Generate code for SH4-100.
32930 @opindex m4-100-nofpu
32931 @item -m4-100-nofpu
32932 Generate code for SH4-100 in such a way that the
32933 floating-point unit is not used.
32935 @opindex m4-100-single
32936 @item -m4-100-single
32937 Generate code for SH4-100 assuming the floating-point unit is in
32938 single-precision mode by default.
32940 @opindex m4-100-single-only
32941 @item -m4-100-single-only
32942 Generate code for SH4-100 in such a way that no double-precision
32943 floating-point operations are used.
32945 @opindex m4-200
32946 @item -m4-200
32947 Generate code for SH4-200.
32949 @opindex m4-200-nofpu
32950 @item -m4-200-nofpu
32951 Generate code for SH4-200 without in such a way that the
32952 floating-point unit is not used.
32954 @opindex m4-200-single
32955 @item -m4-200-single
32956 Generate code for SH4-200 assuming the floating-point unit is in
32957 single-precision mode by default.
32959 @opindex m4-200-single-only
32960 @item -m4-200-single-only
32961 Generate code for SH4-200 in such a way that no double-precision
32962 floating-point operations are used.
32964 @opindex m4-300
32965 @item -m4-300
32966 Generate code for SH4-300.
32968 @opindex m4-300-nofpu
32969 @item -m4-300-nofpu
32970 Generate code for SH4-300 without in such a way that the
32971 floating-point unit is not used.
32973 @opindex m4-300-single
32974 @item -m4-300-single
32975 Generate code for SH4-300 in such a way that no double-precision
32976 floating-point operations are used.
32978 @opindex m4-300-single-only
32979 @item -m4-300-single-only
32980 Generate code for SH4-300 in such a way that no double-precision
32981 floating-point operations are used.
32983 @opindex m4-340
32984 @item -m4-340
32985 Generate code for SH4-340 (no MMU, no FPU).
32987 @opindex m4-500
32988 @item -m4-500
32989 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
32990 assembler.
32992 @opindex m4a-nofpu
32993 @item -m4a-nofpu
32994 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
32995 floating-point unit is not used.
32997 @opindex m4a-single-only
32998 @item -m4a-single-only
32999 Generate code for the SH4a, in such a way that no double-precision
33000 floating-point operations are used.
33002 @opindex m4a-single
33003 @item -m4a-single
33004 Generate code for the SH4a assuming the floating-point unit is in
33005 single-precision mode by default.
33007 @opindex m4a
33008 @item -m4a
33009 Generate code for the SH4a.
33011 @opindex m4al
33012 @item -m4al
33013 Same as @option{-m4a-nofpu}, except that it implicitly passes
33014 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
33015 instructions at the moment.
33017 @opindex mb
33018 @item -mb
33019 Compile code for the processor in big-endian mode.
33021 @opindex ml
33022 @item -ml
33023 Compile code for the processor in little-endian mode.
33025 @opindex mdalign
33026 @item -mdalign
33027 Align doubles at 64-bit boundaries.  Note that this changes the calling
33028 conventions, and thus some functions from the standard C library do
33029 not work unless you recompile it first with @option{-mdalign}.
33031 @opindex mrelax
33032 @item -mrelax
33033 Shorten some address references at link time, when possible; uses the
33034 linker option @option{-relax}.
33036 @opindex mbigtable
33037 @item -mbigtable
33038 Use 32-bit offsets in @code{switch} tables.  The default is to use
33039 16-bit offsets.
33041 @opindex mbitops
33042 @item -mbitops
33043 Enable the use of bit manipulation instructions on SH2A.
33045 @opindex mfmovd
33046 @item -mfmovd
33047 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
33048 alignment constraints.
33050 @opindex mrenesas
33051 @item -mrenesas
33052 Comply with the calling conventions defined by Renesas.
33054 @opindex mno-renesas
33055 @item -mno-renesas
33056 Comply with the calling conventions defined for GCC before the Renesas
33057 conventions were available.  This option is the default for all
33058 targets of the SH toolchain.
33060 @opindex mnomacsave
33061 @item -mnomacsave
33062 Mark the @code{MAC} register as call-clobbered, even if
33063 @option{-mrenesas} is given.
33065 @opindex mieee
33066 @opindex mno-ieee
33067 @item -mieee
33068 @itemx -mno-ieee
33069 Control the IEEE compliance of floating-point comparisons, which affects the
33070 handling of cases where the result of a comparison is unordered.  By default
33071 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
33072 enabled @option{-mno-ieee} is implicitly set, which results in faster
33073 floating-point greater-equal and less-equal comparisons.  The implicit settings
33074 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
33076 @opindex minline-ic_invalidate
33077 @item -minline-ic_invalidate
33078 Inline code to invalidate instruction cache entries after setting up
33079 nested function trampolines.
33080 This option has no effect if @option{-musermode} is in effect and the selected
33081 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
33082 instruction.
33083 If the selected code generation option does not allow the use of the @code{icbi}
33084 instruction, and @option{-musermode} is not in effect, the inlined code
33085 manipulates the instruction cache address array directly with an associative
33086 write.  This not only requires privileged mode at run time, but it also
33087 fails if the cache line had been mapped via the TLB and has become unmapped.
33089 @opindex misize
33090 @item -misize
33091 Dump instruction size and location in the assembly code.
33093 @opindex mpadstruct
33094 @item -mpadstruct
33095 This option is deprecated.  It pads structures to multiple of 4 bytes,
33096 which is incompatible with the SH ABI@.
33098 @opindex matomic-model=@var{model}
33099 @item -matomic-model=@var{model}
33100 Sets the model of atomic operations and additional parameters as a comma
33101 separated list.  For details on the atomic built-in functions see
33102 @ref{__atomic Builtins}.  The following models and parameters are supported:
33104 @table @samp
33106 @item none
33107 Disable compiler generated atomic sequences and emit library calls for atomic
33108 operations.  This is the default if the target is not @code{sh*-*-linux*}.
33110 @item soft-gusa
33111 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
33112 built-in functions.  The generated atomic sequences require additional support
33113 from the interrupt/exception handling code of the system and are only suitable
33114 for SH3* and SH4* single-core systems.  This option is enabled by default when
33115 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
33116 this option also partially utilizes the hardware atomic instructions
33117 @code{movli.l} and @code{movco.l} to create more efficient code, unless
33118 @samp{strict} is specified.  
33120 @item soft-tcb
33121 Generate software atomic sequences that use a variable in the thread control
33122 block.  This is a variation of the gUSA sequences which can also be used on
33123 SH1* and SH2* targets.  The generated atomic sequences require additional
33124 support from the interrupt/exception handling code of the system and are only
33125 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
33126 parameter has to be specified as well.
33128 @item soft-imask
33129 Generate software atomic sequences that temporarily disable interrupts by
33130 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
33131 in privileged mode and is only suitable for single-core systems.  Additional
33132 support from the interrupt/exception handling code of the system is not
33133 required.  This model is enabled by default when the target is
33134 @code{sh*-*-linux*} and SH1* or SH2*.
33136 @item hard-llcs
33137 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
33138 instructions only.  This is only available on SH4A and is suitable for
33139 multi-core systems.  Since the hardware instructions support only 32 bit atomic
33140 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
33141 Code compiled with this option is also compatible with other software
33142 atomic model interrupt/exception handling systems if executed on an SH4A
33143 system.  Additional support from the interrupt/exception handling code of the
33144 system is not required for this model.
33146 @item gbr-offset=
33147 This parameter specifies the offset in bytes of the variable in the thread
33148 control block structure that should be used by the generated atomic sequences
33149 when the @samp{soft-tcb} model has been selected.  For other models this
33150 parameter is ignored.  The specified value must be an integer multiple of four
33151 and in the range 0-1020.
33153 @item strict
33154 This parameter prevents mixed usage of multiple atomic models, even if they
33155 are compatible, and makes the compiler generate atomic sequences of the
33156 specified model only.
33158 @end table
33160 @opindex mtas
33161 @item -mtas
33162 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
33163 Notice that depending on the particular hardware and software configuration
33164 this can degrade overall performance due to the operand cache line flushes
33165 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
33166 processors the @code{tas.b} instruction must be used with caution since it
33167 can result in data corruption for certain cache configurations.
33169 @opindex mprefergot
33170 @item -mprefergot
33171 When generating position-independent code, emit function calls using
33172 the Global Offset Table instead of the Procedure Linkage Table.
33174 @opindex musermode
33175 @opindex mno-usermode
33176 @item -musermode
33177 @itemx -mno-usermode
33178 Don't allow (allow) the compiler generating privileged mode code.  Specifying
33179 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
33180 inlined code would not work in user mode.  @option{-musermode} is the default
33181 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
33182 @option{-musermode} has no effect, since there is no user mode.
33184 @opindex multcost=@var{number}
33185 @item -multcost=@var{number}
33186 Set the cost to assume for a multiply insn.
33188 @opindex mdiv=@var{strategy}
33189 @item -mdiv=@var{strategy}
33190 Set the division strategy to be used for integer division operations.
33191 @var{strategy} can be one of: 
33193 @table @samp
33195 @item call-div1
33196 Calls a library function that uses the single-step division instruction
33197 @code{div1} to perform the operation.  Division by zero calculates an
33198 unspecified result and does not trap.  This is the default except for SH4,
33199 SH2A and SHcompact.
33201 @item call-fp
33202 Calls a library function that performs the operation in double precision
33203 floating point.  Division by zero causes a floating-point exception.  This is
33204 the default for SHcompact with FPU.  Specifying this for targets that do not
33205 have a double precision FPU defaults to @code{call-div1}.
33207 @item call-table
33208 Calls a library function that uses a lookup table for small divisors and
33209 the @code{div1} instruction with case distinction for larger divisors.  Division
33210 by zero calculates an unspecified result and does not trap.  This is the default
33211 for SH4.  Specifying this for targets that do not have dynamic shift
33212 instructions defaults to @code{call-div1}.
33214 @end table
33216 When a division strategy has not been specified the default strategy is
33217 selected based on the current target.  For SH2A the default strategy is to
33218 use the @code{divs} and @code{divu} instructions instead of library function
33219 calls.
33221 @opindex maccumulate-outgoing-args
33222 @item -maccumulate-outgoing-args
33223 Reserve space once for outgoing arguments in the function prologue rather
33224 than around each call.  Generally beneficial for performance and size.  Also
33225 needed for unwinding to avoid changing the stack frame around conditional code.
33227 @opindex mdivsi3_libfunc=@var{name}
33228 @item -mdivsi3_libfunc=@var{name}
33229 Set the name of the library function used for 32-bit signed division to
33230 @var{name}.
33231 This only affects the name used in the @samp{call} division strategies, and
33232 the compiler still expects the same sets of input/output/clobbered registers as
33233 if this option were not present.
33235 @opindex mfixed-range
33236 @item -mfixed-range=@var{register-range}
33237 Generate code treating the given register range as fixed registers.
33238 A fixed register is one that the register allocator cannot use.  This is
33239 useful when compiling kernel code.  A register range is specified as
33240 two registers separated by a dash.  Multiple register ranges can be
33241 specified separated by a comma.
33243 @opindex mbranch-cost=@var{num}
33244 @item -mbranch-cost=@var{num}
33245 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
33246 make the compiler try to generate more branch-free code if possible.  
33247 If not specified the value is selected depending on the processor type that
33248 is being compiled for.
33250 @opindex mzdcbranch
33251 @opindex mno-zdcbranch
33252 @item -mzdcbranch
33253 @itemx -mno-zdcbranch
33254 Assume (do not assume) that zero displacement conditional branch instructions
33255 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
33256 compiler prefers zero displacement branch code sequences.  This is
33257 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
33258 disabled by specifying @option{-mno-zdcbranch}.
33260 @opindex mcbranch-force-delay-slot
33261 @item -mcbranch-force-delay-slot
33262 Force the usage of delay slots for conditional branches, which stuffs the delay
33263 slot with a @code{nop} if a suitable instruction cannot be found.  By default
33264 this option is disabled.  It can be enabled to work around hardware bugs as
33265 found in the original SH7055.
33267 @opindex mfused-madd
33268 @opindex mno-fused-madd
33269 @item -mfused-madd
33270 @itemx -mno-fused-madd
33271 Generate code that uses (does not use) the floating-point multiply and
33272 accumulate instructions.  These instructions are generated by default
33273 if hardware floating point is used.  The machine-dependent
33274 @option{-mfused-madd} option is now mapped to the machine-independent
33275 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
33276 mapped to @option{-ffp-contract=off}.
33278 @opindex mfsca
33279 @opindex mno-fsca
33280 @item -mfsca
33281 @itemx -mno-fsca
33282 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
33283 and cosine approximations.  The option @option{-mfsca} must be used in
33284 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
33285 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
33286 approximations even if @option{-funsafe-math-optimizations} is in effect.
33288 @opindex mfsrra
33289 @opindex mno-fsrra
33290 @item -mfsrra
33291 @itemx -mno-fsrra
33292 Allow or disallow the compiler to emit the @code{fsrra} instruction for
33293 reciprocal square root approximations.  The option @option{-mfsrra} must be used
33294 in combination with @option{-funsafe-math-optimizations} and
33295 @option{-ffinite-math-only}.  It is enabled by default when generating code for
33296 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
33297 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
33298 in effect.
33300 @opindex mpretend-cmove
33301 @item -mpretend-cmove
33302 Prefer zero-displacement conditional branches for conditional move instruction
33303 patterns.  This can result in faster code on the SH4 processor.
33305 @opindex fdpic
33306 @item -mfdpic
33307 Generate code using the FDPIC ABI.
33309 @end table
33311 @node Solaris 2 Options
33312 @subsection Solaris 2 Options
33313 @cindex Solaris 2 options
33315 These @samp{-m} options are supported on Solaris 2:
33317 @table @gcctabopt
33318 @opindex mclear-hwcap
33319 @item -mclear-hwcap
33320 @option{-mclear-hwcap} tells the compiler to remove the hardware
33321 capabilities generated by the Solaris assembler.  This is only necessary
33322 when object files use ISA extensions not supported by the current
33323 machine, but check at runtime whether or not to use them.
33325 @opindex mimpure-text
33326 @item -mimpure-text
33327 @option{-mimpure-text}, used in addition to @option{-shared}, tells
33328 the compiler to not pass @option{-z text} to the linker when linking a
33329 shared object.  Using this option, you can link position-dependent
33330 code into a shared object.
33332 @option{-mimpure-text} suppresses the ``relocations remain against
33333 allocatable but non-writable sections'' linker error message.
33334 However, the necessary relocations trigger copy-on-write, and the
33335 shared object is not actually shared across processes.  Instead of
33336 using @option{-mimpure-text}, you should compile all source code with
33337 @option{-fpic} or @option{-fPIC}.
33339 @end table
33341 These switches are supported in addition to the above on Solaris 2:
33343 @table @gcctabopt
33344 @opindex pthreads
33345 @item -pthreads
33346 This is a synonym for @option{-pthread}.
33347 @end table
33349 @node SPARC Options
33350 @subsection SPARC Options
33351 @cindex SPARC options
33353 These @samp{-m} options are supported on the SPARC:
33355 @table @gcctabopt
33356 @opindex mno-app-regs
33357 @opindex mapp-regs
33358 @item -mno-app-regs
33359 @itemx -mapp-regs
33360 Specify @option{-mapp-regs} to generate output using the global registers
33361 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
33362 global register 1, each global register 2 through 4 is then treated as an
33363 allocable register that is clobbered by function calls.  This is the default.
33365 To be fully SVR4 ABI-compliant at the cost of some performance loss,
33366 specify @option{-mno-app-regs}.  You should compile libraries and system
33367 software with this option.
33369 @opindex mflat
33370 @opindex mno-flat
33371 @item -mflat
33372 @itemx -mno-flat
33373 With @option{-mflat}, the compiler does not generate save/restore instructions
33374 and uses a ``flat'' or single register window model.  This model is compatible
33375 with the regular register window model.  The local registers and the input
33376 registers (0--5) are still treated as ``call-saved'' registers and are
33377 saved on the stack as needed.
33379 With @option{-mno-flat} (the default), the compiler generates save/restore
33380 instructions (except for leaf functions).  This is the normal operating mode.
33382 @opindex mfpu
33383 @opindex mhard-float
33384 @item -mfpu
33385 @itemx -mhard-float
33386 Generate output containing floating-point instructions.  This is the
33387 default.
33389 @opindex mno-fpu
33390 @opindex msoft-float
33391 @item -mno-fpu
33392 @itemx -msoft-float
33393 Generate output containing library calls for floating point.
33394 @strong{Warning:} the requisite libraries are not available for all SPARC
33395 targets.  Normally the facilities of the machine's usual C compiler are
33396 used, but this cannot be done directly in cross-compilation.  You must make
33397 your own arrangements to provide suitable library functions for
33398 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
33399 @samp{sparclite-*-*} do provide software floating-point support.
33401 @option{-msoft-float} changes the calling convention in the output file;
33402 therefore, it is only useful if you compile @emph{all} of a program with
33403 this option.  In particular, you need to compile @file{libgcc.a}, the
33404 library that comes with GCC, with @option{-msoft-float} in order for
33405 this to work.
33407 @opindex mhard-quad-float
33408 @item -mhard-quad-float
33409 Generate output containing quad-word (long double) floating-point
33410 instructions.
33412 @opindex msoft-quad-float
33413 @item -msoft-quad-float
33414 Generate output containing library calls for quad-word (long double)
33415 floating-point instructions.  The functions called are those specified
33416 in the SPARC ABI@.  This is the default.
33418 As of this writing, there are no SPARC implementations that have hardware
33419 support for the quad-word floating-point instructions.  They all invoke
33420 a trap handler for one of these instructions, and then the trap handler
33421 emulates the effect of the instruction.  Because of the trap handler overhead,
33422 this is much slower than calling the ABI library routines.  Thus the
33423 @option{-msoft-quad-float} option is the default.
33425 @opindex mno-unaligned-doubles
33426 @opindex munaligned-doubles
33427 @item -mno-unaligned-doubles
33428 @itemx -munaligned-doubles
33429 Assume that doubles have 8-byte alignment.  This is the default.
33431 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
33432 alignment only if they are contained in another type, or if they have an
33433 absolute address.  Otherwise, it assumes they have 4-byte alignment.
33434 Specifying this option avoids some rare compatibility problems with code
33435 generated by other compilers.  It is not the default because it results
33436 in a performance loss, especially for floating-point code.
33438 @opindex muser-mode
33439 @opindex mno-user-mode
33440 @item -muser-mode
33441 @itemx -mno-user-mode
33442 Do not generate code that can only run in supervisor mode.  This is relevant
33443 only for the @code{casa} instruction emitted for the LEON3 processor.  This
33444 is the default.
33446 @opindex mfaster-structs
33447 @opindex mno-faster-structs
33448 @item -mfaster-structs
33449 @itemx -mno-faster-structs
33450 With @option{-mfaster-structs}, the compiler assumes that structures
33451 should have 8-byte alignment.  This enables the use of pairs of
33452 @code{ldd} and @code{std} instructions for copies in structure
33453 assignment, in place of twice as many @code{ld} and @code{st} pairs.
33454 However, the use of this changed alignment directly violates the SPARC
33455 ABI@.  Thus, it's intended only for use on targets where the developer
33456 acknowledges that their resulting code is not directly in line with
33457 the rules of the ABI@.
33459 @opindex mstd-struct-return
33460 @opindex mno-std-struct-return
33461 @item -mstd-struct-return
33462 @itemx -mno-std-struct-return
33463 With @option{-mstd-struct-return}, the compiler generates checking code
33464 in functions returning structures or unions to detect size mismatches
33465 between the two sides of function calls, as per the 32-bit ABI@.
33467 The default is @option{-mno-std-struct-return}.  This option has no effect
33468 in 64-bit mode.
33470 @opindex mlra
33471 @opindex mno-lra
33472 @item -mlra
33473 @itemx -mno-lra
33474 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
33475 so @option{-mno-lra} needs to be passed to get old Reload.
33477 @opindex mcpu
33478 @item -mcpu=@var{cpu_type}
33479 Set the instruction set, register set, and instruction scheduling parameters
33480 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
33481 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
33482 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
33483 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
33484 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
33485 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
33486 @samp{m8}.
33488 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
33489 which selects the best architecture option for the host processor.
33490 @option{-mcpu=native} has no effect if GCC does not recognize
33491 the processor.
33493 Default instruction scheduling parameters are used for values that select
33494 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
33495 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
33497 Here is a list of each supported architecture and their supported
33498 implementations.
33500 @table @asis
33501 @item v7
33502 cypress, leon3v7
33504 @item v8
33505 supersparc, hypersparc, leon, leon3, leon5
33507 @item sparclite
33508 f930, f934, sparclite86x
33510 @item sparclet
33511 tsc701
33513 @item v9
33514 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
33515 niagara7, m8
33516 @end table
33518 By default (unless configured otherwise), GCC generates code for the V7
33519 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
33520 additionally optimizes it for the Cypress CY7C602 chip, as used in the
33521 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
33522 SPARCStation 1, 2, IPX etc.
33524 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
33525 architecture.  The only difference from V7 code is that the compiler emits
33526 the integer multiply and integer divide instructions which exist in SPARC-V8
33527 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
33528 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
33529 2000 series.
33531 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
33532 the SPARC architecture.  This adds the integer multiply, integer divide step
33533 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
33534 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
33535 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
33536 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
33537 MB86934 chip, which is the more recent SPARClite with FPU@.
33539 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
33540 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
33541 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
33542 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
33543 optimizes it for the TEMIC SPARClet chip.
33545 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
33546 architecture.  This adds 64-bit integer and floating-point move instructions,
33547 3 additional floating-point condition code registers and conditional move
33548 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
33549 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
33550 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
33551 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
33552 @option{-mcpu=niagara}, the compiler additionally optimizes it for
33553 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
33554 additionally optimizes it for Sun UltraSPARC T2 chips. With
33555 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
33556 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
33557 additionally optimizes it for Sun UltraSPARC T4 chips.  With
33558 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
33559 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
33560 additionally optimizes it for Oracle M8 chips.
33562 @opindex mtune
33563 @item -mtune=@var{cpu_type}
33564 Set the instruction scheduling parameters for machine type
33565 @var{cpu_type}, but do not set the instruction set or register set that the
33566 option @option{-mcpu=@var{cpu_type}} does.
33568 The same values for @option{-mcpu=@var{cpu_type}} can be used for
33569 @option{-mtune=@var{cpu_type}}, but the only useful values are those
33570 that select a particular CPU implementation.  Those are
33571 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
33572 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
33573 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
33574 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
33575 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
33576 and GNU/Linux toolchains, @samp{native} can also be used.
33578 @opindex mv8plus
33579 @opindex mno-v8plus
33580 @item -mv8plus
33581 @itemx -mno-v8plus
33582 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
33583 difference from the V8 ABI is that the global and out registers are
33584 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
33585 mode for all SPARC-V9 processors.
33587 @opindex mvis
33588 @opindex mno-vis
33589 @item -mvis
33590 @itemx -mno-vis
33591 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
33592 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
33594 @opindex mvis2
33595 @opindex mno-vis2
33596 @item -mvis2
33597 @itemx -mno-vis2
33598 With @option{-mvis2}, GCC generates code that takes advantage of
33599 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
33600 default is @option{-mvis2} when targeting a cpu that supports such
33601 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
33602 also sets @option{-mvis}.
33604 @opindex mvis3
33605 @opindex mno-vis3
33606 @item -mvis3
33607 @itemx -mno-vis3
33608 With @option{-mvis3}, GCC generates code that takes advantage of
33609 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
33610 default is @option{-mvis3} when targeting a cpu that supports such
33611 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
33612 also sets @option{-mvis2} and @option{-mvis}.
33614 @opindex mvis4
33615 @opindex mno-vis4
33616 @item -mvis4
33617 @itemx -mno-vis4
33618 With @option{-mvis4}, GCC generates code that takes advantage of
33619 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
33620 default is @option{-mvis4} when targeting a cpu that supports such
33621 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
33622 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
33624 @opindex mvis4b
33625 @opindex mno-vis4b
33626 @item -mvis4b
33627 @itemx -mno-vis4b
33628 With @option{-mvis4b}, GCC generates code that takes advantage of
33629 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
33630 the additional VIS instructions introduced in the Oracle SPARC
33631 Architecture 2017.  The default is @option{-mvis4b} when targeting a
33632 cpu that supports such instructions, such as m8 and later.  Setting
33633 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
33634 @option{-mvis2} and @option{-mvis}.
33636 @opindex mcbcond
33637 @opindex mno-cbcond
33638 @item -mcbcond
33639 @itemx -mno-cbcond
33640 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
33641 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
33642 when targeting a CPU that supports such instructions, such as Niagara-4 and
33643 later.
33645 @opindex mfmaf
33646 @opindex mno-fmaf
33647 @item -mfmaf
33648 @itemx -mno-fmaf
33649 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
33650 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
33651 when targeting a CPU that supports such instructions, such as Niagara-3 and
33652 later.
33654 @opindex mfsmuld
33655 @opindex mno-fsmuld
33656 @item -mfsmuld
33657 @itemx -mno-fsmuld
33658 With @option{-mfsmuld}, GCC generates code that takes advantage of the
33659 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
33660 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
33661 or V9 with FPU except @option{-mcpu=leon}.
33663 @opindex mpopc
33664 @opindex mno-popc
33665 @item -mpopc
33666 @itemx -mno-popc
33667 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
33668 Population Count instruction.  The default is @option{-mpopc}
33669 when targeting a CPU that supports such an instruction, such as Niagara-2 and
33670 later.
33672 @opindex msubxc
33673 @opindex mno-subxc
33674 @item -msubxc
33675 @itemx -mno-subxc
33676 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
33677 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
33678 when targeting a CPU that supports such an instruction, such as Niagara-7 and
33679 later.
33681 @opindex mfix-at697f
33682 @item -mfix-at697f
33683 Enable the documented workaround for the single erratum of the Atmel AT697F
33684 processor (which corresponds to erratum #13 of the AT697E processor).
33686 @opindex mfix-ut699
33687 @item -mfix-ut699
33688 Enable the documented workarounds for the floating-point errata and the data
33689 cache nullify errata of the UT699 processor.
33691 @opindex mfix-ut700
33692 @item -mfix-ut700
33693 Enable the documented workaround for the back-to-back store errata of
33694 the UT699E/UT700 processor.
33696 @opindex mfix-gr712rc
33697 @item -mfix-gr712rc
33698 Enable the documented workaround for the back-to-back store errata of
33699 the GR712RC processor.
33700 @end table
33702 These @samp{-m} options are supported in addition to the above
33703 on SPARC-V9 processors in 64-bit environments:
33705 @table @gcctabopt
33706 @opindex m32
33707 @opindex m64
33708 @item -m32
33709 @itemx -m64
33710 Generate code for a 32-bit or 64-bit environment.
33711 The 32-bit environment sets int, long and pointer to 32 bits.
33712 The 64-bit environment sets int to 32 bits and long and pointer
33713 to 64 bits.
33715 @opindex mcmodel
33716 @item -mcmodel=@var{which}
33717 Set the code model to one of
33719 @table @samp
33720 @item medlow
33721 The Medium/Low code model: 64-bit addresses, programs
33722 must be linked in the low 32 bits of memory.  Programs can be statically
33723 or dynamically linked.
33725 @item medmid
33726 The Medium/Middle code model: 64-bit addresses, programs
33727 must be linked in the low 44 bits of memory, the text and data segments must
33728 be less than 2GB in size and the data segment must be located within 2GB of
33729 the text segment.
33731 @item medany
33732 The Medium/Anywhere code model: 64-bit addresses, programs
33733 may be linked anywhere in memory, the text and data segments must be less
33734 than 2GB in size and the data segment must be located within 2GB of the
33735 text segment.
33737 @item embmedany
33738 The Medium/Anywhere code model for embedded systems:
33739 64-bit addresses, the text and data segments must be less than 2GB in
33740 size, both starting anywhere in memory (determined at link time).  The
33741 global register %g4 points to the base of the data segment.  Programs
33742 are statically linked and PIC is not supported.
33743 @end table
33745 @opindex mmemory-model
33746 @item -mmemory-model=@var{mem-model}
33747 Set the memory model in force on the processor to one of
33749 @table @samp
33750 @item default
33751 The default memory model for the processor and operating system.
33753 @item rmo
33754 Relaxed Memory Order
33756 @item pso
33757 Partial Store Order
33759 @item tso
33760 Total Store Order
33762 @item sc
33763 Sequential Consistency
33764 @end table
33766 These memory models are formally defined in Appendix D of the SPARC-V9
33767 architecture manual, as set in the processor's @code{PSTATE.MM} field.
33769 @opindex mstack-bias
33770 @opindex mno-stack-bias
33771 @item -mstack-bias
33772 @itemx -mno-stack-bias
33773 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
33774 frame pointer if present, are offset by @minus{}2047 which must be added back
33775 when making stack frame references.  This is the default in 64-bit mode.
33776 Otherwise, assume no such offset is present.
33777 @end table
33779 @node System V Options
33780 @subsection Options for System V
33782 These additional options are available on System V Release 4 for
33783 compatibility with other compilers on those systems:
33785 @table @gcctabopt
33786 @opindex G
33787 @item -G
33788 Create a shared object.
33789 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
33791 @opindex Qy
33792 @item -Qy
33793 Identify the versions of each tool used by the compiler, in a
33794 @code{.ident} assembler directive in the output.
33796 @opindex Qn
33797 @item -Qn
33798 Refrain from adding @code{.ident} directives to the output file (this is
33799 the default).
33801 @opindex YP
33802 @item -YP,@var{dirs}
33803 Search the directories @var{dirs}, and no others, for libraries
33804 specified with @option{-l}.
33806 @opindex Ym
33807 @item -Ym,@var{dir}
33808 Look in the directory @var{dir} to find the M4 preprocessor.
33809 The assembler uses this option.
33810 @c This is supposed to go with a -Yd for predefined M4 macro files, but
33811 @c the generic assembler that comes with Solaris takes just -Ym.
33812 @end table
33814 @node V850 Options
33815 @subsection V850 Options
33816 @cindex V850 Options
33818 These @samp{-m} options are defined for V850 implementations:
33820 @table @gcctabopt
33821 @opindex mlong-calls
33822 @opindex mno-long-calls
33823 @item -mlong-calls
33824 @itemx -mno-long-calls
33825 Treat all calls as being far away (near).  If calls are assumed to be
33826 far away, the compiler always loads the function's address into a
33827 register, and calls indirect through the pointer.
33829 @opindex mno-ep
33830 @opindex mep
33831 @item -mno-ep
33832 @itemx -mep
33833 Do not optimize (do optimize) basic blocks that use the same index
33834 pointer 4 or more times to copy pointer into the @code{ep} register, and
33835 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
33836 option is on by default if you optimize.
33838 @opindex mno-prolog-function
33839 @opindex mprolog-function
33840 @item -mno-prolog-function
33841 @itemx -mprolog-function
33842 Do not use (do use) external functions to save and restore registers
33843 at the prologue and epilogue of a function.  The external functions
33844 are slower, but use less code space if more than one function saves
33845 the same number of registers.  The @option{-mprolog-function} option
33846 is on by default if you optimize.
33848 @opindex mspace
33849 @item -mspace
33850 Try to make the code as small as possible.  At present, this just turns
33851 on the @option{-mep} and @option{-mprolog-function} options.
33853 @opindex mtda
33854 @item -mtda=@var{n}
33855 Put static or global variables whose size is @var{n} bytes or less into
33856 the tiny data area that register @code{ep} points to.  The tiny data
33857 area can hold up to 256 bytes in total (128 bytes for byte references).
33859 @opindex msda
33860 @item -msda=@var{n}
33861 Put static or global variables whose size is @var{n} bytes or less into
33862 the small data area that register @code{gp} points to.  The small data
33863 area can hold up to 64 kilobytes.
33865 @opindex mzda
33866 @item -mzda=@var{n}
33867 Put static or global variables whose size is @var{n} bytes or less into
33868 the first 32 kilobytes of memory.
33870 @opindex mv850
33871 @item -mv850
33872 Specify that the target processor is the V850.
33874 @opindex mv850e3v5
33875 @item -mv850e3v5
33876 Specify that the target processor is the V850E3V5.  The preprocessor
33877 constant @code{__v850e3v5__} is defined if this option is used.
33879 @opindex mv850e2v4
33880 @item -mv850e2v4
33881 Specify that the target processor is the V850E3V5.  This is an alias for
33882 the @option{-mv850e3v5} option.
33884 @opindex mv850e2v3
33885 @item -mv850e2v3
33886 Specify that the target processor is the V850E2V3.  The preprocessor
33887 constant @code{__v850e2v3__} is defined if this option is used.
33889 @opindex mv850e2
33890 @item -mv850e2
33891 Specify that the target processor is the V850E2.  The preprocessor
33892 constant @code{__v850e2__} is defined if this option is used.
33894 @opindex mv850e1
33895 @item -mv850e1
33896 Specify that the target processor is the V850E1.  The preprocessor
33897 constants @code{__v850e1__} and @code{__v850e__} are defined if
33898 this option is used.
33900 @opindex mv850es
33901 @item -mv850es
33902 Specify that the target processor is the V850ES.  This is an alias for
33903 the @option{-mv850e1} option.
33905 @opindex mv850e
33906 @item -mv850e
33907 Specify that the target processor is the V850E@.  The preprocessor
33908 constant @code{__v850e__} is defined if this option is used.
33910 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
33911 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
33912 are defined then a default target processor is chosen and the
33913 relevant @samp{__v850*__} preprocessor constant is defined.
33915 The preprocessor constants @code{__v850} and @code{__v851__} are always
33916 defined, regardless of which processor variant is the target.
33918 @opindex mdisable-callt
33919 @opindex mno-disable-callt
33920 @item -mdisable-callt
33921 @itemx -mno-disable-callt
33922 This option suppresses generation of the @code{CALLT} instruction for the
33923 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
33924 architecture.
33926 This option is enabled by default when the RH850 ABI is
33927 in use (see @option{-mrh850-abi}), and disabled by default when the
33928 GCC ABI is in use.  If @code{CALLT} instructions are being generated
33929 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
33931 @opindex mrelax
33932 @opindex mno-relax
33933 @item -mrelax
33934 @itemx -mno-relax
33935 Pass on (or do not pass on) the @option{-mrelax} command-line option
33936 to the assembler.
33938 @opindex mlong-jumps
33939 @opindex mno-long-jumps
33940 @item -mlong-jumps
33941 @itemx -mno-long-jumps
33942 Disable (or re-enable) the generation of PC-relative jump instructions.
33944 @opindex msoft-float
33945 @opindex mhard-float
33946 @item -msoft-float
33947 @itemx -mhard-float
33948 Disable (or re-enable) the generation of hardware floating point
33949 instructions.  This option is only significant when the target
33950 architecture is @samp{V850E2V3} or higher.  If hardware floating point
33951 instructions are being generated then the C preprocessor symbol
33952 @code{__FPU_OK__} is defined, otherwise the symbol
33953 @code{__NO_FPU__} is defined.
33955 @opindex mloop
33956 @item -mloop
33957 Enables the use of the e3v5 LOOP instruction.  The use of this
33958 instruction is not enabled by default when the e3v5 architecture is
33959 selected because its use is still experimental.
33961 @opindex mrh850-abi
33962 @opindex mghs
33963 @item -mrh850-abi
33964 @itemx -mghs
33965 Enables support for the RH850 version of the V850 ABI.  This is the
33966 default.  With this version of the ABI the following rules apply:
33968 @itemize
33969 @item
33970 Integer sized structures and unions are returned via a memory pointer
33971 rather than a register.
33973 @item
33974 Large structures and unions (more than 8 bytes in size) are passed by
33975 value.
33977 @item
33978 Functions are aligned to 16-bit boundaries.
33980 @item
33981 The @option{-m8byte-align} command-line option is supported.
33983 @item
33984 The @option{-mdisable-callt} command-line option is enabled by
33985 default.  The @option{-mno-disable-callt} command-line option is not
33986 supported.
33987 @end itemize
33989 When this version of the ABI is enabled the C preprocessor symbol
33990 @code{__V850_RH850_ABI__} is defined.
33992 @opindex mgcc-abi
33993 @item -mgcc-abi
33994 Enables support for the old GCC version of the V850 ABI.  With this
33995 version of the ABI the following rules apply:
33997 @itemize
33998 @item
33999 Integer sized structures and unions are returned in register @code{r10}.
34001 @item
34002 Large structures and unions (more than 8 bytes in size) are passed by
34003 reference.
34005 @item
34006 Functions are aligned to 32-bit boundaries, unless optimizing for
34007 size.
34009 @item
34010 The @option{-m8byte-align} command-line option is not supported.
34012 @item
34013 The @option{-mdisable-callt} command-line option is supported but not
34014 enabled by default.
34015 @end itemize
34017 When this version of the ABI is enabled the C preprocessor symbol
34018 @code{__V850_GCC_ABI__} is defined.
34020 @opindex m8byte-align
34021 @opindex mno-8byte-align
34022 @item -m8byte-align
34023 @itemx -mno-8byte-align
34024 Enables support for @code{double} and @code{long long} types to be
34025 aligned on 8-byte boundaries.  The default is to restrict the
34026 alignment of all objects to at most 4-bytes.  When
34027 @option{-m8byte-align} is in effect the C preprocessor symbol
34028 @code{__V850_8BYTE_ALIGN__} is defined.
34030 @opindex mbig-switch
34031 @item -mbig-switch
34032 Generate code suitable for big switch tables.  Use this option only if
34033 the assembler/linker complain about out of range branches within a switch
34034 table.
34036 @opindex mapp-regs
34037 @item -mapp-regs
34038 This option causes r2 and r5 to be used in the code generated by
34039 the compiler.  This setting is the default.
34041 @opindex mno-app-regs
34042 @item -mno-app-regs
34043 This option causes r2 and r5 to be treated as fixed registers.
34045 @end table
34047 @node VAX Options
34048 @subsection VAX Options
34049 @cindex VAX options
34051 These @samp{-m} options are defined for the VAX:
34053 @table @gcctabopt
34054 @opindex munix
34055 @item -munix
34056 Do not output certain jump instructions (@code{aobleq} and so on)
34057 that the Unix assembler for the VAX cannot handle across long
34058 ranges.
34060 @opindex mgnu
34061 @item -mgnu
34062 Do output those jump instructions, on the assumption that the
34063 GNU assembler is being used.
34065 @opindex mg
34066 @item -mg
34067 Output code for G-format floating-point numbers instead of D-format.
34069 @opindex mlra
34070 @opindex mno-lra
34071 @item -mlra
34072 @itemx -mno-lra
34073 Enable Local Register Allocation.  This is still experimental for the VAX,
34074 so by default the compiler uses standard reload.
34075 @end table
34077 @node Visium Options
34078 @subsection Visium Options
34079 @cindex Visium options
34081 @table @gcctabopt
34083 @opindex mdebug
34084 @item -mdebug
34085 A program which performs file I/O and is destined to run on an MCM target
34086 should be linked with this option.  It causes the libraries libc.a and
34087 libdebug.a to be linked.  The program should be run on the target under
34088 the control of the GDB remote debugging stub.
34090 @opindex msim
34091 @item -msim
34092 A program which performs file I/O and is destined to run on the simulator
34093 should be linked with option.  This causes libraries libc.a and libsim.a to
34094 be linked.
34096 @opindex mfpu
34097 @opindex mhard-float
34098 @item -mfpu
34099 @itemx -mhard-float
34100 Generate code containing floating-point instructions.  This is the
34101 default.
34103 @opindex mno-fpu
34104 @opindex msoft-float
34105 @item -mno-fpu
34106 @itemx -msoft-float
34107 Generate code containing library calls for floating-point.
34109 @option{-msoft-float} changes the calling convention in the output file;
34110 therefore, it is only useful if you compile @emph{all} of a program with
34111 this option.  In particular, you need to compile @file{libgcc.a}, the
34112 library that comes with GCC, with @option{-msoft-float} in order for
34113 this to work.
34115 @opindex mcpu
34116 @item -mcpu=@var{cpu_type}
34117 Set the instruction set, register set, and instruction scheduling parameters
34118 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
34119 @samp{mcm}, @samp{gr5} and @samp{gr6}.
34121 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
34123 By default (unless configured otherwise), GCC generates code for the GR5
34124 variant of the Visium architecture.  
34126 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
34127 architecture.  The only difference from GR5 code is that the compiler will
34128 generate block move instructions.
34130 @opindex mtune
34131 @item -mtune=@var{cpu_type}
34132 Set the instruction scheduling parameters for machine type @var{cpu_type},
34133 but do not set the instruction set or register set that the option
34134 @option{-mcpu=@var{cpu_type}} would.
34136 @opindex msv-mode
34137 @item -msv-mode
34138 Generate code for the supervisor mode, where there are no restrictions on
34139 the access to general registers.  This is the default.
34141 @opindex muser-mode
34142 @item -muser-mode
34143 Generate code for the user mode, where the access to some general registers
34144 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
34145 mode; on the GR6, only registers r29 to r31 are affected.
34146 @end table
34148 @node VMS Options
34149 @subsection VMS Options
34151 These @samp{-m} options are defined for the VMS implementations:
34153 @table @gcctabopt
34154 @opindex mvms-return-codes
34155 @item -mvms-return-codes
34156 Return VMS condition codes from @code{main}. The default is to return POSIX-style
34157 condition (e.g.@: error) codes.
34159 @opindex mdebug-main=@var{prefix}
34160 @item -mdebug-main=@var{prefix}
34161 Flag the first routine whose name starts with @var{prefix} as the main
34162 routine for the debugger.
34164 @opindex mmalloc64
34165 @item -mmalloc64
34166 Default to 64-bit memory allocation routines.
34168 @opindex mpointer-size=@var{size}
34169 @item -mpointer-size=@var{size}
34170 Set the default size of pointers. Possible options for @var{size} are
34171 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
34172 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
34173 The later option disables @code{pragma pointer_size}.
34174 @end table
34176 @node VxWorks Options
34177 @subsection VxWorks Options
34178 @cindex VxWorks Options
34180 The options in this section are defined for all VxWorks targets.
34181 Options specific to the target hardware are listed with the other
34182 options for that target.
34184 @table @gcctabopt
34185 @opindex mrtp
34186 @item -mrtp
34187 GCC can generate code for both VxWorks kernels and real time processes
34188 (RTPs).  This option switches from the former to the latter.  It also
34189 defines the preprocessor macro @code{__RTP__}.
34191 @opindex msmp
34192 @item -msmp
34193 Select SMP runtimes for linking.  Not available on architectures other
34194 than PowerPC, nor on VxWorks version 7 or later, in which the selection
34195 is part of the VxWorks build configuration and the library paths are the
34196 same for either choice.
34198 @opindex non-static
34199 @item -non-static
34200 Link an RTP executable against shared libraries rather than static
34201 libraries.  The options @option{-static} and @option{-shared} can
34202 also be used for RTPs (@pxref{Link Options}); @option{-static}
34203 is the default.
34205 @opindex Bstatic
34206 @opindex Bdynamic
34207 @item -Bstatic
34208 @itemx -Bdynamic
34209 These options are passed down to the linker.  They are defined for
34210 compatibility with Diab.
34212 @opindex Xbind-lazy
34213 @item -Xbind-lazy
34214 Enable lazy binding of function calls.  This option is equivalent to
34215 @option{-Wl,-z,now} and is defined for compatibility with Diab.
34217 @opindex Xbind-now
34218 @item -Xbind-now
34219 Disable lazy binding of function calls.  This option is the default and
34220 is defined for compatibility with Diab.
34221 @end table
34223 @node x86 Options
34224 @subsection x86 Options
34225 @cindex x86 Options
34227 These @samp{-m} options are defined for the x86 family of computers.
34229 @table @gcctabopt
34231 @opindex march
34232 @item -march=@var{cpu-type}
34233 Generate instructions for the machine type @var{cpu-type}.  In contrast to
34234 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
34235 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
34236 to generate code that may not run at all on processors other than the one
34237 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
34238 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
34240 The choices for @var{cpu-type} are:
34242 @table @samp
34243 @item native
34244 This selects the CPU to generate code for at compilation time by determining
34245 the processor type of the compiling machine.  Using @option{-march=native}
34246 enables all instruction subsets supported by the local machine (hence
34247 the result might not run on different machines).  Using @option{-mtune=native}
34248 produces code optimized for the local machine under the constraints
34249 of the selected instruction set.  
34251 @item x86-64
34252 A generic CPU with 64-bit extensions.
34254 @item x86-64-v2
34255 @itemx x86-64-v3
34256 @itemx x86-64-v4
34257 These choices for @var{cpu-type} select the corresponding
34258 micro-architecture level from the x86-64 psABI.  On ABIs other than
34259 the x86-64 psABI they select the same CPU features as the x86-64 psABI
34260 documents for the particular micro-architecture level.
34262 Since these @var{cpu-type} values do not have a corresponding
34263 @option{-mtune} setting, using @option{-march} with these values enables
34264 generic tuning.  Specific tuning can be enabled using the
34265 @option{-mtune=@var{other-cpu-type}} option with an appropriate
34266 @var{other-cpu-type} value.
34268 @item i386
34269 Original Intel i386 CPU@.
34271 @item i486
34272 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
34274 @item i586
34275 @itemx pentium
34276 Intel Pentium CPU with no MMX support.
34278 @item lakemont
34279 Intel Lakemont MCU, based on Intel Pentium CPU.
34281 @item pentium-mmx
34282 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
34284 @item pentiumpro
34285 Intel Pentium Pro CPU@.
34287 @item i686
34288 When used with @option{-march}, the Pentium Pro
34289 instruction set is used, so the code runs on all i686 family chips.
34290 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
34292 @item pentium2
34293 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
34294 set support.
34296 @item pentium3
34297 @itemx pentium3m
34298 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
34299 instruction set support.
34301 @item pentium-m
34302 Intel Pentium M; low-power version of Intel Pentium III CPU
34303 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
34304 notebooks.
34306 @item pentium4
34307 @itemx pentium4m
34308 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
34310 @item prescott
34311 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
34312 instruction set support.
34314 @item nocona
34315 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
34316 SSE2, SSE3 and FXSR instruction set support.
34318 @item core2
34319 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
34320 SAHF and FXSR instruction set support.
34322 @item nehalem
34323 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34324 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
34326 @item westmere
34327 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34328 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
34330 @item sandybridge
34331 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34332 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
34333 support.
34335 @item ivybridge
34336 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34337 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
34338 and F16C instruction set support.
34340 @item haswell
34341 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34342 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34343 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
34345 @item broadwell
34346 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34347 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34348 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
34349 instruction set support.
34351 @item skylake
34352 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34353 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34354 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34355 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
34357 @item bonnell
34358 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
34359 instruction set support.
34361 @item silvermont
34362 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34363 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
34364 instruction set support.
34366 @item goldmont
34367 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34368 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
34369 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
34370 set support.
34372 @item goldmont-plus
34373 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34374 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
34375 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
34376 RDPID and SGX instruction set support.
34378 @item tremont
34379 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34380 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
34381 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
34382 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
34383 support.
34385 @item sierraforest
34386 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34387 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34388 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34389 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34390 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34391 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
34392 support.
34394 @item grandridge
34395 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34396 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34397 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34398 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34399 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34400 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
34401 support.
34403 @item clearwaterforest
34404 Intel Clearwater Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
34405 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE,
34406 XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
34407 MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
34408 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34409 ENQCMD, UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16,
34410 SHA512, SM3, SM4, USER_MSR and PREFETCHI instruction set support.
34412 @item knl
34413 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34414 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34415 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34416 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
34418 @item knm
34419 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34420 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34421 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34422 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
34423 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
34425 @item skylake-avx512
34426 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34427 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34428 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34429 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
34430 AVX512DQ and AVX512CD instruction set support.
34432 @item cannonlake
34433 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
34434 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
34435 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
34436 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
34437 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
34438 support.
34440 @item icelake-client
34441 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34442 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34443 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34444 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34445 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
34446 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
34448 @item icelake-server
34449 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34450 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34451 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34452 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34453 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
34454 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
34455 instruction set support.
34457 @item cascadelake
34458 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34459 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34460 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34461 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
34462 AVX512CD and AVX512VNNI instruction set support.
34464 @item cooperlake
34465 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34466 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34467 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34468 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
34469 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
34471 @item tigerlake
34472 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34473 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34474 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34475 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
34476 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34477 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
34478 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
34480 @item sapphirerapids
34481 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34482 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34483 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34484 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34485 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34486 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34487 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34488 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
34489 instruction set support.
34491 @item alderlake
34492 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34493 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
34494 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
34495 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
34496 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
34497 support.
34499 @item rocketlake
34500 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
34501 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34502 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34503 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
34504 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34505 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
34507 @item graniterapids
34508 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34509 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34510 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34511 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34512 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34513 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34514 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34515 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
34516 and PREFETCHI instruction set support.
34518 @item graniterapids-d
34519 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34520 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34521 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34522 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34523 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34524 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34525 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34526 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
34527 PREFETCHI and AMX-COMPLEX instruction set support.
34529 @item arrowlake
34530 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34531 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34532 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34533 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34534 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34535 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set
34536 support.
34538 @item arrowlake-s
34539 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34540 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34541 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34542 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34543 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34544 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
34545 SM3 and SM4 instruction set support.
34547 @item pantherlake
34548 Intel Panther Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34549 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34550 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34551 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34552 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34553 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
34554 SM3, SM4 and PREFETCHI instruction set support.
34556 @item k6
34557 AMD K6 CPU with MMX instruction set support.
34559 @item k6-2
34560 @itemx k6-3
34561 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
34563 @item athlon
34564 @itemx athlon-tbird
34565 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
34566 support.
34568 @item athlon-4
34569 @itemx athlon-xp
34570 @itemx athlon-mp
34571 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
34572 instruction set support.
34574 @item k8
34575 @itemx opteron
34576 @itemx athlon64
34577 @itemx athlon-fx
34578 Processors based on the AMD K8 core with x86-64 instruction set support,
34579 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
34580 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
34581 instruction set extensions.)
34583 @item k8-sse3
34584 @itemx opteron-sse3
34585 @itemx athlon64-sse3
34586 Improved versions of AMD K8 cores with SSE3 instruction set support.
34588 @item amdfam10
34589 @itemx barcelona
34590 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
34591 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
34592 instruction set extensions.)
34594 @item bdver1
34595 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
34596 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
34597 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
34599 @item bdver2
34600 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34601 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
34602 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
34603 extensions.)
34605 @item bdver3
34606 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34607 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
34608 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
34609 64-bit instruction set extensions.)
34611 @item bdver4
34612 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34613 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
34614 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
34615 SSE4.2, ABM and 64-bit instruction set extensions.)
34617 @item znver1
34618 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
34619 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
34620 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
34621 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
34622 instruction set extensions.)
34624 @item znver2
34625 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
34626 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34627 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34628 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34629 WBNOINVD, and 64-bit instruction set extensions.)
34631 @item znver3
34632 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
34633 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34634 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34635 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34636 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
34638 @item znver4
34639 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
34640 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34641 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34642 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34643 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
34644 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
34645 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
34647 @item znver5
34648 AMD Family 1ah core based CPUs with x86-64 instruction set support. (This
34649 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34650 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34651 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34652 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
34653 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
34654 AVX512BITALG, AVX512VPOPCNTDQ, GFNI, AVXVNNI, MOVDIRI, MOVDIR64B,
34655 AVX512VP2INTERSECT, PREFETCHI and 64-bit instruction set extensions.)
34657 @item btver1
34658 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
34659 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
34660 instruction set extensions.)
34662 @item btver2
34663 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
34664 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
34665 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
34667 @item winchip-c6
34668 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
34669 set support.
34671 @item winchip2
34672 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
34673 instruction set support.
34675 @item c3
34676 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
34677 (No scheduling is implemented for this chip.)
34679 @item c3-2
34680 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
34681 (No scheduling is implemented for this chip.)
34683 @item c7
34684 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
34685 (No scheduling is implemented for this chip.)
34687 @item samuel-2
34688 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
34689 (No scheduling is implemented for this chip.)
34691 @item nehemiah
34692 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
34693 (No scheduling is implemented for this chip.)
34695 @item esther
34696 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
34697 (No scheduling is implemented for this chip.)
34699 @item eden-x2
34700 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
34701 (No scheduling is implemented for this chip.)
34703 @item eden-x4
34704 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
34705 AVX and AVX2 instruction set support.
34706 (No scheduling is implemented for this chip.)
34708 @item nano
34709 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34710 instruction set support.
34711 (No scheduling is implemented for this chip.)
34713 @item nano-1000
34714 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34715 instruction set support.
34716 (No scheduling is implemented for this chip.)
34718 @item nano-2000
34719 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34720 instruction set support.
34721 (No scheduling is implemented for this chip.)
34723 @item nano-3000
34724 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34725 instruction set support.
34726 (No scheduling is implemented for this chip.)
34728 @item nano-x2
34729 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34730 instruction set support.
34731 (No scheduling is implemented for this chip.)
34733 @item nano-x4
34734 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34735 instruction set support.
34736 (No scheduling is implemented for this chip.)
34738 @item lujiazui
34739 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
34740 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
34741 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
34743 @item yongfeng
34744 ZHAOXIN yongfeng CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
34745 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
34746 ABM, BMI, BMI2, F16C, FXSR, RDSEED, AVX2, FMA, SHA, LZCNT
34747 instruction set support.
34749 @item geode
34750 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
34751 @end table
34753 @opindex mtune
34754 @item -mtune=@var{cpu-type}
34755 Tune to @var{cpu-type} everything applicable about the generated code, except
34756 for the ABI and the set of available instructions.  
34757 While picking a specific @var{cpu-type} schedules things appropriately
34758 for that particular chip, the compiler does not generate any code that
34759 cannot run on the default machine type unless you use a
34760 @option{-march=@var{cpu-type}} option.
34761 For example, if GCC is configured for i686-pc-linux-gnu
34762 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
34763 but still runs on i686 machines.
34765 The choices for @var{cpu-type} are the same as for @option{-march}.
34766 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
34768 @table @samp
34769 @item generic
34770 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
34771 If you know the CPU on which your code will run, then you should use
34772 the corresponding @option{-mtune} or @option{-march} option instead of
34773 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
34774 of your application will have, then you should use this option.
34776 As new processors are deployed in the marketplace, the behavior of this
34777 option will change.  Therefore, if you upgrade to a newer version of
34778 GCC, code generation controlled by this option will change to reflect
34779 the processors
34780 that are most common at the time that version of GCC is released.
34782 There is no @option{-march=generic} option because @option{-march}
34783 indicates the instruction set the compiler can use, and there is no
34784 generic instruction set applicable to all processors.  In contrast,
34785 @option{-mtune} indicates the processor (or, in this case, collection of
34786 processors) for which the code is optimized.
34788 @item intel
34789 Produce code optimized for the most current Intel processors, which are
34790 Haswell and Silvermont for this version of GCC.  If you know the CPU
34791 on which your code will run, then you should use the corresponding
34792 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
34793 But, if you want your application performs better on both Haswell and
34794 Silvermont, then you should use this option.
34796 As new Intel processors are deployed in the marketplace, the behavior of
34797 this option will change.  Therefore, if you upgrade to a newer version of
34798 GCC, code generation controlled by this option will change to reflect
34799 the most current Intel processors at the time that version of GCC is
34800 released.
34802 There is no @option{-march=intel} option because @option{-march} indicates
34803 the instruction set the compiler can use, and there is no common
34804 instruction set applicable to all processors.  In contrast,
34805 @option{-mtune} indicates the processor (or, in this case, collection of
34806 processors) for which the code is optimized.
34807 @end table
34809 @opindex mcpu
34810 @item -mcpu=@var{cpu-type}
34811 A deprecated synonym for @option{-mtune}.
34813 @opindex mfpmath
34814 @item -mfpmath=@var{unit}
34815 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
34816 for @var{unit} are:
34818 @table @samp
34819 @item 387
34820 Use the standard 387 floating-point coprocessor present on the majority of chips and
34821 emulated otherwise.  Code compiled with this option runs almost everywhere.
34822 The temporary results are computed in 80-bit precision instead of the precision
34823 specified by the type, resulting in slightly different results compared to most
34824 of other chips.  See @option{-ffloat-store} for more detailed description.
34826 This is the default choice for non-Darwin x86-32 targets.
34828 @item sse
34829 Use scalar floating-point instructions present in the SSE instruction set.
34830 This instruction set is supported by Pentium III and newer chips,
34831 and in the AMD line
34832 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
34833 instruction set supports only single-precision arithmetic, thus the double and
34834 extended-precision arithmetic are still done using 387.  A later version, present
34835 only in Pentium 4 and AMD x86-64 chips, supports double-precision
34836 arithmetic too.
34838 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
34839 or @option{-msse2} switches to enable SSE extensions and make this option
34840 effective.  For the x86-64 compiler, these extensions are enabled by default.
34842 The resulting code should be considerably faster in the majority of cases and avoid
34843 the numerical instability problems of 387 code, but may break some existing
34844 code that expects temporaries to be 80 bits.
34846 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
34847 and the default choice for x86-32 targets with the SSE2 instruction set
34848 when @option{-ffast-math} is enabled.
34850 @item sse,387
34851 @itemx sse+387
34852 @itemx both
34853 Attempt to utilize both instruction sets at once.  This effectively doubles the
34854 amount of available registers, and on chips with separate execution units for
34855 387 and SSE the execution resources too.  Use this option with care, as it is
34856 still experimental, because the GCC register allocator does not model separate
34857 functional units well, resulting in unstable performance.
34858 @end table
34860 @opindex masm=@var{dialect}
34861 @item -masm=@var{dialect}
34862 Output assembly instructions using selected @var{dialect}.  Also affects
34863 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
34864 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
34865 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
34866 not support @samp{intel}.
34868 @opindex mieee-fp
34869 @opindex mno-ieee-fp
34870 @item -mieee-fp
34871 @itemx -mno-ieee-fp
34872 Control whether or not the compiler uses IEEE floating-point
34873 comparisons.  These correctly handle the case where the result of a
34874 comparison is unordered.
34876 @opindex m80387
34877 @opindex mhard-float
34878 @item -m80387
34879 @itemx -mhard-float
34880 Generate output containing 80387 instructions for floating point.
34882 @opindex no-80387
34883 @opindex msoft-float
34884 @item -mno-80387
34885 @itemx -msoft-float
34886 Generate output containing library calls for floating point.
34888 @strong{Warning:} the requisite libraries are not part of GCC@.
34889 Normally the facilities of the machine's usual C compiler are used, but
34890 this cannot be done directly in cross-compilation.  You must make your
34891 own arrangements to provide suitable library functions for
34892 cross-compilation.
34894 On machines where a function returns floating-point results in the 80387
34895 register stack, some floating-point opcodes may be emitted even if
34896 @option{-msoft-float} is used.
34898 @opindex mno-fp-ret-in-387
34899 @opindex mfp-ret-in-387
34900 @item -mno-fp-ret-in-387
34901 Do not use the FPU registers for return values of functions.
34903 The usual calling convention has functions return values of types
34904 @code{float} and @code{double} in an FPU register, even if there
34905 is no FPU@.  The idea is that the operating system should emulate
34906 an FPU@.
34908 The option @option{-mno-fp-ret-in-387} causes such values to be returned
34909 in ordinary CPU registers instead.
34911 @opindex mno-fancy-math-387
34912 @opindex mfancy-math-387
34913 @item -mno-fancy-math-387
34914 Some 387 emulators do not support the @code{sin}, @code{cos} and
34915 @code{sqrt} instructions for the 387.  Specify this option to avoid
34916 generating those instructions.
34917 This option is overridden when @option{-march}
34918 indicates that the target CPU always has an FPU and so the
34919 instruction does not need emulation.  These
34920 instructions are not generated unless you also use the
34921 @option{-funsafe-math-optimizations} switch.
34923 @opindex malign-double
34924 @opindex mno-align-double
34925 @item -malign-double
34926 @itemx -mno-align-double
34927 Control whether GCC aligns @code{double}, @code{long double}, and
34928 @code{long long} variables on a two-word boundary or a one-word
34929 boundary.  Aligning @code{double} variables on a two-word boundary
34930 produces code that runs somewhat faster on a Pentium at the
34931 expense of more memory.
34933 On x86-64, @option{-malign-double} is enabled by default.
34935 @strong{Warning:} if you use the @option{-malign-double} switch,
34936 structures containing the above types are aligned differently than
34937 the published application binary interface specifications for the x86-32
34938 and are not binary compatible with structures in code compiled
34939 without that switch.
34941 @opindex m96bit-long-double
34942 @opindex m128bit-long-double
34943 @item -m96bit-long-double
34944 @itemx -m128bit-long-double
34945 These switches control the size of @code{long double} type.  The x86-32
34946 application binary interface specifies the size to be 96 bits,
34947 so @option{-m96bit-long-double} is the default in 32-bit mode.
34949 Modern architectures (Pentium and newer) prefer @code{long double}
34950 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
34951 conforming to the ABI, this is not possible.  So specifying
34952 @option{-m128bit-long-double} aligns @code{long double}
34953 to a 16-byte boundary by padding the @code{long double} with an additional
34954 32-bit zero.
34956 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
34957 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
34959 Notice that neither of these options enable any extra precision over the x87
34960 standard of 80 bits for a @code{long double}.
34962 @strong{Warning:} if you override the default value for your target ABI, this
34963 changes the size of 
34964 structures and arrays containing @code{long double} variables,
34965 as well as modifying the function calling convention for functions taking
34966 @code{long double}.  Hence they are not binary-compatible
34967 with code compiled without that switch.
34969 @opindex mlong-double-64
34970 @opindex mlong-double-80
34971 @opindex mlong-double-128
34972 @item -mlong-double-64
34973 @itemx -mlong-double-80
34974 @itemx -mlong-double-128
34975 These switches control the size of @code{long double} type. A size
34976 of 64 bits makes the @code{long double} type equivalent to the @code{double}
34977 type. This is the default for 32-bit Bionic C library.  A size
34978 of 128 bits makes the @code{long double} type equivalent to the
34979 @code{__float128} type. This is the default for 64-bit Bionic C library.
34981 @strong{Warning:} if you override the default value for your target ABI, this
34982 changes the size of
34983 structures and arrays containing @code{long double} variables,
34984 as well as modifying the function calling convention for functions taking
34985 @code{long double}.  Hence they are not binary-compatible
34986 with code compiled without that switch.
34988 @opindex malign-data
34989 @item -malign-data=@var{type}
34990 Control how GCC aligns variables.  Supported values for @var{type} are
34991 @samp{compat} uses increased alignment value compatible uses GCC 4.8
34992 and earlier, @samp{abi} uses alignment value as specified by the
34993 psABI, and @samp{cacheline} uses increased alignment value to match
34994 the cache line size.  @samp{compat} is the default.
34996 @opindex mlarge-data-threshold
34997 @item -mlarge-data-threshold=@var{threshold}
34998 When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
34999 objects larger than @var{threshold} are placed in large data sections.  The
35000 default is 65535.
35002 @opindex mrtd
35003 @item -mrtd
35004 Use a different function-calling convention, in which functions that
35005 take a fixed number of arguments return with the @code{ret @var{num}}
35006 instruction, which pops their arguments while returning.  This saves one
35007 instruction in the caller since there is no need to pop the arguments
35008 there.
35010 You can specify that an individual function is called with this calling
35011 sequence with the function attribute @code{stdcall}.  You can also
35012 override the @option{-mrtd} option by using the function attribute
35013 @code{cdecl}.  @xref{Function Attributes}.
35015 @strong{Warning:} this calling convention is incompatible with the one
35016 normally used on Unix, so you cannot use it if you need to call
35017 libraries compiled with the Unix compiler.
35019 Also, you must provide function prototypes for all functions that
35020 take variable numbers of arguments (including @code{printf});
35021 otherwise incorrect code is generated for calls to those
35022 functions.
35024 In addition, seriously incorrect code results if you call a
35025 function with too many arguments.  (Normally, extra arguments are
35026 harmlessly ignored.)
35028 @opindex mregparm
35029 @item -mregparm=@var{num}
35030 Control how many registers are used to pass integer arguments.  By
35031 default, no registers are used to pass arguments, and at most 3
35032 registers can be used.  You can control this behavior for a specific
35033 function by using the function attribute @code{regparm}.
35034 @xref{Function Attributes}.
35036 @strong{Warning:} if you use this switch, and
35037 @var{num} is nonzero, then you must build all modules with the same
35038 value, including any libraries.  This includes the system libraries and
35039 startup modules.
35041 @opindex msseregparm
35042 @item -msseregparm
35043 Use SSE register passing conventions for float and double arguments
35044 and return values.  You can control this behavior for a specific
35045 function by using the function attribute @code{sseregparm}.
35046 @xref{Function Attributes}.
35048 @strong{Warning:} if you use this switch then you must build all
35049 modules with the same value, including any libraries.  This includes
35050 the system libraries and startup modules.
35052 @opindex mvect8-ret-in-mem
35053 @item -mvect8-ret-in-mem
35054 Return 8-byte vectors in memory instead of MMX registers.  This is the
35055 default on VxWorks to match the ABI of the Sun Studio compilers until
35056 version 12.  @emph{Only} use this option if you need to remain
35057 compatible with existing code produced by those previous compiler
35058 versions or older versions of GCC@.
35060 @opindex mpc32
35061 @opindex mpc64
35062 @opindex mpc80
35063 @item -mpc32
35064 @itemx -mpc64
35065 @itemx -mpc80
35067 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
35068 is specified, the significands of results of floating-point operations are
35069 rounded to 24 bits (single precision); @option{-mpc64} rounds the
35070 significands of results of floating-point operations to 53 bits (double
35071 precision) and @option{-mpc80} rounds the significands of results of
35072 floating-point operations to 64 bits (extended double precision), which is
35073 the default.  When this option is used, floating-point operations in higher
35074 precisions are not available to the programmer without setting the FPU
35075 control word explicitly.
35077 Setting the rounding of floating-point operations to less than the default
35078 80 bits can speed some programs by 2% or more.  Note that some mathematical
35079 libraries assume that extended-precision (80-bit) floating-point operations
35080 are enabled by default; routines in such libraries could suffer significant
35081 loss of accuracy, typically through so-called ``catastrophic cancellation'',
35082 when this option is used to set the precision to less than extended precision.
35084 @opindex mdaz-ftz
35085 @item -mdaz-ftz
35087 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
35088 are used to control floating-point calculations.SSE and AVX instructions
35089 including scalar and vector instructions could benefit from enabling the FTZ
35090 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
35091 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
35092 will set FTZ/DAZ flags even with @option{-shared}.
35094 @opindex mstackrealign
35095 @item -mstackrealign
35096 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
35097 option generates an alternate prologue and epilogue that realigns the
35098 run-time stack if necessary.  This supports mixing legacy codes that keep
35099 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
35100 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
35101 applicable to individual functions.
35103 @opindex mpreferred-stack-boundary
35104 @item -mpreferred-stack-boundary=@var{num}
35105 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
35106 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
35107 the default is 4 (16 bytes or 128 bits).
35109 @strong{Warning:} When generating code for the x86-64 architecture with
35110 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
35111 used to keep the stack boundary aligned to 8 byte boundary.  Since
35112 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
35113 intended to be used in controlled environment where stack space is
35114 important limitation.  This option leads to wrong code when functions
35115 compiled with 16 byte stack alignment (such as functions from a standard
35116 library) are called with misaligned stack.  In this case, SSE
35117 instructions may lead to misaligned memory access traps.  In addition,
35118 variable arguments are handled incorrectly for 16 byte aligned
35119 objects (including x87 long double and __int128), leading to wrong
35120 results.  You must build all modules with
35121 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
35122 includes the system libraries and startup modules.
35124 @opindex mincoming-stack-boundary
35125 @item -mincoming-stack-boundary=@var{num}
35126 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
35127 boundary.  If @option{-mincoming-stack-boundary} is not specified,
35128 the one specified by @option{-mpreferred-stack-boundary} is used.
35130 On Pentium and Pentium Pro, @code{double} and @code{long double} values
35131 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
35132 suffer significant run time performance penalties.  On Pentium III, the
35133 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
35134 properly if it is not 16-byte aligned.
35136 To ensure proper alignment of this values on the stack, the stack boundary
35137 must be as aligned as that required by any value stored on the stack.
35138 Further, every function must be generated such that it keeps the stack
35139 aligned.  Thus calling a function compiled with a higher preferred
35140 stack boundary from a function compiled with a lower preferred stack
35141 boundary most likely misaligns the stack.  It is recommended that
35142 libraries that use callbacks always use the default setting.
35144 This extra alignment does consume extra stack space, and generally
35145 increases code size.  Code that is sensitive to stack space usage, such
35146 as embedded systems and operating system kernels, may want to reduce the
35147 preferred alignment to @option{-mpreferred-stack-boundary=2}.
35149 @need 200
35150 @opindex mmmx
35151 @item -mmmx
35152 @need 200
35153 @opindex msse
35154 @itemx -msse
35155 @need 200
35156 @opindex msse2
35157 @itemx -msse2
35158 @need 200
35159 @opindex msse3
35160 @itemx -msse3
35161 @need 200
35162 @opindex mssse3
35163 @itemx -mssse3
35164 @need 200
35165 @opindex msse4
35166 @itemx -msse4
35167 @need 200
35168 @opindex msse4a
35169 @itemx -msse4a
35170 @need 200
35171 @opindex msse4.1
35172 @itemx -msse4.1
35173 @need 200
35174 @opindex msse4.2
35175 @itemx -msse4.2
35176 @need 200
35177 @opindex mavx
35178 @itemx -mavx
35179 @need 200
35180 @opindex mavx2
35181 @itemx -mavx2
35182 @need 200
35183 @opindex mavx512f
35184 @itemx -mavx512f
35185 @need 200
35186 @opindex mavx512pf
35187 @itemx -mavx512pf
35188 @need 200
35189 @opindex mavx512er
35190 @itemx -mavx512er
35191 @need 200
35192 @opindex mavx512cd
35193 @itemx -mavx512cd
35194 @need 200
35195 @opindex mavx512vl
35196 @itemx -mavx512vl
35197 @need 200
35198 @opindex mavx512bw
35199 @itemx -mavx512bw
35200 @need 200
35201 @opindex mavx512dq
35202 @itemx -mavx512dq
35203 @need 200
35204 @opindex mavx512ifma
35205 @itemx -mavx512ifma
35206 @need 200
35207 @opindex mavx512vbmi
35208 @itemx -mavx512vbmi
35209 @need 200
35210 @opindex msha
35211 @itemx -msha
35212 @need 200
35213 @opindex maes
35214 @itemx -maes
35215 @need 200
35216 @opindex mpclmul
35217 @itemx -mpclmul
35218 @need 200
35219 @opindex mclflushopt
35220 @itemx -mclflushopt
35221 @need 200
35222 @opindex mclwb
35223 @itemx -mclwb
35224 @need 200
35225 @opindex mfsgsbase
35226 @itemx -mfsgsbase
35227 @need 200
35228 @opindex mptwrite
35229 @itemx -mptwrite
35230 @need 200
35231 @opindex mrdrnd
35232 @itemx -mrdrnd
35233 @need 200
35234 @opindex mf16c
35235 @itemx -mf16c
35236 @need 200
35237 @opindex mfma
35238 @itemx -mfma
35239 @need 200
35240 @opindex mpconfig
35241 @itemx -mpconfig
35242 @need 200
35243 @opindex mwbnoinvd
35244 @itemx -mwbnoinvd
35245 @need 200
35246 @opindex mfma4
35247 @itemx -mfma4
35248 @need 200
35249 @opindex mprfchw
35250 @itemx -mprfchw
35251 @need 200
35252 @opindex mrdpid
35253 @itemx -mrdpid
35254 @need 200
35255 @opindex mprefetchwt1
35256 @itemx -mprefetchwt1
35257 @need 200
35258 @opindex mrdseed
35259 @itemx -mrdseed
35260 @need 200
35261 @opindex msgx
35262 @itemx -msgx
35263 @need 200
35264 @opindex mxop
35265 @itemx -mxop
35266 @need 200
35267 @opindex mlwp
35268 @itemx -mlwp
35269 @need 200
35270 @opindex m3dnow
35271 @itemx -m3dnow
35272 @need 200
35273 @opindex m3dnowa
35274 @itemx -m3dnowa
35275 @need 200
35276 @opindex mpopcnt
35277 @itemx -mpopcnt
35278 @need 200
35279 @opindex mabm
35280 @itemx -mabm
35281 @need 200
35282 @opindex madx
35283 @itemx -madx
35284 @need 200
35285 @opindex mbmi
35286 @itemx -mbmi
35287 @need 200
35288 @opindex mbmi2
35289 @itemx -mbmi2
35290 @need 200
35291 @opindex mlzcnt
35292 @itemx -mlzcnt
35293 @need 200
35294 @opindex mfxsr
35295 @itemx -mfxsr
35296 @need 200
35297 @opindex mxsave
35298 @itemx -mxsave
35299 @need 200
35300 @opindex mxsaveopt
35301 @itemx -mxsaveopt
35302 @need 200
35303 @opindex mxsavec
35304 @itemx -mxsavec
35305 @need 200
35306 @opindex mxsaves
35307 @itemx -mxsaves
35308 @need 200
35309 @opindex mrtm
35310 @itemx -mrtm
35311 @need 200
35312 @opindex mhle
35313 @itemx -mhle
35314 @need 200
35315 @opindex mtbm
35316 @itemx -mtbm
35317 @need 200
35318 @opindex mmwaitx
35319 @itemx -mmwaitx
35320 @need 200
35321 @opindex mclzero
35322 @itemx -mclzero
35323 @need 200
35324 @opindex mpku
35325 @itemx -mpku
35326 @need 200
35327 @opindex mavx512vbmi2
35328 @itemx -mavx512vbmi2
35329 @need 200
35330 @opindex mavx512bf16
35331 @itemx -mavx512bf16
35332 @need 200
35333 @opindex mavx512fp16
35334 @itemx -mavx512fp16
35335 @need 200
35336 @opindex mgfni
35337 @itemx -mgfni
35338 @need 200
35339 @opindex mvaes
35340 @itemx -mvaes
35341 @need 200
35342 @opindex mwaitpkg
35343 @itemx -mwaitpkg
35344 @need 200
35345 @opindex mvpclmulqdq
35346 @itemx -mvpclmulqdq
35347 @need 200
35348 @opindex mavx512bitalg
35349 @itemx -mavx512bitalg
35350 @need 200
35351 @opindex mmovdiri
35352 @itemx -mmovdiri
35353 @need 200
35354 @opindex mmovdir64b
35355 @itemx -mmovdir64b
35356 @need 200
35357 @opindex menqcmd
35358 @opindex muintr
35359 @itemx -menqcmd
35360 @itemx -muintr
35361 @need 200
35362 @opindex mtsxldtrk
35363 @itemx -mtsxldtrk
35364 @need 200
35365 @opindex mavx512vpopcntdq
35366 @itemx -mavx512vpopcntdq
35367 @need 200
35368 @opindex mavx512vp2intersect
35369 @itemx -mavx512vp2intersect
35370 @need 200
35371 @opindex mavx5124fmaps
35372 @itemx -mavx5124fmaps
35373 @need 200
35374 @opindex mavx512vnni
35375 @itemx -mavx512vnni
35376 @need 200
35377 @opindex mavxvnni
35378 @itemx -mavxvnni
35379 @need 200
35380 @opindex mavx5124vnniw
35381 @itemx -mavx5124vnniw
35382 @need 200
35383 @opindex mcldemote
35384 @itemx -mcldemote
35385 @need 200
35386 @opindex mserialize
35387 @itemx -mserialize
35388 @need 200
35389 @opindex mamx-tile
35390 @itemx -mamx-tile
35391 @need 200
35392 @opindex mamx-int8
35393 @itemx -mamx-int8
35394 @need 200
35395 @opindex mamx-bf16
35396 @itemx -mamx-bf16
35397 @need 200
35398 @opindex mhreset
35399 @opindex mkl
35400 @itemx -mhreset
35401 @itemx -mkl
35402 @need 200
35403 @opindex mwidekl
35404 @itemx -mwidekl
35405 @need 200
35406 @opindex mavxifma
35407 @itemx -mavxifma
35408 @need 200
35409 @opindex mavxvnniint8
35410 @itemx -mavxvnniint8
35411 @need 200
35412 @opindex mavxneconvert
35413 @itemx -mavxneconvert
35414 @need 200
35415 @opindex mcmpccxadd
35416 @itemx -mcmpccxadd
35417 @need 200
35418 @opindex mamx-fp16
35419 @itemx -mamx-fp16
35420 @need 200
35421 @opindex mprefetchi
35422 @itemx -mprefetchi
35423 @need 200
35424 @opindex mraoint
35425 @itemx -mraoint
35426 @need 200
35427 @opindex mamx-complex
35428 @itemx -mamx-complex
35429 @need 200
35430 @opindex mavxvnniint16
35431 @itemx -mavxvnniint16
35432 @need 200
35433 @opindex msm3
35434 @itemx -msm3
35435 @need 200
35436 @opindex msha512
35437 @itemx -msha512
35438 @need 200
35439 @opindex msm4
35440 @itemx -msm4
35441 @need 200
35442 @opindex mapxf
35443 @itemx -mapxf
35444 @need 200
35445 @opindex musermsr
35446 @itemx -musermsr
35447 @need 200
35448 @opindex mavx10.1
35449 @itemx -mavx10.1
35450 @need 200
35451 @opindex mavx10.1-256
35452 @itemx -mavx10.1-256
35453 @need 200
35454 @opindex mavx10.1-512
35455 @itemx -mavx10.1-512
35456 These switches enable the use of instructions in the MMX, SSE,
35457 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
35458 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
35459 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
35460 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
35461 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
35462 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
35463 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
35464 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
35465 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
35466 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4, APX_F, USER_MSR, AVX10.1 or
35467 CLDEMOTE extended instruction sets.  Each has a corresponding @option{-mno-}
35468 option to disable use of these instructions.
35470 These extensions are also available as built-in functions: see
35471 @ref{x86 Built-in Functions}, for details of the functions enabled and
35472 disabled by these switches.
35474 To generate SSE/SSE2 instructions automatically from floating-point
35475 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
35477 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
35478 generates new AVX instructions or AVX equivalence for all SSEx instructions
35479 when needed.
35481 These options enable GCC to use these extended instructions in
35482 generated code, even without @option{-mfpmath=sse}.  Applications that
35483 perform run-time CPU detection must compile separate files for each
35484 supported architecture, using the appropriate flags.  In particular,
35485 the file containing the CPU detection code should be compiled without
35486 these options.
35488 @opindex mdump-tune-features
35489 @item -mdump-tune-features
35490 This option instructs GCC to dump the names of the x86 performance 
35491 tuning features and default settings. The names can be used in 
35492 @option{-mtune-ctrl=@var{feature-list}}.
35494 @opindex mtune-ctrl=@var{feature-list}
35495 @item -mtune-ctrl=@var{feature-list}
35496 This option is used to do fine grain control of x86 code generation features.
35497 @var{feature-list} is a comma separated list of @var{feature} names. See also
35498 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
35499 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
35500 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
35501 developers. Using it may lead to code paths not covered by testing and can
35502 potentially result in compiler ICEs or runtime errors.
35504 @opindex mno-default
35505 @item -mno-default
35506 This option instructs GCC to turn off all tunable features. See also 
35507 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
35509 @opindex mcld
35510 @item -mcld
35511 This option instructs GCC to emit a @code{cld} instruction in the prologue
35512 of functions that use string instructions.  String instructions depend on
35513 the DF flag to select between autoincrement or autodecrement mode.  While the
35514 ABI specifies the DF flag to be cleared on function entry, some operating
35515 systems violate this specification by not clearing the DF flag in their
35516 exception dispatchers.  The exception handler can be invoked with the DF flag
35517 set, which leads to wrong direction mode when string instructions are used.
35518 This option can be enabled by default on 32-bit x86 targets by configuring
35519 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
35520 instructions can be suppressed with the @option{-mno-cld} compiler option
35521 in this case.
35523 @opindex mvzeroupper
35524 @item -mvzeroupper
35525 This option instructs GCC to emit a @code{vzeroupper} instruction
35526 before a transfer of control flow out of the function to minimize
35527 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
35528 intrinsics.
35530 @opindex mprefer-avx128
35531 @item -mprefer-avx128
35532 This option instructs GCC to use 128-bit AVX instructions instead of
35533 256-bit AVX instructions in the auto-vectorizer.
35535 @opindex mprefer-vector-width
35536 @item -mprefer-vector-width=@var{opt}
35537 This option instructs GCC to use @var{opt}-bit vector width in instructions
35538 instead of default on the selected platform.
35540 @opindex mpartial-vector-fp-math
35541 @item -mpartial-vector-fp-math
35542 This option enables GCC to generate floating-point operations that might
35543 affect the set of floating-point status flags on partial vectors, where
35544 vector elements reside in the low part of the 128-bit SSE register.  Unless
35545 @option{-fno-trapping-math} is specified, the compiler guarantees correct
35546 behavior by sanitizing all input operands to have zeroes in the unused
35547 upper part of the vector register.  Note that by using built-in functions
35548 or inline assembly with partial vector arguments, NaNs, denormal or invalid
35549 values can leak into the upper part of the vector, causing possible
35550 performance issues when @option{-fno-trapping-math} is in effect.  These
35551 issues can be mitigated by manually sanitizing the upper part of the partial
35552 vector argument register or by using @option{-mdaz-ftz} to set
35553 denormals-are-zero (DAZ) flag in the MXCSR register.
35555 This option is enabled by default.
35557 @opindex mmove-max
35558 @item -mmove-max=@var{bits}
35559 This option instructs GCC to set the maximum number of bits can be
35560 moved from memory to memory efficiently to @var{bits}.  The valid
35561 @var{bits} are 128, 256 and 512.
35563 @opindex mstore-max
35564 @item -mstore-max=@var{bits}
35565 This option instructs GCC to set the maximum number of bits can be
35566 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
35567 128, 256 and 512.
35569 @table @samp
35570 @item none
35571 No extra limitations applied to GCC other than defined by the selected platform.
35573 @item 128
35574 Prefer 128-bit vector width for instructions.
35576 @item 256
35577 Prefer 256-bit vector width for instructions.
35579 @item 512
35580 Prefer 512-bit vector width for instructions.
35581 @end table
35583 @opindex mnoreturn-no-callee-saved-registers
35584 @item -mnoreturn-no-callee-saved-registers
35585 This option optimizes functions with @code{noreturn} attribute or
35586 @code{_Noreturn} specifier by not saving in the function prologue callee-saved
35587 registers which are used in the function (except for the @code{BP}
35588 register).  This option can interfere with debugging of the caller of the
35589 @code{noreturn} function or any function further up in the call stack, so it
35590 is not enabled by default.
35592 @opindex mcx16
35593 @item -mcx16
35594 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
35595 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
35596 objects.  This is useful for atomic updates of data structures exceeding one
35597 machine word in size.  The compiler uses this instruction to implement
35598 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
35599 128-bit integers, a library call is always used.
35601 @opindex msahf
35602 @item -msahf
35603 This option enables generation of @code{SAHF} instructions in 64-bit code.
35604 Early Intel Pentium 4 CPUs with Intel 64 support,
35605 prior to the introduction of Pentium 4 G1 step in December 2005,
35606 lacked the @code{LAHF} and @code{SAHF} instructions
35607 which are supported by AMD64.
35608 These are load and store instructions, respectively, for certain status flags.
35609 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
35610 @code{drem}, and @code{remainder} built-in functions;
35611 see @ref{Other Builtins} for details.
35613 @opindex mmovbe
35614 @item -mmovbe
35615 This option enables use of the @code{movbe} instruction to optimize
35616 byte swapping of four and eight byte entities.
35618 @opindex mshstk
35619 @item -mshstk
35620 The @option{-mshstk} option enables shadow stack built-in functions
35621 from x86 Control-flow Enforcement Technology (CET).
35623 @opindex mcrc32
35624 @item -mcrc32
35625 This option enables built-in functions @code{__builtin_ia32_crc32qi},
35626 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
35627 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
35629 @opindex mmwait
35630 @item -mmwait
35631 This option enables built-in functions @code{__builtin_ia32_monitor},
35632 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
35633 @code{mwait} machine instructions.
35635 @opindex mrecip
35636 @item -mrecip
35637 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
35638 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
35639 with an additional Newton-Raphson step
35640 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
35641 (and their vectorized
35642 variants) for single-precision floating-point arguments.  These instructions
35643 are generated only when @option{-funsafe-math-optimizations} is enabled
35644 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
35645 Note that while the throughput of the sequence is higher than the throughput
35646 of the non-reciprocal instruction, the precision of the sequence can be
35647 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
35649 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
35650 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
35651 combination), and doesn't need @option{-mrecip}.
35653 Also note that GCC emits the above sequence with additional Newton-Raphson step
35654 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
35655 already with @option{-ffast-math} (or the above option combination), and
35656 doesn't need @option{-mrecip}.
35658 @opindex mrecip=opt
35659 @item -mrecip=@var{opt}
35660 This option controls which reciprocal estimate instructions
35661 may be used.  @var{opt} is a comma-separated list of options, which may
35662 be preceded by a @samp{!} to invert the option:
35664 @table @samp
35665 @item all
35666 Enable all estimate instructions.
35668 @item default
35669 Enable the default instructions, equivalent to @option{-mrecip}.
35671 @item none
35672 Disable all estimate instructions, equivalent to @option{-mno-recip}.
35674 @item div
35675 Enable the approximation for scalar division.
35677 @item vec-div
35678 Enable the approximation for vectorized division.
35680 @item sqrt
35681 Enable the approximation for scalar square root.
35683 @item vec-sqrt
35684 Enable the approximation for vectorized square root.
35685 @end table
35687 So, for example, @option{-mrecip=all,!sqrt} enables
35688 all of the reciprocal approximations, except for square root.
35690 @opindex mveclibabi
35691 @item -mveclibabi=@var{type}
35692 Specifies the ABI type to use for vectorizing intrinsics using an
35693 external library.  Supported values for @var{type} are @samp{svml} 
35694 for the Intel short
35695 vector math library and @samp{acml} for the AMD math core library.
35696 To use this option, both @option{-ftree-vectorize} and
35697 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
35698 ABI-compatible library must be specified at link time.
35700 GCC currently emits calls to @code{vmldExp2},
35701 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
35702 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
35703 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
35704 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
35705 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
35706 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
35707 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
35708 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
35709 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
35710 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
35711 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
35712 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
35713 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
35714 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
35715 when @option{-mveclibabi=acml} is used.  
35717 @opindex mabi
35718 @item -mabi=@var{name}
35719 Generate code for the specified calling convention.  Permissible values
35720 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
35721 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
35722 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
35723 You can control this behavior for specific functions by
35724 using the function attributes @code{ms_abi} and @code{sysv_abi}.
35725 @xref{Function Attributes}.
35727 @opindex mforce-indirect-call
35728 @item -mforce-indirect-call
35729 Force all calls to functions to be indirect. This is useful
35730 when using Intel Processor Trace where it generates more precise timing
35731 information for function calls.
35733 @opindex mmanual-endbr
35734 @item -mmanual-endbr
35735 Insert ENDBR instruction at function entry only via the @code{cf_check}
35736 function attribute. This is useful when used with the option
35737 @option{-fcf-protection=branch} to control ENDBR insertion at the
35738 function entry.
35740 @opindex mcet-switch
35741 @item -mcet-switch
35742 By default, CET instrumentation is turned off on switch statements that
35743 use a jump table and indirect branch track is disabled.  Since jump
35744 tables are stored in read-only memory, this does not result in a direct
35745 loss of hardening.  But if the jump table index is attacker-controlled,
35746 the indirect jump may not be constrained by CET.  This option turns on
35747 CET instrumentation to enable indirect branch track for switch statements
35748 with jump tables which leads to the jump targets reachable via any indirect
35749 jumps.
35751 @opindex mcall-ms2sysv-xlogues
35752 @opindex mno-call-ms2sysv-xlogues
35753 @item -mcall-ms2sysv-xlogues
35754 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
35755 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
35756 default, the code for saving and restoring these registers is emitted inline,
35757 resulting in fairly lengthy prologues and epilogues.  Using
35758 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
35759 use stubs in the static portion of libgcc to perform these saves and restores,
35760 thus reducing function size at the cost of a few extra instructions.
35762 @opindex mtls-dialect
35763 @item -mtls-dialect=@var{type}
35764 Generate code to access thread-local storage using the @samp{gnu} or
35765 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
35766 @samp{gnu2} is more efficient, but it may add compile- and run-time
35767 requirements that cannot be satisfied on all systems.
35769 @opindex mpush-args
35770 @opindex mno-push-args
35771 @item -mpush-args
35772 @itemx -mno-push-args
35773 Use PUSH operations to store outgoing parameters.  This method is shorter
35774 and usually equally fast as method using SUB/MOV operations and is enabled
35775 by default.  In some cases disabling it may improve performance because of
35776 improved scheduling and reduced dependencies.
35778 @opindex maccumulate-outgoing-args
35779 @item -maccumulate-outgoing-args
35780 If enabled, the maximum amount of space required for outgoing arguments is
35781 computed in the function prologue.  This is faster on most modern CPUs
35782 because of reduced dependencies, improved scheduling and reduced stack usage
35783 when the preferred stack boundary is not equal to 2.  The drawback is a notable
35784 increase in code size.  This switch implies @option{-mno-push-args}.
35786 @opindex mthreads
35787 @item -mthreads
35788 Support thread-safe exception handling on MinGW.  Programs that rely
35789 on thread-safe exception handling must compile and link all code with the
35790 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
35791 @option{-D_MT}; when linking, it links in a special thread helper library
35792 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
35794 @opindex mms-bitfields
35795 @opindex mno-ms-bitfields
35796 @item -mms-bitfields
35797 @itemx -mno-ms-bitfields
35799 Enable/disable bit-field layout compatible with the native Microsoft
35800 Windows compiler.  
35802 If @code{packed} is used on a structure, or if bit-fields are used,
35803 it may be that the Microsoft ABI lays out the structure differently
35804 than the way GCC normally does.  Particularly when moving packed
35805 data between functions compiled with GCC and the native Microsoft compiler
35806 (either via function call or as data in a file), it may be necessary to access
35807 either format.
35809 This option is enabled by default for Microsoft Windows
35810 targets.  This behavior can also be controlled locally by use of variable
35811 or type attributes.  For more information, see @ref{x86 Variable Attributes}
35812 and @ref{x86 Type Attributes}.
35814 The Microsoft structure layout algorithm is fairly simple with the exception
35815 of the bit-field packing.  
35816 The padding and alignment of members of structures and whether a bit-field 
35817 can straddle a storage-unit boundary are determine by these rules:
35819 @enumerate
35820 @item Structure members are stored sequentially in the order in which they are
35821 declared: the first member has the lowest memory address and the last member
35822 the highest.
35824 @item Every data object has an alignment requirement.  The alignment requirement
35825 for all data except structures, unions, and arrays is either the size of the
35826 object or the current packing size (specified with either the
35827 @code{aligned} attribute or the @code{pack} pragma),
35828 whichever is less.  For structures, unions, and arrays,
35829 the alignment requirement is the largest alignment requirement of its members.
35830 Every object is allocated an offset so that:
35832 @smallexample
35833 offset % alignment_requirement == 0
35834 @end smallexample
35836 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
35837 unit if the integral types are the same size and if the next bit-field fits
35838 into the current allocation unit without crossing the boundary imposed by the
35839 common alignment requirements of the bit-fields.
35840 @end enumerate
35842 MSVC interprets zero-length bit-fields in the following ways:
35844 @enumerate
35845 @item If a zero-length bit-field is inserted between two bit-fields that
35846 are normally coalesced, the bit-fields are not coalesced.
35848 For example:
35850 @smallexample
35851 struct
35852  @{
35853    unsigned long bf_1 : 12;
35854    unsigned long : 0;
35855    unsigned long bf_2 : 12;
35856  @} t1;
35857 @end smallexample
35859 @noindent
35860 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
35861 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
35863 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
35864 alignment of the zero-length bit-field is greater than the member that follows it,
35865 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
35867 For example:
35869 @smallexample
35870 struct
35871  @{
35872    char foo : 4;
35873    short : 0;
35874    char bar;
35875  @} t2;
35877 struct
35878  @{
35879    char foo : 4;
35880    short : 0;
35881    double bar;
35882  @} t3;
35883 @end smallexample
35885 @noindent
35886 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
35887 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
35888 bit-field does not affect the alignment of @code{bar} or, as a result, the size
35889 of the structure.
35891 Taking this into account, it is important to note the following:
35893 @enumerate
35894 @item If a zero-length bit-field follows a normal bit-field, the type of the
35895 zero-length bit-field may affect the alignment of the structure as whole. For
35896 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
35897 normal bit-field, and is of type short.
35899 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
35900 still affect the alignment of the structure:
35902 @smallexample
35903 struct
35904  @{
35905    char foo : 6;
35906    long : 0;
35907  @} t4;
35908 @end smallexample
35910 @noindent
35911 Here, @code{t4} takes up 4 bytes.
35912 @end enumerate
35914 @item Zero-length bit-fields following non-bit-field members are ignored:
35916 @smallexample
35917 struct
35918  @{
35919    char foo;
35920    long : 0;
35921    char bar;
35922  @} t5;
35923 @end smallexample
35925 @noindent
35926 Here, @code{t5} takes up 2 bytes.
35927 @end enumerate
35930 @opindex mno-align-stringops
35931 @opindex malign-stringops
35932 @item -mno-align-stringops
35933 Do not align the destination of inlined string operations.  This switch reduces
35934 code size and improves performance in case the destination is already aligned,
35935 but GCC doesn't know about it.
35937 @opindex minline-all-stringops
35938 @item -minline-all-stringops
35939 By default GCC inlines string operations only when the destination is 
35940 known to be aligned to least a 4-byte boundary.  
35941 This enables more inlining and increases code
35942 size, but may improve performance of code that depends on fast
35943 @code{memcpy} and @code{memset} for short lengths.
35944 The option enables inline expansion of @code{strlen} for all
35945 pointer alignments.
35947 @opindex minline-stringops-dynamically
35948 @item -minline-stringops-dynamically
35949 For string operations of unknown size, use run-time checks with
35950 inline code for small blocks and a library call for large blocks.
35952 @opindex mstringop-strategy=@var{alg}
35953 @item -mstringop-strategy=@var{alg}
35954 Override the internal decision heuristic for the particular algorithm to use
35955 for inlining string operations.  The allowed values for @var{alg} are:
35957 @table @samp
35958 @item rep_byte
35959 @itemx rep_4byte
35960 @itemx rep_8byte
35961 Expand using i386 @code{rep} prefix of the specified size.
35963 @item byte_loop
35964 @itemx loop
35965 @itemx unrolled_loop
35966 Expand into an inline loop.
35968 @item libcall
35969 Always use a library call.
35970 @end table
35972 @opindex mmemcpy-strategy=@var{strategy}
35973 @item -mmemcpy-strategy=@var{strategy}
35974 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
35975 should be inlined and what inline algorithm to use when the expected size
35976 of the copy operation is known. @var{strategy} 
35977 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
35978 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
35979 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
35980 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
35981 in the list must be specified in increasing order.  The minimal byte size for 
35982 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
35983 preceding range.
35985 @opindex mmemset-strategy=@var{strategy}
35986 @item -mmemset-strategy=@var{strategy}
35987 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
35988 @code{__builtin_memset} expansion.
35990 @opindex momit-leaf-frame-pointer
35991 @item -momit-leaf-frame-pointer
35992 Don't keep the frame pointer in a register for leaf functions.  This
35993 avoids the instructions to save, set up, and restore frame pointers and
35994 makes an extra register available in leaf functions.  The option
35995 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
35996 which might make debugging harder.
35998 @opindex mtls-direct-seg-refs
35999 @item -mtls-direct-seg-refs
36000 @itemx -mno-tls-direct-seg-refs
36001 Controls whether TLS variables may be accessed with offsets from the
36002 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
36003 or whether the thread base pointer must be added.  Whether or not this
36004 is valid depends on the operating system, and whether it maps the
36005 segment to cover the entire TLS area.
36007 For systems that use the GNU C Library, the default is on.
36009 @opindex msse2avx
36010 @item -msse2avx
36011 @itemx -mno-sse2avx
36012 Specify that the assembler should encode SSE instructions with VEX
36013 prefix.  The option @option{-mavx} turns this on by default.
36015 @opindex mfentry
36016 @item -mfentry
36017 @itemx -mno-fentry
36018 If profiling is active (@option{-pg}), put the profiling
36019 counter call before the prologue.
36020 Note: On x86 architectures the attribute @code{ms_hook_prologue}
36021 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
36023 @opindex mrecord-mcount
36024 @item -mrecord-mcount
36025 @itemx -mno-record-mcount
36026 If profiling is active (@option{-pg}), generate a __mcount_loc section
36027 that contains pointers to each profiling call. This is useful for
36028 automatically patching and out calls.
36030 @opindex mnop-mcount
36031 @item -mnop-mcount
36032 @itemx -mno-nop-mcount
36033 If profiling is active (@option{-pg}), generate the calls to
36034 the profiling functions as NOPs. This is useful when they
36035 should be patched in later dynamically. This is likely only
36036 useful together with @option{-mrecord-mcount}.
36038 @opindex minstrument-return
36039 @item -minstrument-return=@var{type}
36040 Instrument function exit in -pg -mfentry instrumented functions with
36041 call to specified function. This only instruments true returns ending
36042 with ret, but not sibling calls ending with jump. Valid types
36043 are @var{none} to not instrument, @var{call} to generate a call to __return__,
36044 or @var{nop5} to generate a 5 byte nop.
36046 @opindex mrecord-return
36047 @item -mrecord-return
36048 @itemx -mno-record-return
36049 Generate a __return_loc section pointing to all return instrumentation code.
36051 @opindex mfentry-name
36052 @item -mfentry-name=@var{name}
36053 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
36055 @opindex mfentry-section
36056 @item -mfentry-section=@var{name}
36057 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
36059 @opindex mskip-rax-setup
36060 @item -mskip-rax-setup
36061 @itemx -mno-skip-rax-setup
36062 When generating code for the x86-64 architecture with SSE extensions
36063 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
36064 register when there are no variable arguments passed in vector registers.
36066 @strong{Warning:} Since RAX register is used to avoid unnecessarily
36067 saving vector registers on stack when passing variable arguments, the
36068 impacts of this option are callees may waste some stack space,
36069 misbehave or jump to a random location.  GCC 4.4 or newer don't have
36070 those issues, regardless the RAX register value.
36072 @opindex m8bit-idiv
36073 @item -m8bit-idiv
36074 @itemx -mno-8bit-idiv
36075 On some processors, like Intel Atom, 8-bit unsigned integer divide is
36076 much faster than 32-bit/64-bit integer divide.  This option generates a
36077 run-time check.  If both dividend and divisor are within range of 0
36078 to 255, 8-bit unsigned integer divide is used instead of
36079 32-bit/64-bit integer divide.
36081 @opindex mavx256-split-unaligned-load
36082 @opindex mavx256-split-unaligned-store
36083 @item -mavx256-split-unaligned-load
36084 @itemx -mavx256-split-unaligned-store
36085 Split 32-byte AVX unaligned load and store.
36087 @opindex mstack-protector-guard
36088 @opindex mstack-protector-guard-reg
36089 @opindex mstack-protector-guard-offset
36090 @item -mstack-protector-guard=@var{guard}
36091 @itemx -mstack-protector-guard-reg=@var{reg}
36092 @itemx -mstack-protector-guard-offset=@var{offset}
36093 Generate stack protection code using canary at @var{guard}.  Supported
36094 locations are @samp{global} for global canary or @samp{tls} for per-thread
36095 canary in the TLS block (the default).  This option has effect only when
36096 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
36098 With the latter choice the options
36099 @option{-mstack-protector-guard-reg=@var{reg}} and
36100 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
36101 which segment register (@code{%fs} or @code{%gs}) to use as base register
36102 for reading the canary, and from what offset from that base register.
36103 The default for those is as specified in the relevant ABI.
36105 @opindex mgeneral-regs-only
36106 @item -mgeneral-regs-only
36107 Generate code that uses only the general-purpose registers.  This
36108 prevents the compiler from using floating-point, vector, mask and bound
36109 registers.
36111 @opindex mrelax-cmpxchg-loop
36112 @item -mrelax-cmpxchg-loop
36113 When emitting a compare-and-swap loop for @ref{__sync Builtins}
36114 and @ref{__atomic Builtins} lacking a native instruction, optimize
36115 for the highly contended case by issuing an atomic load before the
36116 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
36117 to save CPU power when restarting the loop.
36119 @opindex mindirect-branch
36120 @item -mindirect-branch=@var{choice}
36121 Convert indirect call and jump with @var{choice}.  The default is
36122 @samp{keep}, which keeps indirect call and jump unmodified.
36123 @samp{thunk} converts indirect call and jump to call and return thunk.
36124 @samp{thunk-inline} converts indirect call and jump to inlined call
36125 and return thunk.  @samp{thunk-extern} converts indirect call and jump
36126 to external call and return thunk provided in a separate object file.
36127 You can control this behavior for a specific function by using the
36128 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
36130 Note that @option{-mcmodel=large} is incompatible with
36131 @option{-mindirect-branch=thunk} and
36132 @option{-mindirect-branch=thunk-extern} since the thunk function may
36133 not be reachable in the large code model.
36135 Note that @option{-mindirect-branch=thunk-extern} is compatible with
36136 @option{-fcf-protection=branch} since the external thunk can be made
36137 to enable control-flow check.
36139 @opindex mfunction-return
36140 @item -mfunction-return=@var{choice}
36141 Convert function return with @var{choice}.  The default is @samp{keep},
36142 which keeps function return unmodified.  @samp{thunk} converts function
36143 return to call and return thunk.  @samp{thunk-inline} converts function
36144 return to inlined call and return thunk.  @samp{thunk-extern} converts
36145 function return to external call and return thunk provided in a separate
36146 object file.  You can control this behavior for a specific function by
36147 using the function attribute @code{function_return}.
36148 @xref{Function Attributes}.
36150 Note that @option{-mindirect-return=thunk-extern} is compatible with
36151 @option{-fcf-protection=branch} since the external thunk can be made
36152 to enable control-flow check.
36154 Note that @option{-mcmodel=large} is incompatible with
36155 @option{-mfunction-return=thunk} and
36156 @option{-mfunction-return=thunk-extern} since the thunk function may
36157 not be reachable in the large code model.
36160 @opindex mindirect-branch-register
36161 @item -mindirect-branch-register
36162 Force indirect call and jump via register.
36164 @opindex mharden-sls
36165 @item -mharden-sls=@var{choice}
36166 Generate code to mitigate against straight line speculation (SLS) with
36167 @var{choice}.  The default is @samp{none} which disables all SLS
36168 hardening.  @samp{return} enables SLS hardening for function returns.
36169 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
36170 @samp{all} enables all SLS hardening.
36172 @opindex mindirect-branch-cs-prefix
36173 @item -mindirect-branch-cs-prefix
36174 Add CS prefix to call and jmp to indirect thunk with branch target in
36175 r8-r15 registers so that the call and jmp instruction length is 6 bytes
36176 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
36177 @samp{lfence; jmp *%r8-r15} at run-time.
36179 @opindex mapx-inline-asm-use-gpr32
36180 @item -mapx-inline-asm-use-gpr32
36181 For inline asm support with APX, by default the EGPR feature was
36182 disabled to prevent potential illegal instruction with EGPR occurs.
36183 To invoke egpr usage in inline asm, use new compiler option
36184 -mapx-inline-asm-use-gpr32 and user should ensure the instruction
36185 supports EGPR.
36187 @opindex mevex512
36188 @item -mevex512
36189 @itemx -mno-evex512
36190 Enables/disables 512-bit vector. It will be default on if AVX512F is enabled.
36192 @end table
36194 These @samp{-m} switches are supported in addition to the above
36195 on x86-64 processors in 64-bit environments.
36197 @table @gcctabopt
36198 @opindex m32
36199 @opindex m64
36200 @opindex mx32
36201 @opindex m16
36202 @opindex miamcu
36203 @item -m32
36204 @itemx -m64
36205 @itemx -mx32
36206 @itemx -m16
36207 @itemx -miamcu
36208 Generate code for a 16-bit, 32-bit or 64-bit environment.
36209 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
36210 to 32 bits, and
36211 generates code that runs in 32-bit mode.
36213 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
36214 types to 64 bits, and generates code for the x86-64 architecture.
36215 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
36216 and @option{-mdynamic-no-pic} options.
36218 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
36219 to 32 bits, and
36220 generates code for the x86-64 architecture.
36222 The @option{-m16} option is the same as @option{-m32}, except for that
36223 it outputs the @code{.code16gcc} assembly directive at the beginning of
36224 the assembly output so that the binary can run in 16-bit mode.
36226 The @option{-miamcu} option generates code which conforms to Intel MCU
36227 psABI.  It requires the @option{-m32} option to be turned on.
36229 @opindex mno-red-zone
36230 @opindex mred-zone
36231 @item -mno-red-zone
36232 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
36233 by the x86-64 ABI; it is a 128-byte area beyond the location of the
36234 stack pointer that is not modified by signal or interrupt handlers
36235 and therefore can be used for temporary data without adjusting the stack
36236 pointer.  The flag @option{-mno-red-zone} disables this red zone.
36238 @opindex mcmodel=small
36239 @item -mcmodel=small
36240 Generate code for the small code model: the program and its symbols must
36241 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
36242 Programs can be statically or dynamically linked.  This is the default
36243 code model.
36245 @opindex mcmodel=kernel
36246 @item -mcmodel=kernel
36247 Generate code for the kernel code model.  The kernel runs in the
36248 negative 2 GB of the address space.
36249 This model has to be used for Linux kernel code.
36251 @opindex mcmodel=medium
36252 @item -mcmodel=medium
36253 Generate code for the medium model: the program is linked in the lower 2
36254 GB of the address space.  Small symbols are also placed there.  Symbols
36255 with sizes larger than @option{-mlarge-data-threshold} are put into
36256 large data or BSS sections and can be located above 2GB.  Programs can
36257 be statically or dynamically linked.
36259 @opindex mcmodel=large
36260 @item -mcmodel=large
36261 Generate code for the large model.  This model makes no assumptions
36262 about addresses and sizes of sections.
36264 @opindex maddress-mode=long
36265 @item -maddress-mode=long
36266 Generate code for long address mode.  This is only supported for 64-bit
36267 and x32 environments.  It is the default address mode for 64-bit
36268 environments.
36270 @opindex maddress-mode=short
36271 @item -maddress-mode=short
36272 Generate code for short address mode.  This is only supported for 32-bit
36273 and x32 environments.  It is the default address mode for 32-bit and
36274 x32 environments.
36276 @opindex mneeded
36277 @item -mneeded
36278 @itemx -mno-needed
36279 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
36280 indicate the micro-architecture ISA level required to execute the binary.
36282 @opindex mno-direct-extern-access
36283 @opindex mdirect-extern-access
36284 @item -mno-direct-extern-access
36285 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
36286 to access external symbols.  With @option{-fpic} or @option{-fPIC},
36287 treat access to protected symbols as local symbols.  The default is
36288 @option{-mdirect-extern-access}.
36290 @strong{Warning:} shared libraries compiled with
36291 @option{-mno-direct-extern-access} and executable compiled with
36292 @option{-mdirect-extern-access} may not be binary compatible if
36293 protected symbols are used in shared libraries and executable.
36295 @opindex munroll-only-small-loops
36296 @opindex mno-unroll-only-small-loops
36297 @item -munroll-only-small-loops
36298 Controls conservative small loop unrolling. It is default enabled by
36299 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
36300 -f[no-]unroll-[all-]loops would disable this flag to avoid any
36301 unintended unrolling behavior that user does not want.
36303 @opindex mlam
36304 @item -mlam=@var{choice}
36305 LAM(linear-address masking) allows special bits in the pointer to be used
36306 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
36307 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
36308 positions 62:57 can be used for metadata.
36309 @end table
36311 @node x86 Windows Options
36312 @subsection x86 Windows Options
36313 @cindex x86 Windows Options
36314 @cindex Windows Options for x86
36316 These additional options are available for Microsoft Windows targets:
36318 @table @gcctabopt
36319 @opindex mconsole
36320 @item -mconsole
36321 This option
36322 specifies that a console application is to be generated, by
36323 instructing the linker to set the PE header subsystem type
36324 required for console applications.
36325 This option is available for Cygwin and MinGW targets and is
36326 enabled by default on those targets.
36328 @opindex mcrtdll
36329 @item -mcrtdll=@var{library}
36330 Preprocess, compile or link with specified C RunTime DLL @var{library}.
36331 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
36332 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
36333 start file for CRT @var{library} and link with CRT @var{library}.
36334 Recognized CRT library names for proprocessor are:
36335 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
36336 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
36337 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
36338 If this options is not specified then the default MinGW import library
36339 @code{msvcrt} is used for linking and no other adjustment for
36340 preprocessor is done. MinGW import library @code{msvcrt} is just a
36341 symlink to (or a copy of) another MinGW CRT import library
36342 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
36343 is for Windows system CRT DLL library @code{msvcrt.dll} and
36344 in most cases is the default MinGW import library.
36345 Generally speaking, changing the CRT DLL requires recompiling
36346 the entire MinGW CRT. This option is for experimental and testing
36347 purposes only.
36348 This option is available for MinGW targets.
36350 @opindex mdll
36351 @item -mdll
36352 This option is available for Cygwin and MinGW targets.  It
36353 specifies that a DLL---a dynamic link library---is to be
36354 generated, enabling the selection of the required runtime
36355 startup object and entry point.
36357 @opindex mnop-fun-dllimport
36358 @item -mnop-fun-dllimport
36359 This option is available for Cygwin and MinGW targets.  It
36360 specifies that the @code{dllimport} attribute should be ignored.
36362 @opindex mthreads
36363 @item -mthreads
36364 This option is available for MinGW targets. It specifies
36365 that MinGW-specific thread support is to be used.
36367 @opindex municode
36368 @item -municode
36369 This option is available for MinGW-w64 targets.  It causes
36370 the @code{UNICODE} preprocessor macro to be predefined, and
36371 chooses Unicode-capable runtime startup code.
36373 @opindex mwin32
36374 @item -mwin32
36375 This option is available for Cygwin and MinGW targets.  It
36376 specifies that the typical Microsoft Windows predefined macros are to
36377 be set in the pre-processor, but does not influence the choice
36378 of runtime library/startup code.
36380 @opindex mwindows
36381 @item -mwindows
36382 This option is available for Cygwin and MinGW targets.  It
36383 specifies that a GUI application is to be generated by
36384 instructing the linker to set the PE header subsystem type
36385 appropriately.
36387 @opindex fno-set-stack-executable
36388 @opindex fset-stack-executable
36389 @item -fno-set-stack-executable
36390 This option is available for MinGW targets. It specifies that
36391 the executable flag for the stack used by nested functions isn't
36392 set. This is necessary for binaries running in kernel mode of
36393 Microsoft Windows, as there the User32 API, which is used to set executable
36394 privileges, isn't available.
36396 @opindex fno-writable-relocated-rdata
36397 @opindex fwritable-relocated-rdata
36398 @item -fwritable-relocated-rdata
36399 This option is available for MinGW and Cygwin targets.  It specifies
36400 that relocated-data in read-only section is put into the @code{.data}
36401 section.  This is a necessary for older runtimes not supporting
36402 modification of @code{.rdata} sections for pseudo-relocation.
36404 @opindex mpe-aligned-commons
36405 @item -mpe-aligned-commons
36406 This option is available for Cygwin and MinGW targets.  It
36407 specifies that the GNU extension to the PE file format that
36408 permits the correct alignment of COMMON variables should be
36409 used when generating code.  It is enabled by default if
36410 GCC detects that the target assembler found during configuration
36411 supports the feature.
36412 @end table
36414 See also under @ref{x86 Options} for standard options.
36416 @node Xstormy16 Options
36417 @subsection Xstormy16 Options
36418 @cindex Xstormy16 Options
36420 These options are defined for Xstormy16:
36422 @table @gcctabopt
36423 @opindex msim
36424 @item -msim
36425 Choose startup files and linker script suitable for the simulator.
36426 @end table
36428 @node Xtensa Options
36429 @subsection Xtensa Options
36430 @cindex Xtensa Options
36432 These options are supported for Xtensa targets:
36434 @table @gcctabopt
36435 @opindex mconst16
36436 @opindex mno-const16
36437 @item -mconst16
36438 @itemx -mno-const16
36439 Enable or disable use of @code{CONST16} instructions for loading
36440 constant values.  The @code{CONST16} instruction is currently not a
36441 standard option from Tensilica.  When enabled, @code{CONST16}
36442 instructions are always used in place of the standard @code{L32R}
36443 instructions.  The use of @code{CONST16} is enabled by default only if
36444 the @code{L32R} instruction is not available.
36446 @opindex mfused-madd
36447 @opindex mno-fused-madd
36448 @item -mfused-madd
36449 @itemx -mno-fused-madd
36450 Enable or disable use of fused multiply/add and multiply/subtract
36451 instructions in the floating-point option.  This has no effect if the
36452 floating-point option is not also enabled.  Disabling fused multiply/add
36453 and multiply/subtract instructions forces the compiler to use separate
36454 instructions for the multiply and add/subtract operations.  This may be
36455 desirable in some cases where strict IEEE 754-compliant results are
36456 required: the fused multiply add/subtract instructions do not round the
36457 intermediate result, thereby producing results with @emph{more} bits of
36458 precision than specified by the IEEE standard.  Disabling fused multiply
36459 add/subtract instructions also ensures that the program output is not
36460 sensitive to the compiler's ability to combine multiply and add/subtract
36461 operations.
36463 @opindex mserialize-volatile
36464 @opindex mno-serialize-volatile
36465 @item -mserialize-volatile
36466 @itemx -mno-serialize-volatile
36467 When this option is enabled, GCC inserts @code{MEMW} instructions before
36468 @code{volatile} memory references to guarantee sequential consistency.
36469 The default is @option{-mserialize-volatile}.  Use
36470 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
36472 @opindex mforce-no-pic
36473 @item -mforce-no-pic
36474 For targets, like GNU/Linux, where all user-mode Xtensa code must be
36475 position-independent code (PIC), this option disables PIC for compiling
36476 kernel code.
36478 @opindex mtext-section-literals
36479 @opindex mno-text-section-literals
36480 @item -mtext-section-literals
36481 @itemx -mno-text-section-literals
36482 These options control the treatment of literal pools.  The default is
36483 @option{-mno-text-section-literals}, which places literals in a separate
36484 section in the output file.  This allows the literal pool to be placed
36485 in a data RAM/ROM, and it also allows the linker to combine literal
36486 pools from separate object files to remove redundant literals and
36487 improve code size.  With @option{-mtext-section-literals}, the literals
36488 are interspersed in the text section in order to keep them as close as
36489 possible to their references.  This may be necessary for large assembly
36490 files.  Literals for each function are placed right before that function.
36492 @opindex mauto-litpools
36493 @opindex mno-auto-litpools
36494 @item -mauto-litpools
36495 @itemx -mno-auto-litpools
36496 These options control the treatment of literal pools.  The default is
36497 @option{-mno-auto-litpools}, which places literals in a separate
36498 section in the output file unless @option{-mtext-section-literals} is
36499 used.  With @option{-mauto-litpools} the literals are interspersed in
36500 the text section by the assembler.  Compiler does not produce explicit
36501 @code{.literal} directives and loads literals into registers with
36502 @code{MOVI} instructions instead of @code{L32R} to let the assembler
36503 do relaxation and place literals as necessary.  This option allows
36504 assembler to create several literal pools per function and assemble
36505 very big functions, which may not be possible with
36506 @option{-mtext-section-literals}.
36508 @opindex mtarget-align
36509 @opindex mno-target-align
36510 @item -mtarget-align
36511 @itemx -mno-target-align
36512 When this option is enabled, GCC instructs the assembler to
36513 automatically align instructions to reduce branch penalties at the
36514 expense of some code density.  The assembler attempts to widen density
36515 instructions to align branch targets and the instructions following call
36516 instructions.  If there are not enough preceding safe density
36517 instructions to align a target, no widening is performed.  The
36518 default is @option{-mtarget-align}.  These options do not affect the
36519 treatment of auto-aligned instructions like @code{LOOP}, which the
36520 assembler always aligns, either by widening density instructions or
36521 by inserting NOP instructions.
36523 @opindex mlongcalls
36524 @opindex mno-longcalls
36525 @item -mlongcalls
36526 @itemx -mno-longcalls
36527 When this option is enabled, GCC instructs the assembler to translate
36528 direct calls to indirect calls unless it can determine that the target
36529 of a direct call is in the range allowed by the call instruction.  This
36530 translation typically occurs for calls to functions in other source
36531 files.  Specifically, the assembler translates a direct @code{CALL}
36532 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
36533 The default is @option{-mno-longcalls}.  This option should be used in
36534 programs where the call target can potentially be out of range.  This
36535 option is implemented in the assembler, not the compiler, so the
36536 assembly code generated by GCC still shows direct call
36537 instructions---look at the disassembled object code to see the actual
36538 instructions.  Note that the assembler uses an indirect call for
36539 every cross-file call, not just those that really are out of range.
36541 @opindex mabi
36542 @item -mabi=@var{name}
36543 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
36544 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
36546 @opindex mabi=call0
36547 @item -mabi=call0
36548 When this option is enabled function parameters are passed in registers
36549 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
36550 caller-saved, and register @code{a15} may be used as a frame pointer.
36551 When this version of the ABI is enabled the C preprocessor symbol
36552 @code{__XTENSA_CALL0_ABI__} is defined.
36554 @opindex mabi=windowed
36555 @item -mabi=windowed
36556 When this option is enabled function parameters are passed in registers
36557 @code{a10} through @code{a15}, and called function rotates register window
36558 by 8 registers on entry so that its arguments are found in registers
36559 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
36560 pointer.  Register window is rotated 8 registers back upon return.
36561 When this version of the ABI is enabled the C preprocessor symbol
36562 @code{__XTENSA_WINDOWED_ABI__} is defined.
36564 @opindex mextra-l32r-costs
36565 @item -mextra-l32r-costs=@var{n}
36566 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
36567 instructions, in clock cycles.  This affects, when optimizing for speed,
36568 whether loading a constant from literal pool using @code{L32R} or
36569 synthesizing the constant from a small one with a couple of arithmetic
36570 instructions.  The default value is 0.
36572 @opindex mstrict-align
36573 @opindex mno-strict-align
36574 @item -mstrict-align
36575 @itemx -mno-strict-align
36576 Avoid or allow generating memory accesses that may not be aligned on a natural
36577 object boundary as described in the architecture specification.
36578 The default is @option{-mno-strict-align} for cores that support both
36579 unaligned loads and stores in hardware and @option{-mstrict-align} for all
36580 other cores.
36582 @end table
36584 @node zSeries Options
36585 @subsection zSeries Options
36586 @cindex zSeries options
36588 These are listed under @xref{S/390 and zSeries Options}.
36591 @c man end
36593 @node Spec Files
36594 @section Specifying Subprocesses and the Switches to Pass to Them
36595 @cindex Spec Files
36597 @command{gcc} is a driver program.  It performs its job by invoking a
36598 sequence of other programs to do the work of compiling, assembling and
36599 linking.  GCC interprets its command-line parameters and uses these to
36600 deduce which programs it should invoke, and which command-line options
36601 it ought to place on their command lines.  This behavior is controlled
36602 by @dfn{spec strings}.  In most cases there is one spec string for each
36603 program that GCC can invoke, but a few programs have multiple spec
36604 strings to control their behavior.  The spec strings built into GCC can
36605 be overridden by using the @option{-specs=} command-line switch to specify
36606 a spec file.
36608 @dfn{Spec files} are plain-text files that are used to construct spec
36609 strings.  They consist of a sequence of directives separated by blank
36610 lines.  The type of directive is determined by the first non-whitespace
36611 character on the line, which can be one of the following:
36613 @table @code
36614 @item %@var{command}
36615 Issues a @var{command} to the spec file processor.  The commands that can
36616 appear here are:
36618 @table @code
36619 @cindex @code{%include}
36620 @item %include <@var{file}>
36621 Search for @var{file} and insert its text at the current point in the
36622 specs file.
36624 @cindex @code{%include_noerr}
36625 @item %include_noerr <@var{file}>
36626 Just like @samp{%include}, but do not generate an error message if the include
36627 file cannot be found.
36629 @cindex @code{%rename}
36630 @item %rename @var{old_name} @var{new_name}
36631 Rename the spec string @var{old_name} to @var{new_name}.
36633 @end table
36635 @item *[@var{spec_name}]:
36636 This tells the compiler to create, override or delete the named spec
36637 string.  All lines after this directive up to the next directive or
36638 blank line are considered to be the text for the spec string.  If this
36639 results in an empty string then the spec is deleted.  (Or, if the
36640 spec did not exist, then nothing happens.)  Otherwise, if the spec
36641 does not currently exist a new spec is created.  If the spec does
36642 exist then its contents are overridden by the text of this
36643 directive, unless the first character of that text is the @samp{+}
36644 character, in which case the text is appended to the spec.
36646 @item [@var{suffix}]:
36647 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
36648 and up to the next directive or blank line are considered to make up the
36649 spec string for the indicated suffix.  When the compiler encounters an
36650 input file with the named suffix, it processes the spec string in
36651 order to work out how to compile that file.  For example:
36653 @smallexample
36654 .ZZ:
36655 z-compile -input %i
36656 @end smallexample
36658 This says that any input file whose name ends in @samp{.ZZ} should be
36659 passed to the program @samp{z-compile}, which should be invoked with the
36660 command-line switch @option{-input} and with the result of performing the
36661 @samp{%i} substitution.  (See below.)
36663 As an alternative to providing a spec string, the text following a
36664 suffix directive can be one of the following:
36666 @table @code
36667 @item @@@var{language}
36668 This says that the suffix is an alias for a known @var{language}.  This is
36669 similar to using the @option{-x} command-line switch to GCC to specify a
36670 language explicitly.  For example:
36672 @smallexample
36673 .ZZ:
36674 @@c++
36675 @end smallexample
36677 Says that .ZZ files are, in fact, C++ source files.
36679 @item #@var{name}
36680 This causes an error messages saying:
36682 @smallexample
36683 @var{name} compiler not installed on this system.
36684 @end smallexample
36685 @end table
36687 GCC already has an extensive list of suffixes built into it.
36688 This directive adds an entry to the end of the list of suffixes, but
36689 since the list is searched from the end backwards, it is effectively
36690 possible to override earlier entries using this technique.
36692 @end table
36694 GCC has the following spec strings built into it.  Spec files can
36695 override these strings or create their own.  Note that individual
36696 targets can also add their own spec strings to this list.
36698 @smallexample
36699 asm          Options to pass to the assembler
36700 asm_final    Options to pass to the assembler post-processor
36701 cpp          Options to pass to the C preprocessor
36702 cc1          Options to pass to the C compiler
36703 cc1plus      Options to pass to the C++ compiler
36704 endfile      Object files to include at the end of the link
36705 link         Options to pass to the linker
36706 lib          Libraries to include on the command line to the linker
36707 libgcc       Decides which GCC support library to pass to the linker
36708 linker       Sets the name of the linker
36709 predefines   Defines to be passed to the C preprocessor
36710 signed_char  Defines to pass to CPP to say whether @code{char} is signed
36711              by default
36712 startfile    Object files to include at the start of the link
36713 @end smallexample
36715 Here is a small example of a spec file:
36717 @smallexample
36718 %rename lib                 old_lib
36720 *lib:
36721 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
36722 @end smallexample
36724 This example renames the spec called @samp{lib} to @samp{old_lib} and
36725 then overrides the previous definition of @samp{lib} with a new one.
36726 The new definition adds in some extra command-line options before
36727 including the text of the old definition.
36729 @dfn{Spec strings} are a list of command-line options to be passed to their
36730 corresponding program.  In addition, the spec strings can contain
36731 @samp{%}-prefixed sequences to substitute variable text or to
36732 conditionally insert text into the command line.  Using these constructs
36733 it is possible to generate quite complex command lines.
36735 Here is a table of all defined @samp{%}-sequences for spec
36736 strings.  Note that spaces are not generated automatically around the
36737 results of expanding these sequences.  Therefore you can concatenate them
36738 together or combine them with constant text in a single argument.
36740 @table @code
36741 @item %%
36742 Substitute one @samp{%} into the program name or argument.
36744 @item %"
36745 Substitute an empty argument.
36747 @item %i
36748 Substitute the name of the input file being processed.
36750 @item %b
36751 Substitute the basename for outputs related with the input file being
36752 processed.  This is often the substring up to (and not including) the
36753 last period and not including the directory but, unless %w is active, it
36754 expands to the basename for auxiliary outputs, which may be influenced
36755 by an explicit output name, and by various other options that control
36756 how auxiliary outputs are named.
36758 @item %B
36759 This is the same as @samp{%b}, but include the file suffix (text after
36760 the last period).  Without %w, it expands to the basename for dump
36761 outputs.
36763 @item %d
36764 Marks the argument containing or following the @samp{%d} as a
36765 temporary file name, so that that file is deleted if GCC exits
36766 successfully.  Unlike @samp{%g}, this contributes no text to the
36767 argument.
36769 @item %g@var{suffix}
36770 Substitute a file name that has suffix @var{suffix} and is chosen
36771 once per compilation, and mark the argument in the same way as
36772 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
36773 name is now chosen in a way that is hard to predict even when previously
36774 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
36775 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
36776 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
36777 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
36778 was simply substituted with a file name chosen once per compilation,
36779 without regard to any appended suffix (which was therefore treated
36780 just like ordinary text), making such attacks more likely to succeed.
36782 @item %u@var{suffix}
36783 Like @samp{%g}, but generates a new temporary file name
36784 each time it appears instead of once per compilation.
36786 @item %U@var{suffix}
36787 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
36788 new one if there is no such last file name.  In the absence of any
36789 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
36790 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
36791 involves the generation of two distinct file names, one
36792 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
36793 simply substituted with a file name chosen for the previous @samp{%u},
36794 without regard to any appended suffix.
36796 @item %j@var{suffix}
36797 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
36798 writable, and if @option{-save-temps} is not used; 
36799 otherwise, substitute the name
36800 of a temporary file, just like @samp{%u}.  This temporary file is not
36801 meant for communication between processes, but rather as a junk
36802 disposal mechanism.
36804 @item %|@var{suffix}
36805 @itemx %m@var{suffix}
36806 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
36807 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
36808 all.  These are the two most common ways to instruct a program that it
36809 should read from standard input or write to standard output.  If you
36810 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
36811 construct: see for example @file{gcc/fortran/lang-specs.h}.
36813 @item %.@var{SUFFIX}
36814 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
36815 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
36816 terminated by the next space or %.
36818 @item %w
36819 Marks the argument containing or following the @samp{%w} as the
36820 designated output file of this compilation.  This puts the argument
36821 into the sequence of arguments that @samp{%o} substitutes.
36823 @item %V
36824 Indicates that this compilation produces no output file.
36826 @item %o
36827 Substitutes the names of all the output files, with spaces
36828 automatically placed around them.  You should write spaces
36829 around the @samp{%o} as well or the results are undefined.
36830 @samp{%o} is for use in the specs for running the linker.
36831 Input files whose names have no recognized suffix are not compiled
36832 at all, but they are included among the output files, so they are
36833 linked.
36835 @item %O
36836 Substitutes the suffix for object files.  Note that this is
36837 handled specially when it immediately follows @samp{%g, %u, or %U},
36838 because of the need for those to form complete file names.  The
36839 handling is such that @samp{%O} is treated exactly as if it had already
36840 been substituted, except that @samp{%g, %u, and %U} do not currently
36841 support additional @var{suffix} characters following @samp{%O} as they do
36842 following, for example, @samp{.o}.
36844 @item %I
36845 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
36846 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
36847 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
36848 and @option{-imultilib} as necessary.
36850 @item %s
36851 Current argument is the name of a library or startup file of some sort.
36852 Search for that file in a standard list of directories and substitute
36853 the full name found.  The current working directory is included in the
36854 list of directories scanned.
36856 @item %T
36857 Current argument is the name of a linker script.  Search for that file
36858 in the current list of directories to scan for libraries. If the file
36859 is located insert a @option{--script} option into the command line
36860 followed by the full path name found.  If the file is not found then
36861 generate an error message.  Note: the current working directory is not
36862 searched.
36864 @item %e@var{str}
36865 Print @var{str} as an error message.  @var{str} is terminated by a newline.
36866 Use this when inconsistent options are detected.
36868 @item %n@var{str}
36869 Print @var{str} as a notice.  @var{str} is terminated by a newline.
36871 @item %(@var{name})
36872 Substitute the contents of spec string @var{name} at this point.
36874 @item %x@{@var{option}@}
36875 Accumulate an option for @samp{%X}.
36877 @item %X
36878 Output the accumulated linker options specified by a @samp{%x} spec string.
36880 @item %Y
36881 Output the accumulated assembler options specified by @option{-Wa}.
36883 @item %Z
36884 Output the accumulated preprocessor options specified by @option{-Wp}.
36886 @item %M
36887 Output @code{multilib_os_dir}.
36889 @item %R
36890 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
36892 @item %a
36893 Process the @code{asm} spec.  This is used to compute the
36894 switches to be passed to the assembler.
36896 @item %A
36897 Process the @code{asm_final} spec.  This is a spec string for
36898 passing switches to an assembler post-processor, if such a program is
36899 needed.
36901 @item %l
36902 Process the @code{link} spec.  This is the spec for computing the
36903 command line passed to the linker.  Typically it makes use of the
36904 @samp{%L %G %S %D and %E} sequences.
36906 @item %D
36907 Dump out a @option{-L} option for each directory that GCC believes might
36908 contain startup files.  If the target supports multilibs then the
36909 current multilib directory is prepended to each of these paths.
36911 @item %L
36912 Process the @code{lib} spec.  This is a spec string for deciding which
36913 libraries are included on the command line to the linker.
36915 @item %G
36916 Process the @code{libgcc} spec.  This is a spec string for deciding
36917 which GCC support library is included on the command line to the linker.
36919 @item %S
36920 Process the @code{startfile} spec.  This is a spec for deciding which
36921 object files are the first ones passed to the linker.  Typically
36922 this might be a file named @file{crt0.o}.
36924 @item %E
36925 Process the @code{endfile} spec.  This is a spec string that specifies
36926 the last object files that are passed to the linker.
36928 @item %C
36929 Process the @code{cpp} spec.  This is used to construct the arguments
36930 to be passed to the C preprocessor.
36932 @item %1
36933 Process the @code{cc1} spec.  This is used to construct the options to be
36934 passed to the actual C compiler (@command{cc1}).
36936 @item %2
36937 Process the @code{cc1plus} spec.  This is used to construct the options to be
36938 passed to the actual C++ compiler (@command{cc1plus}).
36940 @item %*
36941 Substitute the variable part of a matched option.  See below.
36942 Note that each comma in the substituted string is replaced by
36943 a single space.
36945 @item %<@var{S}
36946 Remove all occurrences of @code{-@var{S}} from the command line.  Note---this
36947 command is position dependent.  @samp{%} commands in the spec string
36948 before this one see @code{-@var{S}}, @samp{%} commands in the spec string
36949 after this one do not.
36951 @item %<@var{S}*
36952 Similar to @samp{%<@var{S}}, but match all switches beginning with @code{-@var{S}}.
36954 @item %>@var{S}
36955 Similar to @samp{%<@var{S}}, but keep @code{-@var{S}} in the GCC command line.
36957 @item %:@var{function}(@var{args})
36958 Call the named function @var{function}, passing it @var{args}.
36959 @var{args} is first processed as a nested spec string, then split
36960 into an argument vector in the usual fashion.  The function returns
36961 a string which is processed as if it had appeared literally as part
36962 of the current spec.
36964 The following built-in spec functions are provided:
36966 @table @code
36967 @item @code{getenv}
36968 The @code{getenv} spec function takes two arguments: an environment
36969 variable name and a string.  If the environment variable is not
36970 defined, a fatal error is issued.  Otherwise, the return value is the
36971 value of the environment variable concatenated with the string.  For
36972 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
36974 @smallexample
36975 %:getenv(TOPDIR /include)
36976 @end smallexample
36978 expands to @file{/path/to/top/include}.
36980 @item @code{if-exists}
36981 The @code{if-exists} spec function takes one argument, an absolute
36982 pathname to a file.  If the file exists, @code{if-exists} returns the
36983 pathname.  Here is a small example of its usage:
36985 @smallexample
36986 *startfile:
36987 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
36988 @end smallexample
36990 @item @code{if-exists-else}
36991 The @code{if-exists-else} spec function is similar to the @code{if-exists}
36992 spec function, except that it takes two arguments.  The first argument is
36993 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
36994 returns the pathname.  If it does not exist, it returns the second argument.
36995 This way, @code{if-exists-else} can be used to select one file or another,
36996 based on the existence of the first.  Here is a small example of its usage:
36998 @smallexample
36999 *startfile:
37000 crt0%O%s %:if-exists(crti%O%s) \
37001 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
37002 @end smallexample
37004 @item @code{if-exists-then-else}
37005 The @code{if-exists-then-else} spec function takes at least two arguments
37006 and an optional third one. The first argument is an absolute pathname to a
37007 file.  If the file exists, the function returns the second argument.
37008 If the file does not exist, the function returns the third argument if there
37009 is one, or NULL otherwise. This can be used to expand one text, or optionally
37010 another, based on the existence of a file.  Here is a small example of its
37011 usage:
37013 @smallexample
37014 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
37015 @end smallexample
37017 @item @code{sanitize}
37018 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
37019 any address, thread or undefined behavior sanitizers are active.
37021 @smallexample
37022 %@{%:sanitize(address):-funwind-tables@}
37023 @end smallexample
37025 @item @code{replace-outfile}
37026 The @code{replace-outfile} spec function takes two arguments.  It looks for the
37027 first argument in the outfiles array and replaces it with the second argument.  Here
37028 is a small example of its usage:
37030 @smallexample
37031 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
37032 @end smallexample
37034 @item @code{remove-outfile}
37035 The @code{remove-outfile} spec function takes one argument.  It looks for the
37036 first argument in the outfiles array and removes it.  Here is a small example
37037 its usage:
37039 @smallexample
37040 %:remove-outfile(-lm)
37041 @end smallexample
37043 @item @code{version-compare}
37044 The @code{version-compare} spec function takes four or five arguments of the following
37045 form:
37047 @smallexample
37048 <comparison-op> <arg1> [<arg2>] <switch> <result>
37049 @end smallexample
37051 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
37052 The supported @code{comparison-op} values are:
37054 @table @code
37055 @item >=
37056 True if @code{switch} is a later (or same) version than @code{arg1}
37058 @item !>
37059 Opposite of @code{>=}
37061 @item <
37062 True if @code{switch} is an earlier version than @code{arg1}
37064 @item !<
37065 Opposite of @code{<}
37067 @item ><
37068 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
37070 @item <>
37071 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
37072 @end table
37074 If the @code{switch} is not present at all, the condition is false unless the first character
37075 of the @code{comparison-op} is @code{!}.
37077 @smallexample
37078 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
37079 @end smallexample
37081 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
37082 passed.
37084 @item @code{include}
37085 The @code{include} spec function behaves much like @code{%include}, with the advantage
37086 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
37087 the filename, and looks for it in the startfile path.  It always returns NULL.
37089 @smallexample
37090 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
37091 @end smallexample
37093 @item @code{pass-through-libs}
37094 The @code{pass-through-libs} spec function takes any number of arguments.  It
37095 finds any @option{-l} options and any non-options ending in @file{.a} (which it
37096 assumes are the names of linker input library archive files) and returns a
37097 result containing all the found arguments each prepended by
37098 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
37099 intended to be passed to the LTO linker plugin.
37101 @smallexample
37102 %:pass-through-libs(%G %L %G)
37103 @end smallexample
37105 @item @code{print-asm-header}
37106 The @code{print-asm-header} function takes no arguments and simply
37107 prints a banner like:
37109 @smallexample
37110 Assembler options
37111 =================
37113 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
37114 @end smallexample
37116 It is used to separate compiler options from assembler options
37117 in the @option{--target-help} output.
37119 @item @code{gt}
37120 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
37121 empty string) if the second-to-last argument is greater than the last argument, and NULL
37122 otherwise.  The following example inserts the @code{link_gomp} spec if the last
37123 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
37125 @smallexample
37126 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
37127 @end smallexample
37129 @item @code{debug-level-gt}
37130 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
37131 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
37132 otherwise.
37134 @smallexample
37135 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
37136 @end smallexample
37137 @end table
37139 @item %@{@var{S}@}
37140 Substitutes the @code{-@var{S}} switch, if that switch is given to GCC@.
37141 If that switch is not specified, this substitutes nothing.  Note that
37142 the leading dash is omitted when specifying this option, and it is
37143 automatically inserted if the substitution is performed.  Thus the spec
37144 string @samp{%@{foo@}} matches the command-line option @option{-foo}
37145 and outputs the command-line option @option{-foo}.
37147 @item %W@{@var{S}@}
37148 Like %@{@code{@var{S}}@} but mark last argument supplied within as a file to be
37149 deleted on failure.
37151 @item %@@@{@var{S}@}
37152 Like %@{@code{@var{S}}@} but puts the result into a @code{FILE} and substitutes
37153 @code{@@FILE} if an @code{@@file} argument has been supplied.
37155 @item %@{@var{S}*@}
37156 Substitutes all the switches specified to GCC whose names start
37157 with @code{-@var{S}}, but which also take an argument.  This is used for
37158 switches like @option{-o}, @option{-D}, @option{-I}, etc.
37159 GCC considers @option{-o foo} as being
37160 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
37161 text, including the space.  Thus two arguments are generated.
37163 @item %@{@var{S}*&@var{T}*@}
37164 Like %@{@code{@var{S}}*@}, but preserve order of @code{@var{S}} and @code{@var{T}} options
37165 (the order of @code{@var{S}} and @code{@var{T}} in the spec is not significant).
37166 There can be any number of ampersand-separated variables; for each the
37167 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
37169 @item %@{@var{S}:@var{X}@}
37170 Substitutes @code{@var{X}}, if the @option{-@var{S}} switch is given to GCC@.
37172 @item %@{!@var{S}:@var{X}@}
37173 Substitutes @code{@var{X}}, if the @option{-@var{S}} switch is @emph{not} given to GCC@.
37175 @item %@{@var{S}*:@var{X}@}
37176 Substitutes @code{@var{X}} if one or more switches whose names start with
37177 @code{-@var{S}} are specified to GCC@.  Normally @code{@var{X}} is substituted only
37178 once, no matter how many such switches appeared.  However, if @code{%*}
37179 appears somewhere in @code{@var{X}}, then @code{@var{X}} is substituted once
37180 for each matching switch, with the @code{%*} replaced by the part of
37181 that switch matching the @code{*}.
37183 If @code{%*} appears as the last part of a spec sequence then a space
37184 is added after the end of the last substitution.  If there is more
37185 text in the sequence, however, then a space is not generated.  This
37186 allows the @code{%*} substitution to be used as part of a larger
37187 string.  For example, a spec string like this:
37189 @smallexample
37190 %@{mcu=*:--script=%*/memory.ld@}
37191 @end smallexample
37193 @noindent
37194 when matching an option like @option{-mcu=newchip} produces:
37196 @smallexample
37197 --script=newchip/memory.ld
37198 @end smallexample
37200 @item %@{.@var{S}:@var{X}@}
37201 Substitutes @code{@var{X}}, if processing a file with suffix @code{@var{S}}.
37203 @item %@{!.@var{S}:@var{X}@}
37204 Substitutes @code{@var{X}}, if @emph{not} processing a file with suffix @code{@var{S}}.
37206 @item %@{,@var{S}:@var{X}@}
37207 Substitutes @code{@var{X}}, if processing a file for language @code{@var{S}}.
37209 @item %@{!,@var{S}:@var{X}@}
37210 Substitutes @code{@var{X}}, if not processing a file for language @code{@var{S}}.
37212 @item %@{@var{S}|@var{P}:@var{X}@}
37213 Substitutes @code{@var{X}} if either @code{-@var{S}} or @code{-@var{P}} is given to
37214 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
37215 @code{*} sequences as well, although they have a stronger binding than
37216 the @samp{|}.  If @code{%*} appears in @code{@var{X}}, all of the
37217 alternatives must be starred, and only the first matching alternative
37218 is substituted.
37220 For example, a spec string like this:
37222 @smallexample
37223 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
37224 @end smallexample
37226 @noindent
37227 outputs the following command-line options from the following input
37228 command-line options:
37230 @smallexample
37231 fred.c        -foo -baz
37232 jim.d         -bar -boggle
37233 -d fred.c     -foo -baz -boggle
37234 -d jim.d      -bar -baz -boggle
37235 @end smallexample
37237 @item %@{%:@var{function}(@var{args}):@var{X}@}
37239 Call function named @var{function} with args @var{args}.  If the
37240 function returns non-NULL, then @code{@var{X}} is substituted, if it returns
37241 NULL, it isn't substituted.
37243 @item %@{@var{S}:@var{X}; @var{T}:@var{Y}; :@var{D}@}
37245 If @code{@var{S}} is given to GCC, substitutes @code{@var{X}}; else if @code{@var{T}} is
37246 given to GCC, substitutes @code{@var{Y}}; else substitutes @code{@var{D}}.  There can
37247 be as many clauses as you need.  This may be combined with @code{.},
37248 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
37251 @end table
37253 The switch matching text @code{@var{S}} in a @samp{%@{@var{S}@}}, @samp{%@{@var{S}:@var{X}@}}
37254 or similar construct can use a backslash to ignore the special meaning
37255 of the character following it, thus allowing literal matching of a
37256 character that is otherwise specially treated.  For example,
37257 @samp{%@{std=iso9899\:1999:@var{X}@}} substitutes @code{@var{X}} if the
37258 @option{-std=iso9899:1999} option is given.
37260 The conditional text @code{@var{X}} in a @samp{%@{@var{S}:@var{X}@}} or similar
37261 construct may contain other nested @samp{%} constructs or spaces, or
37262 even newlines.  They are processed as usual, as described above.
37263 Trailing white space in @code{@var{X}} is ignored.  White space may also
37264 appear anywhere on the left side of the colon in these constructs,
37265 except between @code{.} or @code{*} and the corresponding word.
37267 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
37268 handled specifically in these constructs.  If another value of
37269 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
37270 @option{-W} switch is found later in the command line, the earlier
37271 switch value is ignored, except with @{@code{@var{S}}*@} where @code{@var{S}} is
37272 just one letter, which passes all matching options.
37274 The character @samp{|} at the beginning of the predicate text is used to
37275 indicate that a command should be piped to the following command, but
37276 only if @option{-pipe} is specified.
37278 It is built into GCC which switches take arguments and which do not.
37279 (You might think it would be useful to generalize this to allow each
37280 compiler's spec to say which switches take arguments.  But this cannot
37281 be done in a consistent fashion.  GCC cannot even decide which input
37282 files have been specified without knowing which switches take arguments,
37283 and it must know which input files to compile in order to tell which
37284 compilers to run).
37286 GCC also knows implicitly that arguments starting in @option{-l} are to be
37287 treated as compiler output files, and passed to the linker in their
37288 proper position among the other output files.
37290 @node Environment Variables
37291 @section Environment Variables Affecting GCC
37292 @cindex environment variables
37294 @c man begin ENVIRONMENT
37295 This section describes several environment variables that affect how GCC
37296 operates.  Some of them work by specifying directories or prefixes to use
37297 when searching for various kinds of files.  Some are used to specify other
37298 aspects of the compilation environment.
37300 Note that you can also specify places to search using options such as
37301 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
37302 take precedence over places specified using environment variables, which
37303 in turn take precedence over those specified by the configuration of GCC@.
37304 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
37305 GNU Compiler Collection (GCC) Internals}.
37307 @table @env
37308 @vindex LANG
37309 @vindex LC_CTYPE
37310 @c @vindex LC_COLLATE
37311 @vindex LC_MESSAGES
37312 @c @vindex LC_MONETARY
37313 @c @vindex LC_NUMERIC
37314 @c @vindex LC_TIME
37315 @vindex LC_ALL
37316 @cindex locale
37317 @item LANG
37318 @itemx LC_CTYPE
37319 @c @itemx LC_COLLATE
37320 @itemx LC_MESSAGES
37321 @c @itemx LC_MONETARY
37322 @c @itemx LC_NUMERIC
37323 @c @itemx LC_TIME
37324 @itemx LC_ALL
37325 These environment variables control the way that GCC uses
37326 localization information which allows GCC to work with different
37327 national conventions.  GCC inspects the locale categories
37328 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
37329 so.  These locale categories can be set to any value supported by your
37330 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
37331 Kingdom encoded in UTF-8.
37333 The @env{LC_CTYPE} environment variable specifies character
37334 classification.  GCC uses it to determine the character boundaries in
37335 a string; this is needed for some multibyte encodings that contain quote
37336 and escape characters that are otherwise interpreted as a string
37337 end or escape.
37339 The @env{LC_MESSAGES} environment variable specifies the language to
37340 use in diagnostic messages.
37342 If the @env{LC_ALL} environment variable is set, it overrides the value
37343 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
37344 and @env{LC_MESSAGES} default to the value of the @env{LANG}
37345 environment variable.  If none of these variables are set, GCC
37346 defaults to traditional C English behavior.
37348 @vindex TMPDIR
37349 @item TMPDIR
37350 If @env{TMPDIR} is set, it specifies the directory to use for temporary
37351 files.  GCC uses temporary files to hold the output of one stage of
37352 compilation which is to be used as input to the next stage: for example,
37353 the output of the preprocessor, which is the input to the compiler
37354 proper.
37356 @vindex GCC_COMPARE_DEBUG
37357 @item GCC_COMPARE_DEBUG
37358 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
37359 @option{-fcompare-debug} to the compiler driver.  See the documentation
37360 of this option for more details.
37362 @vindex GCC_EXEC_PREFIX
37363 @item GCC_EXEC_PREFIX
37364 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
37365 names of the subprograms executed by the compiler.  No slash is added
37366 when this prefix is combined with the name of a subprogram, but you can
37367 specify a prefix that ends with a slash if you wish.
37369 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
37370 an appropriate prefix to use based on the pathname it is invoked with.
37372 If GCC cannot find the subprogram using the specified prefix, it
37373 tries looking in the usual places for the subprogram.
37375 The default value of @env{GCC_EXEC_PREFIX} is
37376 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
37377 the installed compiler. In many cases @var{prefix} is the value
37378 of @code{prefix} when you ran the @file{configure} script.
37380 Other prefixes specified with @option{-B} take precedence over this prefix.
37382 This prefix is also used for finding files such as @file{crt0.o} that are
37383 used for linking.
37385 In addition, the prefix is used in an unusual way in finding the
37386 directories to search for header files.  For each of the standard
37387 directories whose name normally begins with @samp{/usr/local/lib/gcc}
37388 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
37389 replacing that beginning with the specified prefix to produce an
37390 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
37391 @file{foo/bar} just before it searches the standard directory 
37392 @file{/usr/local/lib/bar}.
37393 If a standard directory begins with the configured
37394 @var{prefix} then the value of @var{prefix} is replaced by
37395 @env{GCC_EXEC_PREFIX} when looking for header files.
37397 @vindex COMPILER_PATH
37398 @item COMPILER_PATH
37399 The value of @env{COMPILER_PATH} is a colon-separated list of
37400 directories, much like @env{PATH}.  GCC tries the directories thus
37401 specified when searching for subprograms, if it cannot find the
37402 subprograms using @env{GCC_EXEC_PREFIX}.
37404 @vindex LIBRARY_PATH
37405 @item LIBRARY_PATH
37406 The value of @env{LIBRARY_PATH} is a colon-separated list of
37407 directories, much like @env{PATH}.  When configured as a native compiler,
37408 GCC tries the directories thus specified when searching for special
37409 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
37410 using GCC also uses these directories when searching for ordinary
37411 libraries for the @option{-l} option (but directories specified with
37412 @option{-L} come first).
37414 @vindex LANG
37415 @cindex locale definition
37416 @item LANG
37417 This variable is used to pass locale information to the compiler.  One way in
37418 which this information is used is to determine the character set to be used
37419 when character literals, string literals and comments are parsed in C and C++.
37420 When the compiler is configured to allow multibyte characters,
37421 the following values for @env{LANG} are recognized:
37423 @table @samp
37424 @item C-JIS
37425 Recognize JIS characters.
37426 @item C-SJIS
37427 Recognize SJIS characters.
37428 @item C-EUCJP
37429 Recognize EUCJP characters.
37430 @end table
37432 If @env{LANG} is not defined, or if it has some other value, then the
37433 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
37434 recognize and translate multibyte characters.
37436 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
37437 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
37438 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
37439 then additional text will be emitted to stderr when fix-it hints are
37440 emitted.  @option{-fdiagnostics-parseable-fixits} and
37441 @option{-fno-diagnostics-parseable-fixits} take precedence over this
37442 environment variable.
37444 @table @samp
37445 @item fixits-v1
37446 Emit parseable fix-it hints, equivalent to
37447 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
37448 expressed as a count of bytes, starting at byte 1 for the initial column.
37450 @item fixits-v2
37451 As @code{fixits-v1}, but columns are expressed as display columns,
37452 as per @option{-fdiagnostics-column-unit=display}.
37453 @end table
37455 @end table
37457 @noindent
37458 Some additional environment variables affect the behavior of the
37459 preprocessor.
37461 @include cppenv.texi
37463 @c man end
37465 @node Precompiled Headers
37466 @section Using Precompiled Headers
37467 @cindex precompiled headers
37468 @cindex speed of compilation
37470 Often large projects have many header files that are included in every
37471 source file.  The time the compiler takes to process these header files
37472 over and over again can account for nearly all of the time required to
37473 build the project.  To make builds faster, GCC allows you to
37474 @dfn{precompile} a header file.
37476 To create a precompiled header file, simply compile it as you would any
37477 other file, if necessary using the @option{-x} option to make the driver
37478 treat it as a C or C++ header file.  You may want to use a
37479 tool like @command{make} to keep the precompiled header up-to-date when
37480 the headers it contains change.
37482 A precompiled header file is searched for when @code{#include} is
37483 seen in the compilation.  As it searches for the included file
37484 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
37485 compiler looks for a precompiled header in each directory just before it
37486 looks for the include file in that directory.  The name searched for is
37487 the name specified in the @code{#include} with @samp{.gch} appended.  If
37488 the precompiled header file cannot be used, it is ignored.
37490 For instance, if you have @code{#include "all.h"}, and you have
37491 @file{all.h.gch} in the same directory as @file{all.h}, then the
37492 precompiled header file is used if possible, and the original
37493 header is used otherwise.
37495 Alternatively, you might decide to put the precompiled header file in a
37496 directory and use @option{-I} to ensure that directory is searched
37497 before (or instead of) the directory containing the original header.
37498 Then, if you want to check that the precompiled header file is always
37499 used, you can put a file of the same name as the original header in this
37500 directory containing an @code{#error} command.
37502 This also works with @option{-include}.  So yet another way to use
37503 precompiled headers, good for projects not designed with precompiled
37504 header files in mind, is to simply take most of the header files used by
37505 a project, include them from another header file, precompile that header
37506 file, and @option{-include} the precompiled header.  If the header files
37507 have guards against multiple inclusion, they are skipped because
37508 they've already been included (in the precompiled header).
37510 If you need to precompile the same header file for different
37511 languages, targets, or compiler options, you can instead make a
37512 @emph{directory} named like @file{all.h.gch}, and put each precompiled
37513 header in the directory, perhaps using @option{-o}.  It doesn't matter
37514 what you call the files in the directory; every precompiled header in
37515 the directory is considered.  The first precompiled header
37516 encountered in the directory that is valid for this compilation is
37517 used; they're searched in no particular order.
37519 There are many other possibilities, limited only by your imagination,
37520 good sense, and the constraints of your build system.
37522 A precompiled header file can be used only when these conditions apply:
37524 @itemize
37525 @item
37526 Only one precompiled header can be used in a particular compilation.
37528 @item
37529 A precompiled header cannot be used once the first C token is seen.  You
37530 can have preprocessor directives before a precompiled header; you cannot
37531 include a precompiled header from inside another header.
37533 @item
37534 The precompiled header file must be produced for the same language as
37535 the current compilation.  You cannot use a C precompiled header for a C++
37536 compilation.
37538 @item
37539 The precompiled header file must have been produced by the same compiler
37540 binary as the current compilation is using.
37542 @item
37543 Any macros defined before the precompiled header is included must
37544 either be defined in the same way as when the precompiled header was
37545 generated, or must not affect the precompiled header, which usually
37546 means that they don't appear in the precompiled header at all.
37548 The @option{-D} option is one way to define a macro before a
37549 precompiled header is included; using a @code{#define} can also do it.
37550 There are also some options that define macros implicitly, like
37551 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
37552 defined this way.
37554 @item If debugging information is output when using the precompiled
37555 header, using @option{-g} or similar, the same kind of debugging information
37556 must have been output when building the precompiled header.  However,
37557 a precompiled header built using @option{-g} can be used in a compilation
37558 when no debugging information is being output.
37560 @item The same @option{-m} options must generally be used when building
37561 and using the precompiled header.  @xref{Submodel Options},
37562 for any cases where this rule is relaxed.
37564 @item Each of the following options must be the same when building and using
37565 the precompiled header:
37567 @gccoptlist{-fexceptions}
37569 @item
37570 Some other command-line options starting with @option{-f},
37571 @option{-p}, or @option{-O} must be defined in the same way as when
37572 the precompiled header was generated.  At present, it's not clear
37573 which options are safe to change and which are not; the safest choice
37574 is to use exactly the same options when generating and using the
37575 precompiled header.  The following are known to be safe:
37577 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
37578 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
37579 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
37580 -pedantic-errors}
37582 @item Address space layout randomization (ASLR) can lead to not binary identical
37583 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
37584 PCH files.
37586 @end itemize
37588 For all of these except the last, the compiler automatically
37589 ignores the precompiled header if the conditions aren't met.  If you
37590 find an option combination that doesn't work and doesn't cause the
37591 precompiled header to be ignored, please consider filing a bug report,
37592 see @ref{Bugs}.
37594 If you do use differing options when generating and using the
37595 precompiled header, the actual behavior is a mixture of the
37596 behavior for the options.  For instance, if you use @option{-g} to
37597 generate the precompiled header but not when using it, you may or may
37598 not get debugging information for routines in the precompiled header.
37600 @node C++ Modules
37601 @section C++ Modules
37602 @cindex speed of compilation
37604 Modules are a C++20 language feature.  As the name suggests, they
37605 provides a modular compilation system, intending to provide both
37606 faster builds and better library isolation.  The ``Merging Modules''
37607 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
37608 of changes to the standard, although it does not capture later
37609 changes.
37611 @emph{G++'s modules support is not complete.}  Other than bugs, the
37612 known missing pieces are:
37614 @table @emph
37616 @item Private Module Fragment
37617 The Private Module Fragment is recognized, but an error is emitted.
37619 @item Partition definition visibility rules
37620 Entities may be defined in implementation partitions, and those
37621 definitions are not available outside of the module.  This is not
37622 implemented, and the definitions are available to extra-module use.
37624 @item Textual merging of reachable GM entities
37625 Entities may be multiply defined across different header-units.
37626 These must be de-duplicated, and this is implemented across imports,
37627 or when an import redefines a textually-defined entity.  However the
37628 reverse is not implemented---textually redefining an entity that has
37629 been defined in an imported header-unit.  A redefinition error is
37630 emitted.
37632 @item Translation-Unit local referencing rules
37633 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
37634 (@uref{https://wg21.link/p2003}) add limitations on which entities an
37635 exported region may reference (for instance, the entities an exported
37636 template definition may reference).  These are not fully implemented.
37638 @item Standard Library Header Units
37639 The Standard Library is not provided as importable header units.  If
37640 you want to import such units, you must explicitly build them first.
37641 If you do not do this with care, you may have multiple declarations,
37642 which the module machinery must merge---compiler resource usage can be
37643 affected by how you partition header files into header units.
37645 @end table
37647 Modular compilation is @emph{not} enabled with just the
37648 @option{-std=c++20} option.  You must explicitly enable it with the
37649 @option{-fmodules-ts} option.  It is independent of the language
37650 version selected, although in pre-C++20 versions, it is of course an
37651 extension.
37653 No new source file suffixes are required or supported.  If you wish to
37654 use a non-standard suffix (@pxref{Overall Options}), you also need
37655 to provide a @option{-x c++} option too.@footnote{Some users like to
37656 distinguish module interface files with a new suffix, such as naming
37657 the source @code{module.cppm}, which involves
37658 teaching all tools about the new suffix.  A different scheme, such as
37659 naming @code{module-m.cpp} would be less invasive.}
37661 Compiling a module interface unit produces an additional output (to
37662 the assembly or object file), called a Compiled Module Interface
37663 (CMI).  This encodes the exported declarations of the module.
37664 Importing a module reads in the CMI.  The import graph is a Directed
37665 Acyclic Graph (DAG).  You must build imports before the importer.
37667 Header files may themselves be compiled to header units, which are a
37668 transitional ability aiming at faster compilation.  The
37669 @option{-fmodule-header} option is used to enable this, and implies
37670 the @option{-fmodules-ts} option.  These CMIs are named by the fully
37671 resolved underlying header file, and thus may be a complete pathname
37672 containing subdirectories.  If the header file is found at an absolute
37673 pathname, the CMI location is still relative to a CMI root directory.
37675 As header files often have no suffix, you commonly have to specify a
37676 @option{-x} option to tell the compiler the source is a header file.
37677 You may use @option{-x c++-header}, @option{-x c++-user-header} or
37678 @option{-x c++-system-header}.  When used in conjunction with
37679 @option{-fmodules-ts}, these all imply an appropriate
37680 @option{-fmodule-header} option.  The latter two variants use the
37681 user or system include path to search for the file specified.  This
37682 allows you to, for instance, compile standard library header files as
37683 header units, without needing to know exactly where they are
37684 installed.  Specifying the language as one of these variants also
37685 inhibits output of the object file, as header files have no associated
37686 object file.
37688 The @option{-fmodule-only} option disables generation of the
37689 associated object file for compiling a module interface.  Only the CMI
37690 is generated.  This option is implied when using the
37691 @option{-fmodule-header} option.
37693 The @option{-flang-info-include-translate} and
37694 @option{-flang-info-include-translate-not} options notes whether
37695 include translation occurs or not.  With no argument, the first will
37696 note all include translation.  The second will note all
37697 non-translations of include files not known to intentionally be
37698 textual.  With an argument, queries about include translation of a
37699 header files with that particular trailing pathname are noted.  You
37700 may repeat this form to cover several different header files.  This
37701 option may be helpful in determining whether include translation is
37702 happening---if it is working correctly, it behaves as if it isn't
37703 there at all.
37705 The @option{-flang-info-module-cmi} option can be used to determine
37706 where the compiler is reading a CMI from.  Without the option, the
37707 compiler is silent when such a read is successful.  This option has an
37708 optional argument, which will restrict the notification to just the
37709 set of named modules or header units specified.
37711 The @option{-Winvalid-imported-macros} option causes all imported macros
37712 to be resolved at the end of compilation.  Without this, imported
37713 macros are only resolved when expanded or (re)defined.  This option
37714 detects conflicting import definitions for all macros.
37716 For details of the @option{-fmodule-mapper} family of options,
37717 @pxref{C++ Module Mapper}.
37719 @menu
37720 * C++ Module Mapper::       Module Mapper
37721 * C++ Module Preprocessing::  Module Preprocessing
37722 * C++ Compiled Module Interface:: Compiled Module Interface
37723 @end menu
37725 @node C++ Module Mapper
37726 @subsection Module Mapper
37727 @cindex C++ Module Mapper
37729 A module mapper provides a server or file that the compiler queries to
37730 determine the mapping between module names and CMI files.  It is also
37731 used to build CMIs on demand.  @emph{Mapper functionality is in its
37732 infancy and is intended for experimentation with build system
37733 interactions.}
37735 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
37736 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
37737 have one of the following forms:
37739 @table @gcctabopt
37741 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
37742 An optional hostname and a numeric port number to connect to.  If the
37743 hostname is omitted, the loopback address is used.  If the hostname
37744 corresponds to multiple IPV6 addresses, these are tried in turn, until
37745 one is successful.  If your host lacks IPv6, this form is
37746 non-functional.  If you must use IPv4 use
37747 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
37749 @item =@var{socket}@r{[}?@var{ident}@r{]}
37750 A local domain socket.  If your host lacks local domain sockets, this
37751 form is non-functional.
37753 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
37754 A program to spawn, and communicate with on its stdin/stdout streams.
37755 Your @var{PATH} environment variable is searched for the program.
37756 Arguments are separated by space characters, (it is not possible for
37757 one of the arguments delivered to the program to contain a space).  An
37758 exception is if @var{program} begins with @@.  In that case
37759 @var{program} (sans @@) is looked for in the compiler's internal
37760 binary directory.  Thus the sample mapper-server can be specified
37761 with @code{@@g++-mapper-server}.
37763 @item <>@r{[}?@var{ident}@r{]}
37764 @item <>@var{inout}@r{[}?@var{ident}@r{]}
37765 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
37766 Named pipes or file descriptors to communicate over.  The first form,
37767 @option{<>}, communicates over stdin and stdout.  The other forms
37768 allow you to specify a file descriptor or name a pipe.  A numeric value
37769 is interpreted as a file descriptor, otherwise named pipe is opened.
37770 The second form specifies a bidirectional pipe and the last form
37771 allows specifying two independent pipes.  Using file descriptors
37772 directly in this manner is fragile in general, as it can require the
37773 cooperation of intermediate processes.  In particular using stdin &
37774 stdout is fraught with danger as other compiler options might also
37775 cause the compiler to read stdin or write stdout, and it can have
37776 unfortunate interactions with signal delivery from the terminal.
37778 @item @var{file}@r{[}?@var{ident}@r{]}
37779 A mapping file consisting of space-separated module-name, filename
37780 pairs, one per line.  Only the mappings for the direct imports and any
37781 module export name need be provided.  If other mappings are provided,
37782 they override those stored in any imported CMI files.  A repository
37783 root may be specified in the mapping file by using @samp{$root} as the
37784 module name in the first active line.  Use of this option will disable
37785 any default module->CMI name mapping.
37787 @end table
37789 As shown, an optional @var{ident} may suffix the first word of the
37790 option, indicated by a @samp{?} prefix.  The value is used in the
37791 initial handshake with the module server, or to specify a prefix on
37792 mapping file lines.  In the server case, the main source file name is
37793 used if no @var{ident} is specified.  In the file case, all non-blank
37794 lines are significant, unless a value is specified, in which case only
37795 lines beginning with @var{ident} are significant.  The @var{ident}
37796 must be separated by whitespace from the module name.  Be aware that
37797 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
37798 significant to the shell, and therefore may need quoting.
37800 The mapper is connected to or loaded lazily, when the first module
37801 mapping is required.  The networking protocols are only supported on
37802 hosts that provide networking.  If no mapper is specified a default is
37803 provided.
37805 A project-specific mapper is expected to be provided by the build
37806 system that invokes the compiler.  It is not expected that a
37807 general-purpose server is provided for all compilations.  As such, the
37808 server will know the build configuration, the compiler it invoked, and
37809 the environment (such as working directory) in which that is
37810 operating.  As it may parallelize builds, several compilations may
37811 connect to the same socket.
37813 The default mapper generates CMI files in a @samp{gcm.cache}
37814 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
37815 is used directly to provide the basename.  Header units construct a
37816 relative path using the underlying header file name.  If the path is
37817 already relative, a @samp{,} directory is prepended.  Internal
37818 @samp{..} components are translated to @samp{,,}.  No attempt is made
37819 to canonicalize these filenames beyond that done by the preprocessor's
37820 include search algorithm, as in general it is ambiguous when symbolic
37821 links are present.
37823 The mapper protocol was published as ``A Module Mapper''
37824 @uref{https://wg21.link/p1184}.  The implementation is provided by
37825 @command{libcody}, @uref{https://github.com/urnathan/libcody},
37826 which specifies the canonical protocol definition.  A proof of concept
37827 server implementation embedded in @command{make} was described in
37828 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
37830 @node C++ Module Preprocessing
37831 @subsection Module Preprocessing
37832 @cindex C++ Module Preprocessing
37834 Modules affect preprocessing because of header units and include
37835 translation.  Some uses of the preprocessor as a separate step either
37836 do not produce a correct output, or require CMIs to be available.
37838 Header units import macros.  These macros can affect later conditional
37839 inclusion, which therefore can cascade to differing import sets.  When
37840 preprocessing, it is necessary to load the CMI.  If a header unit is
37841 unavailable, the preprocessor issues a warning and continue (when
37842 not just preprocessing, an error is emitted).  Detecting such imports
37843 requires preprocessor tokenization of the input stream to phase 4
37844 (macro expansion).
37846 Include translation converts @code{#include}, @code{#include_next} and
37847 @code{#import} directives to internal @code{import} declarations.
37848 Whether a particular directive is translated is controlled by the
37849 module mapper.  Header unit names are canonicalized during
37850 preprocessing.
37852 Dependency information can be emitted for macro import, extending the
37853 functionality of @option{-MD} and @option{-MMD} options.  Detection of
37854 import declarations also requires phase 4 preprocessing, and thus
37855 requires full preprocessing (or compilation).
37857 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
37858 preprocessing before phase 4.
37860 The @option{-save-temps} option uses @option{-fdirectives-only} for
37861 preprocessing, and preserve the macro definitions in the preprocessed
37862 output.  Usually you also want to use this option when explicitly
37863 preprocessing a header-unit, or consuming such preprocessed output:
37865 @smallexample
37866 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
37867 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
37868 @end smallexample
37870 @node C++ Compiled Module Interface
37871 @subsection Compiled Module Interface
37872 @cindex C++ Compiled Module Interface
37874 CMIs are an additional artifact when compiling named module
37875 interfaces, partitions or header units.  These are read when
37876 importing.  CMI contents are implementation-specific, and in GCC's
37877 case tied to the compiler version.  Consider them a rebuildable cache
37878 artifact, not a distributable object.
37880 When creating an output CMI, any missing directory components are
37881 created in a manner that is safe for concurrent builds creating
37882 multiple, different, CMIs within a common subdirectory tree.
37884 CMI contents are written to a temporary file, which is then atomically
37885 renamed.  Observers either see old contents (if there is an
37886 existing file), or complete new contents.  They do not observe the
37887 CMI during its creation.  This is unlike object file writing, which
37888 may be observed by an external process.
37890 CMIs are read in lazily, if the host OS provides @code{mmap}
37891 functionality.  Generally blocks are read when name lookup or template
37892 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
37893 option may be used.
37895 The @option{--param lazy-modules=@var{n}} parameter controls the limit
37896 on the number of concurrently open module files during lazy loading.
37897 Should more modules be imported, an LRU algorithm is used to determine
37898 which files to close---until that file is needed again.  This limit
37899 may be exceeded with deep module dependency hierarchies.  With large
37900 code bases there may be more imports than the process limit of file
37901 descriptors.  By default, the limit is a few less than the per-process
37902 file descriptor hard limit, if that is determinable.@footnote{Where
37903 applicable the soft limit is incremented as needed towards the hard limit.}
37905 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
37906 You may use @command{readelf} to inspect them, although section
37907 contents are largely undecipherable.  There is a section named
37908 @code{.gnu.c++.README}, which contains human-readable text.  Other
37909 than the first line, each line consists of @code{@var{tag}: @code{value}}
37910 tuples.
37912 @smallexample
37913 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
37915 String dump of section '.gnu.c++.README':
37916   [     0]  GNU C++ primary module interface
37917   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
37918   [    6f]  version: 2020/11/16-04:54
37919   [    89]  module: foo
37920   [    95]  source: c_b.ii
37921   [    a4]  dialect: C++20/coroutines
37922   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
37923   [    ee]  repository: gcm.cache
37924   [   104]  buildtime: 2020/11/16 15:03:21 UTC
37925   [   127]  localtime: 2020/11/16 07:03:21 PST
37926   [   14a]  export: foo:part1 foo-part1.gcm
37927 @end smallexample
37929 Amongst other things, this lists the source that was built, C++
37930 dialect used and imports of the module.@footnote{The precise contents
37931 of this output may change.} The timestamp is the same value as that
37932 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
37933 explicitly specified with the environment variable
37934 @code{SOURCE_DATE_EPOCH}.  For further details
37935 @pxref{Environment Variables}.
37937 A set of related CMIs may be copied, provided the relative pathnames
37938 are preserved.
37940 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
37941 it may be removed or altered.  The section numbering of the sections
37942 whose names do not begin with @code{.gnu.c++.}, or are not the string
37943 section is significant and must not be altered.