RISC-V: Implement TLS Descriptors.
[official-gcc.git] / gcc / doc / invoke.texi
blobf5f5d83f8179b40203d49be9169af0bf2bfeec18
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{cpu-type}  -mtune=@var{cpu-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
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 Wwrite-strings
9395 @opindex Wno-write-strings
9396 @item -Wwrite-strings
9397 When compiling C, give string constants the type @code{const
9398 char[@var{length}]} so that copying the address of one into a
9399 non-@code{const} @code{char *} pointer produces a warning.  These
9400 warnings help you find at compile time code that can try to write
9401 into a string constant, but only if you have been very careful about
9402 using @code{const} in declarations and prototypes.  Otherwise, it is
9403 just a nuisance. This is why we did not make @option{-Wall} request
9404 these warnings.
9406 When compiling C++, warn about the deprecated conversion from string
9407 literals to @code{char *}.  This warning is enabled by default for C++
9408 programs.
9410 This warning is upgraded to an error by @option{-pedantic-errors} in
9411 C++11 mode or later.
9413 @opindex Wclobbered
9414 @opindex Wno-clobbered
9415 @item -Wclobbered
9416 Warn for variables that might be changed by @code{longjmp} or
9417 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9419 @opindex Wcomplain-wrong-lang
9420 @opindex Wno-complain-wrong-lang
9421 @item -Wno-complain-wrong-lang
9422 By default, language front ends complain when a command-line option is
9423 valid, but not applicable to that front end.
9424 This may be disabled with @option{-Wno-complain-wrong-lang},
9425 which is mostly useful when invoking a single compiler driver for
9426 multiple source files written in different languages, for example:
9428 @smallexample
9429 $ g++ -fno-rtti a.cc b.f90
9430 @end smallexample
9432 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9433 and the Fortran front end to compile @file{b.f90}.
9434 The latter front end diagnoses
9435 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9436 which may be disabled with @option{-Wno-complain-wrong-lang}.
9438 @opindex Wcompare-distinct-pointer-types
9439 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9440 Warn if pointers of distinct types are compared without a cast.  This
9441 warning is enabled by default.
9443 @opindex Wconversion
9444 @opindex Wno-conversion
9445 @item -Wconversion
9446 Warn for implicit conversions that may alter a value. This includes
9447 conversions between real and integer, like @code{abs (x)} when
9448 @code{x} is @code{double}; conversions between signed and unsigned,
9449 like @code{unsigned ui = -1}; and conversions to smaller types, like
9450 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9451 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9452 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9453 conversions between signed and unsigned integers can be disabled by
9454 using @option{-Wno-sign-conversion}.
9456 For C++, also warn for confusing overload resolution for user-defined
9457 conversions; and conversions that never use a type conversion
9458 operator: conversions to @code{void}, the same type, a base class or a
9459 reference to them. Warnings about conversions between signed and
9460 unsigned integers are disabled by default in C++ unless
9461 @option{-Wsign-conversion} is explicitly enabled.
9463 Warnings about conversion from arithmetic on a small type back to that
9464 type are only given with @option{-Warith-conversion}.
9466 @opindex Wdangling-else
9467 @opindex Wno-dangling-else
9468 @item -Wdangling-else
9469 Warn about constructions where there may be confusion to which
9470 @code{if} statement an @code{else} branch belongs.  Here is an example of
9471 such a case:
9473 @smallexample
9474 @group
9476   if (a)
9477     if (b)
9478       foo ();
9479   else
9480     bar ();
9482 @end group
9483 @end smallexample
9485 In C/C++, every @code{else} branch belongs to the innermost possible
9486 @code{if} statement, which in this example is @code{if (b)}.  This is
9487 often not what the programmer expected, as illustrated in the above
9488 example by indentation the programmer chose.  When there is the
9489 potential for this confusion, GCC issues a warning when this flag
9490 is specified.  To eliminate the warning, add explicit braces around
9491 the innermost @code{if} statement so there is no way the @code{else}
9492 can belong to the enclosing @code{if}.  The resulting code
9493 looks like this:
9495 @smallexample
9496 @group
9498   if (a)
9499     @{
9500       if (b)
9501         foo ();
9502       else
9503         bar ();
9504     @}
9506 @end group
9507 @end smallexample
9509 This warning is enabled by @option{-Wparentheses}.
9511 @opindex Wdangling-pointer
9512 @opindex Wno-dangling-pointer
9513 @item -Wdangling-pointer
9514 @itemx -Wdangling-pointer=@var{n}
9515 Warn about uses of pointers (or C++ references) to objects with automatic
9516 storage duration after their lifetime has ended.  This includes local
9517 variables declared in nested blocks, compound literals and other unnamed
9518 temporary objects.  In addition, warn about storing the address of such
9519 objects in escaped pointers.  The warning is enabled at all optimization
9520 levels but may yield different results with optimization than without.
9522 @table @gcctabopt
9523 @item -Wdangling-pointer=1
9524 At level 1, the warning diagnoses only unconditional uses of dangling pointers.
9526 @item -Wdangling-pointer=2
9527 At level 2, in addition to unconditional uses the warning also diagnoses
9528 conditional uses of dangling pointers.
9529 @end table
9531 The short form @option{-Wdangling-pointer} is equivalent to
9532 @option{-Wdangling-pointer=2}, while @option{-Wno-dangling-pointer} and
9533 @option{-Wdangling-pointer=0} have the same effect of disabling the warnings.
9534 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9536 This example triggers the warning at level 1; the address of the unnamed
9537 temporary is unconditionally referenced outside of its scope.
9539 @smallexample
9540 char f (char c1, char c2, char c3)
9542   char *p;
9543   @{
9544     p = (char[]) @{ c1, c2, c3 @};
9545   @}
9546   // warning: using dangling pointer 'p' to an unnamed temporary
9547   return *p;
9549 @end smallexample
9551 In the following function the store of the address of the local variable
9552 @code{x} in the escaped pointer @code{*p} triggers the warning at
9553 level 1.
9555 @smallexample
9556 void g (int **p)
9558   int x = 7;
9559   // warning: storing the address of local variable 'x' in '*p'
9560   *p = &x;
9562 @end smallexample
9564 In this example, the array @var{a} is out of
9565 scope when the pointer @var{s} is used.  Since the code that sets @code{s}
9566 is conditional, the warning triggers at level 2.
9568 @smallexample
9569 extern void frob (const char *);
9570 void h (char *s)
9572   if (!s)
9573     @{
9574       char a[12] = "tmpname";
9575       s = a;
9576     @}
9577   // warning: dangling pointer 's' to 'a' may be used
9578   frob (s);
9580 @end smallexample
9582 @opindex Wdate-time
9583 @opindex Wno-date-time
9584 @item -Wdate-time
9585 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9586 are encountered as they might prevent bit-wise-identical reproducible
9587 compilations.
9589 @opindex Wempty-body
9590 @opindex Wno-empty-body
9591 @item -Wempty-body
9592 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9593 while} statement.  This warning is also enabled by @option{-Wextra}.
9595 @opindex Wendif-labels
9596 @opindex Wno-endif-labels
9597 @item -Wno-endif-labels
9598 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9600 @opindex Wenum-compare
9601 @opindex Wno-enum-compare
9602 @item -Wenum-compare
9603 Warn about a comparison between values of different enumerated types.
9604 In C++ enumerated type mismatches in conditional expressions are also
9605 diagnosed and the warning is enabled by default.  In C this warning is 
9606 enabled by @option{-Wall}.
9608 @opindex Wenum-conversion
9609 @opindex Wno-enum-conversion
9610 @item -Wenum-conversion
9611 Warn when a value of enumerated type is implicitly converted to a 
9612 different enumerated type.  This warning is enabled by @option{-Wextra}
9613 in C@.
9615 @opindex Wenum-int-mismatch
9616 @opindex Wno-enum-int-mismatch
9617 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9618 Warn about mismatches between an enumerated type and an integer type in
9619 declarations.  For example:
9621 @smallexample
9622 enum E @{ l = -1, z = 0, g = 1 @};
9623 int foo(void);
9624 enum E foo(void);
9625 @end smallexample
9627 In C, an enumerated type is compatible with @code{char}, a signed
9628 integer type, or an unsigned integer type.  However, since the choice
9629 of the underlying type of an enumerated type is implementation-defined,
9630 such mismatches may cause portability issues.  In C++, such mismatches
9631 are an error.  In C, this warning is enabled by @option{-Wall} and
9632 @option{-Wc++-compat}.
9634 @opindex Wjump-misses-init
9635 @opindex Wno-jump-misses-init
9636 @item -Wjump-misses-init @r{(C, Objective-C only)}
9637 Warn if a @code{goto} statement or a @code{switch} statement jumps
9638 forward across the initialization of a variable, or jumps backward to a
9639 label after the variable has been initialized.  This only warns about
9640 variables that are initialized when they are declared.  This warning is
9641 only supported for C and Objective-C; in C++ this sort of branch is an
9642 error in any case.
9644 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9645 can be disabled with the @option{-Wno-jump-misses-init} option.
9647 @opindex Wsign-compare
9648 @opindex Wno-sign-compare
9649 @cindex warning for comparison of signed and unsigned values
9650 @cindex comparison of signed and unsigned values, warning
9651 @cindex signed and unsigned values, comparison warning
9652 @item -Wsign-compare
9653 Warn when a comparison between signed and unsigned values could produce
9654 an incorrect result when the signed value is converted to unsigned.
9655 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9656 also enabled by @option{-Wextra}.
9658 @opindex Wsign-conversion
9659 @opindex Wno-sign-conversion
9660 @item -Wsign-conversion
9661 Warn for implicit conversions that may change the sign of an integer
9662 value, like assigning a signed integer expression to an unsigned
9663 integer variable. An explicit cast silences the warning. In C, this
9664 option is enabled also by @option{-Wconversion}.
9666 @opindex Wflex-array-member-not-at-end
9667 @opindex Wno-flex-array-member-not-at-end
9668 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9669 Warn when a structure containing a C99 flexible array member as the last
9670 field is not at the end of another structure.
9671 This warning warns e.g. about
9673 @smallexample
9674 struct flex  @{ int length; char data[]; @};
9675 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9676 @end smallexample
9678 @opindex Wfloat-conversion
9679 @opindex Wno-float-conversion
9680 @item -Wfloat-conversion
9681 Warn for implicit conversions that reduce the precision of a real value.
9682 This includes conversions from real to integer, and from higher precision
9683 real to lower precision real values.  This option is also enabled by
9684 @option{-Wconversion}.
9686 @opindex Wno-scalar-storage-order
9687 @opindex Wscalar-storage-order
9688 @item -Wno-scalar-storage-order
9689 Do not warn on suspicious constructs involving reverse scalar storage order.
9691 @opindex Wsizeof-array-div
9692 @opindex Wno-sizeof-array-div
9693 @item -Wsizeof-array-div
9694 Warn about divisions of two sizeof operators when the first one is applied
9695 to an array and the divisor does not equal the size of the array element.
9696 In such a case, the computation will not yield the number of elements in the
9697 array, which is likely what the user intended.  This warning warns e.g. about
9698 @smallexample
9699 int fn ()
9701   int arr[10];
9702   return sizeof (arr) / sizeof (short);
9704 @end smallexample
9706 This warning is enabled by @option{-Wall}.
9708 @opindex Wsizeof-pointer-div
9709 @opindex Wno-sizeof-pointer-div
9710 @item -Wsizeof-pointer-div
9711 Warn for suspicious divisions of two sizeof expressions that divide
9712 the pointer size by the element size, which is the usual way to compute
9713 the array size but won't work out correctly with pointers.  This warning
9714 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9715 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9717 @opindex Wsizeof-pointer-memaccess
9718 @opindex Wno-sizeof-pointer-memaccess
9719 @item -Wsizeof-pointer-memaccess
9720 Warn for suspicious length parameters to certain string and memory built-in
9721 functions if the argument uses @code{sizeof}.  This warning triggers for
9722 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9723 an array, but a pointer, and suggests a possible fix, or about
9724 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9725 also warns about calls to bounded string copy functions like @code{strncat}
9726 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9727 the source array.  For example, in the following function the call to
9728 @code{strncat} specifies the size of the source string as the bound.  That
9729 is almost certainly a mistake and so the call is diagnosed.
9730 @smallexample
9731 void make_file (const char *name)
9733   char path[PATH_MAX];
9734   strncpy (path, name, sizeof path - 1);
9735   strncat (path, ".text", sizeof ".text");
9736   @dots{}
9738 @end smallexample
9740 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9742 @opindex Wsizeof-array-argument
9743 @opindex Wno-sizeof-array-argument
9744 @item -Wno-sizeof-array-argument
9745 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9746 declared as an array in a function definition.  This warning is enabled by
9747 default for C and C++ programs.
9749 @opindex Wmemset-elt-size
9750 @opindex Wno-memset-elt-size
9751 @item -Wmemset-elt-size
9752 Warn for suspicious calls to the @code{memset} built-in function, if the
9753 first argument references an array, and the third argument is a number
9754 equal to the number of elements, but not equal to the size of the array
9755 in memory.  This indicates that the user has omitted a multiplication by
9756 the element size.  This warning is enabled by @option{-Wall}.
9758 @opindex Wmemset-transposed-args
9759 @opindex Wno-memset-transposed-args
9760 @item -Wmemset-transposed-args
9761 Warn for suspicious calls to the @code{memset} built-in function where
9762 the second argument is not zero and the third argument is zero.  For
9763 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9764 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9765 is only emitted if the third argument is a literal zero.  Otherwise, if
9766 it is an expression that is folded to zero, or a cast of zero to some
9767 type, it is far less likely that the arguments have been mistakenly
9768 transposed and no warning is emitted.  This warning is enabled
9769 by @option{-Wall}.
9771 @opindex Waddress
9772 @opindex Wno-address
9773 @item -Waddress
9774 Warn about suspicious uses of address expressions. These include comparing
9775 the address of a function or a declared object to the null pointer constant
9776 such as in
9777 @smallexample
9778 void f (void);
9779 void g (void)
9781   if (!f)   // warning: expression evaluates to false
9782     abort ();
9784 @end smallexample
9785 comparisons of a pointer to a string literal, such as in
9786 @smallexample
9787 void f (const char *x)
9789   if (x == "abc")   // warning: expression evaluates to false
9790     puts ("equal");
9792 @end smallexample
9793 and tests of the results of pointer addition or subtraction for equality
9794 to null, such as in
9795 @smallexample
9796 void f (const int *p, int i)
9798   return p + i == NULL;
9800 @end smallexample
9801 Such uses typically indicate a programmer error: the address of most
9802 functions and objects necessarily evaluates to true (the exception are
9803 weak symbols), so their use in a conditional might indicate missing
9804 parentheses in a function call or a missing dereference in an array
9805 expression.  The subset of the warning for object pointers can be
9806 suppressed by casting the pointer operand to an integer type such
9807 as @code{intptr_t} or @code{uintptr_t}.
9808 Comparisons against string literals result in unspecified behavior
9809 and are not portable, and suggest the intent was to call @code{strcmp}.
9810 The warning is suppressed if the suspicious expression is the result
9811 of macro expansion.
9812 @option{-Waddress} warning is enabled by @option{-Wall}.
9814 @opindex Waddress-of-packed-member
9815 @opindex Wno-address-of-packed-member
9816 @item -Wno-address-of-packed-member
9817 Do not warn when the address of packed member of struct or union is taken,
9818 which usually results in an unaligned pointer value.  This is
9819 enabled by default.
9821 @opindex Wlogical-op
9822 @opindex Wno-logical-op
9823 @item -Wlogical-op
9824 Warn about suspicious uses of logical operators in expressions.
9825 This includes using logical operators in contexts where a
9826 bit-wise operator is likely to be expected.  Also warns when
9827 the operands of a logical operator are the same:
9828 @smallexample
9829 extern int a;
9830 if (a < 0 && a < 0) @{ @dots{} @}
9831 @end smallexample
9833 @opindex Wlogical-not-parentheses
9834 @opindex Wno-logical-not-parentheses
9835 @item -Wlogical-not-parentheses
9836 Warn about logical not used on the left hand side operand of a comparison.
9837 This option does not warn if the right operand is considered to be a boolean
9838 expression.  Its purpose is to detect suspicious code like the following:
9839 @smallexample
9840 int a;
9841 @dots{}
9842 if (!a > 1) @{ @dots{} @}
9843 @end smallexample
9845 It is possible to suppress the warning by wrapping the LHS into
9846 parentheses:
9847 @smallexample
9848 if ((!a) > 1) @{ @dots{} @}
9849 @end smallexample
9851 This warning is enabled by @option{-Wall}.
9853 @opindex Waggregate-return
9854 @opindex Wno-aggregate-return
9855 @item -Waggregate-return
9856 Warn if any functions that return structures or unions are defined or
9857 called.  (In languages where you can return an array, this also elicits
9858 a warning.)
9860 @opindex Wno-aggressive-loop-optimizations
9861 @opindex Waggressive-loop-optimizations
9862 @item -Wno-aggressive-loop-optimizations
9863 Warn if in a loop with constant number of iterations the compiler detects
9864 undefined behavior in some statement during one or more of the iterations.
9866 @opindex Wno-attributes
9867 @opindex Wattributes
9868 @item -Wno-attributes
9869 Do not warn if an unexpected @code{__attribute__} is used, such as
9870 unrecognized attributes, function attributes applied to variables,
9871 etc.  This does not stop errors for incorrect use of supported
9872 attributes.
9874 Warnings about ill-formed uses of standard attributes are upgraded to
9875 errors by @option{-pedantic-errors}.
9877 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9878 warnings about unknown scoped attributes (in C++11 and C23).  For example,
9879 @option{-Wno-attributes=vendor::attr} disables warning about the following
9880 declaration:
9882 @smallexample
9883 [[vendor::attr]] void f();
9884 @end smallexample
9886 It is also possible to disable warning about all attributes in a namespace
9887 using @option{-Wno-attributes=vendor::} which prevents warning about both
9888 of these declarations:
9890 @smallexample
9891 [[vendor::safe]] void f();
9892 [[vendor::unsafe]] void f2();
9893 @end smallexample
9895 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9897 @opindex Wno-builtin-declaration-mismatch
9898 @opindex Wbuiltin-declaration-mismatch
9899 @item -Wno-builtin-declaration-mismatch
9900 Warn if a built-in function is declared with an incompatible signature
9901 or as a non-function, or when a built-in function declared with a type
9902 that does not include a prototype is called with arguments whose promoted
9903 types do not match those expected by the function.  When @option{-Wextra}
9904 is specified, also warn when a built-in function that takes arguments is
9905 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9906 warning is enabled by default.  To avoid the warning include the appropriate
9907 header to bring the prototypes of built-in functions into scope.
9909 For example, the call to @code{memset} below is diagnosed by the warning
9910 because the function expects a value of type @code{size_t} as its argument
9911 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9912 the declaration of the function is diagnosed as well.
9913 @smallexample
9914 extern void* memset ();
9915 void f (void *d)
9917   memset (d, '\0', 32);
9919 @end smallexample
9921 @opindex Wno-builtin-macro-redefined
9922 @opindex Wbuiltin-macro-redefined
9923 @item -Wno-builtin-macro-redefined
9924 Do not warn if certain built-in macros are redefined.  This suppresses
9925 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9926 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9928 @opindex Wstrict-prototypes
9929 @opindex Wno-strict-prototypes
9930 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9931 Warn if a function is declared or defined without specifying the
9932 argument types.  (An old-style function definition is permitted without
9933 a warning if preceded by a declaration that specifies the argument
9934 types.)
9936 @opindex Wold-style-declaration
9937 @opindex Wno-old-style-declaration
9938 @item -Wold-style-declaration @r{(C and Objective-C only)}
9939 Warn for obsolescent usages, according to the C Standard, in a
9940 declaration. For example, warn if storage-class specifiers like
9941 @code{static} are not the first things in a declaration.  This warning
9942 is also enabled by @option{-Wextra}.
9944 @opindex Wold-style-definition
9945 @opindex Wno-old-style-definition
9946 @item -Wold-style-definition @r{(C and Objective-C only)}
9947 Warn if an old-style function definition is used.  A warning is given
9948 even if there is a previous prototype.  A definition using @samp{()}
9949 is not considered an old-style definition in C23 mode, because it is
9950 equivalent to @samp{(void)} in that case, but is considered an
9951 old-style definition for older standards.
9953 @opindex Wmissing-parameter-type
9954 @opindex Wno-missing-parameter-type
9955 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9956 A function parameter is declared without a type specifier in K&R-style
9957 functions:
9959 @smallexample
9960 void foo(bar) @{ @}
9961 @end smallexample
9963 This warning is also enabled by @option{-Wextra}.
9965 @opindex Wno-declaration-missing-parameter-type
9966 @opindex Wdeclaration-missing-parameter-type
9967 @item -Wno-declaration-missing-parameter-type @r{(C and Objective-C only)}
9968 Do not warn if a function declaration contains a parameter name without
9969 a type.  Such function declarations do not provide a function prototype
9970 and prevent most type checking in function calls.
9972 This warning is enabled by default.  In C99 and later dialects of C, it
9973 is treated as an error.  The error can be downgraded to a warning using
9974 @option{-fpermissive} (along with certain other errors), or for this
9975 error alone, with @option{-Wno-error=declaration-missing-parameter-type}.
9977 This warning is upgraded to an error by @option{-pedantic-errors}.
9979 @opindex Wmissing-prototypes
9980 @opindex Wno-missing-prototypes
9981 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9982 Warn if a global function is defined without a previous prototype
9983 declaration.  This warning is issued even if the definition itself
9984 provides a prototype.  Use this option to detect global functions
9985 that do not have a matching prototype declaration in a header file.
9986 This option is not valid for C++ because all function declarations
9987 provide prototypes and a non-matching declaration declares an
9988 overload rather than conflict with an earlier declaration.
9989 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9991 @opindex Wmissing-variable-declarations
9992 @opindex Wno-missing-variable-declarations
9993 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9994 Warn if a global variable is defined without a previous declaration.
9995 Use this option to detect global variables that do not have a matching
9996 extern declaration in a header file.
9998 @opindex Wmissing-declarations
9999 @opindex Wno-missing-declarations
10000 @item -Wmissing-declarations
10001 Warn if a global function is defined without a previous declaration.
10002 Do so even if the definition itself provides a prototype.
10003 Use this option to detect global functions that are not declared in
10004 header files.  In C, no warnings are issued for functions with previous
10005 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
10006 missing prototypes.  In C++, no warnings are issued for function templates,
10007 or for inline functions, or for functions in anonymous namespaces.
10009 @opindex Wmissing-field-initializers
10010 @opindex Wno-missing-field-initializers
10011 @opindex W
10012 @opindex Wextra
10013 @opindex Wno-extra
10014 @item -Wmissing-field-initializers
10015 Warn if a structure's initializer has some fields missing.  For
10016 example, the following code causes such a warning, because
10017 @code{x.h} is implicitly zero:
10019 @smallexample
10020 struct s @{ int f, g, h; @};
10021 struct s x = @{ 3, 4 @};
10022 @end smallexample
10024 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
10025 In C this option does not warn about designated initializers, so the
10026 following modification does not trigger a warning:
10028 @smallexample
10029 struct s @{ int f, g, h; @};
10030 struct s x = @{ .f = 3, .g = 4 @};
10031 @end smallexample
10033 In C this option does not warn about the universal zero initializer
10034 @samp{@{ 0 @}}:
10036 @smallexample
10037 struct s @{ int f, g, h; @};
10038 struct s x = @{ 0 @};
10039 @end smallexample
10041 Likewise, in C++ this option does not warn about the empty @{ @}
10042 initializer, for example:
10044 @smallexample
10045 struct s @{ int f, g, h; @};
10046 s x = @{ @};
10047 @end smallexample
10049 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
10050 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
10052 @opindex Wmissing-requires
10053 @opindex Wno-missing-requires
10054 @item -Wno-missing-requires
10056 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
10058 @smallexample
10059 bool satisfied = requires @{ C<T> @};
10060 @end smallexample
10062 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
10063 expression, which it is for all T.  Presumably the user meant to write
10065 @smallexample
10066 bool satisfied = requires @{ requires C<T> @};
10067 @end smallexample
10069 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
10070 type @samp{T}.
10072 This warning can be disabled with @option{-Wno-missing-requires}.
10074 @opindex Wmissing-template-keyword
10075 @opindex Wno-missing-template-keyword
10076 @item -Wno-missing-template-keyword
10078 The member access tokens ., -> and :: must be followed by the @code{template}
10079 keyword if the parent object is dependent and the member being named is a
10080 template.
10082 @smallexample
10083 template <class X>
10084 void DoStuff (X x)
10086   x.template DoSomeOtherStuff<X>(); // Good.
10087   x.DoMoreStuff<X>(); // Warning, x is dependent.
10089 @end smallexample
10091 In rare cases it is possible to get false positives. To silence this, wrap
10092 the expression in parentheses. For example, the following is treated as a
10093 template, even where m and N are integers:
10095 @smallexample
10096 void NotATemplate (my_class t)
10098   int N = 5;
10100   bool test = t.m < N > (0); // Treated as a template.
10101   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
10103 @end smallexample
10105 This warning can be disabled with @option{-Wno-missing-template-keyword}.
10107 @opindex Wno-multichar
10108 @opindex Wmultichar
10109 @item -Wno-multichar
10110 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
10111 Usually they indicate a typo in the user's code, as they have
10112 implementation-defined values, and should not be used in portable code.
10114 @opindex Wnormalized=
10115 @opindex Wnormalized
10116 @opindex Wno-normalized
10117 @cindex NFC
10118 @cindex NFKC
10119 @cindex character set, input normalization
10120 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
10121 In ISO C and ISO C++, two identifiers are different if they are
10122 different sequences of characters.  However, sometimes when characters
10123 outside the basic ASCII character set are used, you can have two
10124 different character sequences that look the same.  To avoid confusion,
10125 the ISO 10646 standard sets out some @dfn{normalization rules} which
10126 when applied ensure that two sequences that look the same are turned into
10127 the same sequence.  GCC can warn you if you are using identifiers that
10128 have not been normalized; this option controls that warning.
10130 There are four levels of warning supported by GCC@.  The default is
10131 @option{-Wnormalized=nfc}, which warns about any identifier that is
10132 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
10133 recommended form for most uses.  It is equivalent to
10134 @option{-Wnormalized}.
10136 Unfortunately, there are some characters allowed in identifiers by
10137 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
10138 identifiers.  That is, there's no way to use these symbols in portable
10139 ISO C or C++ and have all your identifiers in NFC@.
10140 @option{-Wnormalized=id} suppresses the warning for these characters.
10141 It is hoped that future versions of the standards involved will correct
10142 this, which is why this option is not the default.
10144 You can switch the warning off for all characters by writing
10145 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
10146 only do this if you are using some other normalization scheme (like
10147 ``D''), because otherwise you can easily create bugs that are
10148 literally impossible to see.
10150 Some characters in ISO 10646 have distinct meanings but look identical
10151 in some fonts or display methodologies, especially once formatting has
10152 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
10153 LETTER N'', displays just like a regular @code{n} that has been
10154 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
10155 normalization scheme to convert all these into a standard form as
10156 well, and GCC warns if your code is not in NFKC if you use
10157 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
10158 about every identifier that contains the letter O because it might be
10159 confused with the digit 0, and so is not the default, but may be
10160 useful as a local coding convention if the programming environment 
10161 cannot be fixed to display these characters distinctly.
10163 @opindex Wno-attribute-warning
10164 @opindex Wattribute-warning
10165 @item -Wno-attribute-warning
10166 Do not warn about usage of functions (@pxref{Function Attributes})
10167 declared with @code{warning} attribute.  By default, this warning is
10168 enabled.  @option{-Wno-attribute-warning} can be used to disable the
10169 warning or @option{-Wno-error=attribute-warning} can be used to
10170 disable the error when compiled with @option{-Werror} flag.
10172 @opindex Wno-deprecated
10173 @opindex Wdeprecated
10174 @item -Wno-deprecated
10175 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
10177 @opindex Wno-deprecated-declarations
10178 @opindex Wdeprecated-declarations
10179 @item -Wno-deprecated-declarations
10180 Do not warn about uses of functions (@pxref{Function Attributes}),
10181 variables (@pxref{Variable Attributes}), and types (@pxref{Type
10182 Attributes}) marked as deprecated by using the @code{deprecated}
10183 attribute.
10185 @opindex Wno-overflow
10186 @opindex Woverflow
10187 @item -Wno-overflow
10188 Do not warn about compile-time overflow in constant expressions.
10190 @opindex Wno-odr
10191 @opindex Wodr
10192 @item -Wno-odr
10193 Warn about One Definition Rule violations during link-time optimization.
10194 Enabled by default.
10196 @opindex Wopenacc-parallelism
10197 @opindex Wno-openacc-parallelism
10198 @cindex OpenACC accelerator programming
10199 @item -Wopenacc-parallelism
10200 Warn about potentially suboptimal choices related to OpenACC parallelism.
10202 @opindex Wopenmp
10203 @opindex Wno-openmp
10204 @item -Wno-openmp
10205 Warn about suspicious OpenMP code.
10207 @opindex Wopenmp-simd
10208 @opindex Wno-openmp-simd
10209 @item -Wopenmp-simd
10210 Warn if the vectorizer cost model overrides the OpenMP
10211 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
10212 option can be used to relax the cost model.
10214 @opindex Woverride-init
10215 @opindex Wno-override-init
10216 @opindex W
10217 @opindex Wextra
10218 @opindex Wno-extra
10219 @item -Woverride-init @r{(C and Objective-C only)}
10220 Warn if an initialized field without side effects is overridden when
10221 using designated initializers (@pxref{Designated Inits, , Designated
10222 Initializers}).
10224 This warning is included in @option{-Wextra}.  To get other
10225 @option{-Wextra} warnings without this one, use @option{-Wextra
10226 -Wno-override-init}.
10228 @opindex Woverride-init-side-effects
10229 @opindex Wno-override-init-side-effects
10230 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
10231 Do not warn if an initialized field with side effects is overridden when
10232 using designated initializers (@pxref{Designated Inits, , Designated
10233 Initializers}).  This warning is enabled by default.
10235 @opindex Wpacked
10236 @opindex Wno-packed
10237 @item -Wpacked
10238 Warn if a structure is given the packed attribute, but the packed
10239 attribute has no effect on the layout or size of the structure.
10240 Such structures may be mis-aligned for little benefit.  For
10241 instance, in this code, the variable @code{f.x} in @code{struct bar}
10242 is misaligned even though @code{struct bar} does not itself
10243 have the packed attribute:
10245 @smallexample
10246 @group
10247 struct foo @{
10248   int x;
10249   char a, b, c, d;
10250 @} __attribute__((packed));
10251 struct bar @{
10252   char z;
10253   struct foo f;
10255 @end group
10256 @end smallexample
10258 @opindex Wpacked-bitfield-compat
10259 @opindex Wno-packed-bitfield-compat
10260 @item -Wnopacked-bitfield-compat
10261 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
10262 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
10263 the change can lead to differences in the structure layout.  GCC
10264 informs you when the offset of such a field has changed in GCC 4.4.
10265 For example there is no longer a 4-bit padding between field @code{a}
10266 and @code{b} in this structure:
10268 @smallexample
10269 struct foo
10271   char a:4;
10272   char b:8;
10273 @} __attribute__ ((packed));
10274 @end smallexample
10276 This warning is enabled by default.  Use
10277 @option{-Wno-packed-bitfield-compat} to disable this warning.
10279 @opindex Wpacked-not-aligned
10280 @opindex Wno-packed-not-aligned
10281 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
10282 Warn if a structure field with explicitly specified alignment in a
10283 packed struct or union is misaligned.  For example, a warning will
10284 be issued on @code{struct S}, like, @code{warning: alignment 1 of
10285 'struct S' is less than 8}, in this code:
10287 @smallexample
10288 @group
10289 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
10290 struct __attribute__ ((packed)) S @{
10291   struct S8 s8;
10293 @end group
10294 @end smallexample
10296 This warning is enabled by @option{-Wall}.
10298 @opindex Wpadded
10299 @opindex Wno-padded
10300 @item -Wpadded
10301 Warn if padding is included in a structure, either to align an element
10302 of the structure or to align the whole structure.  Sometimes when this
10303 happens it is possible to rearrange the fields of the structure to
10304 reduce the padding and so make the structure smaller.
10306 @opindex Wredundant-decls
10307 @opindex Wno-redundant-decls
10308 @item -Wredundant-decls
10309 Warn if anything is declared more than once in the same scope, even in
10310 cases where multiple declaration is valid and changes nothing.
10312 @opindex Wrestrict
10313 @opindex Wno-restrict
10314 @item -Wrestrict
10315 Warn when an object referenced by a @code{restrict}-qualified parameter
10316 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
10317 argument, or when copies between such objects overlap.  For example,
10318 the call to the @code{strcpy} function below attempts to truncate the string
10319 by replacing its initial characters with the last four.  However, because
10320 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
10321 the call is diagnosed.
10323 @smallexample
10324 void foo (void)
10326   char a[] = "abcd1234";
10327   strcpy (a, a + 4);
10328   @dots{}
10330 @end smallexample
10331 The @option{-Wrestrict} option detects some instances of simple overlap
10332 even without optimization but works best at @option{-O2} and above.  It
10333 is included in @option{-Wall}.
10335 @opindex Wnested-externs
10336 @opindex Wno-nested-externs
10337 @item -Wnested-externs @r{(C and Objective-C only)}
10338 Warn if an @code{extern} declaration is encountered within a function.
10340 @opindex Winline
10341 @opindex Wno-inline
10342 @item -Winline
10343 Warn if a function that is declared as inline cannot be inlined.
10344 Even with this option, the compiler does not warn about failures to
10345 inline functions declared in system headers.
10347 The compiler uses a variety of heuristics to determine whether or not
10348 to inline a function.  For example, the compiler takes into account
10349 the size of the function being inlined and the amount of inlining
10350 that has already been done in the current function.  Therefore,
10351 seemingly insignificant changes in the source program can cause the
10352 warnings produced by @option{-Winline} to appear or disappear.
10354 @opindex Winterference-size
10355 @item -Winterference-size
10356 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10357 without specifying its value with @option{--param destructive-interference-size}.
10358 Also warn about questionable values for that option.
10360 This variable is intended to be used for controlling class layout, to
10361 avoid false sharing in concurrent code:
10363 @smallexample
10364 struct independent_fields @{
10365   alignas(std::hardware_destructive_interference_size)
10366     std::atomic<int> one;
10367   alignas(std::hardware_destructive_interference_size)
10368     std::atomic<int> two;
10370 @end smallexample
10372 Here @samp{one} and @samp{two} are intended to be far enough apart
10373 that stores to one won't require accesses to the other to reload the
10374 cache line.
10376 By default, @option{--param destructive-interference-size} and
10377 @option{--param constructive-interference-size} are set based on the
10378 current @option{-mtune} option, typically to the L1 cache line size
10379 for the particular target CPU, sometimes to a range if tuning for a
10380 generic target.  So all translation units that depend on ABI
10381 compatibility for the use of these variables must be compiled with
10382 the same @option{-mtune} (or @option{-mcpu}).
10384 If ABI stability is important, such as if the use is in a header for a
10385 library, you should probably not use the hardware interference size
10386 variables at all.  Alternatively, you can force a particular value
10387 with @option{--param}.
10389 If you are confident that your use of the variable does not affect ABI
10390 outside a single build of your project, you can turn off the warning
10391 with @option{-Wno-interference-size}.
10393 @opindex Wint-in-bool-context
10394 @opindex Wno-int-in-bool-context
10395 @item -Wint-in-bool-context
10396 Warn for suspicious use of integer values where boolean values are expected,
10397 such as conditional expressions (?:) using non-boolean integer constants in
10398 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10399 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10400 for all kinds of multiplications regardless of the data type.
10401 This warning is enabled by @option{-Wall}.
10403 @opindex Wno-int-to-pointer-cast
10404 @opindex Wint-to-pointer-cast
10405 @item -Wno-int-to-pointer-cast
10406 Suppress warnings from casts to pointer type of an integer of a
10407 different size. In C++, casting to a pointer type of smaller size is
10408 an error. @option{Wint-to-pointer-cast} is enabled by default.
10411 @opindex Wno-pointer-to-int-cast
10412 @opindex Wpointer-to-int-cast
10413 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10414 Suppress warnings from casts from a pointer to an integer type of a
10415 different size.
10417 @opindex Winvalid-pch
10418 @opindex Wno-invalid-pch
10419 @item -Winvalid-pch
10420 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10421 the search path but cannot be used.
10423 @opindex Winvalid-utf8
10424 @opindex Wno-invalid-utf8
10425 @item -Winvalid-utf8
10426 Warn if an invalid UTF-8 character is found.
10427 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10428 is used and turned into error with @option{-pedantic-errors}.
10430 @opindex Wunicode
10431 @opindex Wno-unicode
10432 @item -Wno-unicode
10433 Don't diagnose invalid forms of delimited or named escape sequences which are
10434 treated as separate tokens.  @option{Wunicode} is enabled by default.
10436 @opindex Wlong-long
10437 @opindex Wno-long-long
10438 @item -Wlong-long
10439 Warn if @code{long long} type is used.  This is enabled by either
10440 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10441 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10443 This warning is upgraded to an error by @option{-pedantic-errors}.
10445 @opindex Wvariadic-macros
10446 @opindex Wno-variadic-macros
10447 @item -Wvariadic-macros
10448 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10449 alternate syntax is used in ISO C99 mode.  This is enabled by either
10450 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10451 messages, use @option{-Wno-variadic-macros}.
10453 @opindex Wvarargs
10454 @opindex Wno-varargs
10455 @item -Wno-varargs
10456 Do not warn upon questionable usage of the macros used to handle variable
10457 arguments like @code{va_start}.  These warnings are enabled by default.
10459 @opindex Wvector-operation-performance
10460 @opindex Wno-vector-operation-performance
10461 @item -Wvector-operation-performance
10462 Warn if vector operation is not implemented via SIMD capabilities of the
10463 architecture.  Mainly useful for the performance tuning.
10464 Vector operation can be implemented @code{piecewise}, which means that the
10465 scalar operation is performed on every vector element; 
10466 @code{in parallel}, which means that the vector operation is implemented
10467 using scalars of wider type, which normally is more performance efficient;
10468 and @code{as a single scalar}, which means that vector fits into a
10469 scalar type.
10471 @opindex Wvla
10472 @opindex Wno-vla
10473 @item -Wvla
10474 Warn if a variable-length array is used in the code.
10475 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10476 the variable-length array.
10478 This warning is upgraded to an error by @option{-pedantic-errors}.
10480 @opindex Wvla-larger-than=
10481 @opindex Wno-vla-larger-than
10482 @item -Wvla-larger-than=@var{byte-size}
10483 If this option is used, the compiler warns for declarations of
10484 variable-length arrays whose size is either unbounded, or bounded
10485 by an argument that allows the array size to exceed @var{byte-size}
10486 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10487 works, but with variable-length arrays.
10489 Note that GCC may optimize small variable-length arrays of a known
10490 value into plain arrays, so this warning may not get triggered for
10491 such arrays.
10493 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10494 is typically only effective when @option{-ftree-vrp} is active (default
10495 for @option{-O2} and above).
10497 See also @option{-Walloca-larger-than=@var{byte-size}}.
10499 @opindex Wno-vla-larger-than
10500 @item -Wno-vla-larger-than
10501 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10502 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10504 @opindex Wno-vla-parameter
10505 @item -Wvla-parameter
10506 Warn about redeclarations of functions involving arguments of Variable
10507 Length Array types of inconsistent kinds or forms, and enable the detection
10508 of out-of-bounds accesses to such parameters by warnings such as
10509 @option{-Warray-bounds}.
10511 If the first function declaration uses the VLA form the bound specified
10512 in the array is assumed to be the minimum number of elements expected to
10513 be provided in calls to the function and the maximum number of elements
10514 accessed by it.  Failing to provide arguments of sufficient size or
10515 accessing more than the maximum number of elements may be diagnosed.
10517 For example, the warning triggers for the following redeclarations because
10518 the first one allows an array of any size to be passed to @code{f} while
10519 the second one specifies that the array argument must have at least @code{n}
10520 elements.  In addition, calling @code{f} with the associated VLA bound
10521 parameter in excess of the actual VLA bound triggers a warning as well.
10523 @smallexample
10524 void f (int n, int[n]);
10525 // warning: argument 2 previously declared as a VLA
10526 void f (int, int[]);
10528 void g (int n)
10530     if (n > 4)
10531       return;
10532     int a[n];
10533     // warning: access to a by f may be out of bounds
10534     f (sizeof a, a);
10535   @dots{}
10538 @end smallexample
10540 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10541 @option{-Warray-parameter} option triggers warnings for similar problems
10542 involving ordinary array arguments.
10544 @opindex Wvolatile-register-var
10545 @opindex Wno-volatile-register-var
10546 @item -Wvolatile-register-var
10547 Warn if a register variable is declared volatile.  The volatile
10548 modifier does not inhibit all optimizations that may eliminate reads
10549 and/or writes to register variables.  This warning is enabled by
10550 @option{-Wall}.
10552 @opindex Wxor-used-as-pow
10553 @opindex Wno-xor-used-as-pow
10554 @item -Wno-xor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10555 Disable warnings about uses of @code{^}, the exclusive or operator,
10556 where it appears the code meant exponentiation.
10557 Specifically, the warning occurs when the
10558 left-hand side is the decimal constant 2 or 10 and the right-hand side
10559 is also a decimal constant.
10561 In C and C++, @code{^} means exclusive or, whereas in some other languages
10562 (e.g. TeX and some versions of BASIC) it means exponentiation.
10564 This warning can be silenced by converting one of the operands to
10565 hexadecimal as well as by compiling with @option{-Wno-xor-used-as-pow}.
10567 @opindex Wdisabled-optimization
10568 @opindex Wno-disabled-optimization
10569 @item -Wdisabled-optimization
10570 Warn if a requested optimization pass is disabled.  This warning does
10571 not generally indicate that there is anything wrong with your code; it
10572 merely indicates that GCC's optimizers are unable to handle the code
10573 effectively.  Often, the problem is that your code is too big or too
10574 complex; GCC refuses to optimize programs when the optimization
10575 itself is likely to take inordinate amounts of time.
10577 @opindex Wpointer-sign
10578 @opindex Wno-pointer-sign
10579 @item -Wpointer-sign @r{(C and Objective-C only)}
10580 Warn for pointer argument passing or assignment with different signedness.
10581 This option is only supported for C and Objective-C@.  It is implied by
10582 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10583 @option{-Wno-pointer-sign}.
10585 This warning is upgraded to an error by @option{-pedantic-errors}.
10587 @opindex Wstack-protector
10588 @opindex Wno-stack-protector
10589 @item -Wstack-protector
10590 This option is only active when @option{-fstack-protector} is active.  It
10591 warns about functions that are not protected against stack smashing.
10593 @opindex Woverlength-strings
10594 @opindex Wno-overlength-strings
10595 @item -Woverlength-strings
10596 Warn about string constants that are longer than the ``minimum
10597 maximum'' length specified in the C standard.  Modern compilers
10598 generally allow string constants that are much longer than the
10599 standard's minimum limit, but very portable programs should avoid
10600 using longer strings.
10602 The limit applies @emph{after} string constant concatenation, and does
10603 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10604 C99, it was raised to 4095.  C++98 does not specify a normative
10605 minimum maximum, so we do not diagnose overlength strings in C++@.
10607 This option is implied by @option{-Wpedantic}, and can be disabled with
10608 @option{-Wno-overlength-strings}.
10610 @opindex Wunsuffixed-float-constants
10611 @opindex Wno-unsuffixed-float-constants
10612 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10614 Issue a warning for any floating constant that does not have
10615 a suffix.  When used together with @option{-Wsystem-headers} it
10616 warns about such constants in system header files.  This can be useful
10617 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10618 from the decimal floating-point extension to C99.
10620 @opindex Wlto-type-mismatch
10621 @opindex Wno-lto-type-mismatch
10622 @item -Wno-lto-type-mismatch
10624 During the link-time optimization, do not warn about type mismatches in
10625 global declarations from different compilation units.
10626 Requires @option{-flto} to be enabled.  Enabled by default.
10628 @opindex Wdesignated-init
10629 @opindex Wno-designated-init
10630 @item -Wno-designated-init @r{(C and Objective-C only)}
10631 Suppress warnings when a positional initializer is used to initialize
10632 a structure that has been marked with the @code{designated_init}
10633 attribute.
10635 @end table
10637 @node Static Analyzer Options
10638 @section Options That Control Static Analysis
10640 @table @gcctabopt
10641 @opindex analyzer
10642 @opindex fanalyzer
10643 @opindex fno-analyzer
10644 @item -fanalyzer
10645 This option enables an static analysis of program flow which looks
10646 for ``interesting'' interprocedural paths through the
10647 code, and issues warnings for problems found on them.
10649 This analysis is much more expensive than other GCC warnings.
10651 In technical terms, it performs coverage-guided symbolic execution of
10652 the code being compiled.  It is neither sound nor complete: it can
10653 have false positives and false negatives.  It is a bug-finding tool,
10654 rather than a tool for proving program correctness.
10656 The analyzer is only suitable for use on C code in this release.
10658 Enabling this option effectively enables the following warnings:
10660 @gccoptlist{
10661 -Wanalyzer-allocation-size
10662 -Wanalyzer-deref-before-check
10663 -Wanalyzer-double-fclose
10664 -Wanalyzer-double-free
10665 -Wanalyzer-exposure-through-output-file
10666 -Wanalyzer-exposure-through-uninit-copy
10667 -Wanalyzer-fd-access-mode-mismatch
10668 -Wanalyzer-fd-double-close
10669 -Wanalyzer-fd-leak
10670 -Wanalyzer-fd-phase-mismatch
10671 -Wanalyzer-fd-type-mismatch
10672 -Wanalyzer-fd-use-after-close
10673 -Wanalyzer-fd-use-without-check
10674 -Wanalyzer-file-leak
10675 -Wanalyzer-free-of-non-heap
10676 -Wanalyzer-imprecise-fp-arithmetic
10677 -Wanalyzer-infinite-loop
10678 -Wanalyzer-infinite-recursion
10679 -Wanalyzer-jump-through-null
10680 -Wanalyzer-malloc-leak
10681 -Wanalyzer-mismatching-deallocation
10682 -Wanalyzer-null-argument
10683 -Wanalyzer-null-dereference
10684 -Wanalyzer-out-of-bounds
10685 -Wanalyzer-overlapping-buffers
10686 -Wanalyzer-possible-null-argument
10687 -Wanalyzer-possible-null-dereference
10688 -Wanalyzer-putenv-of-auto-var
10689 -Wanalyzer-shift-count-negative
10690 -Wanalyzer-shift-count-overflow
10691 -Wanalyzer-stale-setjmp-buffer
10692 -Wanalyzer-tainted-allocation-size
10693 -Wanalyzer-tainted-array-index
10694 -Wanalyzer-tainted-assertion
10695 -Wanalyzer-tainted-divisor
10696 -Wanalyzer-tainted-offset
10697 -Wanalyzer-tainted-size
10698 -Wanalyzer-undefined-behavior-strtok
10699 -Wanalyzer-unsafe-call-within-signal-handler
10700 -Wanalyzer-use-after-free
10701 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10702 -Wanalyzer-use-of-uninitialized-value
10703 -Wanalyzer-va-arg-type-mismatch
10704 -Wanalyzer-va-list-exhausted
10705 -Wanalyzer-va-list-leak
10706 -Wanalyzer-va-list-use-after-va-end
10707 -Wanalyzer-write-to-const
10708 -Wanalyzer-write-to-string-literal
10711 This option is only available if GCC was configured with analyzer
10712 support enabled.
10714 @opindex Wanalyzer-symbol-too-complex
10715 @opindex Wno-analyzer-symbol-too-complex
10716 @item -Wanalyzer-symbol-too-complex
10717 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10718 to attempt to track the state of memory, but these can be defeated by
10719 sufficiently complicated code.
10721 By default, the analysis silently stops tracking values of expressions
10722 if they exceed the threshold defined by
10723 @option{--param analyzer-max-svalue-depth=@var{value}}, and falls back
10724 to an imprecise representation for such expressions.
10725 The @option{-Wanalyzer-symbol-too-complex} option warns if this occurs.
10727 @opindex Wanalyzer-too-complex
10728 @opindex Wno-analyzer-too-complex
10729 @item -Wanalyzer-too-complex
10730 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10731 to attempt to explore the control flow and data flow in the program,
10732 but these can be defeated by sufficiently complicated code.
10734 By default, the analysis silently stops if the code is too
10735 complicated for the analyzer to fully explore and it reaches an internal
10736 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10738 @opindex Wanalyzer-allocation-size
10739 @opindex Wno-analyzer-allocation-size
10740 @item -Wno-analyzer-allocation-size
10741 This warning requires @option{-fanalyzer}, which enables it;
10742 to disable it, use @option{-Wno-analyzer-allocation-size}.
10744 This diagnostic warns for paths through the code in which a pointer to
10745 a buffer is assigned to point at a buffer with a size that is not a
10746 multiple of @code{sizeof (*pointer)}.
10748 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10750 @opindex Wanalyzer-deref-before-check
10751 @opindex Wno-analyzer-deref-before-check
10752 @item -Wno-analyzer-deref-before-check
10753 This warning requires @option{-fanalyzer}, which enables it; use
10754 @option{-Wno-analyzer-deref-before-check}
10755 to disable it.
10757 This diagnostic warns for paths through the code in which a pointer
10758 is checked for @code{NULL} *after* it has already been
10759 dereferenced, suggesting that the pointer could have been NULL.
10760 Such cases suggest that the check for NULL is either redundant,
10761 or that it needs to be moved to before the pointer is dereferenced.
10763 This diagnostic also considers values passed to a function argument
10764 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10765 value, and thus will complain if such values are checked for @code{NULL}
10766 after returning from such a function call.
10768 This diagnostic is unlikely to be reported when any level of optimization
10769 is enabled, as GCC's optimization logic will typically consider such
10770 checks for NULL as being redundant, and optimize them away before the
10771 analyzer "sees" them.  Hence optimization should be disabled when
10772 attempting to trigger this diagnostic.
10774 @opindex Wanalyzer-double-fclose
10775 @opindex Wno-analyzer-double-fclose
10776 @item -Wno-analyzer-double-fclose
10777 This warning requires @option{-fanalyzer}, which enables it; use
10778 @option{-Wno-analyzer-double-fclose} to disable it.
10780 This diagnostic warns for paths through the code in which a @code{FILE *}
10781 can have @code{fclose} called on it more than once.
10783 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10785 @opindex Wanalyzer-double-free
10786 @opindex Wno-analyzer-double-free
10787 @item -Wno-analyzer-double-free
10788 This warning requires @option{-fanalyzer}, which enables it; use
10789 @option{-Wno-analyzer-double-free} to disable it.
10791 This diagnostic warns for paths through the code in which a pointer
10792 can have a deallocator called on it more than once, either @code{free},
10793 or a deallocator referenced by attribute @code{malloc}.
10795 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10797 @opindex Wanalyzer-exposure-through-output-file
10798 @opindex Wno-analyzer-exposure-through-output-file
10799 @item -Wno-analyzer-exposure-through-output-file
10800 This warning requires @option{-fanalyzer}, which enables it; use
10801 @option{-Wno-analyzer-exposure-through-output-file}
10802 to disable it.
10804 This diagnostic warns for paths through the code in which a
10805 security-sensitive value is written to an output file
10806 (such as writing a password to a log file).
10808 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10810 @opindex Wanalyzer-exposure-through-uninit-copy
10811 @opindex Wno-analyzer-exposure-through-uninit-copy
10812 @item -Wanalyzer-exposure-through-uninit-copy
10813 This warning requires both @option{-fanalyzer} and the use of a plugin
10814 to specify a function that copies across a ``trust boundary''.  Use
10815 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10817 This diagnostic warns for ``infoleaks'' - paths through the code in which
10818 uninitialized values are copied across a security boundary
10819 (such as code within an OS kernel that copies a partially-initialized
10820 struct on the stack to user space).
10822 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10824 @opindex Wanalyzer-fd-access-mode-mismatch
10825 @opindex Wno-analyzer-fd-access-mode-mismatch
10826 @item -Wno-analyzer-fd-access-mode-mismatch
10827 This warning requires @option{-fanalyzer}, which enables it; use
10828 @option{-Wno-analyzer-fd-access-mode-mismatch}
10829 to disable it.
10831 This diagnostic warns for paths through code in which a
10832 @code{read} on a write-only file descriptor is attempted, or vice versa.
10834 This diagnostic also warns for code paths in a which a function with attribute
10835 @code{fd_arg_read (N)} is called with a file descriptor opened with
10836 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10837 @code{fd_arg_write (N)} is called with a file descriptor opened with
10838 @code{O_RDONLY} at referenced argument @var{N}.
10840 @opindex Wanalyzer-fd-double-close
10841 @opindex Wno-analyzer-fd-double-close
10842 @item -Wno-analyzer-fd-double-close
10843 This warning requires @option{-fanalyzer}, which enables it; use
10844 @option{-Wno-analyzer-fd-double-close}
10845 to disable it.
10847 This diagnostic warns for paths through code in which a
10848 file descriptor can be closed more than once.
10850 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10852 @opindex Wanalyzer-fd-leak
10853 @opindex Wno-analyzer-fd-leak
10854 @item -Wno-analyzer-fd-leak
10855 This warning requires @option{-fanalyzer}, which enables it; use
10856 @option{-Wno-analyzer-fd-leak}
10857 to disable it.
10859 This diagnostic warns for paths through code in which an
10860 open file descriptor is leaked.
10862 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10864 @opindex Wanalyzer-fd-phase-mismatch
10865 @opindex Wno-analyzer-fd-phase-mismatch
10866 @item -Wno-analyzer-fd-phase-mismatch
10867 This warning requires @option{-fanalyzer}, which enables it; use
10868 @option{-Wno-analyzer-fd-phase-mismatch}
10869 to disable it.
10871 This diagnostic warns for paths through code in which an operation is
10872 attempted in the wrong phase of a file descriptor's lifetime.
10873 For example, it will warn on attempts to call @code{accept} on a stream
10874 socket that has not yet had @code{listen} successfully called on it.
10876 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10878 @opindex Wanalyzer-fd-type-mismatch
10879 @opindex Wno-analyzer-fd-type-mismatch
10880 @item -Wno-analyzer-fd-type-mismatch
10881 This warning requires @option{-fanalyzer}, which enables it; use
10882 @option{-Wno-analyzer-fd-type-mismatch}
10883 to disable it.
10885 This diagnostic warns for paths through code in which an
10886 operation is attempted on the wrong type of file descriptor.
10887 For example, it will warn on attempts to use socket operations
10888 on a file descriptor obtained via @code{open}, or when attempting
10889 to use a stream socket operation on a datagram socket.
10891 @opindex Wanalyzer-fd-use-after-close
10892 @opindex Wno-analyzer-fd-use-after-close
10893 @item -Wno-analyzer-fd-use-after-close
10894 This warning requires @option{-fanalyzer}, which enables it; use
10895 @option{-Wno-analyzer-fd-use-after-close}
10896 to disable it.
10898 This diagnostic warns for paths through code in which a
10899 read or write is called on a closed file descriptor.
10901 This diagnostic also warns for paths through code in which
10902 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10903 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10904 referenced argument @code{N}.
10906 @opindex Wanalyzer-fd-use-without-check
10907 @opindex Wno-analyzer-fd-use-without-check
10908 @item -Wno-analyzer-fd-use-without-check
10909 This warning requires @option{-fanalyzer}, which enables it; use
10910 @option{-Wno-analyzer-fd-use-without-check}
10911 to disable it.
10913 This diagnostic warns for paths through code in which a
10914 file descriptor is used without being checked for validity.
10916 This diagnostic also warns for paths through code in which
10917 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10918 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10919 argument @code{N}, without being checked for validity.
10921 @opindex Wanalyzer-file-leak
10922 @opindex Wno-analyzer-file-leak
10923 @item -Wno-analyzer-file-leak
10924 This warning requires @option{-fanalyzer}, which enables it; use
10925 @option{-Wno-analyzer-file-leak}
10926 to disable it.
10928 This diagnostic warns for paths through the code in which a
10929 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10931 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10933 @opindex Wanalyzer-free-of-non-heap
10934 @opindex Wno-analyzer-free-of-non-heap
10935 @item -Wno-analyzer-free-of-non-heap
10936 This warning requires @option{-fanalyzer}, which enables it; use
10937 @option{-Wno-analyzer-free-of-non-heap}
10938 to disable it.
10940 This diagnostic warns for paths through the code in which @code{free}
10941 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10943 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10945 @opindex Wanalyzer-imprecise-fp-arithmetic
10946 @opindex Wno-analyzer-imprecise-fp-arithmetic
10947 @item -Wno-analyzer-imprecise-fp-arithmetic
10948 This warning requires @option{-fanalyzer}, which enables it; use
10949 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10950 to disable it.
10952 This diagnostic warns for paths through the code in which floating-point
10953 arithmetic is used in locations where precise computation is needed.  This
10954 diagnostic only warns on use of floating-point operands inside the
10955 calculation of an allocation size at the moment.
10957 @opindex Wanalyzer-infinite-loop
10958 @opindex Wno-analyzer-infinite-loop
10959 @item -Wno-analyzer-infinite-loop
10960 This warning requires @option{-fanalyzer}, which enables it; use
10961 @option{-Wno-analyzer-infinite-loop} to disable it.
10963 This diagnostics warns for paths through the code which appear to
10964 lead to an infinite loop.
10966 Specifically, the analyzer will issue this warning when it "sees" a loop
10967 in which:
10968 @itemize @bullet
10969 @item
10970 no externally-visible work could be being done within the loop
10971 @item
10972 there is no way to escape from the loop
10973 @item
10974 the analyzer is sufficiently confident about the program state
10975 throughout the loop to know that the above are true
10976 @end itemize
10978 One way for this warning to be emitted is when there is an execution
10979 path through a loop for which taking the path on one iteration implies
10980 that the same path will be taken on all subsequent iterations.
10982 For example, consider:
10984 @smallexample
10985   while (1)
10986     @{
10987       char opcode = *cpu_state.pc;
10988       switch (opcode)
10989        @{
10990        case OPCODE_FOO:
10991          handle_opcode_foo (&cpu_state);
10992          break;
10993        case OPCODE_BAR:
10994          handle_opcode_bar (&cpu_state);
10995          break;
10996        @}
10997     @}
10998 @end smallexample
11000 The analyzer will complain for the above case because if @code{opcode}
11001 ever matches none of the cases, the @code{switch} will follow the
11002 implicit @code{default} case, making the body of the loop be a ``no-op''
11003 with @code{cpu_state.pc} unchanged, and thus using the same value of
11004 @code{opcode} on all subseqent iterations, leading to an infinite loop.
11006 See @uref{https://cwe.mitre.org/data/definitions/835.html, CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')}.
11008 @opindex Wanalyzer-infinite-recursion
11009 @opindex Wno-analyzer-infinite-recursion
11010 @item -Wno-analyzer-infinite-recursion
11011 This warning requires @option{-fanalyzer}, which enables it; use
11012 @option{-Wno-analyzer-infinite-recursion} to disable it.
11014 This diagnostics warns for paths through the code which appear to
11015 lead to infinite recursion.
11017 Specifically, when the analyzer "sees" a recursive call, it will compare
11018 the state of memory at the entry to the new frame with that at the entry
11019 to the previous frame of that function on the stack.  The warning is
11020 issued if nothing in memory appears to be changing; any changes observed
11021 to parameters or globals are assumed to lead to termination of the
11022 recursion and thus suppress the warning.
11024 This diagnostic is likely to miss cases of infinite recursion that
11025 are convered to iteration by the optimizer before the analyzer "sees"
11026 them.  Hence optimization should be disabled when attempting to trigger
11027 this diagnostic.
11029 Compare with @option{-Winfinite-recursion}, which provides a similar
11030 diagnostic, but is implemented in a different way.
11032 See @uref{https://cwe.mitre.org/data/definitions/674.html, CWE-674: Uncontrolled Recursion}.
11034 @opindex Wanalyzer-jump-through-null
11035 @opindex Wno-analyzer-jump-through-null
11036 @item -Wno-analyzer-jump-through-null
11037 This warning requires @option{-fanalyzer}, which enables it; use
11038 @option{-Wno-analyzer-jump-through-null}
11039 to disable it.
11041 This diagnostic warns for paths through the code in which a @code{NULL}
11042 function pointer is called.
11044 @opindex Wanalyzer-malloc-leak
11045 @opindex Wno-analyzer-malloc-leak
11046 @item -Wno-analyzer-malloc-leak
11047 This warning requires @option{-fanalyzer}, which enables it; use
11048 @option{-Wno-analyzer-malloc-leak}
11049 to disable it.
11051 This diagnostic warns for paths through the code in which a
11052 pointer allocated via an allocator is leaked: either @code{malloc},
11053 or a function marked with attribute @code{malloc}.
11055 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
11057 @opindex Wanalyzer-mismatching-deallocation
11058 @opindex Wno-analyzer-mismatching-deallocation
11059 @item -Wno-analyzer-mismatching-deallocation
11060 This warning requires @option{-fanalyzer}, which enables it; use
11061 @option{-Wno-analyzer-mismatching-deallocation}
11062 to disable it.
11064 This diagnostic warns for paths through the code in which the
11065 wrong deallocation function is called on a pointer value, based on
11066 which function was used to allocate the pointer value.  The diagnostic
11067 will warn about mismatches between @code{free}, scalar @code{delete}
11068 and vector @code{delete[]}, and those marked as allocator/deallocator
11069 pairs using attribute @code{malloc}.
11071 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
11073 @opindex Wanalyzer-out-of-bounds
11074 @opindex Wno-analyzer-out-of-bounds
11075 @item -Wno-analyzer-out-of-bounds
11076 This warning requires @option{-fanalyzer}, which enables it; use
11077 @option{-Wno-analyzer-out-of-bounds} to disable it.
11079 This diagnostic warns for paths through the code in which a buffer is
11080 definitely read or written out-of-bounds.  The diagnostic applies for
11081 cases where the analyzer is able to determine a constant offset and for
11082 accesses past the end of a buffer, also a constant capacity.  Further,
11083 the diagnostic does limited checking for accesses past the end when the
11084 offset as well as the capacity is symbolic.
11086 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
11088 For cases where the analyzer is able, it will emit a text art diagram
11089 visualizing the spatial relationship between the memory region that the
11090 analyzer predicts would be accessed, versus the range of memory that is
11091 valid to access: whether they overlap, are touching, are close or far
11092 apart; which one is before or after in memory, the relative sizes
11093 involved, the direction of the access (read vs write), and, in some
11094 cases, the values of data involved.  This diagram can be suppressed
11095 using @option{-fdiagnostics-text-art-charset=none}.
11097 @opindex Wanalyzer-overlapping-buffers
11098 @opindex Wno-analyzer-overlapping-buffers
11099 @item -Wno-analyzer-overlapping-buffers
11100 This warning requires @option{-fanalyzer}, which enables it; use
11101 @option{-Wno-analyzer-overlapping-buffers} to disable it.
11103 This diagnostic warns for paths through the code in which overlapping
11104 buffers are passed to an API for which the behavior on such buffers
11105 is undefined.
11107 Specifically, the diagnostic occurs on calls to the following functions
11108 @itemize @bullet
11109 @item @code{memcpy}
11110 @item @code{strcat}
11111 @item @code{strcpy}
11112 @end itemize
11113 for cases where the buffers are known to overlap.
11115 @opindex Wanalyzer-possible-null-argument
11116 @opindex Wno-analyzer-possible-null-argument
11117 @item -Wno-analyzer-possible-null-argument
11118 This warning requires @option{-fanalyzer}, which enables it; use
11119 @option{-Wno-analyzer-possible-null-argument} to disable it.
11121 This diagnostic warns for paths through the code in which a
11122 possibly-NULL value is passed to a function argument marked
11123 with @code{__attribute__((nonnull))} as requiring a non-NULL
11124 value.
11126 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
11128 @opindex Wanalyzer-possible-null-dereference
11129 @opindex Wno-analyzer-possible-null-dereference
11130 @item -Wno-analyzer-possible-null-dereference
11131 This warning requires @option{-fanalyzer}, which enables it; use
11132 @option{-Wno-analyzer-possible-null-dereference} to disable it.
11134 This diagnostic warns for paths through the code in which a
11135 possibly-NULL value is dereferenced.
11137 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
11139 @opindex Wanalyzer-null-argument
11140 @opindex Wno-analyzer-null-argument
11141 @item -Wno-analyzer-null-argument
11142 This warning requires @option{-fanalyzer}, which enables it; use
11143 @option{-Wno-analyzer-null-argument} to disable it.
11145 This diagnostic warns for paths through the code in which a
11146 value known to be NULL is passed to a function argument marked
11147 with @code{__attribute__((nonnull))} as requiring a non-NULL
11148 value.
11150 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
11152 @opindex Wanalyzer-null-dereference
11153 @opindex Wno-analyzer-null-dereference
11154 @item -Wno-analyzer-null-dereference
11155 This warning requires @option{-fanalyzer}, which enables it; use
11156 @option{-Wno-analyzer-null-dereference} to disable it.
11158 This diagnostic warns for paths through the code in which a
11159 value known to be NULL is dereferenced.
11161 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
11163 @opindex Wanalyzer-putenv-of-auto-var
11164 @opindex Wno-analyzer-putenv-of-auto-var
11165 @item -Wno-analyzer-putenv-of-auto-var
11166 This warning requires @option{-fanalyzer}, which enables it; use
11167 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
11169 This diagnostic warns for paths through the code in which a
11170 call to @code{putenv} is passed a pointer to an automatic variable
11171 or an on-stack buffer.
11173 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}.
11175 @opindex Wanalyzer-shift-count-negative
11176 @opindex Wno-analyzer-shift-count-negative
11177 @item -Wno-analyzer-shift-count-negative
11178 This warning requires @option{-fanalyzer}, which enables it; use
11179 @option{-Wno-analyzer-shift-count-negative} to disable it.
11181 This diagnostic warns for paths through the code in which a
11182 shift is attempted with a negative count.  It is analogous to
11183 the @option{-Wshift-count-negative} diagnostic implemented in
11184 the C/C++ front ends, but is implemented based on analyzing
11185 interprocedural paths, rather than merely parsing the syntax tree.
11186 However, the analyzer does not prioritize detection of such paths, so
11187 false negatives are more likely relative to other warnings.
11189 @opindex Wanalyzer-shift-count-overflow
11190 @opindex Wno-analyzer-shift-count-overflow
11191 @item -Wno-analyzer-shift-count-overflow
11192 This warning requires @option{-fanalyzer}, which enables it; use
11193 @option{-Wno-analyzer-shift-count-overflow} to disable it.
11195 This diagnostic warns for paths through the code in which a
11196 shift is attempted with a count greater than or equal to the
11197 precision of the operand's type.  It is analogous to
11198 the @option{-Wshift-count-overflow} diagnostic implemented in
11199 the C/C++ front ends, but is implemented based on analyzing
11200 interprocedural paths, rather than merely parsing the syntax tree.
11201 However, the analyzer does not prioritize detection of such paths, so
11202 false negatives are more likely relative to other warnings.
11204 @opindex Wanalyzer-stale-setjmp-buffer
11205 @opindex Wno-analyzer-stale-setjmp-buffer
11206 @item -Wno-analyzer-stale-setjmp-buffer
11207 This warning requires @option{-fanalyzer}, which enables it; use
11208 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
11210 This diagnostic warns for paths through the code in which
11211 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
11212 to a @code{setjmp} call in a function that has returned.
11214 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
11215 location, it records the stack frame.  The stack frame becomes invalid
11216 when the function containing the @code{setjmp} call returns.  Attempting
11217 to rewind to it via @code{longjmp} would reference a stack frame that
11218 no longer exists, and likely lead to a crash (or worse).
11220 @opindex Wanalyzer-tainted-allocation-size
11221 @opindex Wno-analyzer-tainted-allocation-size
11222 @item -Wno-analyzer-tainted-allocation-size
11223 This warning requires @option{-fanalyzer} which enables it;
11224 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
11226 This diagnostic warns for paths through the code in which a value
11227 that could be under an attacker's control is used as the size
11228 of an allocation without being sanitized, so that an attacker could
11229 inject an excessively large allocation and potentially cause a denial
11230 of service attack.
11232 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
11234 @opindex Wanalyzer-tainted-assertion
11235 @opindex Wno-analyzer-tainted-assertion
11236 @item -Wno-analyzer-tainted-assertion
11238 This warning requires @option{-fanalyzer} which enables it;
11239 use @option{-Wno-analyzer-tainted-assertion} to disable it.
11241 This diagnostic warns for paths through the code in which a value
11242 that could be under an attacker's control is used as part of a
11243 condition without being first sanitized, and that condition guards a
11244 call to a function marked with attribute @code{noreturn}
11245 (such as the function @code{__builtin_unreachable}).  Such functions
11246 typically indicate abnormal termination of the program, such as for
11247 assertion failure handlers.  For example:
11249 @smallexample
11250 assert (some_tainted_value < SOME_LIMIT);
11251 @end smallexample
11253 In such cases:
11255 @itemize
11256 @item
11257 when assertion-checking is enabled: an attacker could trigger
11258 a denial of service by injecting an assertion failure
11260 @item
11261 when assertion-checking is disabled, such as by defining @code{NDEBUG},
11262 an attacker could inject data that subverts the process, since it
11263 presumably violates a precondition that is being assumed by the code.
11265 @end itemize
11267 Note that when assertion-checking is disabled, the assertions are
11268 typically removed by the preprocessor before the analyzer has a chance
11269 to "see" them, so this diagnostic can only generate warnings on builds
11270 in which assertion-checking is enabled.
11272 For the purpose of this warning, any function marked with attribute
11273 @code{noreturn} is considered as a possible assertion failure
11274 handler, including @code{__builtin_unreachable}.  Note that these functions
11275 are sometimes removed by the optimizer before the analyzer "sees" them.
11276 Hence optimization should be disabled when attempting to trigger this
11277 diagnostic.
11279 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
11281 The warning can also report problematic constructions such as
11283 @smallexample
11284 switch (some_tainted_value) @{
11285 case 0:
11286   /* [...etc; various valid cases omitted...] */
11287   break;
11289 default:
11290   __builtin_unreachable (); /* BUG: attacker can trigger this  */
11292 @end smallexample
11294 despite the above not being an assertion failure, strictly speaking.
11296 @opindex Wanalyzer-tainted-array-index
11297 @opindex Wno-analyzer-tainted-array-index
11298 @item -Wno-analyzer-tainted-array-index
11299 This warning requires @option{-fanalyzer} which enables it;
11300 use @option{-Wno-analyzer-tainted-array-index} to disable it.
11302 This diagnostic warns for paths through the code in which a value
11303 that could be under an attacker's control is used as the index
11304 of an array access without being sanitized, so that an attacker
11305 could inject an out-of-bounds access.
11307 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11309 @opindex Wanalyzer-tainted-divisor
11310 @opindex Wno-analyzer-tainted-divisor
11311 @item -Wno-analyzer-tainted-divisor
11312 This warning requires @option{-fanalyzer} which enables it;
11313 use @option{-Wno-analyzer-tainted-divisor} 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 divisor
11317 in a division or modulus operation without being sanitized, so that
11318 an attacker could inject a division-by-zero.
11320 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
11322 @opindex Wanalyzer-tainted-offset
11323 @opindex Wno-analyzer-tainted-offset
11324 @item -Wno-analyzer-tainted-offset
11325 This warning requires @option{-fanalyzer} which enables it;
11326 use @option{-Wno-analyzer-tainted-offset} 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 a pointer offset
11330 without being sanitized, so that an attacker could inject an out-of-bounds
11331 access.
11333 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
11335 @opindex Wanalyzer-tainted-size
11336 @opindex Wno-analyzer-tainted-size
11337 @item -Wno-analyzer-tainted-size
11338 This warning requires @option{-fanalyzer} which enables it;
11339 use @option{-Wno-analyzer-tainted-size} 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 the size of
11343 an operation such as @code{memset} without being sanitized, so that an
11344 attacker could inject an out-of-bounds access.
11346 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11348 @opindex Wanalyzer-undefined-behavior-strtok
11349 @opindex Wno-analyzer-undefined-behavior-strtok
11350 @item -Wno-analyzer-undefined-behavior-strtok
11351 This warning requires @option{-fanalyzer}, which enables it; use
11352 @option{-Wno-analyzer-undefined-behavior-strtok} to disable it.
11354 This diagnostic warns for paths through the code in which a
11355 call is made to @code{strtok} with undefined behavior.
11357 Specifically, passing NULL as the first parameter for the initial
11358 call to @code{strtok} within a process has undefined behavior.
11360 @opindex Wanalyzer-unsafe-call-within-signal-handler
11361 @opindex Wno-analyzer-unsafe-call-within-signal-handler
11362 @item -Wno-analyzer-unsafe-call-within-signal-handler
11363 This warning requires @option{-fanalyzer}, which enables it; use
11364 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
11366 This diagnostic warns for paths through the code in which a
11367 function known to be async-signal-unsafe (such as @code{fprintf}) is
11368 called from a signal handler.
11370 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
11372 @opindex Wanalyzer-use-after-free
11373 @opindex Wno-analyzer-use-after-free
11374 @item -Wno-analyzer-use-after-free
11375 This warning requires @option{-fanalyzer}, which enables it; use
11376 @option{-Wno-analyzer-use-after-free} to disable it.
11378 This diagnostic warns for paths through the code in which a
11379 pointer is used after a deallocator is called on it: either @code{free},
11380 or a deallocator referenced by attribute @code{malloc}.
11382 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
11384 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
11385 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
11386 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
11387 This warning requires @option{-fanalyzer}, which enables it; use
11388 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
11389 to disable it.
11391 This diagnostic warns for paths through the code in which a pointer
11392 is dereferenced that points to a variable in a stale stack frame.
11394 @opindex Wanalyzer-va-arg-type-mismatch
11395 @opindex Wno-analyzer-va-arg-type-mismatch
11396 @item -Wno-analyzer-va-arg-type-mismatch
11397 This warning requires @option{-fanalyzer}, which enables it; use
11398 @option{-Wno-analyzer-va-arg-type-mismatch}
11399 to disable it.
11401 This diagnostic warns for interprocedural paths through the code for which
11402 the analyzer detects an attempt to use @code{va_arg} to extract a value
11403 passed to a variadic call, but uses a type that does not match that of
11404 the expression passed to the call.
11406 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11408 @opindex Wanalyzer-va-list-exhausted
11409 @opindex Wno-analyzer-va-list-exhausted
11410 @item -Wno-analyzer-va-list-exhausted
11411 This warning requires @option{-fanalyzer}, which enables it; use
11412 @option{-Wno-analyzer-va-list-exhausted}
11413 to disable it.
11415 This diagnostic warns for interprocedural paths through the code for which
11416 the analyzer detects an attempt to use @code{va_arg} to access the next
11417 value passed to a variadic call, but all of the values in the
11418 @code{va_list} have already been consumed.
11420 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11422 @opindex Wanalyzer-va-list-leak
11423 @opindex Wno-analyzer-va-list-leak
11424 @item -Wno-analyzer-va-list-leak
11425 This warning requires @option{-fanalyzer}, which enables it; use
11426 @option{-Wno-analyzer-va-list-leak}
11427 to disable it.
11429 This diagnostic warns for interprocedural paths through the code for which
11430 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11431 on a @code{va_list} without a corresponding call to @code{va_end}.
11433 @opindex Wanalyzer-va-list-use-after-va-end
11434 @opindex Wno-analyzer-va-list-use-after-va-end
11435 @item -Wno-analyzer-va-list-use-after-va-end
11436 This warning requires @option{-fanalyzer}, which enables it; use
11437 @option{-Wno-analyzer-va-list-use-after-va-end}
11438 to disable it.
11440 This diagnostic warns for interprocedural paths through the code for which
11441 the analyzer detects an attempt to use a @code{va_list}  after
11442 @code{va_end} has been called on it.
11443 @code{va_list}.
11445 @opindex Wanalyzer-write-to-const
11446 @opindex Wno-analyzer-write-to-const
11447 @item -Wno-analyzer-write-to-const
11448 This warning requires @option{-fanalyzer}, which enables it; use
11449 @option{-Wno-analyzer-write-to-const}
11450 to disable it.
11452 This diagnostic warns for paths through the code in which the analyzer
11453 detects an attempt to write through a pointer to a @code{const} object.
11454 However, the analyzer does not prioritize detection of such paths, so
11455 false negatives are more likely relative to other warnings.
11457 @opindex Wanalyzer-write-to-string-literal
11458 @opindex Wno-analyzer-write-to-string-literal
11459 @item -Wno-analyzer-write-to-string-literal
11460 This warning requires @option{-fanalyzer}, which enables it; use
11461 @option{-Wno-analyzer-write-to-string-literal}
11462 to disable it.
11464 This diagnostic warns for paths through the code in which the analyzer
11465 detects an attempt to write through a pointer to a string literal.
11466 However, the analyzer does not prioritize detection of such paths, so
11467 false negatives are more likely relative to other warnings.
11469 @opindex Wanalyzer-use-of-uninitialized-value
11470 @opindex Wno-analyzer-use-of-uninitialized-value
11471 @item -Wno-analyzer-use-of-uninitialized-value
11472 This warning requires @option{-fanalyzer}, which enables it; use
11473 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11475 This diagnostic warns for paths through the code in which an uninitialized
11476 value is used.
11478 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11480 @end table
11482 The analyzer has hardcoded knowledge about the behavior of the following
11483 memory-management functions:
11485 @itemize @bullet
11486 @item @code{alloca}
11487 @item The built-in functions @code{__builtin_alloc},
11488 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11489 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11490 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11491 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11492 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11493 @item @code{calloc}
11494 @item @code{free}
11495 @item @code{malloc}
11496 @item @code{memset}
11497 @item @code{operator delete}
11498 @item @code{operator delete []}
11499 @item @code{operator new}
11500 @item @code{operator new []}
11501 @item @code{realloc}
11502 @item @code{strdup}
11503 @item @code{strndup}
11504 @end itemize
11506 @noindent
11507 of the following functions for working with file descriptors:
11509 @itemize @bullet
11510 @item @code{open}
11511 @item @code{close}
11512 @item @code{creat}
11513 @item @code{dup}, @code{dup2} and @code{dup3}
11514 @item @code{isatty}
11515 @item @code{pipe}, and @code{pipe2}
11516 @item @code{read}
11517 @item @code{write}
11518 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11519 @end itemize
11521 @noindent
11522 of the following functions for working with @code{<stdio.h>} streams:
11523 @itemize @bullet
11524 @item The built-in functions @code{__builtin_fprintf},
11525 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11526 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11527 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11528 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11529 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11530 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11531 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11532 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11533 @code{__builtin_vprintf}
11534 @item @code{fopen}
11535 @item @code{fclose}
11536 @item @code{ferror}
11537 @item @code{fgets}
11538 @item @code{fgets_unlocked}
11539 @item @code{fileno}
11540 @item @code{fread}
11541 @item @code{getc}
11542 @item @code{getchar}
11543 @item @code{fprintf}
11544 @item @code{printf}
11545 @item @code{fwrite}
11546 @end itemize
11548 @noindent
11549 and of the following functions:
11551 @itemize @bullet
11552 @item The built-in functions @code{__builtin_expect},
11553 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11554 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11555 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11556 @code{__builtin_va_start}
11557 @item The GNU extensions @code{error} and @code{error_at_line}
11558 @item @code{getpass}
11559 @item @code{longjmp}
11560 @item @code{putenv}
11561 @item @code{setjmp}
11562 @item @code{siglongjmp}
11563 @item @code{signal}
11564 @item @code{sigsetjmp}
11565 @item @code{strcat}
11566 @item @code{strchr}
11567 @item @code{strlen}
11568 @end itemize
11570 In addition, various functions with an @code{__analyzer_} prefix have
11571 special meaning to the analyzer, described in the GCC Internals manual.
11573 Pertinent parameters for controlling the exploration are:
11574 @itemize @bullet
11575 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11576 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11577 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11578 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11579 @end itemize
11581 The following options control the analyzer.
11583 @table @gcctabopt
11585 @opindex fanalyzer-call-summaries
11586 @opindex fno-analyzer-call-summaries
11587 @item -fanalyzer-call-summaries
11588 Simplify interprocedural analysis by computing the effect of certain calls,
11589 rather than exploring all paths through the function from callsite to each
11590 possible return.
11592 If enabled, call summaries are only used for functions with more than one
11593 call site, and that are sufficiently complicated (as per
11594 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11596 @opindex fanalyzer-checker
11597 @item -fanalyzer-checker=@var{name}
11598 Restrict the analyzer to run just the named checker, and enable it.
11600 @opindex fanalyzer-debug-text-art
11601 @opindex fno-analyzer-debug-text-art
11602 @item -fanalyzer-debug-text-art-headings
11603 This option is intended for analyzer developers.  If enabled,
11604 the analyzer will add extra annotations to any diagrams it generates.
11606 @opindex fanalyzer-feasibility
11607 @opindex fno-analyzer-feasibility
11608 @item -fno-analyzer-feasibility
11609 This option is intended for analyzer developers.
11611 By default the analyzer verifies that there is a feasible control flow path
11612 for each diagnostic it emits: that the conditions that hold are not mutually
11613 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11614 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11615 debugging issues in this code.
11617 @opindex fanalyzer-fine-grained
11618 @opindex fno-analyzer-fine-grained
11619 @item -fanalyzer-fine-grained
11620 This option is intended for analyzer developers.
11622 Internally the analyzer builds an ``exploded graph'' that combines
11623 control flow graphs with data flow information.
11625 By default, an edge in this graph can contain the effects of a run
11626 of multiple statements within a basic block.  With
11627 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11629 @opindex fanalyzer-show-duplicate-count
11630 @opindex fno-analyzer-show-duplicate-count
11631 @item -fanalyzer-show-duplicate-count
11632 This option is intended for analyzer developers: if multiple diagnostics
11633 have been detected as being duplicates of each other, it emits a note when
11634 reporting the best diagnostic, giving the number of additional diagnostics
11635 that were suppressed by the deduplication logic.
11637 @opindex fanalyzer-show-events-in-system-headers
11638 @opindex fno-analyzer-show-events-in-system-headers
11639 @item -fanalyzer-show-events-in-system-headers
11640 By default the analyzer emits simplified diagnostics paths by hiding
11641 events fully located within a system header.
11642 With @option{-fanalyzer-show-events-in-system-headers} such
11643 events are no longer suppressed.
11645 @opindex fanalyzer-state-merge
11646 @opindex fno-analyzer-state-merge
11647 @item -fno-analyzer-state-merge
11648 This option is intended for analyzer developers.
11650 By default the analyzer attempts to simplify analysis by merging
11651 sufficiently similar states at each program point as it builds its
11652 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11653 merging can be suppressed, for debugging state-handling issues.
11655 @opindex fanalyzer-state-purge
11656 @opindex fno-analyzer-state-purge
11657 @item -fno-analyzer-state-purge
11658 This option is intended for analyzer developers.
11660 By default the analyzer attempts to simplify analysis by purging
11661 aspects of state at a program point that appear to no longer be relevant
11662 e.g. the values of locals that aren't accessed later in the function
11663 and which aren't relevant to leak analysis.
11665 With @option{-fno-analyzer-state-purge} this purging of state can
11666 be suppressed, for debugging state-handling issues.
11668 @opindex fanalyzer-suppress-followups
11669 @opindex fno-analyzer-suppress-followups
11670 @item -fno-analyzer-suppress-followups
11671 This option is intended for analyzer developers.
11673 By default the analyzer will stop exploring an execution path after
11674 encountering certain diagnostics, in order to avoid potentially issuing a
11675 cascade of follow-up diagnostics.
11677 The diagnostics that terminate analysis along a path are:
11679 @itemize
11680 @item @option{-Wanalyzer-null-argument}
11681 @item @option{-Wanalyzer-null-dereference}
11682 @item @option{-Wanalyzer-use-after-free}
11683 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11684 @item @option{-Wanalyzer-use-of-uninitialized-value}
11685 @end itemize
11687 With @option{-fno-analyzer-suppress-followups} the analyzer will
11688 continue to explore such paths even after such diagnostics, which may
11689 be helpful for debugging issues in the analyzer, or for microbenchmarks
11690 for detecting undefined behavior.
11692 @opindex fanalyzer-transitivity
11693 @opindex fno-analyzer-transitivity
11694 @item -fanalyzer-transitivity
11695 This option enables transitivity of constraints within the analyzer.
11697 @opindex fanalyzer-undo-inlining
11698 @opindex fno-analyzer-undo-inlining
11699 @item -fno-analyzer-undo-inlining
11700 This option is intended for analyzer developers.
11702 @option{-fanalyzer} runs relatively late compared to other code analysis
11703 tools, and some optimizations have already been applied to the code.  In
11704 particular function inlining may have occurred, leading to the
11705 interprocedural execution paths emitted by the analyzer containing
11706 function frames that don't correspond to those in the original source
11707 code.
11709 By default the analyzer attempts to reconstruct the original function
11710 frames, and to emit events showing the inlined calls.
11712 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11713 the original frame information can be be disabled, which may be of help
11714 when debugging issues in the analyzer.
11716 @item -fanalyzer-verbose-edges
11717 This option is intended for analyzer developers.  It enables more
11718 verbose, lower-level detail in the descriptions of control flow
11719 within diagnostic paths.
11721 @item -fanalyzer-verbose-state-changes
11722 This option is intended for analyzer developers.  It enables more
11723 verbose, lower-level detail in the descriptions of events relating
11724 to state machines within diagnostic paths.
11726 @item -fanalyzer-verbosity=@var{level}
11727 This option controls the complexity of the control flow paths that are
11728 emitted for analyzer diagnostics.
11730 The @var{level} can be one of:
11732 @table @samp
11733 @item 0
11734 At this level, interprocedural call and return events are displayed,
11735 along with the most pertinent state-change events relating to
11736 a diagnostic.  For example, for a double-@code{free} diagnostic,
11737 both calls to @code{free} will be shown.
11739 @item 1
11740 As per the previous level, but also show events for the entry
11741 to each function.
11743 @item 2
11744 As per the previous level, but also show events relating to
11745 control flow that are significant to triggering the issue
11746 (e.g. ``true path taken'' at a conditional).
11748 This level is the default.
11750 @item 3
11751 As per the previous level, but show all control flow events, not
11752 just significant ones.
11754 @item 4
11755 This level is intended for analyzer developers; it adds various
11756 other events intended for debugging the analyzer.
11758 @end table
11760 @opindex fdump-analyzer
11761 @item -fdump-analyzer
11762 Dump internal details about what the analyzer is doing to
11763 @file{@var{file}.analyzer.txt}.
11764 @option{-fdump-analyzer-stderr} overrides this option.
11766 @opindex fdump-analyzer-stderr
11767 @item -fdump-analyzer-stderr
11768 Dump internal details about what the analyzer is doing to stderr.
11769 This option overrides @option{-fdump-analyzer}.
11771 @opindex fdump-analyzer-callgraph
11772 @item -fdump-analyzer-callgraph
11773 Dump a representation of the call graph suitable for viewing with
11774 GraphViz to @file{@var{file}.callgraph.dot}.
11776 @opindex fdump-analyzer-exploded-graph
11777 @item -fdump-analyzer-exploded-graph
11778 Dump a representation of the ``exploded graph'' suitable for viewing with
11779 GraphViz to @file{@var{file}.eg.dot}.
11780 Nodes are color-coded based on state-machine states to emphasize
11781 state changes.
11783 @opindex dump-analyzer-exploded-nodes
11784 @item -fdump-analyzer-exploded-nodes
11785 Emit diagnostics showing where nodes in the ``exploded graph'' are
11786 in relation to the program source.
11788 @opindex dump-analyzer-exploded-nodes-2
11789 @item -fdump-analyzer-exploded-nodes-2
11790 Dump a textual representation of the ``exploded graph'' to
11791 @file{@var{file}.eg.txt}.
11793 @opindex dump-analyzer-exploded-nodes-3
11794 @item -fdump-analyzer-exploded-nodes-3
11795 Dump a textual representation of the ``exploded graph'' to
11796 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11797 This is typically a large number of dump files.
11799 @opindex fdump-analyzer-exploded-paths
11800 @item -fdump-analyzer-exploded-paths
11801 Dump a textual representation of the ``exploded path'' for each
11802 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11804 @opindex dump-analyzer-feasibility
11805 @item -fdump-analyzer-feasibility
11806 Dump internal details about the analyzer's search for feasible paths.
11807 The details are written in a form suitable for viewing with GraphViz
11808 to filenames of the form @file{@var{file}.*.fg.dot},
11809 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11811 @opindex dump-analyzer-infinite-loop
11812 @item -fdump-analyzer-infinite-loop
11813 Dump internal details about the analyzer's search for infinite loops.
11814 The details are written in a form suitable for viewing with GraphViz
11815 to filenames of the form @file{@var{file}.*.infinite-loop.dot}.
11817 @opindex fdump-analyzer-json
11818 @item -fdump-analyzer-json
11819 Dump a compressed JSON representation of analyzer internals to
11820 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11821 to change.
11823 @opindex fdump-analyzer-state-purge
11824 @item -fdump-analyzer-state-purge
11825 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11826 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11827 graph with information on what state will be purged at each node.
11828 The graph is written to @file{@var{file}.state-purge.dot}.
11830 @opindex fdump-analyzer-supergraph
11831 @item -fdump-analyzer-supergraph
11832 Dump representations of the ``supergraph'' suitable for viewing with
11833 GraphViz to @file{@var{file}.supergraph.dot} and to
11834 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11835 control flow graphs in the program, with interprocedural edges for
11836 calls and returns.  The second dump contains annotations showing nodes
11837 in the ``exploded graph'' and diagnostics associated with them.
11839 @opindex fdump-analyzer-untracked
11840 @item -fdump-analyzer-untracked
11841 Emit custom warnings with internal details intended for analyzer developers.
11843 @end table
11845 @node Debugging Options
11846 @section Options for Debugging Your Program
11847 @cindex options, debugging
11848 @cindex debugging information options
11850 To tell GCC to emit extra information for use by a debugger, in almost 
11851 all cases you need only to add @option{-g} to your other options.  Some debug
11852 formats can co-exist (like DWARF with CTF) when each of them is enabled
11853 explicitly by adding the respective command line option to your other options.
11855 GCC allows you to use @option{-g} with
11856 @option{-O}.  The shortcuts taken by optimized code may occasionally
11857 be surprising: some variables you declared may not exist
11858 at all; flow of control may briefly move where you did not expect it;
11859 some statements may not be executed because they compute constant
11860 results or their values are already at hand; some statements may
11861 execute in different places because they have been moved out of loops.
11862 Nevertheless it is possible to debug optimized output.  This makes
11863 it reasonable to use the optimizer for programs that might have bugs.
11865 If you are not using some other optimization option, consider
11866 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11867 With no @option{-O} option at all, some compiler passes that collect
11868 information useful for debugging do not run at all, so that
11869 @option{-Og} may result in a better debugging experience.
11871 @table @gcctabopt
11872 @opindex g
11873 @item -g
11874 Produce debugging information in the operating system's native format
11875 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11876 information.
11878 On most systems that use stabs format, @option{-g} enables use of extra
11879 debugging information that only GDB can use; this extra information
11880 makes debugging work better in GDB but probably makes other debuggers
11881 crash or refuse to read the program.  If you want to control for certain whether
11882 to generate the extra information, use @option{-gvms} (see below).
11884 @opindex ggdb
11885 @item -ggdb
11886 Produce debugging information for use by GDB@.  This means to use the
11887 most expressive format available (DWARF, stabs, or the native format
11888 if neither of those are supported), including GDB extensions if at all
11889 possible.
11891 @opindex gdwarf
11892 @item -gdwarf
11893 @itemx -gdwarf-@var{version}
11894 Produce debugging information in DWARF format (if that is supported).
11895 The value of @var{version} may be either 2, 3, 4 or 5; the default
11896 version for most targets is 5 (with the exception of VxWorks, TPF and
11897 Darwin / macOS, which default to version 2, and AIX, which defaults
11898 to version 4).
11900 Note that with DWARF Version 2, some ports require and always
11901 use some non-conflicting DWARF 3 extensions in the unwind tables.
11903 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11904 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11906 GCC no longer supports DWARF Version 1, which is substantially
11907 different than Version 2 and later.  For historical reasons, some
11908 other DWARF-related options such as
11909 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11910 in their names, but apply to all currently-supported versions of DWARF.
11912 @opindex gbtf
11913 @item -gbtf
11914 Request BTF debug information.  BTF is the default debugging format for the
11915 eBPF target.  On other targets, like x86, BTF debug information can be
11916 generated along with DWARF debug information when both of the debug formats are
11917 enabled explicitly via their respective command line options.
11919 @opindex gctf
11920 @item -gctf
11921 @itemx -gctf@var{level}
11922 Request CTF debug information and use level to specify how much CTF debug
11923 information should be produced.  If @option{-gctf} is specified
11924 without a value for level, the default level of CTF debug information is 2.
11926 CTF debug information can be generated along with DWARF debug information when
11927 both of the debug formats are enabled explicitly via their respective command
11928 line options.
11930 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11931 negates @option{-gctf}.
11933 Level 1 produces CTF information for tracebacks only.  This includes callsite
11934 information, but does not include type information.
11936 Level 2 produces type information for entities (functions, data objects etc.)
11937 at file-scope or global-scope only.
11939 @opindex gvms
11940 @item -gvms
11941 Produce debugging information in Alpha/VMS debug format (if that is
11942 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11944 @item -gcodeview
11945 @opindex gcodeview
11946 Produce debugging information in CodeView debug format (if that is
11947 supported).  This is the format used by Microsoft Visual C++ on
11948 Windows.
11950 @item -g@var{level}
11951 @itemx -ggdb@var{level}
11952 @itemx -gvms@var{level}
11953 Request debugging information and also use @var{level} to specify how
11954 much information.  The default level is 2.
11956 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11957 @option{-g}.
11959 Level 1 produces minimal information, enough for making backtraces in
11960 parts of the program that you don't plan to debug.  This includes
11961 descriptions of functions and external variables, and line number
11962 tables, but no information about local variables.
11964 Level 3 includes extra information, such as all the macro definitions
11965 present in the program.  Some debuggers support macro expansion when
11966 you use @option{-g3}.
11968 If you use multiple @option{-g} options, with or without level numbers,
11969 the last such option is the one that is effective.
11971 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11972 confusion with @option{-gdwarf-@var{level}}.
11973 Instead use an additional @option{-g@var{level}} option to change the
11974 debug level for DWARF.
11976 @opindex feliminate-unused-debug-symbols
11977 @opindex fno-eliminate-unused-debug-symbols
11978 @item -fno-eliminate-unused-debug-symbols
11979 By default, no debug information is produced for symbols that are not actually
11980 used. Use this option if you want debug information for all symbols.
11982 @opindex femit-class-debug-always
11983 @item -femit-class-debug-always
11984 Instead of emitting debugging information for a C++ class in only one
11985 object file, emit it in all object files using the class.  This option
11986 should be used only with debuggers that are unable to handle the way GCC
11987 normally emits debugging information for classes because using this
11988 option increases the size of debugging information by as much as a
11989 factor of two.
11991 @opindex fmerge-debug-strings
11992 @opindex fno-merge-debug-strings
11993 @item -fno-merge-debug-strings
11994 Direct the linker to not merge together strings in the debugging
11995 information that are identical in different object files.  Merging is
11996 not supported by all assemblers or linkers.  Merging decreases the size
11997 of the debug information in the output file at the cost of increasing
11998 link processing time.  Merging is enabled by default.
12000 @opindex fdebug-prefix-map
12001 @item -fdebug-prefix-map=@var{old}=@var{new}
12002 When compiling files residing in directory @file{@var{old}}, record
12003 debugging information describing them as if the files resided in
12004 directory @file{@var{new}} instead.  This can be used to replace a
12005 build-time path with an install-time path in the debug info.  It can
12006 also be used to change an absolute path to a relative path by using
12007 @file{.} for @var{new}.  This can give more reproducible builds, which
12008 are location independent, but may require an extra command to tell GDB
12009 where to find the source files. See also @option{-ffile-prefix-map}
12010 and @option{-fcanon-prefix-map}.
12012 @opindex fvar-tracking
12013 @item -fvar-tracking
12014 Run variable tracking pass.  It computes where variables are stored at each
12015 position in code.  Better debugging information is then generated
12016 (if the debugging information format supports this information).
12018 It is enabled by default when compiling with optimization (@option{-Os},
12019 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
12020 the debug info format supports it.
12022 @opindex fvar-tracking-assignments
12023 @opindex fno-var-tracking-assignments
12024 @item -fvar-tracking-assignments
12025 Annotate assignments to user variables early in the compilation and
12026 attempt to carry the annotations over throughout the compilation all the
12027 way to the end, in an attempt to improve debug information while
12028 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
12030 It can be enabled even if var-tracking is disabled, in which case
12031 annotations are created and maintained, but discarded at the end.
12032 By default, this flag is enabled together with @option{-fvar-tracking},
12033 except when selective scheduling is enabled.
12035 @opindex gsplit-dwarf
12036 @item -gsplit-dwarf
12037 If DWARF debugging information is enabled, separate as much debugging
12038 information as possible into a separate output file with the extension
12039 @file{.dwo}.  This option allows the build system to avoid linking files with
12040 debug information.  To be useful, this option requires a debugger capable of
12041 reading @file{.dwo} files.
12043 @opindex gdwarf32
12044 @opindex gdwarf64
12045 @item -gdwarf32
12046 @itemx -gdwarf64
12047 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
12048 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
12049 DWARF format.  The default is target specific, on most targets it is
12050 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
12051 can't support more than 2GiB of debug information in any of the DWARF
12052 debug information sections.  The 64-bit DWARF format allows larger debug
12053 information and might not be well supported by all consumers yet.
12055 @opindex gdescribe-dies
12056 @item -gdescribe-dies
12057 Add description attributes to some DWARF DIEs that have no name attribute,
12058 such as artificial variables, external references and call site
12059 parameter DIEs.
12061 @opindex gpubnames
12062 @item -gpubnames
12063 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
12065 @opindex ggnu-pubnames
12066 @item -ggnu-pubnames
12067 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
12068 suitable for conversion into a GDB@ index.  This option is only useful
12069 with a linker that can produce GDB@ index version 7.
12071 @opindex fdebug-types-section
12072 @opindex fno-debug-types-section
12073 @item -fdebug-types-section
12074 When using DWARF Version 4 or higher, type DIEs can be put into
12075 their own @code{.debug_types} section instead of making them part of the
12076 @code{.debug_info} section.  It is more efficient to put them in a separate
12077 comdat section since the linker can then remove duplicates.
12078 But not all DWARF consumers support @code{.debug_types} sections yet
12079 and on some objects @code{.debug_types} produces larger instead of smaller
12080 debugging information.
12082 @opindex grecord-gcc-switches
12083 @opindex gno-record-gcc-switches
12084 @item -grecord-gcc-switches
12085 @itemx -gno-record-gcc-switches
12086 This switch causes the command-line options used to invoke the
12087 compiler that may affect code generation to be appended to the
12088 DW_AT_producer attribute in DWARF debugging information.  The options
12089 are concatenated with spaces separating them from each other and from
12090 the compiler version.  
12091 It is enabled by default.
12092 See also @option{-frecord-gcc-switches} for another
12093 way of storing compiler options into the object file.  
12095 @opindex gstrict-dwarf
12096 @item -gstrict-dwarf
12097 Disallow using extensions of later DWARF standard version than selected
12098 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
12099 DWARF extensions from later standard versions is allowed.
12101 @opindex gno-strict-dwarf
12102 @item -gno-strict-dwarf
12103 Allow using extensions of later DWARF standard version than selected with
12104 @option{-gdwarf-@var{version}}.
12106 @opindex gas-loc-support
12107 @item -gas-loc-support
12108 Inform the compiler that the assembler supports @code{.loc} directives.
12109 It may then use them for the assembler to generate DWARF2+ line number
12110 tables.
12112 This is generally desirable, because assembler-generated line-number
12113 tables are a lot more compact than those the compiler can generate
12114 itself.
12116 This option will be enabled by default if, at GCC configure time, the
12117 assembler was found to support such directives.
12119 @opindex gno-as-loc-support
12120 @item -gno-as-loc-support
12121 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
12122 line number tables are to be generated.
12124 @opindex gas-locview-support
12125 @item -gas-locview-support
12126 Inform the compiler that the assembler supports @code{view} assignment
12127 and reset assertion checking in @code{.loc} directives.
12129 This option will be enabled by default if, at GCC configure time, the
12130 assembler was found to support them.
12132 @item -gno-as-locview-support
12133 Force GCC to assign view numbers internally, if
12134 @option{-gvariable-location-views} are explicitly requested.
12136 @opindex gcolumn-info
12137 @opindex gno-column-info
12138 @item -gcolumn-info
12139 @itemx -gno-column-info
12140 Emit location column information into DWARF debugging information, rather
12141 than just file and line.
12142 This option is enabled by default.
12144 @opindex gstatement-frontiers
12145 @opindex gno-statement-frontiers
12146 @item -gstatement-frontiers
12147 @itemx -gno-statement-frontiers
12148 This option causes GCC to create markers in the internal representation
12149 at the beginning of statements, and to keep them roughly in place
12150 throughout compilation, using them to guide the output of @code{is_stmt}
12151 markers in the line number table.  This is enabled by default when
12152 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
12153 @dots{}), and outputting DWARF 2 debug information at the normal level.
12155 @opindex gvariable-location-views
12156 @opindex gvariable-location-views=incompat5
12157 @opindex gno-variable-location-views
12158 @item -gvariable-location-views
12159 @itemx -gvariable-location-views=incompat5
12160 @itemx -gno-variable-location-views
12161 Augment variable location lists with progressive view numbers implied
12162 from the line number table.  This enables debug information consumers to
12163 inspect state at certain points of the program, even if no instructions
12164 associated with the corresponding source locations are present at that
12165 point.  If the assembler lacks support for view numbers in line number
12166 tables, this will cause the compiler to emit the line number table,
12167 which generally makes them somewhat less compact.  The augmented line
12168 number tables and location lists are fully backward-compatible, so they
12169 can be consumed by debug information consumers that are not aware of
12170 these augmentations, but they won't derive any benefit from them either.
12172 This is enabled by default when outputting DWARF 2 debug information at
12173 the normal level, as long as there is assembler support,
12174 @option{-fvar-tracking-assignments} is enabled and
12175 @option{-gstrict-dwarf} is not.  When assembler support is not
12176 available, this may still be enabled, but it will force GCC to output
12177 internal line number tables, and if
12178 @option{-ginternal-reset-location-views} is not enabled, that will most
12179 certainly lead to silently mismatching location views.
12181 There is a proposed representation for view numbers that is not backward
12182 compatible with the location list format introduced in DWARF 5, that can
12183 be enabled with @option{-gvariable-location-views=incompat5}.  This
12184 option may be removed in the future, is only provided as a reference
12185 implementation of the proposed representation.  Debug information
12186 consumers are not expected to support this extended format, and they
12187 would be rendered unable to decode location lists using it.
12189 @opindex ginternal-reset-location-views
12190 @opindex gno-internal-reset-location-views
12191 @item -ginternal-reset-location-views
12192 @itemx -gno-internal-reset-location-views
12193 Attempt to determine location views that can be omitted from location
12194 view lists.  This requires the compiler to have very accurate insn
12195 length estimates, which isn't always the case, and it may cause
12196 incorrect view lists to be generated silently when using an assembler
12197 that does not support location view lists.  The GNU assembler will flag
12198 any such error as a @code{view number mismatch}.  This is only enabled
12199 on ports that define a reliable estimation function.
12201 @opindex ginline-points
12202 @opindex gno-inline-points
12203 @item -ginline-points
12204 @itemx -gno-inline-points
12205 Generate extended debug information for inlined functions.  Location
12206 view tracking markers are inserted at inlined entry points, so that
12207 address and view numbers can be computed and output in debug
12208 information.  This can be enabled independently of location views, in
12209 which case the view numbers won't be output, but it can only be enabled
12210 along with statement frontiers, and it is only enabled by default if
12211 location views are enabled.
12213 @opindex gz
12214 @item -gz@r{[}=@var{type}@r{]}
12215 Produce compressed debug sections in DWARF format, if that is supported.
12216 If @var{type} is not given, the default type depends on the capabilities
12217 of the assembler and linker used.  @var{type} may be one of
12218 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
12219 compression in ELF gABI format).  If the linker doesn't support writing
12220 compressed debug sections, the option is rejected.  Otherwise, if the
12221 assembler does not support them, @option{-gz} is silently ignored when
12222 producing object files.
12224 @opindex femit-struct-debug-baseonly
12225 @item -femit-struct-debug-baseonly
12226 Emit debug information for struct-like types
12227 only when the base name of the compilation source file
12228 matches the base name of file in which the struct is defined.
12230 This option substantially reduces the size of debugging information,
12231 but at significant potential loss in type information to the debugger.
12232 See @option{-femit-struct-debug-reduced} for a less aggressive option.
12233 See @option{-femit-struct-debug-detailed} for more detailed control.
12235 This option works only with DWARF debug output.
12237 @opindex femit-struct-debug-reduced
12238 @item -femit-struct-debug-reduced
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 type is defined,
12242 unless the struct is a template or defined in a system header.
12244 This option significantly reduces the size of debugging information,
12245 with some potential loss in type information to the debugger.
12246 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
12247 See @option{-femit-struct-debug-detailed} for more detailed control.
12249 This option works only with DWARF debug output.
12251 @opindex femit-struct-debug-detailed
12252 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
12253 Specify the struct-like types
12254 for which the compiler generates debug information.
12255 The intent is to reduce duplicate struct debug information
12256 between different object files within the same program.
12258 This option is a detailed version of
12259 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
12260 which serves for most needs.
12262 A specification has the syntax@*
12263 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
12265 The optional first word limits the specification to
12266 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
12267 A struct type is used directly when it is the type of a variable, member.
12268 Indirect uses arise through pointers to structs.
12269 That is, when use of an incomplete struct is valid, the use is indirect.
12270 An example is
12271 @samp{struct one direct; struct two * indirect;}.
12273 The optional second word limits the specification to
12274 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
12275 Generic structs are a bit complicated to explain.
12276 For C++, these are non-explicit specializations of template classes,
12277 or non-template classes within the above.
12278 Other programming languages have generics,
12279 but @option{-femit-struct-debug-detailed} does not yet implement them.
12281 The third word specifies the source files for those
12282 structs for which the compiler should emit debug information.
12283 The values @samp{none} and @samp{any} have the normal meaning.
12284 The value @samp{base} means that
12285 the base of name of the file in which the type declaration appears
12286 must match the base of the name of the main compilation file.
12287 In practice, this means that when compiling @file{foo.c}, debug information
12288 is generated for types declared in that file and @file{foo.h},
12289 but not other header files.
12290 The value @samp{sys} means those types satisfying @samp{base}
12291 or declared in system or compiler headers.
12293 You may need to experiment to determine the best settings for your application.
12295 The default is @option{-femit-struct-debug-detailed=all}.
12297 This option works only with DWARF debug output.
12299 @opindex fdwarf2-cfi-asm
12300 @opindex fno-dwarf2-cfi-asm
12301 @item -fno-dwarf2-cfi-asm
12302 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
12303 instead of using GAS @code{.cfi_*} directives.
12305 @opindex feliminate-unused-debug-types
12306 @opindex fno-eliminate-unused-debug-types
12307 @item -fno-eliminate-unused-debug-types
12308 Normally, when producing DWARF output, GCC avoids producing debug symbol 
12309 output for types that are nowhere used in the source file being compiled.
12310 Sometimes it is useful to have GCC emit debugging
12311 information for all types declared in a compilation
12312 unit, regardless of whether or not they are actually used
12313 in that compilation unit, for example 
12314 if, in the debugger, you want to cast a value to a type that is
12315 not actually used in your program (but is declared).  More often,
12316 however, this results in a significant amount of wasted space.
12317 @end table
12319 @node Optimize Options
12320 @section Options That Control Optimization
12321 @cindex optimize options
12322 @cindex options, optimization
12324 These options control various sorts of optimizations.
12326 Without any optimization option, the compiler's goal is to reduce the
12327 cost of compilation and to make debugging produce the expected
12328 results.  Statements are independent: if you stop the program with a
12329 breakpoint between statements, you can then assign a new value to any
12330 variable or change the program counter to any other statement in the
12331 function and get exactly the results you expect from the source
12332 code.
12334 Turning on optimization flags makes the compiler attempt to improve
12335 the performance and/or code size at the expense of compilation time
12336 and possibly the ability to debug the program.
12338 The compiler performs optimization based on the knowledge it has of the
12339 program.  Compiling multiple files at once to a single output file mode allows
12340 the compiler to use information gained from all of the files when compiling
12341 each of them.
12343 Not all optimizations are controlled directly by a flag.  Only
12344 optimizations that have a flag are listed in this section.
12346 Most optimizations are completely disabled at @option{-O0} or if an
12347 @option{-O} level is not set on the command line, even if individual
12348 optimization flags are specified.  Similarly, @option{-Og} suppresses
12349 many optimization passes.
12351 Depending on the target and how GCC was configured, a slightly different
12352 set of optimizations may be enabled at each @option{-O} level than
12353 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
12354 to find out the exact set of optimizations that are enabled at each level.
12355 @xref{Overall Options}, for examples.
12357 @table @gcctabopt
12358 @opindex O
12359 @opindex O1
12360 @item -O
12361 @itemx -O1
12362 Optimize.  Optimizing compilation takes somewhat more time, and a lot
12363 more memory for a large function.
12365 With @option{-O}, the compiler tries to reduce code size and execution
12366 time, without performing any optimizations that take a great deal of
12367 compilation time.
12369 @c Note that in addition to the default_options_table list in opts.cc,
12370 @c several optimization flags default to true but control optimization
12371 @c passes that are explicitly disabled at -O0.
12373 @option{-O} turns on the following optimization flags:
12375 @c Please keep the following list alphabetized.
12376 @gccoptlist{-fauto-inc-dec
12377 -fbranch-count-reg
12378 -fcombine-stack-adjustments
12379 -fcompare-elim
12380 -fcprop-registers
12381 -fdce
12382 -fdefer-pop
12383 -fdelayed-branch
12384 -fdse
12385 -fforward-propagate
12386 -fguess-branch-probability
12387 -fif-conversion
12388 -fif-conversion2
12389 -finline-functions-called-once
12390 -fipa-modref
12391 -fipa-profile
12392 -fipa-pure-const
12393 -fipa-reference
12394 -fipa-reference-addressable
12395 -fmerge-constants
12396 -fmove-loop-invariants
12397 -fmove-loop-stores
12398 -fomit-frame-pointer
12399 -freorder-blocks
12400 -fshrink-wrap
12401 -fshrink-wrap-separate
12402 -fsplit-wide-types
12403 -fssa-backprop
12404 -fssa-phiopt
12405 -ftree-bit-ccp
12406 -ftree-ccp
12407 -ftree-ch
12408 -ftree-coalesce-vars
12409 -ftree-copy-prop
12410 -ftree-dce
12411 -ftree-dominator-opts
12412 -ftree-dse
12413 -ftree-forwprop
12414 -ftree-fre
12415 -ftree-phiprop
12416 -ftree-pta
12417 -ftree-scev-cprop
12418 -ftree-sink
12419 -ftree-slsr
12420 -ftree-sra
12421 -ftree-ter
12422 -funit-at-a-time}
12424 @opindex O2
12425 @item -O2
12426 Optimize even more.  GCC performs nearly all supported optimizations
12427 that do not involve a space-speed tradeoff.
12428 As compared to @option{-O}, this option increases both compilation time
12429 and the performance of the generated code.
12431 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12432 also turns on the following optimization flags:
12434 @c Please keep the following list alphabetized!
12435 @gccoptlist{-falign-functions  -falign-jumps
12436 -falign-labels  -falign-loops
12437 -fcaller-saves
12438 -fcode-hoisting
12439 -fcrossjumping
12440 -fcse-follow-jumps  -fcse-skip-blocks
12441 -fdelete-null-pointer-checks
12442 -fdevirtualize  -fdevirtualize-speculatively
12443 -fexpensive-optimizations
12444 -ffinite-loops
12445 -fgcse  -fgcse-lm
12446 -fhoist-adjacent-loads
12447 -finline-functions
12448 -finline-small-functions
12449 -findirect-inlining
12450 -fipa-bit-cp  -fipa-cp  -fipa-icf
12451 -fipa-ra  -fipa-sra  -fipa-vrp
12452 -fisolate-erroneous-paths-dereference
12453 -flra-remat
12454 -foptimize-sibling-calls
12455 -foptimize-strlen
12456 -fpartial-inlining
12457 -fpeephole2
12458 -freorder-blocks-algorithm=stc
12459 -freorder-blocks-and-partition  -freorder-functions
12460 -frerun-cse-after-loop
12461 -fschedule-insns  -fschedule-insns2
12462 -fsched-interblock  -fsched-spec
12463 -fstore-merging
12464 -fstrict-aliasing
12465 -fthread-jumps
12466 -ftree-builtin-call-dce
12467 -ftree-loop-vectorize
12468 -ftree-pre
12469 -ftree-slp-vectorize
12470 -ftree-switch-conversion  -ftree-tail-merge
12471 -ftree-vrp
12472 -fvect-cost-model=very-cheap}
12474 Please note the warning under @option{-fgcse} about
12475 invoking @option{-O2} on programs that use computed gotos.
12477 @opindex O3
12478 @item -O3
12479 Optimize yet more.  @option{-O3} turns on all optimizations specified
12480 by @option{-O2} and also turns on the following optimization flags:
12482 @c Please keep the following list alphabetized!
12483 @gccoptlist{-fgcse-after-reload
12484 -fipa-cp-clone
12485 -floop-interchange
12486 -floop-unroll-and-jam
12487 -fpeel-loops
12488 -fpredictive-commoning
12489 -fsplit-loops
12490 -fsplit-paths
12491 -ftree-loop-distribution
12492 -ftree-partial-pre
12493 -funswitch-loops
12494 -fvect-cost-model=dynamic
12495 -fversion-loops-for-strides}
12497 @opindex O0
12498 @item -O0
12499 Reduce compilation time and make debugging produce the expected
12500 results.  This is the default.
12502 @opindex Os
12503 @item -Os
12504 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12505 except those that often increase code size:
12507 @gccoptlist{-falign-functions  -falign-jumps
12508 -falign-labels  -falign-loops
12509 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12511 It also enables @option{-finline-functions}, causes the compiler to tune for
12512 code size rather than execution speed, and performs further optimizations
12513 designed to reduce code size.
12515 @opindex Ofast
12516 @item -Ofast
12517 Disregard strict standards compliance.  @option{-Ofast} enables all
12518 @option{-O3} optimizations.  It also enables optimizations that are not
12519 valid for all standard-compliant programs.
12520 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12521 and the Fortran-specific @option{-fstack-arrays}, unless
12522 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12523 It turns off @option{-fsemantic-interposition}.
12525 @opindex Og
12526 @item -Og
12527 Optimize debugging experience.  @option{-Og} should be the optimization
12528 level of choice for the standard edit-compile-debug cycle, offering
12529 a reasonable level of optimization while maintaining fast compilation
12530 and a good debugging experience.  It is a better choice than @option{-O0}
12531 for producing debuggable code because some compiler passes
12532 that collect debug information are disabled at @option{-O0}.
12534 Like @option{-O0}, @option{-Og} completely disables a number of 
12535 optimization passes so that individual options controlling them have
12536 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12537 optimization flags except for those that may interfere with debugging:
12539 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12540 -fdse  -fif-conversion  -fif-conversion2
12541 -finline-functions-called-once
12542 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12543 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12545 @opindex Oz
12546 @item -Oz
12547 Optimize aggressively for size rather than speed.  This may increase
12548 the number of instructions executed if those instructions require
12549 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12550 including enabling most @option{-O2} optimizations.
12552 @end table
12554 If you use multiple @option{-O} options, with or without level numbers,
12555 the last such option is the one that is effective.
12557 Options of the form @option{-f@var{flag}} specify machine-independent
12558 flags.  Most flags have both positive and negative forms; the negative
12559 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12560 below, only one of the forms is listed---the one you typically 
12561 use.  You can figure out the other form by either removing @samp{no-}
12562 or adding it.
12564 The following options control specific optimizations.  They are either
12565 activated by @option{-O} options or are related to ones that are.  You
12566 can use the following flags in the rare cases when ``fine-tuning'' of
12567 optimizations to be performed is desired.
12569 @table @gcctabopt
12570 @opindex fno-defer-pop
12571 @opindex fdefer-pop
12572 @item -fno-defer-pop
12573 For machines that must pop arguments after a function call, always pop 
12574 the arguments as soon as each function returns.  
12575 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12576 this allows the compiler to let arguments accumulate on the stack for several
12577 function calls and pop them all at once.
12579 @opindex fforward-propagate
12580 @item -fforward-propagate
12581 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12582 instructions and checks if the result can be simplified.  If loop unrolling
12583 is active, two passes are performed and the second is scheduled after
12584 loop unrolling.
12586 This option is enabled by default at optimization levels @option{-O1},
12587 @option{-O2}, @option{-O3}, @option{-Os}.
12589 @opindex ffp-contract
12590 @item -ffp-contract=@var{style}
12591 @option{-ffp-contract=off} disables floating-point expression contraction.
12592 @option{-ffp-contract=fast} enables floating-point expression contraction
12593 such as forming of fused multiply-add operations if the target has
12594 native support for them.
12595 @option{-ffp-contract=on} enables floating-point expression contraction
12596 if allowed by the language standard.  This is implemented for C and C++,
12597 where it enables contraction within one expression, but not across
12598 different statements.
12600 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12601 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12603 @opindex fomit-frame-pointer
12604 @item -fomit-frame-pointer
12605 Omit the frame pointer in functions that don't need one.  This avoids the
12606 instructions to save, set up and restore the frame pointer; on many targets
12607 it also makes an extra register available.
12609 On some targets this flag has no effect because the standard calling sequence
12610 always uses a frame pointer, so it cannot be omitted.
12612 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12613 is used in all functions.  Several targets always omit the frame pointer in
12614 leaf functions.
12616 Enabled by default at @option{-O1} and higher.
12618 @opindex foptimize-sibling-calls
12619 @item -foptimize-sibling-calls
12620 Optimize sibling and tail recursive calls.
12622 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12624 @opindex foptimize-strlen
12625 @item -foptimize-strlen
12626 Optimize various standard C string functions (e.g.@: @code{strlen},
12627 @code{strchr} or @code{strcpy}) and
12628 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12630 Enabled at levels @option{-O2}, @option{-O3}.
12632 @opindex finline-stringops
12633 @item -finline-stringops[=@var{fn}]
12634 Expand memory and string operations (for now, only @code{memset})
12635 inline, even when the length is variable or big enough as to require
12636 looping.  This is most useful along with @option{-ffreestanding} and
12637 @option{-fno-builtin}.
12639 In some circumstances, it enables the compiler to generate code that
12640 takes advantage of known alignment and length multipliers, but even then
12641 it may be less efficient than optimized runtime implementations, and
12642 grow code size so much that even a less performant but shared
12643 implementation runs faster due to better use of code caches.  This
12644 option is disabled by default.
12646 @opindex fno-inline
12647 @opindex finline
12648 @item -fno-inline
12649 Do not expand any functions inline apart from those marked with
12650 the @code{always_inline} attribute.  This is the default when not
12651 optimizing.
12653 Single functions can be exempted from inlining by marking them
12654 with the @code{noinline} attribute.
12656 @opindex finline-small-functions
12657 @item -finline-small-functions
12658 Integrate functions into their callers when their body is smaller than expected
12659 function call code (so overall size of program gets smaller).  The compiler
12660 heuristically decides which functions are simple enough to be worth integrating
12661 in this way.  This inlining applies to all functions, even those not declared
12662 inline.
12664 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12666 @opindex findirect-inlining
12667 @item -findirect-inlining
12668 Inline also indirect calls that are discovered to be known at compile
12669 time thanks to previous inlining.  This option has any effect only
12670 when inlining itself is turned on by the @option{-finline-functions}
12671 or @option{-finline-small-functions} options.
12673 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12675 @opindex finline-functions
12676 @item -finline-functions
12677 Consider all functions for inlining, even if they are not declared inline.
12678 The compiler heuristically decides which functions are worth integrating
12679 in this way.
12681 If all calls to a given function are integrated, and the function is
12682 declared @code{static}, then the function is normally not output as
12683 assembler code in its own right.
12685 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12686 by @option{-fprofile-use} and @option{-fauto-profile}.
12688 @opindex finline-functions-called-once
12689 @item -finline-functions-called-once
12690 Consider all @code{static} functions called once for inlining into their
12691 caller even if they are not marked @code{inline}.  If a call to a given
12692 function is integrated, then the function is not output as assembler code
12693 in its own right.
12695 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12696 but not @option{-Og}.
12698 @opindex fearly-inlining
12699 @item -fearly-inlining
12700 Inline functions marked by @code{always_inline} and functions whose body seems
12701 smaller than the function call overhead early before doing
12702 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12703 makes profiling significantly cheaper and usually inlining faster on programs
12704 having large chains of nested wrapper functions.
12706 Enabled by default.
12708 @opindex fipa-sra
12709 @item -fipa-sra
12710 Perform interprocedural scalar replacement of aggregates, removal of
12711 unused parameters and replacement of parameters passed by reference
12712 by parameters passed by value.
12714 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12716 @opindex finline-limit
12717 @item -finline-limit=@var{n}
12718 By default, GCC limits the size of functions that can be inlined.  This flag
12719 allows coarse control of this limit.  @var{n} is the size of functions that
12720 can be inlined in number of pseudo instructions.
12722 Inlining is actually controlled by a number of parameters, which may be
12723 specified individually by using @option{--param @var{name}=@var{value}}.
12724 The @option{-finline-limit=@var{n}} option sets some of these parameters
12725 as follows:
12727 @table @gcctabopt
12728 @item max-inline-insns-single
12729 is set to @var{n}/2.
12730 @item max-inline-insns-auto
12731 is set to @var{n}/2.
12732 @end table
12734 See below for a documentation of the individual
12735 parameters controlling inlining and for the defaults of these parameters.
12737 @emph{Note:} there may be no value to @option{-finline-limit} that results
12738 in default behavior.
12740 @emph{Note:} pseudo instruction represents, in this particular context, an
12741 abstract measurement of function's size.  In no way does it represent a count
12742 of assembly instructions and as such its exact meaning might change from one
12743 release to an another.
12745 @opindex fno-keep-inline-dllexport
12746 @opindex fkeep-inline-dllexport
12747 @item -fno-keep-inline-dllexport
12748 This is a more fine-grained version of @option{-fkeep-inline-functions},
12749 which applies only to functions that are declared using the @code{dllexport}
12750 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12751 Functions}.
12753 @opindex fkeep-inline-functions
12754 @item -fkeep-inline-functions
12755 In C, emit @code{static} functions that are declared @code{inline}
12756 into the object file, even if the function has been inlined into all
12757 of its callers.  This switch does not affect functions using the
12758 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12759 inline functions into the object file.
12761 @opindex fkeep-static-functions
12762 @item -fkeep-static-functions
12763 Emit @code{static} functions into the object file, even if the function
12764 is never used.
12766 @opindex fkeep-static-consts
12767 @item -fkeep-static-consts
12768 Emit variables declared @code{static const} when optimization isn't turned
12769 on, even if the variables aren't referenced.
12771 GCC enables this option by default.  If you want to force the compiler to
12772 check if a variable is referenced, regardless of whether or not
12773 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12775 @opindex fmerge-constants
12776 @item -fmerge-constants
12777 Attempt to merge identical constants (string constants and floating-point
12778 constants) across compilation units.
12780 This option is the default for optimized compilation if the assembler and
12781 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12782 behavior.
12784 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12786 @opindex fmerge-all-constants
12787 @item -fmerge-all-constants
12788 Attempt to merge identical constants and identical variables.
12790 This option implies @option{-fmerge-constants}.  In addition to
12791 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12792 arrays or initialized constant variables with integral or floating-point
12793 types.  Languages like C or C++ require each variable, including multiple
12794 instances of the same variable in recursive calls, to have distinct locations,
12795 so using this option results in non-conforming
12796 behavior.
12798 @opindex fmodulo-sched
12799 @item -fmodulo-sched
12800 Perform swing modulo scheduling immediately before the first scheduling
12801 pass.  This pass looks at innermost loops and reorders their
12802 instructions by overlapping different iterations.
12804 @opindex fmodulo-sched-allow-regmoves
12805 @item -fmodulo-sched-allow-regmoves
12806 Perform more aggressive SMS-based modulo scheduling with register moves
12807 allowed.  By setting this flag certain anti-dependences edges are
12808 deleted, which triggers the generation of reg-moves based on the
12809 life-range analysis.  This option is effective only with
12810 @option{-fmodulo-sched} enabled.
12812 @opindex fno-branch-count-reg
12813 @opindex fbranch-count-reg
12814 @item -fno-branch-count-reg
12815 Disable the optimization pass that scans for opportunities to use 
12816 ``decrement and branch'' instructions on a count register instead of
12817 instruction sequences that decrement a register, compare it against zero, and
12818 then branch based upon the result.  This option is only meaningful on
12819 architectures that support such instructions, which include x86, PowerPC,
12820 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12821 doesn't remove the decrement and branch instructions from the generated
12822 instruction stream introduced by other optimization passes.
12824 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12825 except for @option{-Og}.
12827 @opindex fno-function-cse
12828 @opindex ffunction-cse
12829 @item -fno-function-cse
12830 Do not put function addresses in registers; make each instruction that
12831 calls a constant function contain the function's address explicitly.
12833 This option results in less efficient code, but some strange hacks
12834 that alter the assembler output may be confused by the optimizations
12835 performed when this option is not used.
12837 The default is @option{-ffunction-cse}
12839 @opindex fno-zero-initialized-in-bss
12840 @opindex fzero-initialized-in-bss
12841 @item -fno-zero-initialized-in-bss
12842 If the target supports a BSS section, GCC by default puts variables that
12843 are initialized to zero into BSS@.  This can save space in the resulting
12844 code.
12846 This option turns off this behavior because some programs explicitly
12847 rely on variables going to the data section---e.g., so that the
12848 resulting executable can find the beginning of that section and/or make
12849 assumptions based on that.
12851 The default is @option{-fzero-initialized-in-bss}.
12853 @opindex fthread-jumps
12854 @item -fthread-jumps
12855 Perform optimizations that check to see if a jump branches to a
12856 location where another comparison subsumed by the first is found.  If
12857 so, the first branch is redirected to either the destination of the
12858 second branch or a point immediately following it, depending on whether
12859 the condition is known to be true or false.
12861 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12863 @opindex fsplit-wide-types
12864 @item -fsplit-wide-types
12865 When using a type that occupies multiple registers, such as @code{long
12866 long} on a 32-bit system, split the registers apart and allocate them
12867 independently.  This normally generates better code for those types,
12868 but may make debugging more difficult.
12870 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12871 @option{-Os}.
12873 @opindex fsplit-wide-types-early
12874 @item -fsplit-wide-types-early
12875 Fully split wide types early, instead of very late.
12876 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12878 This is the default on some targets.
12880 @opindex fcse-follow-jumps
12881 @item -fcse-follow-jumps
12882 In common subexpression elimination (CSE), scan through jump instructions
12883 when the target of the jump is not reached by any other path.  For
12884 example, when CSE encounters an @code{if} statement with an
12885 @code{else} clause, CSE follows the jump when the condition
12886 tested is false.
12888 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12890 @opindex fcse-skip-blocks
12891 @item -fcse-skip-blocks
12892 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12893 follow jumps that conditionally skip over blocks.  When CSE
12894 encounters a simple @code{if} statement with no else clause,
12895 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12896 body of the @code{if}.
12898 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12900 @opindex frerun-cse-after-loop
12901 @item -frerun-cse-after-loop
12902 Re-run common subexpression elimination after loop optimizations are
12903 performed.
12905 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12907 @opindex fgcse
12908 @item -fgcse
12909 Perform a global common subexpression elimination pass.
12910 This pass also performs global constant and copy propagation.
12912 @emph{Note:} When compiling a program using computed gotos, a GCC
12913 extension, you may get better run-time performance if you disable
12914 the global common subexpression elimination pass by adding
12915 @option{-fno-gcse} to the command line.
12917 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12919 @opindex fgcse-lm
12920 @item -fgcse-lm
12921 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12922 attempts to move loads that are only killed by stores into themselves.  This
12923 allows a loop containing a load/store sequence to be changed to a load outside
12924 the loop, and a copy/store within the loop.
12926 Enabled by default when @option{-fgcse} is enabled.
12928 @opindex fgcse-sm
12929 @item -fgcse-sm
12930 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12931 global common subexpression elimination.  This pass attempts to move
12932 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12933 loops containing a load/store sequence can be changed to a load before
12934 the loop and a store after the loop.
12936 Not enabled at any optimization level.
12938 @opindex fgcse-las
12939 @item -fgcse-las
12940 When @option{-fgcse-las} is enabled, the global common subexpression
12941 elimination pass eliminates redundant loads that come after stores to the
12942 same memory location (both partial and full redundancies).
12944 Not enabled at any optimization level.
12946 @opindex fgcse-after-reload
12947 @item -fgcse-after-reload
12948 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12949 pass is performed after reload.  The purpose of this pass is to clean up
12950 redundant spilling.
12952 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12954 @opindex faggressive-loop-optimizations
12955 @item -faggressive-loop-optimizations
12956 This option tells the loop optimizer to use language constraints to
12957 derive bounds for the number of iterations of a loop.  This assumes that
12958 loop code does not invoke undefined behavior by for example causing signed
12959 integer overflows or out-of-bound array accesses.  The bounds for the
12960 number of iterations of a loop are used to guide loop unrolling and peeling
12961 and loop exit test optimizations.
12962 This option is enabled by default.
12964 @opindex funconstrained-commons
12965 @item -funconstrained-commons
12966 This option tells the compiler that variables declared in common blocks
12967 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12968 prevents certain optimizations that depend on knowing the array bounds.
12970 @opindex fcrossjumping
12971 @item -fcrossjumping
12972 Perform cross-jumping transformation.
12973 This transformation unifies equivalent code and saves code size.  The
12974 resulting code may or may not perform better than without cross-jumping.
12976 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12978 @opindex fauto-inc-dec
12979 @item -fauto-inc-dec
12980 Combine increments or decrements of addresses with memory accesses.
12981 This pass is always skipped on architectures that do not have
12982 instructions to support this.  Enabled by default at @option{-O1} and
12983 higher on architectures that support this.
12985 @opindex fdce
12986 @item -fdce
12987 Perform dead code elimination (DCE) on RTL@.
12988 Enabled by default at @option{-O1} and higher.
12990 @opindex fdse
12991 @item -fdse
12992 Perform dead store elimination (DSE) on RTL@.
12993 Enabled by default at @option{-O1} and higher.
12995 @opindex fif-conversion
12996 @item -fif-conversion
12997 Attempt to transform conditional jumps into branch-less equivalents.  This
12998 includes use of conditional moves, min, max, set flags and abs instructions, and
12999 some tricks doable by standard arithmetics.  The use of conditional execution
13000 on chips where it is available is controlled by @option{-fif-conversion2}.
13002 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
13003 not with @option{-Og}.
13005 @opindex fif-conversion2
13006 @item -fif-conversion2
13007 Use conditional execution (where available) to transform conditional jumps into
13008 branch-less equivalents.
13010 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
13011 not with @option{-Og}.
13013 @opindex fdeclone-ctor-dtor
13014 @item -fdeclone-ctor-dtor
13015 The C++ ABI requires multiple entry points for constructors and
13016 destructors: one for a base subobject, one for a complete object, and
13017 one for a virtual destructor that calls operator delete afterwards.
13018 For a hierarchy with virtual bases, the base and complete variants are
13019 clones, which means two copies of the function.  With this option, the
13020 base and complete variants are changed to be thunks that call a common
13021 implementation.
13023 Enabled by @option{-Os}.
13025 @opindex fdelete-null-pointer-checks
13026 @item -fdelete-null-pointer-checks
13027 Assume that programs cannot safely dereference null pointers, and that
13028 no code or data element resides at address zero.
13029 This option enables simple constant
13030 folding optimizations at all optimization levels.  In addition, other
13031 optimization passes in GCC use this flag to control global dataflow
13032 analyses that eliminate useless checks for null pointers; these assume
13033 that a memory access to address zero always results in a trap, so
13034 that if a pointer is checked after it has already been dereferenced,
13035 it cannot be null.
13037 Note however that in some environments this assumption is not true.
13038 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
13039 for programs that depend on that behavior.
13041 This option is enabled by default on most targets.  On Nios II ELF, it
13042 defaults to off.  On AVR and MSP430, this option is completely disabled.
13044 Passes that use the dataflow information
13045 are enabled independently at different optimization levels.
13047 @opindex fdevirtualize
13048 @item -fdevirtualize
13049 Attempt to convert calls to virtual functions to direct calls.  This
13050 is done both within a procedure and interprocedurally as part of
13051 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
13052 propagation (@option{-fipa-cp}).
13053 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13055 @opindex fdevirtualize-speculatively
13056 @item -fdevirtualize-speculatively
13057 Attempt to convert calls to virtual functions to speculative direct calls.
13058 Based on the analysis of the type inheritance graph, determine for a given call
13059 the set of likely targets. If the set is small, preferably of size 1, change
13060 the call into a conditional deciding between direct and indirect calls.  The
13061 speculative calls enable more optimizations, such as inlining.  When they seem
13062 useless after further optimization, they are converted back into original form.
13064 @opindex fdevirtualize-at-ltrans
13065 @item -fdevirtualize-at-ltrans
13066 Stream extra information needed for aggressive devirtualization when running
13067 the link-time optimizer in local transformation mode.  
13068 This option enables more devirtualization but
13069 significantly increases the size of streamed data. For this reason it is
13070 disabled by default.
13072 @opindex fexpensive-optimizations
13073 @item -fexpensive-optimizations
13074 Perform a number of minor optimizations that are relatively expensive.
13076 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13078 @opindex free
13079 @item -free
13080 Attempt to remove redundant extension instructions.  This is especially
13081 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
13082 registers after writing to their lower 32-bit half.
13084 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
13085 levels @option{-O2}, @option{-O3}, @option{-Os}.
13087 @opindex fno-lifetime-dse
13088 @opindex flifetime-dse
13089 @item -fno-lifetime-dse
13090 In C++ the value of an object is only affected by changes within its
13091 lifetime: when the constructor begins, the object has an indeterminate
13092 value, and any changes during the lifetime of the object are dead when
13093 the object is destroyed.  Normally dead store elimination will take
13094 advantage of this; if your code relies on the value of the object
13095 storage persisting beyond the lifetime of the object, you can use this
13096 flag to disable this optimization.  To preserve stores before the
13097 constructor starts (e.g.@: because your operator new clears the object
13098 storage) but still treat the object as dead after the destructor, you
13099 can use @option{-flifetime-dse=1}.  The default behavior can be
13100 explicitly selected with @option{-flifetime-dse=2}.
13101 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
13103 @opindex flive-range-shrinkage
13104 @item -flive-range-shrinkage
13105 Attempt to decrease register pressure through register live range
13106 shrinkage.  This is helpful for fast processors with small or moderate
13107 size register sets.
13109 @opindex fira-algorithm
13110 @item -fira-algorithm=@var{algorithm}
13111 Use the specified coloring algorithm for the integrated register
13112 allocator.  The @var{algorithm} argument can be @samp{priority}, which
13113 specifies Chow's priority coloring, or @samp{CB}, which specifies
13114 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
13115 for all architectures, but for those targets that do support it, it is
13116 the default because it generates better code.
13118 @opindex fira-region
13119 @item -fira-region=@var{region}
13120 Use specified regions for the integrated register allocator.  The
13121 @var{region} argument should be one of the following:
13123 @table @samp
13125 @item all
13126 Use all loops as register allocation regions.
13127 This can give the best results for machines with a small and/or
13128 irregular register set.
13130 @item mixed
13131 Use all loops except for loops with small register pressure 
13132 as the regions.  This value usually gives
13133 the best results in most cases and for most architectures,
13134 and is enabled by default when compiling with optimization for speed
13135 (@option{-O}, @option{-O2}, @dots{}).
13137 @item one
13138 Use all functions as a single region.  
13139 This typically results in the smallest code size, and is enabled by default for
13140 @option{-Os} or @option{-O0}.
13142 @end table
13144 @opindex fira-hoist-pressure
13145 @item -fira-hoist-pressure
13146 Use IRA to evaluate register pressure in the code hoisting pass for
13147 decisions to hoist expressions.  This option usually results in smaller
13148 code, but it can slow the compiler down.
13150 This option is enabled at level @option{-Os} for all targets.
13152 @opindex fira-loop-pressure
13153 @item -fira-loop-pressure
13154 Use IRA to evaluate register pressure in loops for decisions to move
13155 loop invariants.  This option usually results in generation
13156 of faster and smaller code on machines with large register files (>= 32
13157 registers), but it can slow the compiler down.
13159 This option is enabled at level @option{-O3} for some targets.
13161 @opindex fno-ira-share-save-slots
13162 @opindex fira-share-save-slots
13163 @item -fno-ira-share-save-slots
13164 Disable sharing of stack slots used for saving call-used hard
13165 registers living through a call.  Each hard register gets a
13166 separate stack slot, and as a result function stack frames are
13167 larger.
13169 @opindex fno-ira-share-spill-slots
13170 @opindex fira-share-spill-slots
13171 @item -fno-ira-share-spill-slots
13172 Disable sharing of stack slots allocated for pseudo-registers.  Each
13173 pseudo-register that does not get a hard register gets a separate
13174 stack slot, and as a result function stack frames are larger.
13176 @opindex flra-remat
13177 @item -flra-remat
13178 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
13179 values of spilled pseudos, LRA tries to rematerialize (recalculate)
13180 values if it is profitable.
13182 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13184 @opindex fdelayed-branch
13185 @item -fdelayed-branch
13186 If supported for the target machine, attempt to reorder instructions
13187 to exploit instruction slots available after delayed branch
13188 instructions.
13190 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
13191 but not at @option{-Og}.
13193 @opindex fschedule-insns
13194 @item -fschedule-insns
13195 If supported for the target machine, attempt to reorder instructions to
13196 eliminate execution stalls due to required data being unavailable.  This
13197 helps machines that have slow floating point or memory load instructions
13198 by allowing other instructions to be issued until the result of the load
13199 or floating-point instruction is required.
13201 Enabled at levels @option{-O2}, @option{-O3}.
13203 @opindex fschedule-insns2
13204 @item -fschedule-insns2
13205 Similar to @option{-fschedule-insns}, but requests an additional pass of
13206 instruction scheduling after register allocation has been done.  This is
13207 especially useful on machines with a relatively small number of
13208 registers and where memory load instructions take more than one cycle.
13210 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13212 @opindex fno-sched-interblock
13213 @opindex fsched-interblock
13214 @item -fno-sched-interblock
13215 Disable instruction scheduling across basic blocks, which
13216 is normally enabled when scheduling before register allocation, i.e.@:
13217 with @option{-fschedule-insns} or at @option{-O2} or higher.
13219 @opindex fno-sched-spec
13220 @opindex fsched-spec
13221 @item -fno-sched-spec
13222 Disable speculative motion of non-load instructions, which
13223 is normally enabled when scheduling before register allocation, i.e.@:
13224 with @option{-fschedule-insns} or at @option{-O2} or higher.
13226 @opindex fsched-pressure
13227 @item -fsched-pressure
13228 Enable register pressure sensitive insn scheduling before register
13229 allocation.  This only makes sense when scheduling before register
13230 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
13231 @option{-O2} or higher.  Usage of this option can improve the
13232 generated code and decrease its size by preventing register pressure
13233 increase above the number of available hard registers and subsequent
13234 spills in register allocation.
13236 @opindex fsched-spec-load
13237 @item -fsched-spec-load
13238 Allow speculative motion of some load instructions.  This only makes
13239 sense when scheduling before register allocation, i.e.@: with
13240 @option{-fschedule-insns} or at @option{-O2} or higher.
13242 @opindex fsched-spec-load-dangerous
13243 @item -fsched-spec-load-dangerous
13244 Allow speculative motion of more load instructions.  This only makes
13245 sense when scheduling before register allocation, i.e.@: with
13246 @option{-fschedule-insns} or at @option{-O2} or higher.
13248 @opindex fsched-stalled-insns
13249 @item -fsched-stalled-insns
13250 @itemx -fsched-stalled-insns=@var{n}
13251 Define how many insns (if any) can be moved prematurely from the queue
13252 of stalled insns into the ready list during the second scheduling pass.
13253 @option{-fno-sched-stalled-insns} means that no insns are moved
13254 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
13255 on how many queued insns can be moved prematurely.
13256 @option{-fsched-stalled-insns} without a value is equivalent to
13257 @option{-fsched-stalled-insns=1}.
13259 @opindex fsched-stalled-insns-dep
13260 @item -fsched-stalled-insns-dep
13261 @itemx -fsched-stalled-insns-dep=@var{n}
13262 Define how many insn groups (cycles) are examined for a dependency
13263 on a stalled insn that is a candidate for premature removal from the queue
13264 of stalled insns.  This has an effect only during the second scheduling pass,
13265 and only if @option{-fsched-stalled-insns} is used.
13266 @option{-fno-sched-stalled-insns-dep} is equivalent to
13267 @option{-fsched-stalled-insns-dep=0}.
13268 @option{-fsched-stalled-insns-dep} without a value is equivalent to
13269 @option{-fsched-stalled-insns-dep=1}.
13271 @opindex fsched2-use-superblocks
13272 @item -fsched2-use-superblocks
13273 When scheduling after register allocation, use superblock scheduling.
13274 This allows motion across basic block boundaries,
13275 resulting in faster schedules.  This option is experimental, as not all machine
13276 descriptions used by GCC model the CPU closely enough to avoid unreliable
13277 results from the algorithm.
13279 This only makes sense when scheduling after register allocation, i.e.@: with
13280 @option{-fschedule-insns2} or at @option{-O2} or higher.
13282 @opindex fsched-group-heuristic
13283 @item -fsched-group-heuristic
13284 Enable the group heuristic in the scheduler.  This heuristic favors
13285 the instruction that belongs to a schedule group.  This is enabled
13286 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
13287 or @option{-fschedule-insns2} or at @option{-O2} or higher.
13289 @opindex fsched-critical-path-heuristic
13290 @item -fsched-critical-path-heuristic
13291 Enable the critical-path heuristic in the scheduler.  This heuristic favors
13292 instructions on the critical path.  This is enabled by default when
13293 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
13294 or @option{-fschedule-insns2} or at @option{-O2} or higher.
13296 @opindex fsched-spec-insn-heuristic
13297 @item -fsched-spec-insn-heuristic
13298 Enable the speculative instruction heuristic in the scheduler.  This
13299 heuristic favors speculative instructions with greater dependency weakness.
13300 This is enabled by default when scheduling is enabled, i.e.@:
13301 with @option{-fschedule-insns} or @option{-fschedule-insns2}
13302 or at @option{-O2} or higher.
13304 @opindex fsched-rank-heuristic
13305 @item -fsched-rank-heuristic
13306 Enable the rank heuristic in the scheduler.  This heuristic favors
13307 the instruction belonging to a basic block with greater size or frequency.
13308 This is enabled by default when scheduling is enabled, i.e.@:
13309 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13310 at @option{-O2} or higher.
13312 @opindex fsched-last-insn-heuristic
13313 @item -fsched-last-insn-heuristic
13314 Enable the last-instruction heuristic in the scheduler.  This heuristic
13315 favors the instruction that is less dependent on the last instruction
13316 scheduled.  This is enabled by default when scheduling is enabled,
13317 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13318 at @option{-O2} or higher.
13320 @opindex fsched-dep-count-heuristic
13321 @item -fsched-dep-count-heuristic
13322 Enable the dependent-count heuristic in the scheduler.  This heuristic
13323 favors the instruction that has more instructions depending on it.
13324 This is enabled by default when scheduling is enabled, i.e.@:
13325 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13326 at @option{-O2} or higher.
13328 @opindex freschedule-modulo-scheduled-loops
13329 @item -freschedule-modulo-scheduled-loops
13330 Modulo scheduling is performed before traditional scheduling.  If a loop
13331 is modulo scheduled, later scheduling passes may change its schedule.  
13332 Use this option to control that behavior.
13334 @opindex fselective-scheduling
13335 @item -fselective-scheduling
13336 Schedule instructions using selective scheduling algorithm.  Selective
13337 scheduling runs instead of the first scheduler pass.
13339 @opindex fselective-scheduling2
13340 @item -fselective-scheduling2
13341 Schedule instructions using selective scheduling algorithm.  Selective
13342 scheduling runs instead of the second scheduler pass.
13344 @opindex fsel-sched-pipelining
13345 @item -fsel-sched-pipelining
13346 Enable software pipelining of innermost loops during selective scheduling.
13347 This option has no effect unless one of @option{-fselective-scheduling} or
13348 @option{-fselective-scheduling2} is turned on.
13350 @opindex fsel-sched-pipelining-outer-loops
13351 @item -fsel-sched-pipelining-outer-loops
13352 When pipelining loops during selective scheduling, also pipeline outer loops.
13353 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
13355 @opindex fsemantic-interposition
13356 @item -fsemantic-interposition
13357 Some object formats, like ELF, allow interposing of symbols by the 
13358 dynamic linker.
13359 This means that for symbols exported from the DSO, the compiler cannot perform
13360 interprocedural propagation, inlining and other optimizations in anticipation
13361 that the function or variable in question may change. While this feature is
13362 useful, for example, to rewrite memory allocation functions by a debugging
13363 implementation, it is expensive in the terms of code quality.
13364 With @option{-fno-semantic-interposition} the compiler assumes that 
13365 if interposition happens for functions the overwriting function will have 
13366 precisely the same semantics (and side effects). 
13367 Similarly if interposition happens
13368 for variables, the constructor of the variable will be the same. The flag
13369 has no effect for functions explicitly declared inline 
13370 (where it is never allowed for interposition to change semantics) 
13371 and for symbols explicitly declared weak.
13373 @opindex fshrink-wrap
13374 @item -fshrink-wrap
13375 Emit function prologues only before parts of the function that need it,
13376 rather than at the top of the function.  This flag is enabled by default at
13377 @option{-O} and higher.
13379 @opindex fshrink-wrap-separate
13380 @item -fshrink-wrap-separate
13381 Shrink-wrap separate parts of the prologue and epilogue separately, so that
13382 those parts are only executed when needed.
13383 This option is on by default, but has no effect unless @option{-fshrink-wrap}
13384 is also turned on and the target supports this.
13386 @opindex fcaller-saves
13387 @item -fcaller-saves
13388 Enable allocation of values to registers that are clobbered by
13389 function calls, by emitting extra instructions to save and restore the
13390 registers around such calls.  Such allocation is done only when it
13391 seems to result in better code.
13393 This option is always enabled by default on certain machines, usually
13394 those which have no call-preserved registers to use instead.
13396 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13398 @opindex fcombine-stack-adjustments
13399 @item -fcombine-stack-adjustments
13400 Tracks stack adjustments (pushes and pops) and stack memory references
13401 and then tries to find ways to combine them.
13403 Enabled by default at @option{-O1} and higher.
13405 @opindex fipa-ra
13406 @item -fipa-ra
13407 Use caller save registers for allocation if those registers are not used by
13408 any called function.  In that case it is not necessary to save and restore
13409 them around calls.  This is only possible if called functions are part of
13410 same compilation unit as current function and they are compiled before it.
13412 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13413 is disabled if generated code will be instrumented for profiling
13414 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13415 exactly (this happens on targets that do not expose prologues
13416 and epilogues in RTL).
13418 @opindex fconserve-stack
13419 @item -fconserve-stack
13420 Attempt to minimize stack usage.  The compiler attempts to use less
13421 stack space, even if that makes the program slower.  This option
13422 implies setting the @option{large-stack-frame} parameter to 100
13423 and the @option{large-stack-frame-growth} parameter to 400.
13425 @opindex ftree-reassoc
13426 @item -ftree-reassoc
13427 Perform reassociation on trees.  This flag is enabled by default
13428 at @option{-O1} and higher.
13430 @opindex fcode-hoisting
13431 @item -fcode-hoisting
13432 Perform code hoisting.  Code hoisting tries to move the
13433 evaluation of expressions executed on all paths to the function exit
13434 as early as possible.  This is especially useful as a code size
13435 optimization, but it often helps for code speed as well.
13436 This flag is enabled by default at @option{-O2} and higher.
13438 @opindex ftree-pre
13439 @item -ftree-pre
13440 Perform partial redundancy elimination (PRE) on trees.  This flag is
13441 enabled by default at @option{-O2} and @option{-O3}.
13443 @opindex ftree-partial-pre
13444 @item -ftree-partial-pre
13445 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13446 enabled by default at @option{-O3}.
13448 @opindex ftree-forwprop
13449 @item -ftree-forwprop
13450 Perform forward propagation on trees.  This flag is enabled by default
13451 at @option{-O1} and higher.
13453 @opindex ftree-fre
13454 @item -ftree-fre
13455 Perform full redundancy elimination (FRE) on trees.  The difference
13456 between FRE and PRE is that FRE only considers expressions
13457 that are computed on all paths leading to the redundant computation.
13458 This analysis is faster than PRE, though it exposes fewer redundancies.
13459 This flag is enabled by default at @option{-O1} and higher.
13461 @opindex ftree-phiprop
13462 @item -ftree-phiprop
13463 Perform hoisting of loads from conditional pointers on trees.  This
13464 pass is enabled by default at @option{-O1} and higher.
13466 @opindex fhoist-adjacent-loads
13467 @item -fhoist-adjacent-loads
13468 Speculatively hoist loads from both branches of an if-then-else if the
13469 loads are from adjacent locations in the same structure and the target
13470 architecture has a conditional move instruction.  This flag is enabled
13471 by default at @option{-O2} and higher.
13473 @opindex ftree-copy-prop
13474 @item -ftree-copy-prop
13475 Perform copy propagation on trees.  This pass eliminates unnecessary
13476 copy operations.  This flag is enabled by default at @option{-O1} and
13477 higher.
13479 @opindex fipa-pure-const
13480 @item -fipa-pure-const
13481 Discover which functions are pure or constant.
13482 Enabled by default at @option{-O1} and higher.
13484 @opindex fipa-reference
13485 @item -fipa-reference
13486 Discover which static variables do not escape the
13487 compilation unit.
13488 Enabled by default at @option{-O1} and higher.
13490 @opindex fipa-reference-addressable
13491 @item -fipa-reference-addressable
13492 Discover read-only, write-only and non-addressable static variables.
13493 Enabled by default at @option{-O1} and higher.
13495 @opindex fipa-stack-alignment
13496 @item -fipa-stack-alignment
13497 Reduce stack alignment on call sites if possible.
13498 Enabled by default.
13500 @opindex fipa-pta
13501 @item -fipa-pta
13502 Perform interprocedural pointer analysis and interprocedural modification
13503 and reference analysis.  This option can cause excessive memory and
13504 compile-time usage on large compilation units.  It is not enabled by
13505 default at any optimization level.
13507 @opindex fipa-profile
13508 @item -fipa-profile
13509 Perform interprocedural profile propagation.  The functions called only from
13510 cold functions are marked as cold. Also functions executed once (such as
13511 @code{cold}, @code{noreturn}, static constructors or destructors) are
13512 identified. Cold functions and loop less parts of functions executed once are
13513 then optimized for size.
13514 Enabled by default at @option{-O1} and higher.
13516 @opindex fipa-modref
13517 @item -fipa-modref
13518 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13519 effects of functions (memory locations that are modified or referenced) and
13520 enables better optimization across the function call boundary.  This flag is
13521 enabled by default at @option{-O1} and higher.
13523 @opindex fipa-cp
13524 @item -fipa-cp
13525 Perform interprocedural constant propagation.
13526 This optimization analyzes the program to determine when values passed
13527 to functions are constants and then optimizes accordingly.
13528 This optimization can substantially increase performance
13529 if the application has constants passed to functions.
13530 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13531 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13533 @opindex fipa-cp-clone
13534 @item -fipa-cp-clone
13535 Perform function cloning to make interprocedural constant propagation stronger.
13536 When enabled, interprocedural constant propagation performs function cloning
13537 when externally visible function can be called with constant arguments.
13538 Because this optimization can create multiple copies of functions,
13539 it may significantly increase code size
13540 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13541 This flag is enabled by default at @option{-O3}.
13542 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13544 @opindex fipa-bit-cp
13545 @item -fipa-bit-cp
13546 When enabled, perform interprocedural bitwise constant
13547 propagation. This flag is enabled by default at @option{-O2} and
13548 by @option{-fprofile-use} and @option{-fauto-profile}.
13549 It requires that @option{-fipa-cp} is enabled.  
13551 @opindex fipa-vrp
13552 @item -fipa-vrp
13553 When enabled, perform interprocedural propagation of value
13554 ranges. This flag is enabled by default at @option{-O2}. It requires
13555 that @option{-fipa-cp} is enabled.
13557 @opindex fipa-icf
13558 @item -fipa-icf
13559 Perform Identical Code Folding for functions and read-only variables.
13560 The optimization reduces code size and may disturb unwind stacks by replacing
13561 a function by equivalent one with a different name. The optimization works
13562 more effectively with link-time optimization enabled.
13564 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13565 works on different levels and thus the optimizations are not same - there are
13566 equivalences that are found only by GCC and equivalences found only by Gold.
13568 This flag is enabled by default at @option{-O2} and @option{-Os}.
13570 @opindex flive-patching
13571 @item -flive-patching=@var{level}
13572 Control GCC's optimizations to produce output suitable for live-patching.
13574 If the compiler's optimization uses a function's body or information extracted
13575 from its body to optimize/change another function, the latter is called an
13576 impacted function of the former.  If a function is patched, its impacted
13577 functions should be patched too.
13579 The impacted functions are determined by the compiler's interprocedural
13580 optimizations.  For example, a caller is impacted when inlining a function
13581 into its caller,
13582 cloning a function and changing its caller to call this new clone,
13583 or extracting a function's pureness/constness information to optimize
13584 its direct or indirect callers, etc.
13586 Usually, the more IPA optimizations enabled, the larger the number of
13587 impacted functions for each function.  In order to control the number of
13588 impacted functions and more easily compute the list of impacted function,
13589 IPA optimizations can be partially enabled at two different levels.
13591 The @var{level} argument should be one of the following:
13593 @table @samp
13595 @item inline-clone
13597 Only enable inlining and cloning optimizations, which includes inlining,
13598 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13599 As a result, when patching a function, all its callers and its clones'
13600 callers are impacted, therefore need to be patched as well.
13602 @option{-flive-patching=inline-clone} disables the following optimization flags:
13603 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13604 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13605 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13606 -fipa-reference-addressable
13607 -fipa-stack-alignment -fipa-modref}
13609 @item inline-only-static
13611 Only enable inlining of static functions.
13612 As a result, when patching a static function, all its callers are impacted
13613 and so need to be patched as well.
13615 In addition to all the flags that @option{-flive-patching=inline-clone}
13616 disables,
13617 @option{-flive-patching=inline-only-static} disables the following additional
13618 optimization flags:
13619 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13621 @end table
13623 When @option{-flive-patching} is specified without any value, the default value
13624 is @var{inline-clone}.
13626 This flag is disabled by default.
13628 Note that @option{-flive-patching} is not supported with link-time optimization
13629 (@option{-flto}).
13631 @opindex fisolate-erroneous-paths-dereference
13632 @item -fisolate-erroneous-paths-dereference
13633 Detect paths that trigger erroneous or undefined behavior due to
13634 dereferencing a null pointer.  Isolate those paths from the main control
13635 flow and turn the statement with erroneous or undefined behavior into a trap.
13636 This flag is enabled by default at @option{-O2} and higher and depends on
13637 @option{-fdelete-null-pointer-checks} also being enabled.
13639 @opindex fisolate-erroneous-paths-attribute
13640 @item -fisolate-erroneous-paths-attribute
13641 Detect paths that trigger erroneous or undefined behavior due to a null value
13642 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13643 attribute.  Isolate those paths from the main control flow and turn the
13644 statement with erroneous or undefined behavior into a trap.  This is not
13645 currently enabled, but may be enabled by @option{-O2} in the future.
13647 @opindex ftree-sink
13648 @item -ftree-sink
13649 Perform forward store motion on trees.  This flag is
13650 enabled by default at @option{-O1} and higher.
13652 @opindex ftree-bit-ccp
13653 @item -ftree-bit-ccp
13654 Perform sparse conditional bit constant propagation on trees and propagate
13655 pointer alignment information.
13656 This pass only operates on local scalar variables and is enabled by default
13657 at @option{-O1} and higher, except for @option{-Og}.
13658 It requires that @option{-ftree-ccp} is enabled.
13660 @opindex ftree-ccp
13661 @item -ftree-ccp
13662 Perform sparse conditional constant propagation (CCP) on trees.  This
13663 pass only operates on local scalar variables and is enabled by default
13664 at @option{-O1} and higher.
13666 @opindex fssa-backprop
13667 @item -fssa-backprop
13668 Propagate information about uses of a value up the definition chain
13669 in order to simplify the definitions.  For example, this pass strips
13670 sign operations if the sign of a value never matters.  The flag is
13671 enabled by default at @option{-O1} and higher.
13673 @opindex fssa-phiopt
13674 @item -fssa-phiopt
13675 Perform pattern matching on SSA PHI nodes to optimize conditional
13676 code.  This pass is enabled by default at @option{-O1} and higher,
13677 except for @option{-Og}.
13679 @opindex ftree-switch-conversion
13680 @item -ftree-switch-conversion
13681 Perform conversion of simple initializations in a switch to
13682 initializations from a scalar array.  This flag is enabled by default
13683 at @option{-O2} and higher.
13685 @opindex ftree-tail-merge
13686 @item -ftree-tail-merge
13687 Look for identical code sequences.  When found, replace one with a jump to the
13688 other.  This optimization is known as tail merging or cross jumping.  This flag
13689 is enabled by default at @option{-O2} and higher.  The compilation time
13690 in this pass can
13691 be limited using @option{max-tail-merge-comparisons} parameter and
13692 @option{max-tail-merge-iterations} parameter.
13694 @opindex ftree-dce
13695 @item -ftree-dce
13696 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13697 default at @option{-O1} and higher.
13699 @opindex ftree-builtin-call-dce
13700 @item -ftree-builtin-call-dce
13701 Perform conditional dead code elimination (DCE) for calls to built-in functions
13702 that may set @code{errno} but are otherwise free of side effects.  This flag is
13703 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13704 specified.
13706 @opindex ffinite-loops
13707 @opindex fno-finite-loops
13708 @item -ffinite-loops
13709 Assume that a loop with an exit will eventually take the exit and not loop
13710 indefinitely.  This allows the compiler to remove loops that otherwise have
13711 no side-effects, not considering eventual endless looping as such.
13713 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13714 or higher.
13716 @opindex ftree-dominator-opts
13717 @item -ftree-dominator-opts
13718 Perform a variety of simple scalar cleanups (constant/copy
13719 propagation, redundancy elimination, range propagation and expression
13720 simplification) based on a dominator tree traversal.  This also
13721 performs jump threading (to reduce jumps to jumps). This flag is
13722 enabled by default at @option{-O1} and higher.
13724 @opindex ftree-dse
13725 @item -ftree-dse
13726 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13727 a memory location that is later overwritten by another store without
13728 any intervening loads.  In this case the earlier store can be deleted.  This
13729 flag is enabled by default at @option{-O1} and higher.
13731 @opindex ftree-ch
13732 @item -ftree-ch
13733 Perform loop header copying on trees.  This is beneficial since it increases
13734 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13735 is enabled by default at @option{-O1} and higher.  It is not enabled
13736 for @option{-Os}, since it usually increases code size.
13738 @opindex ftree-loop-optimize
13739 @item -ftree-loop-optimize
13740 Perform loop optimizations on trees.  This flag is enabled by default
13741 at @option{-O1} and higher.
13743 @opindex ftree-loop-linear
13744 @opindex floop-strip-mine
13745 @opindex floop-block
13746 @item -ftree-loop-linear
13747 @itemx -floop-strip-mine
13748 @itemx -floop-block
13749 Perform loop nest optimizations.  Same as
13750 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13751 to be configured with @option{--with-isl} to enable the Graphite loop
13752 transformation infrastructure.
13754 @opindex fgraphite-identity
13755 @item -fgraphite-identity
13756 Enable the identity transformation for graphite.  For every SCoP we generate
13757 the polyhedral representation and transform it back to gimple.  Using
13758 @option{-fgraphite-identity} we can check the costs or benefits of the
13759 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13760 are also performed by the code generator isl, like index splitting and
13761 dead code elimination in loops.
13763 @opindex floop-nest-optimize
13764 @item -floop-nest-optimize
13765 Enable the isl based loop nest optimizer.  This is a generic loop nest
13766 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13767 structure optimized for data-locality and parallelism.  This option
13768 is experimental.
13770 @opindex floop-parallelize-all
13771 @item -floop-parallelize-all
13772 Use the Graphite data dependence analysis to identify loops that can
13773 be parallelized.  Parallelize all the loops that can be analyzed to
13774 not contain loop carried dependences without checking that it is
13775 profitable to parallelize the loops.
13777 @opindex ftree-coalesce-vars
13778 @item -ftree-coalesce-vars
13779 While transforming the program out of the SSA representation, attempt to
13780 reduce copying by coalescing versions of different user-defined
13781 variables, instead of just compiler temporaries.  This may severely
13782 limit the ability to debug an optimized program compiled with
13783 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13784 prevents SSA coalescing of user variables.  This option is enabled by
13785 default if optimization is enabled, and it does very little otherwise.
13787 @opindex ftree-loop-if-convert
13788 @item -ftree-loop-if-convert
13789 Attempt to transform conditional jumps in the innermost loops to
13790 branch-less equivalents.  The intent is to remove control-flow from
13791 the innermost loops in order to improve the ability of the
13792 vectorization pass to handle these loops.  This is enabled by default
13793 if vectorization is enabled.
13795 @opindex ftree-loop-distribution
13796 @item -ftree-loop-distribution
13797 Perform loop distribution.  This flag can improve cache performance on
13798 big loop bodies and allow further loop optimizations, like
13799 parallelization or vectorization, to take place.  For example, the loop
13800 @smallexample
13801 DO I = 1, N
13802   A(I) = B(I) + C
13803   D(I) = E(I) * F
13804 ENDDO
13805 @end smallexample
13806 is transformed to
13807 @smallexample
13808 DO I = 1, N
13809    A(I) = B(I) + C
13810 ENDDO
13811 DO I = 1, N
13812    D(I) = E(I) * F
13813 ENDDO
13814 @end smallexample
13815 This flag is enabled by default at @option{-O3}.
13816 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13818 @opindex ftree-loop-distribute-patterns
13819 @item -ftree-loop-distribute-patterns
13820 Perform loop distribution of patterns that can be code generated with
13821 calls to a library.  This flag is enabled by default at @option{-O2} and
13822 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13824 This pass distributes the initialization loops and generates a call to
13825 memset zero.  For example, the loop
13826 @smallexample
13827 DO I = 1, N
13828   A(I) = 0
13829   B(I) = A(I) + I
13830 ENDDO
13831 @end smallexample
13832 is transformed to
13833 @smallexample
13834 DO I = 1, N
13835    A(I) = 0
13836 ENDDO
13837 DO I = 1, N
13838    B(I) = A(I) + I
13839 ENDDO
13840 @end smallexample
13841 and the initialization loop is transformed into a call to memset zero.
13842 This flag is enabled by default at @option{-O3}.
13843 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13845 @opindex floop-interchange
13846 @item -floop-interchange
13847 Perform loop interchange outside of graphite.  This flag can improve cache
13848 performance on loop nest and allow further loop optimizations, like
13849 vectorization, to take place.  For example, the loop
13850 @smallexample
13851 for (int i = 0; i < N; i++)
13852   for (int j = 0; j < N; j++)
13853     for (int k = 0; k < N; k++)
13854       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13855 @end smallexample
13856 is transformed to
13857 @smallexample
13858 for (int i = 0; i < N; i++)
13859   for (int k = 0; k < N; k++)
13860     for (int j = 0; j < N; j++)
13861       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13862 @end smallexample
13863 This flag is enabled by default at @option{-O3}.
13864 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13866 @opindex floop-unroll-and-jam
13867 @item -floop-unroll-and-jam
13868 Apply unroll and jam transformations on feasible loops.  In a loop
13869 nest this unrolls the outer loop by some factor and fuses the resulting
13870 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13871 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13873 @opindex ftree-loop-im
13874 @item -ftree-loop-im
13875 Perform loop invariant motion on trees.  This pass moves only invariants that
13876 are hard to handle at RTL level (function calls, operations that expand to
13877 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13878 operands of conditions that are invariant out of the loop, so that we can use
13879 just trivial invariantness analysis in loop unswitching.  The pass also includes
13880 store motion.
13882 @opindex ftree-loop-ivcanon
13883 @item -ftree-loop-ivcanon
13884 Create a canonical counter for number of iterations in loops for which
13885 determining number of iterations requires complicated analysis.  Later
13886 optimizations then may determine the number easily.  Useful especially
13887 in connection with unrolling.
13889 @opindex ftree-scev-cprop
13890 @item -ftree-scev-cprop
13891 Perform final value replacement.  If a variable is modified in a loop
13892 in such a way that its value when exiting the loop can be determined using
13893 only its initial value and the number of loop iterations, replace uses of
13894 the final value by such a computation, provided it is sufficiently cheap.
13895 This reduces data dependencies and may allow further simplifications.
13896 Enabled by default at @option{-O1} and higher.
13898 @opindex fivopts
13899 @item -fivopts
13900 Perform induction variable optimizations (strength reduction, induction
13901 variable merging and induction variable elimination) on trees.
13903 @opindex ftree-parallelize-loops
13904 @item -ftree-parallelize-loops=n
13905 Parallelize loops, i.e., split their iteration space to run in n threads.
13906 This is only possible for loops whose iterations are independent
13907 and can be arbitrarily reordered.  The optimization is only
13908 profitable on multiprocessor machines, for loops that are CPU-intensive,
13909 rather than constrained e.g.@: by memory bandwidth.  This option
13910 implies @option{-pthread}, and thus is only supported on targets
13911 that have support for @option{-pthread}.
13913 @opindex ftree-pta
13914 @item -ftree-pta
13915 Perform function-local points-to analysis on trees.  This flag is
13916 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13918 @opindex ftree-sra
13919 @item -ftree-sra
13920 Perform scalar replacement of aggregates.  This pass replaces structure
13921 references with scalars to prevent committing structures to memory too
13922 early.  This flag is enabled by default at @option{-O1} and higher,
13923 except for @option{-Og}.
13925 @opindex fstore-merging
13926 @item -fstore-merging
13927 Perform merging of narrow stores to consecutive memory addresses.  This pass
13928 merges contiguous stores of immediate values narrower than a word into fewer
13929 wider stores to reduce the number of instructions.  This is enabled by default
13930 at @option{-O2} and higher as well as @option{-Os}.
13932 @opindex ftree-ter
13933 @item -ftree-ter
13934 Perform temporary expression replacement during the SSA->normal phase.  Single
13935 use/single def temporaries are replaced at their use location with their
13936 defining expression.  This results in non-GIMPLE code, but gives the expanders
13937 much more complex trees to work on resulting in better RTL generation.  This is
13938 enabled by default at @option{-O1} and higher.
13940 @opindex ftree-slsr
13941 @item -ftree-slsr
13942 Perform straight-line strength reduction on trees.  This recognizes related
13943 expressions involving multiplications and replaces them by less expensive
13944 calculations when possible.  This is enabled by default at @option{-O1} and
13945 higher.
13947 @opindex ftree-vectorize
13948 @item -ftree-vectorize
13949 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13950 and @option{-ftree-slp-vectorize} if not explicitly specified.
13952 @opindex ftree-loop-vectorize
13953 @item -ftree-loop-vectorize
13954 Perform loop vectorization on trees. This flag is enabled by default at
13955 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13956 and @option{-fauto-profile}.
13958 @opindex ftree-slp-vectorize
13959 @item -ftree-slp-vectorize
13960 Perform basic block vectorization on trees. This flag is enabled by default at
13961 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13962 and @option{-fauto-profile}.
13964 @opindex ftrivial-auto-var-init
13965 @item -ftrivial-auto-var-init=@var{choice}
13966 Initialize automatic variables with either a pattern or with zeroes to increase
13967 the security and predictability of a program by preventing uninitialized memory
13968 disclosure and use.
13969 GCC still considers an automatic variable that doesn't have an explicit
13970 initializer as uninitialized, @option{-Wuninitialized} and
13971 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13972 warning messages on such automatic variables and the compiler will
13973 perform optimization as if the variable were uninitialized.
13974 With this option, GCC will also initialize any padding of automatic variables
13975 that have structure or union types to zeroes.
13976 However, the current implementation cannot initialize automatic variables that
13977 are declared between the controlling expression and the first case of a
13978 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13979 such cases.
13981 The three values of @var{choice} are:
13983 @itemize @bullet
13984 @item
13985 @samp{uninitialized} doesn't initialize any automatic variables.
13986 This is C and C++'s default.
13988 @item
13989 @samp{pattern} Initialize automatic variables with values which will likely
13990 transform logic bugs into crashes down the line, are easily recognized in a
13991 crash dump and without being values that programmers can rely on for useful
13992 program semantics.
13993 The current value is byte-repeatable pattern with byte "0xFE".
13994 The values used for pattern initialization might be changed in the future.
13996 @item
13997 @samp{zero} Initialize automatic variables with zeroes.
13998 @end itemize
14000 The default is @samp{uninitialized}.
14002 Note that the initializer values, whether @samp{zero} or @samp{pattern},
14003 refer to data representation (in memory or machine registers), rather
14004 than to their interpretation as numerical values.  This distinction may
14005 be important in languages that support types with biases or implicit
14006 multipliers, and with such extensions as @samp{hardbool} (@pxref{Type
14007 Attributes}).  For example, a variable that uses 8 bits to represent
14008 (biased) quantities in the @code{range 160..400} will be initialized
14009 with the bit patterns @code{0x00} or @code{0xFE}, depending on
14010 @var{choice}, whether or not these representations stand for values in
14011 that range, and even if they do, the interpretation of the value held by
14012 the variable will depend on the bias.  A @samp{hardbool} variable that
14013 uses say @code{0X5A} and @code{0xA5} for @code{false} and @code{true},
14014 respectively, will trap with either @samp{choice} of trivial
14015 initializer, i.e., @samp{zero} initialization will not convert to the
14016 representation for @code{false}, even if it would for a @code{static}
14017 variable of the same type.  This means the initializer pattern doesn't
14018 generally depend on the type of the initialized variable.  One notable
14019 exception is that (non-hardened) boolean variables that fit in registers
14020 are initialized with @code{false} (zero), even when @samp{pattern} is
14021 requested.
14023 You can control this behavior for a specific variable by using the variable
14024 attribute @code{uninitialized} (@pxref{Variable Attributes}).
14026 @opindex fvect-cost-model
14027 @item -fvect-cost-model=@var{model}
14028 Alter the cost model used for vectorization.  The @var{model} argument
14029 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
14030 @samp{very-cheap}.
14031 With the @samp{unlimited} model the vectorized code-path is assumed
14032 to be profitable while with the @samp{dynamic} model a runtime check
14033 guards the vectorized code-path to enable it only for iteration
14034 counts that will likely execute faster than when executing the original
14035 scalar loop.  The @samp{cheap} model disables vectorization of
14036 loops where doing so would be cost prohibitive for example due to
14037 required runtime checks for data dependence or alignment but otherwise
14038 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
14039 allows vectorization if the vector code would entirely replace the
14040 scalar code that is being vectorized.  For example, if each iteration
14041 of a vectorized loop would only be able to handle exactly four iterations
14042 of the scalar loop, the @samp{very-cheap} model would only allow
14043 vectorization if the scalar iteration count is known to be a multiple
14044 of four.
14046 The default cost model depends on other optimization flags and is
14047 either @samp{dynamic} or @samp{cheap}.
14049 @opindex fsimd-cost-model
14050 @item -fsimd-cost-model=@var{model}
14051 Alter the cost model used for vectorization of loops marked with the OpenMP
14052 simd directive.  The @var{model} argument should be one of
14053 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
14054 have the same meaning as described in @option{-fvect-cost-model} and by
14055 default a cost model defined with @option{-fvect-cost-model} is used.
14057 @opindex ftree-vrp
14058 @item -ftree-vrp
14059 Perform Value Range Propagation on trees.  This is similar to the
14060 constant propagation pass, but instead of values, ranges of values are
14061 propagated.  This allows the optimizers to remove unnecessary range
14062 checks like array bound checks and null pointer checks.  This is
14063 enabled by default at @option{-O2} and higher.  Null pointer check
14064 elimination is only done if @option{-fdelete-null-pointer-checks} is
14065 enabled.
14067 @opindex fsplit-paths
14068 @item -fsplit-paths
14069 Split paths leading to loop backedges.  This can improve dead code
14070 elimination and common subexpression elimination.  This is enabled by
14071 default at @option{-O3} and above.
14073 @opindex fsplit-ivs-in-unroller
14074 @item -fsplit-ivs-in-unroller
14075 Enables expression of values of induction variables in later iterations
14076 of the unrolled loop using the value in the first iteration.  This breaks
14077 long dependency chains, thus improving efficiency of the scheduling passes.
14079 A combination of @option{-fweb} and CSE is often sufficient to obtain the
14080 same effect.  However, that is not reliable in cases where the loop body
14081 is more complicated than a single basic block.  It also does not work at all
14082 on some architectures due to restrictions in the CSE pass.
14084 This optimization is enabled by default.
14086 @opindex fvariable-expansion-in-unroller
14087 @item -fvariable-expansion-in-unroller
14088 With this option, the compiler creates multiple copies of some
14089 local variables when unrolling a loop, which can result in superior code.
14091 This optimization is enabled by default for PowerPC targets, but disabled
14092 by default otherwise.
14094 @opindex fpartial-inlining
14095 @item -fpartial-inlining
14096 Inline parts of functions.  This option has any effect only
14097 when inlining itself is turned on by the @option{-finline-functions}
14098 or @option{-finline-small-functions} options.
14100 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14102 @opindex fpredictive-commoning
14103 @item -fpredictive-commoning
14104 Perform predictive commoning optimization, i.e., reusing computations
14105 (especially memory loads and stores) performed in previous
14106 iterations of loops.
14108 This option is enabled at level @option{-O3}.
14109 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14111 @opindex fprefetch-loop-arrays
14112 @item -fprefetch-loop-arrays
14113 If supported by the target machine, generate instructions to prefetch
14114 memory to improve the performance of loops that access large arrays.
14116 This option may generate better or worse code; results are highly
14117 dependent on the structure of loops within the source code.
14119 Disabled at level @option{-Os}.
14121 @opindex fno-printf-return-value
14122 @opindex fprintf-return-value
14123 @item -fno-printf-return-value
14124 Do not substitute constants for known return value of formatted output
14125 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
14126 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
14127 transformation allows GCC to optimize or even eliminate branches based
14128 on the known return value of these functions called with arguments that
14129 are either constant, or whose values are known to be in a range that
14130 makes determining the exact return value possible.  For example, when
14131 @option{-fprintf-return-value} is in effect, both the branch and the
14132 body of the @code{if} statement (but not the call to @code{snprint})
14133 can be optimized away when @code{i} is a 32-bit or smaller integer
14134 because the return value is guaranteed to be at most 8.
14136 @smallexample
14137 char buf[9];
14138 if (snprintf (buf, "%08x", i) >= sizeof buf)
14139   @dots{}
14140 @end smallexample
14142 The @option{-fprintf-return-value} option relies on other optimizations
14143 and yields best results with @option{-O2} and above.  It works in tandem
14144 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
14145 options.  The @option{-fprintf-return-value} option is enabled by default.
14147 @opindex fno-peephole
14148 @opindex fpeephole
14149 @opindex fno-peephole2
14150 @opindex fpeephole2
14151 @item -fno-peephole
14152 @itemx -fno-peephole2
14153 Disable any machine-specific peephole optimizations.  The difference
14154 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
14155 are implemented in the compiler; some targets use one, some use the
14156 other, a few use both.
14158 @option{-fpeephole} is enabled by default.
14159 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14161 @opindex fno-guess-branch-probability
14162 @opindex fguess-branch-probability
14163 @item -fno-guess-branch-probability
14164 Do not guess branch probabilities using heuristics.
14166 GCC uses heuristics to guess branch probabilities if they are
14167 not provided by profiling feedback (@option{-fprofile-arcs}).  These
14168 heuristics are based on the control flow graph.  If some branch probabilities
14169 are specified by @code{__builtin_expect}, then the heuristics are
14170 used to guess branch probabilities for the rest of the control flow graph,
14171 taking the @code{__builtin_expect} info into account.  The interactions
14172 between the heuristics and @code{__builtin_expect} can be complex, and in
14173 some cases, it may be useful to disable the heuristics so that the effects
14174 of @code{__builtin_expect} are easier to understand.
14176 It is also possible to specify expected probability of the expression
14177 with @code{__builtin_expect_with_probability} built-in function.
14179 The default is @option{-fguess-branch-probability} at levels
14180 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
14182 @opindex freorder-blocks
14183 @item -freorder-blocks
14184 Reorder basic blocks in the compiled function in order to reduce number of
14185 taken branches and improve code locality.
14187 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14189 @opindex freorder-blocks-algorithm
14190 @item -freorder-blocks-algorithm=@var{algorithm}
14191 Use the specified algorithm for basic block reordering.  The
14192 @var{algorithm} argument can be @samp{simple}, which does not increase
14193 code size (except sometimes due to secondary effects like alignment),
14194 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
14195 put all often executed code together, minimizing the number of branches
14196 executed by making extra copies of code.
14198 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
14199 @samp{stc} at levels @option{-O2}, @option{-O3}.
14201 @opindex freorder-blocks-and-partition
14202 @item -freorder-blocks-and-partition
14203 In addition to reordering basic blocks in the compiled function, in order
14204 to reduce number of taken branches, partitions hot and cold basic blocks
14205 into separate sections of the assembly and @file{.o} files, to improve
14206 paging and cache locality performance.
14208 This optimization is automatically turned off in the presence of
14209 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
14210 section attribute and on any architecture that does not support named
14211 sections.  When @option{-fsplit-stack} is used this option is not
14212 enabled by default (to avoid linker errors), but may be enabled
14213 explicitly (if using a working linker).
14215 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
14217 @opindex freorder-functions
14218 @item -freorder-functions
14219 Reorder functions in the object file in order to
14220 improve code locality.  This is implemented by using special
14221 subsections @code{.text.hot} for most frequently executed functions and
14222 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
14223 the linker so object file format must support named sections and linker must
14224 place them in a reasonable way.
14226 This option isn't effective unless you either provide profile feedback
14227 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
14228 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
14230 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14232 @opindex fstrict-aliasing
14233 @item -fstrict-aliasing
14234 Allow the compiler to assume the strictest aliasing rules applicable to
14235 the language being compiled.  For C (and C++), this activates
14236 optimizations based on the type of expressions.  In particular, an
14237 object of one type is assumed never to reside at the same address as an
14238 object of a different type, unless the types are almost the same.  For
14239 example, an @code{unsigned int} can alias an @code{int}, but not a
14240 @code{void*} or a @code{double}.  A character type may alias any other
14241 type.
14243 @anchor{Type-punning}Pay special attention to code like this:
14244 @smallexample
14245 union a_union @{
14246   int i;
14247   double d;
14250 int f() @{
14251   union a_union t;
14252   t.d = 3.0;
14253   return t.i;
14255 @end smallexample
14256 The practice of reading from a different union member than the one most
14257 recently written to (called ``type-punning'') is common.  Even with
14258 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
14259 is accessed through the union type.  So, the code above works as
14260 expected.  @xref{Structures unions enumerations and bit-fields
14261 implementation}.  However, this code might not:
14262 @smallexample
14263 int f() @{
14264   union a_union t;
14265   int* ip;
14266   t.d = 3.0;
14267   ip = &t.i;
14268   return *ip;
14270 @end smallexample
14272 Similarly, access by taking the address, casting the resulting pointer
14273 and dereferencing the result has undefined behavior, even if the cast
14274 uses a union type, e.g.:
14275 @smallexample
14276 int f() @{
14277   double d = 3.0;
14278   return ((union a_union *) &d)->i;
14280 @end smallexample
14282 The @option{-fstrict-aliasing} option is enabled at levels
14283 @option{-O2}, @option{-O3}, @option{-Os}.
14285 @opindex fipa-strict-aliasing
14286 @item -fipa-strict-aliasing
14287 Controls whether rules of @option{-fstrict-aliasing} are applied across
14288 function boundaries.  Note that if multiple functions gets inlined into a
14289 single function the memory accesses are no longer considered to be crossing a
14290 function boundary.
14292 The @option{-fipa-strict-aliasing} option is enabled by default and is
14293 effective only in combination with @option{-fstrict-aliasing}.
14295 @opindex falign-functions
14296 @item -falign-functions
14297 @itemx -falign-functions=@var{n}
14298 @itemx -falign-functions=@var{n}:@var{m}
14299 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
14300 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
14301 Align the start of functions to the next power-of-two greater than or
14302 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
14303 least the first @var{m} bytes of the function can be fetched by the CPU
14304 without crossing an @var{n}-byte alignment boundary.
14305 This is an optimization of code performance and alignment is ignored for
14306 functions considered cold.  If alignment is required for all functions,
14307 use @option{-fmin-function-alignment}.
14309 If @var{m} is not specified, it defaults to @var{n}.
14311 Examples: @option{-falign-functions=32} aligns functions to the next
14312 32-byte boundary, @option{-falign-functions=24} aligns to the next
14313 32-byte boundary only if this can be done by skipping 23 bytes or less,
14314 @option{-falign-functions=32:7} aligns to the next
14315 32-byte boundary only if this can be done by skipping 6 bytes or less.
14317 The second pair of @var{n2}:@var{m2} values allows you to specify
14318 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
14319 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
14320 otherwise aligns to the next 32-byte boundary if this can be done
14321 by skipping 2 bytes or less.
14322 If @var{m2} is not specified, it defaults to @var{n2}.
14324 Some assemblers only support this flag when @var{n} is a power of two;
14325 in that case, it is rounded up.
14327 @option{-fno-align-functions} and @option{-falign-functions=1} are
14328 equivalent and mean that functions are not aligned.
14330 If @var{n} is not specified or is zero, use a machine-dependent default.
14331 The maximum allowed @var{n} option value is 65536.
14333 Enabled at levels @option{-O2}, @option{-O3}.
14335 @item -flimit-function-alignment
14336 If this option is enabled, the compiler tries to avoid unnecessarily
14337 overaligning functions. It attempts to instruct the assembler to align
14338 by the amount specified by @option{-falign-functions}, but not to
14339 skip more bytes than the size of the function.
14341 @opindex falign-labels
14342 @item -falign-labels
14343 @itemx -falign-labels=@var{n}
14344 @itemx -falign-labels=@var{n}:@var{m}
14345 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
14346 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
14347 Align all branch targets to a power-of-two boundary.
14349 Parameters of this option are analogous to the @option{-falign-functions} option.
14350 @option{-fno-align-labels} and @option{-falign-labels=1} are
14351 equivalent and mean that labels are not aligned.
14353 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
14354 are greater than this value, then their values are used instead.
14356 If @var{n} is not specified or is zero, use a machine-dependent default
14357 which is very likely to be @samp{1}, meaning no alignment.
14358 The maximum allowed @var{n} option value is 65536.
14360 Enabled at levels @option{-O2}, @option{-O3}.
14362 @opindex falign-loops
14363 @item -falign-loops
14364 @itemx -falign-loops=@var{n}
14365 @itemx -falign-loops=@var{n}:@var{m}
14366 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
14367 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
14368 Align loops to a power-of-two boundary.  If the loops are executed
14369 many times, this makes up for any execution of the dummy padding
14370 instructions.
14371 This is an optimization of code performance and alignment is ignored for
14372 loops considered cold.
14374 If @option{-falign-labels} is greater than this value, then its value
14375 is used instead.
14377 Parameters of this option are analogous to the @option{-falign-functions} option.
14378 @option{-fno-align-loops} and @option{-falign-loops=1} are
14379 equivalent and mean that loops are not aligned.
14380 The maximum allowed @var{n} option value is 65536.
14382 If @var{n} is not specified or is zero, use a machine-dependent default.
14384 Enabled at levels @option{-O2}, @option{-O3}.
14386 @opindex falign-jumps
14387 @item -falign-jumps
14388 @itemx -falign-jumps=@var{n}
14389 @itemx -falign-jumps=@var{n}:@var{m}
14390 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
14391 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
14392 Align branch targets to a power-of-two boundary, for branch targets
14393 where the targets can only be reached by jumping.  In this case,
14394 no dummy operations need be executed.
14395 This is an optimization of code performance and alignment is ignored for
14396 jumps considered cold.
14398 If @option{-falign-labels} is greater than this value, then its value
14399 is used instead.
14401 Parameters of this option are analogous to the @option{-falign-functions} option.
14402 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
14403 equivalent and mean that loops are not aligned.
14405 If @var{n} is not specified or is zero, use a machine-dependent default.
14406 The maximum allowed @var{n} option value is 65536.
14408 Enabled at levels @option{-O2}, @option{-O3}.
14410 @opindex fmin-function-alignment=@var{n}
14411 @item -fmin-function-alignment
14412 Specify minimal alignment of functions to the next power-of-two greater than or
14413 equal to @var{n}. Unlike @option{-falign-functions} this alignment is applied
14414 also to all functions (even those considered cold).  The alignment is also not
14415 affected by @option{-flimit-function-alignment}
14418 @opindex fno-allocation-dce
14419 @item -fno-allocation-dce
14420 Do not remove unused C++ allocations in dead code elimination.
14422 @opindex fallow-store-data-races
14423 @item -fallow-store-data-races
14424 Allow the compiler to perform optimizations that may introduce new data races
14425 on stores, without proving that the variable cannot be concurrently accessed
14426 by other threads.  Does not affect optimization of local data.  It is safe to
14427 use this option if it is known that global data will not be accessed by
14428 multiple threads.
14430 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14431 hoisting or if-conversions that may cause a value that was already in memory
14432 to be re-written with that same value.  Such re-writing is safe in a single
14433 threaded context but may be unsafe in a multi-threaded context.  Note that on
14434 some processors, if-conversions may be required in order to enable
14435 vectorization.
14437 Enabled at level @option{-Ofast}.
14439 @opindex funit-at-a-time
14440 @item -funit-at-a-time
14441 This option is left for compatibility reasons. @option{-funit-at-a-time}
14442 has no effect, while @option{-fno-unit-at-a-time} implies
14443 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14445 Enabled by default.
14447 @opindex fno-toplevel-reorder
14448 @opindex ftoplevel-reorder
14449 @item -fno-toplevel-reorder
14450 Do not reorder top-level functions, variables, and @code{asm}
14451 statements.  Output them in the same order that they appear in the
14452 input file.  When this option is used, unreferenced static variables
14453 are not removed.  This option is intended to support existing code
14454 that relies on a particular ordering.  For new code, it is better to
14455 use attributes when possible.
14457 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14458 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14459 Additionally @option{-fno-toplevel-reorder} implies
14460 @option{-fno-section-anchors}.
14462 @opindex funreachable-traps
14463 @item -funreachable-traps
14464 With this option, the compiler turns calls to
14465 @code{__builtin_unreachable} into traps, instead of using them for
14466 optimization.  This also affects any such calls implicitly generated
14467 by the compiler.
14469 This option has the same effect as @option{-fsanitize=unreachable
14470 -fsanitize-trap=unreachable}, but does not affect the values of those
14471 options.  If @option{-fsanitize=unreachable} is enabled, that option
14472 takes priority over this one.
14474 This option is enabled by default at @option{-O0} and @option{-Og}.
14476 @opindex fweb
14477 @item -fweb
14478 Constructs webs as commonly used for register allocation purposes and assign
14479 each web individual pseudo register.  This allows the register allocation pass
14480 to operate on pseudos directly, but also strengthens several other optimization
14481 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14482 however, make debugging impossible, since variables no longer stay in a
14483 ``home register''.
14485 Enabled by default with @option{-funroll-loops}.
14487 @opindex fwhole-program
14488 @item -fwhole-program
14489 Assume that the current compilation unit represents the whole program being
14490 compiled.  All public functions and variables with the exception of @code{main}
14491 and those merged by attribute @code{externally_visible} become static functions
14492 and in effect are optimized more aggressively by interprocedural optimizers.
14494 With @option{-flto} this option has a limited use.  In most cases the
14495 precise list of symbols used or exported from the binary is known the
14496 resolution info passed to the link-time optimizer by the linker plugin.  It is
14497 still useful if no linker plugin is used or during incremental link step when
14498 final code is produced (with @option{-flto}
14499 @option{-flinker-output=nolto-rel}).
14501 @opindex flto
14502 @item -flto[=@var{n}]
14503 This option runs the standard link-time optimizer.  When invoked
14504 with source code, it generates GIMPLE (one of GCC's internal
14505 representations) and writes it to special ELF sections in the object
14506 file.  When the object files are linked together, all the function
14507 bodies are read from these ELF sections and instantiated as if they
14508 had been part of the same translation unit.
14510 To use the link-time optimizer, @option{-flto} and optimization
14511 options should be specified at compile time and during the final link.
14512 It is recommended that you compile all the files participating in the
14513 same link with the same options and also specify those options at
14514 link time.
14515 For example:
14517 @smallexample
14518 gcc -c -O2 -flto foo.c
14519 gcc -c -O2 -flto bar.c
14520 gcc -o myprog -flto -O2 foo.o bar.o
14521 @end smallexample
14523 The first two invocations to GCC save a bytecode representation
14524 of GIMPLE into special ELF sections inside @file{foo.o} and
14525 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14526 @file{foo.o} and @file{bar.o}, merges the two files into a single
14527 internal image, and compiles the result as usual.  Since both
14528 @file{foo.o} and @file{bar.o} are merged into a single image, this
14529 causes all the interprocedural analyses and optimizations in GCC to
14530 work across the two files as if they were a single one.  This means,
14531 for example, that the inliner is able to inline functions in
14532 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14534 Another (simpler) way to enable link-time optimization is:
14536 @smallexample
14537 gcc -o myprog -flto -O2 foo.c bar.c
14538 @end smallexample
14540 The above generates bytecode for @file{foo.c} and @file{bar.c},
14541 merges them together into a single GIMPLE representation and optimizes
14542 them as usual to produce @file{myprog}.
14544 The important thing to keep in mind is that to enable link-time
14545 optimizations you need to use the GCC driver to perform the link step.
14546 GCC automatically performs link-time optimization if any of the
14547 objects involved were compiled with the @option{-flto} command-line option.  
14548 You can always override
14549 the automatic decision to do link-time optimization
14550 by passing @option{-fno-lto} to the link command.
14552 To make whole program optimization effective, it is necessary to make
14553 certain whole program assumptions.  The compiler needs to know
14554 what functions and variables can be accessed by libraries and runtime
14555 outside of the link-time optimized unit.  When supported by the linker,
14556 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14557 to the compiler about used and externally visible symbols.  When
14558 the linker plugin is not available, @option{-fwhole-program} should be
14559 used to allow the compiler to make these assumptions, which leads
14560 to more aggressive optimization decisions.
14562 When a file is compiled with @option{-flto} without
14563 @option{-fuse-linker-plugin}, the generated object file is larger than
14564 a regular object file because it contains GIMPLE bytecodes and the usual
14565 final code (see @option{-ffat-lto-objects}).  This means that
14566 object files with LTO information can be linked as normal object
14567 files; if @option{-fno-lto} is passed to the linker, no
14568 interprocedural optimizations are applied.  Note that when
14569 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14570 but you cannot perform a regular, non-LTO link on them.
14572 When producing the final binary, GCC only
14573 applies link-time optimizations to those files that contain bytecode.
14574 Therefore, you can mix and match object files and libraries with
14575 GIMPLE bytecodes and final object code.  GCC automatically selects
14576 which files to optimize in LTO mode and which files to link without
14577 further processing.
14579 Generally, options specified at link time override those
14580 specified at compile time, although in some cases GCC attempts to infer
14581 link-time options from the settings used to compile the input files.
14583 If you do not specify an optimization level option @option{-O} at
14584 link time, then GCC uses the highest optimization level 
14585 used when compiling the object files.  Note that it is generally 
14586 ineffective to specify an optimization level option only at link time and 
14587 not at compile time, for two reasons.  First, compiling without 
14588 optimization suppresses compiler passes that gather information 
14589 needed for effective optimization at link time.  Second, some early
14590 optimization passes can be performed only at compile time and 
14591 not at link time.
14593 There are some code generation flags preserved by GCC when
14594 generating bytecodes, as they need to be used during the final link.
14595 Currently, the following options and their settings are taken from
14596 the first object file that explicitly specifies them: 
14597 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14598 @option{-fgnu-tm} and all the @option{-m} target flags.
14600 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14601 @option{-fPIE} are combined based on the following scheme:
14603 @smallexample
14604 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14605 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14606 @option{-fpic/-fPIC} + (no option) = (no option)
14607 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14608 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14609 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14610 @end smallexample
14612 Certain ABI-changing flags are required to match in all compilation units,
14613 and trying to override this at link time with a conflicting value
14614 is ignored.  This includes options such as @option{-freg-struct-return}
14615 and @option{-fpcc-struct-return}. 
14617 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14618 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14619 are passed through to the link stage and merged conservatively for
14620 conflicting translation units.  Specifically
14621 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14622 precedence; and for example @option{-ffp-contract=off} takes precedence
14623 over @option{-ffp-contract=fast}.  You can override them at link time.
14625 Diagnostic options such as @option{-Wstringop-overflow} are passed
14626 through to the link stage and their setting matches that of the
14627 compile-step at function granularity.  Note that this matters only
14628 for diagnostics emitted during optimization.  Note that code
14629 transforms such as inlining can lead to warnings being enabled
14630 or disabled for regions if code not consistent with the setting
14631 at compile time.
14633 When you need to pass options to the assembler via @option{-Wa} or
14634 @option{-Xassembler} make sure to either compile such translation
14635 units with @option{-fno-lto} or consistently use the same assembler
14636 options on all translation units.  You can alternatively also
14637 specify assembler options at LTO link time.
14639 To enable debug info generation you need to supply @option{-g} at
14640 compile time.  If any of the input files at link time were built
14641 with debug info generation enabled the link will enable debug info
14642 generation as well.  Any elaborate debug info settings
14643 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14644 at the linker command line and mixing different settings in different
14645 translation units is discouraged.
14647 If LTO encounters objects with C linkage declared with incompatible
14648 types in separate translation units to be linked together (undefined
14649 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14650 issued.  The behavior is still undefined at run time.  Similar
14651 diagnostics may be raised for other languages.
14653 Another feature of LTO is that it is possible to apply interprocedural
14654 optimizations on files written in different languages:
14656 @smallexample
14657 gcc -c -flto foo.c
14658 g++ -c -flto bar.cc
14659 gfortran -c -flto baz.f90
14660 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14661 @end smallexample
14663 Notice that the final link is done with @command{g++} to get the C++
14664 runtime libraries and @option{-lgfortran} is added to get the Fortran
14665 runtime libraries.  In general, when mixing languages in LTO mode, you
14666 should use the same link command options as when mixing languages in a
14667 regular (non-LTO) compilation.
14669 If object files containing GIMPLE bytecode are stored in a library archive, say
14670 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14671 are using a linker with plugin support.  To create static libraries suitable
14672 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14673 and @command{ranlib}; 
14674 to show the symbols of object files with GIMPLE bytecode, use
14675 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14676 and @command{nm} have been compiled with plugin support.  At link time, use the
14677 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14678 the LTO optimization process:
14680 @smallexample
14681 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14682 @end smallexample
14684 With the linker plugin enabled, the linker extracts the needed
14685 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14686 to make them part of the aggregated GIMPLE image to be optimized.
14688 If you are not using a linker with plugin support and/or do not
14689 enable the linker plugin, then the objects inside @file{libfoo.a}
14690 are extracted and linked as usual, but they do not participate
14691 in the LTO optimization process.  In order to make a static library suitable
14692 for both LTO optimization and usual linkage, compile its object files with
14693 @option{-flto} @option{-ffat-lto-objects}.
14695 Link-time optimizations do not require the presence of the whole program to
14696 operate.  If the program does not require any symbols to be exported, it is
14697 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14698 the interprocedural optimizers to use more aggressive assumptions which may
14699 lead to improved optimization opportunities.
14700 Use of @option{-fwhole-program} is not needed when linker plugin is
14701 active (see @option{-fuse-linker-plugin}).
14703 The current implementation of LTO makes no
14704 attempt to generate bytecode that is portable between different
14705 types of hosts.  The bytecode files are versioned and there is a
14706 strict version check, so bytecode files generated in one version of
14707 GCC do not work with an older or newer version of GCC.
14709 Link-time optimization does not work well with generation of debugging
14710 information on systems other than those using a combination of ELF and
14711 DWARF.
14713 If you specify the optional @var{n}, the optimization and code
14714 generation done at link time is executed in parallel using @var{n}
14715 parallel jobs by utilizing an installed @command{make} program.  The
14716 environment variable @env{MAKE} may be used to override the program
14717 used.
14719 You can also specify @option{-flto=jobserver} to use GNU make's
14720 job server mode to determine the number of parallel jobs. This
14721 is useful when the Makefile calling GCC is already executing in parallel.
14722 You must prepend a @samp{+} to the command recipe in the parent Makefile
14723 for this to work.  This option likely only works if @env{MAKE} is
14724 GNU make.  Even without the option value, GCC tries to automatically
14725 detect a running GNU make's job server.
14727 Use @option{-flto=auto} to use GNU make's job server, if available,
14728 or otherwise fall back to autodetection of the number of CPU threads
14729 present in your system.
14731 @opindex flto-partition
14732 @item -flto-partition=@var{alg}
14733 Specify the partitioning algorithm used by the link-time optimizer.
14734 The value is either @samp{1to1} to specify a partitioning mirroring
14735 the original source files or @samp{balanced} to specify partitioning
14736 into equally sized chunks (whenever possible) or @samp{max} to create
14737 new partition for every symbol where possible.  Specifying @samp{none}
14738 as an algorithm disables partitioning and streaming completely. 
14739 The default value is @samp{balanced}. While @samp{1to1} can be used
14740 as an workaround for various code ordering issues, the @samp{max}
14741 partitioning is intended for internal testing only.
14742 The value @samp{one} specifies that exactly one partition should be
14743 used while the value @samp{none} bypasses partitioning and executes
14744 the link-time optimization step directly from the WPA phase.
14746 @opindex flto-compression-level
14747 @item -flto-compression-level=@var{n}
14748 This option specifies the level of compression used for intermediate
14749 language written to LTO object files, and is only meaningful in
14750 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14751 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14752 to 19 (maximum compression), while zlib supports values from 0 to 9.
14753 Values outside this range are clamped to either minimum or maximum
14754 of the supported values.  If the option is not given,
14755 a default balanced compression setting is used.
14757 @opindex fuse-linker-plugin
14758 @item -fuse-linker-plugin
14759 Enables the use of a linker plugin during link-time optimization.  This
14760 option relies on plugin support in the linker, which is available in gold
14761 or in GNU ld 2.21 or newer.
14763 This option enables the extraction of object files with GIMPLE bytecode out
14764 of library archives. This improves the quality of optimization by exposing
14765 more code to the link-time optimizer.  This information specifies what
14766 symbols can be accessed externally (by non-LTO object or during dynamic
14767 linking).  Resulting code quality improvements on binaries (and shared
14768 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14769 See @option{-flto} for a description of the effect of this flag and how to
14770 use it.
14772 This option is enabled by default when LTO support in GCC is enabled
14773 and GCC was configured for use with
14774 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14776 @opindex ffat-lto-objects
14777 @item -ffat-lto-objects
14778 Fat LTO objects are object files that contain both the intermediate language
14779 and the object code. This makes them usable for both LTO linking and normal
14780 linking. This option is effective only when compiling with @option{-flto}
14781 and is ignored at link time.
14783 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14784 requires the complete toolchain to be aware of LTO. It requires a linker with
14785 linker plugin support for basic functionality.  Additionally,
14786 @command{nm}, @command{ar} and @command{ranlib}
14787 need to support linker plugins to allow a full-featured build environment
14788 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14789 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14790 to these tools. With non fat LTO makefiles need to be modified to use them.
14792 Note that modern binutils provide plugin auto-load mechanism.
14793 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14794 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14795 @command{gcc-ranlib}).
14797 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14798 support.
14800 @opindex fcompare-elim
14801 @item -fcompare-elim
14802 After register allocation and post-register allocation instruction splitting,
14803 identify arithmetic instructions that compute processor flags similar to a
14804 comparison operation based on that arithmetic.  If possible, eliminate the
14805 explicit comparison operation.
14807 This pass only applies to certain targets that cannot explicitly represent
14808 the comparison operation before register allocation is complete.
14810 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14812 @opindex ffold-mem-offsets
14813 @item -ffold-mem-offsets
14814 @itemx -fno-fold-mem-offsets
14815 Try to eliminate add instructions by folding them in memory loads/stores.
14817 Enabled at levels @option{-O2}, @option{-O3}.
14819 @opindex fcprop-registers
14820 @item -fcprop-registers
14821 After register allocation and post-register allocation instruction splitting,
14822 perform a copy-propagation pass to try to reduce scheduling dependencies
14823 and occasionally eliminate the copy.
14825 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14827 @opindex fprofile-correction
14828 @item -fprofile-correction
14829 Profiles collected using an instrumented binary for multi-threaded programs may
14830 be inconsistent due to missed counter updates. When this option is specified,
14831 GCC uses heuristics to correct or smooth out such inconsistencies. By
14832 default, GCC emits an error message when an inconsistent profile is detected.
14834 This option is enabled by @option{-fauto-profile}.
14836 @opindex fprofile-partial-training
14837 @item -fprofile-partial-training
14838 With @code{-fprofile-use} all portions of programs not executed during train
14839 run are optimized agressively for size rather than speed.  In some cases it is
14840 not practical to train all possible hot paths in the program. (For
14841 example, program may contain functions specific for a given hardware and
14842 trianing may not cover all hardware configurations program is run on.)  With
14843 @code{-fprofile-partial-training} profile feedback will be ignored for all
14844 functions not executed during the train run leading them to be optimized as if
14845 they were compiled without profile feedback. This leads to better performance
14846 when train run is not representative but also leads to significantly bigger
14847 code.
14849 @opindex fprofile-use
14850 @item -fprofile-use
14851 @itemx -fprofile-use=@var{path}
14852 Enable profile feedback-directed optimizations, 
14853 and the following optimizations, many of which
14854 are generally profitable only with profile feedback available:
14856 @gccoptlist{-fbranch-probabilities  -fprofile-values
14857 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14858 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14859 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14860 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14861 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14862 -fprofile-reorder-functions}
14864 Before you can use this option, you must first generate profiling information.
14865 @xref{Instrumentation Options}, for information about the
14866 @option{-fprofile-generate} option.
14868 By default, GCC emits an error message if the feedback profiles do not
14869 match the source code.  This error can be turned into a warning by using
14870 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14871 optimized code.  Additionally, by default, GCC also emits a warning message if
14872 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14874 If @var{path} is specified, GCC looks at the @var{path} to find
14875 the profile feedback data files. See @option{-fprofile-dir}.
14877 @opindex fauto-profile
14878 @item -fauto-profile
14879 @itemx -fauto-profile=@var{path}
14880 Enable sampling-based feedback-directed optimizations, 
14881 and the following optimizations,
14882 many of which are generally profitable only with profile feedback available:
14884 @gccoptlist{-fbranch-probabilities  -fprofile-values
14885 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14886 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14887 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14888 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14889 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14890 -fprofile-correction}
14892 @var{path} is the name of a file containing AutoFDO profile information.
14893 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14895 Producing an AutoFDO profile data file requires running your program
14896 with the @command{perf} utility on a supported GNU/Linux target system.
14897 For more information, see @uref{https://perf.wiki.kernel.org/}.
14899 E.g.
14900 @smallexample
14901 perf record -e br_inst_retired:near_taken -b -o perf.data \
14902     -- your_program
14903 @end smallexample
14905 Then use the @command{create_gcov} tool to convert the raw profile data
14906 to a format that can be used by GCC.@  You must also supply the 
14907 unstripped binary for your program to this tool.  
14908 See @uref{https://github.com/google/autofdo}.
14910 E.g.
14911 @smallexample
14912 create_gcov --binary=your_program.unstripped --profile=perf.data \
14913     --gcov=profile.afdo
14914 @end smallexample
14915 @end table
14917 The following options control compiler behavior regarding floating-point 
14918 arithmetic.  These options trade off between speed and
14919 correctness.  All must be specifically enabled.
14921 @table @gcctabopt
14922 @opindex ffloat-store
14923 @item -ffloat-store
14924 Do not store floating-point variables in registers, and inhibit other
14925 options that might change whether a floating-point value is taken from a
14926 register or memory.
14928 @cindex floating-point precision
14929 This option prevents undesirable excess precision on machines such as
14930 the 68000 where the floating registers (of the 68881) keep more
14931 precision than a @code{double} is supposed to have.  Similarly for the
14932 x86 architecture.  For most programs, the excess precision does only
14933 good, but a few programs rely on the precise definition of IEEE floating
14934 point.  Use @option{-ffloat-store} for such programs, after modifying
14935 them to store all pertinent intermediate computations into variables.
14937 @opindex fexcess-precision
14938 @item -fexcess-precision=@var{style}
14939 This option allows further control over excess precision on machines
14940 where floating-point operations occur in a format with more precision or
14941 range than the IEEE standard and interchange floating-point types.  By
14942 default, @option{-fexcess-precision=fast} is in effect; this means that
14943 operations may be carried out in a wider precision than the types specified
14944 in the source if that would result in faster code, and it is unpredictable
14945 when rounding to the types specified in the source code takes place.
14946 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14947 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14948 both casts and assignments cause values to be rounded to their
14949 semantic types (whereas @option{-ffloat-store} only affects
14950 assignments).  This option is enabled by default for C or C++ if a strict
14951 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14952 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14953 regardless of whether a strict conformance option is used.
14954 If @option{-fexcess-precision=16} is specified, constants and the
14955 results of expressions with types @code{_Float16} and @code{__bf16}
14956 are computed without excess precision.
14958 @opindex mfpmath
14959 @option{-fexcess-precision=standard} is not implemented for languages
14960 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14961 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14962 semantics apply without excess precision, and in the latter, rounding
14963 is unpredictable.
14965 @opindex ffast-math
14966 @item -ffast-math
14967 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14968 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14969 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14970 @option{-fexcess-precision=fast}.
14972 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14974 This option is not turned on by any @option{-O} option besides
14975 @option{-Ofast} since it can result in incorrect output for programs
14976 that depend on an exact implementation of IEEE or ISO rules/specifications
14977 for math functions. It may, however, yield faster code for programs
14978 that do not require the guarantees of these specifications.
14980 @opindex fno-math-errno
14981 @opindex fmath-errno
14982 @item -fno-math-errno
14983 Do not set @code{errno} after calling math functions that are executed
14984 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14985 IEEE exceptions for math error handling may want to use this flag
14986 for speed while maintaining IEEE arithmetic compatibility.
14988 This option is not turned on by any @option{-O} option since
14989 it can result in incorrect output for programs that depend on
14990 an exact implementation of IEEE or ISO rules/specifications for
14991 math functions. It may, however, yield faster code for programs
14992 that do not require the guarantees of these specifications.
14994 The default is @option{-fmath-errno}.
14996 On Darwin systems, the math library never sets @code{errno}.  There is
14997 therefore no reason for the compiler to consider the possibility that
14998 it might, and @option{-fno-math-errno} is the default.
15000 @opindex funsafe-math-optimizations
15001 @item -funsafe-math-optimizations
15003 Allow optimizations for floating-point arithmetic that (a) assume
15004 that arguments and results are valid and (b) may violate IEEE or
15005 ANSI standards.  When used at link time, it may include libraries
15006 or startup files that change the default FPU control word or other
15007 similar optimizations.
15009 This option is not turned on by any @option{-O} option since
15010 it can result in incorrect output for programs that depend on
15011 an exact implementation of IEEE or ISO rules/specifications for
15012 math functions. It may, however, yield faster code for programs
15013 that do not require the guarantees of these specifications.
15014 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
15015 @option{-fassociative-math} and @option{-freciprocal-math}.
15017 The default is @option{-fno-unsafe-math-optimizations}.
15019 @opindex fassociative-math
15020 @item -fassociative-math
15022 Allow re-association of operands in series of floating-point operations.
15023 This violates the ISO C and C++ language standard by possibly changing
15024 computation result.  NOTE: re-ordering may change the sign of zero as
15025 well as ignore NaNs and inhibit or create underflow or overflow (and
15026 thus cannot be used on code that relies on rounding behavior like
15027 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
15028 and thus may not be used when ordered comparisons are required.
15029 This option requires that both @option{-fno-signed-zeros} and
15030 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
15031 much sense with @option{-frounding-math}. For Fortran the option
15032 is automatically enabled when both @option{-fno-signed-zeros} and
15033 @option{-fno-trapping-math} are in effect.
15035 The default is @option{-fno-associative-math}.
15037 @opindex freciprocal-math
15038 @item -freciprocal-math
15040 Allow the reciprocal of a value to be used instead of dividing by
15041 the value if this enables optimizations.  For example @code{x / y}
15042 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
15043 is subject to common subexpression elimination.  Note that this loses
15044 precision and increases the number of flops operating on the value.
15046 The default is @option{-fno-reciprocal-math}.
15048 @opindex ffinite-math-only
15049 @item -ffinite-math-only
15050 Allow optimizations for floating-point arithmetic that assume
15051 that arguments and results are not NaNs or +-Infs.
15053 This option is not turned on by any @option{-O} option since
15054 it can result in incorrect output for programs that depend on
15055 an exact implementation of IEEE or ISO rules/specifications for
15056 math functions. It may, however, yield faster code for programs
15057 that do not require the guarantees of these specifications.
15059 The default is @option{-fno-finite-math-only}.
15061 @opindex fno-signed-zeros
15062 @opindex fsigned-zeros
15063 @item -fno-signed-zeros
15064 Allow optimizations for floating-point arithmetic that ignore the
15065 signedness of zero.  IEEE arithmetic specifies the behavior of
15066 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
15067 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
15068 This option implies that the sign of a zero result isn't significant.
15070 The default is @option{-fsigned-zeros}.
15072 @opindex fno-trapping-math
15073 @opindex ftrapping-math
15074 @item -fno-trapping-math
15075 Compile code assuming that floating-point operations cannot generate
15076 user-visible traps.  These traps include division by zero, overflow,
15077 underflow, inexact result and invalid operation.  This option requires
15078 that @option{-fno-signaling-nans} be in effect.  Setting this option may
15079 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
15081 This option should never be turned on by any @option{-O} option since
15082 it can result in incorrect output for programs that depend on
15083 an exact implementation of IEEE or ISO rules/specifications for
15084 math functions.
15086 The default is @option{-ftrapping-math}.
15088 Future versions of GCC may provide finer control of this setting
15089 using C99's @code{FENV_ACCESS} pragma.  This command-line option
15090 will be used along with @option{-frounding-math} to specify the
15091 default state for @code{FENV_ACCESS}.
15093 @opindex frounding-math
15094 @item -frounding-math
15095 Disable transformations and optimizations that assume default floating-point
15096 rounding behavior.  This is round-to-zero for all floating point
15097 to integer conversions, and round-to-nearest for all other arithmetic
15098 truncations.  This option should be specified for programs that change
15099 the FP rounding mode dynamically, or that may be executed with a
15100 non-default rounding mode.  This option disables constant folding of
15101 floating-point expressions at compile time (which may be affected by
15102 rounding mode) and arithmetic transformations that are unsafe in the
15103 presence of sign-dependent rounding modes.
15105 The default is @option{-fno-rounding-math}.
15107 This option is experimental and does not currently guarantee to
15108 disable all GCC optimizations that are affected by rounding mode.
15109 Future versions of GCC may provide finer control of this setting
15110 using C99's @code{FENV_ACCESS} pragma.  This command-line option
15111 will be used along with @option{-ftrapping-math} to specify the
15112 default state for @code{FENV_ACCESS}.
15114 @opindex fsignaling-nans
15115 @item -fsignaling-nans
15116 Compile code assuming that IEEE signaling NaNs may generate user-visible
15117 traps during floating-point operations.  Setting this option disables
15118 optimizations that may change the number of exceptions visible with
15119 signaling NaNs.  This option implies @option{-ftrapping-math}.
15121 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
15122 be defined.
15124 The default is @option{-fno-signaling-nans}.
15126 This option is experimental and does not currently guarantee to
15127 disable all GCC optimizations that affect signaling NaN behavior.
15129 @opindex fno-fp-int-builtin-inexact
15130 @opindex ffp-int-builtin-inexact
15131 @item -fno-fp-int-builtin-inexact
15132 Do not allow the built-in functions @code{ceil}, @code{floor},
15133 @code{round} and @code{trunc}, and their @code{float} and @code{long
15134 double} variants, to generate code that raises the ``inexact''
15135 floating-point exception for noninteger arguments.  ISO C99 and C11
15136 allow these functions to raise the ``inexact'' exception, but ISO/IEC
15137 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
15138 ISO C23, does not allow these functions to do so.
15140 The default is @option{-ffp-int-builtin-inexact}, allowing the
15141 exception to be raised, unless C23 or a later C standard is selected.
15142 This option does nothing unless @option{-ftrapping-math} is in effect.
15144 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
15145 generate a call to a library function then the ``inexact'' exception
15146 may be raised if the library implementation does not follow TS 18661.
15148 @opindex fsingle-precision-constant
15149 @item -fsingle-precision-constant
15150 Treat floating-point constants as single precision instead of
15151 implicitly converting them to double-precision constants.
15153 @opindex fcx-limited-range
15154 @item -fcx-limited-range
15155 When enabled, this option states that a range reduction step is not
15156 needed when performing complex division.  Also, there is no checking
15157 whether the result of a complex multiplication or division is @code{NaN
15158 + I*NaN}, with an attempt to rescue the situation in that case.  The
15159 default is @option{-fno-cx-limited-range}, but is enabled by
15160 @option{-ffast-math}.
15162 This option controls the default setting of the ISO C99
15163 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
15164 all languages.
15166 @opindex fcx-fortran-rules
15167 @item -fcx-fortran-rules
15168 Complex multiplication and division follow Fortran rules.  Range
15169 reduction is done as part of complex division, but there is no checking
15170 whether the result of a complex multiplication or division is @code{NaN
15171 + I*NaN}, with an attempt to rescue the situation in that case.
15173 The default is @option{-fno-cx-fortran-rules}.
15175 @end table
15177 The following options control optimizations that may improve
15178 performance, but are not enabled by any @option{-O} options.  This
15179 section includes experimental options that may produce broken code.
15181 @table @gcctabopt
15182 @opindex fbranch-probabilities
15183 @item -fbranch-probabilities
15184 After running a program compiled with @option{-fprofile-arcs}
15185 (@pxref{Instrumentation Options}),
15186 you can compile it a second time using
15187 @option{-fbranch-probabilities}, to improve optimizations based on
15188 the number of times each branch was taken.  When a program
15189 compiled with @option{-fprofile-arcs} exits, it saves arc execution
15190 counts to a file called @file{@var{sourcename}.gcda} for each source
15191 file.  The information in this data file is very dependent on the
15192 structure of the generated code, so you must use the same source code
15193 and the same optimization options for both compilations.
15194 See details about the file naming in @option{-fprofile-arcs}.
15196 With @option{-fbranch-probabilities}, GCC puts a
15197 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
15198 These can be used to improve optimization.  Currently, they are only
15199 used in one place: in @file{reorg.cc}, instead of guessing which path a
15200 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
15201 exactly determine which path is taken more often.
15203 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15205 @opindex fprofile-values
15206 @item -fprofile-values
15207 If combined with @option{-fprofile-arcs}, it adds code so that some
15208 data about values of expressions in the program is gathered.
15210 With @option{-fbranch-probabilities}, it reads back the data gathered
15211 from profiling values of expressions for usage in optimizations.
15213 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
15214 @option{-fauto-profile}.
15216 @opindex fprofile-reorder-functions
15217 @item -fprofile-reorder-functions
15218 Function reordering based on profile instrumentation collects
15219 first time of execution of a function and orders these functions
15220 in ascending order.
15222 Enabled with @option{-fprofile-use}.
15224 @opindex fvpt
15225 @item -fvpt
15226 If combined with @option{-fprofile-arcs}, this option instructs the compiler
15227 to add code to gather information about values of expressions.
15229 With @option{-fbranch-probabilities}, it reads back the data gathered
15230 and actually performs the optimizations based on them.
15231 Currently the optimizations include specialization of division operations
15232 using the knowledge about the value of the denominator.
15234 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
15236 @opindex frename-registers
15237 @item -frename-registers
15238 Attempt to avoid false dependencies in scheduled code by making use
15239 of registers left over after register allocation.  This optimization
15240 most benefits processors with lots of registers.  Depending on the
15241 debug information format adopted by the target, however, it can
15242 make debugging impossible, since variables no longer stay in
15243 a ``home register''.
15245 Enabled by default with @option{-funroll-loops}.
15247 @opindex fschedule-fusion
15248 @item -fschedule-fusion
15249 Performs a target dependent pass over the instruction stream to schedule
15250 instructions of same type together because target machine can execute them
15251 more efficiently if they are adjacent to each other in the instruction flow.
15253 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
15255 @opindex ftracer
15256 @item -ftracer
15257 Perform tail duplication to enlarge superblock size.  This transformation
15258 simplifies the control flow of the function allowing other optimizations to do
15259 a better job.
15261 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15263 @opindex funroll-loops
15264 @item -funroll-loops
15265 Unroll loops whose number of iterations can be determined at compile time or
15266 upon entry to the loop.  @option{-funroll-loops} implies
15267 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
15268 It also turns on complete loop peeling (i.e.@: complete removal of loops with
15269 a small constant number of iterations).  This option makes code larger, and may
15270 or may not make it run faster.
15272 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15274 @opindex funroll-all-loops
15275 @item -funroll-all-loops
15276 Unroll all loops, even if their number of iterations is uncertain when
15277 the loop is entered.  This usually makes programs run more slowly.
15278 @option{-funroll-all-loops} implies the same options as
15279 @option{-funroll-loops}.
15281 @opindex fpeel-loops
15282 @item -fpeel-loops
15283 Peels loops for which there is enough information that they do not
15284 roll much (from profile feedback or static analysis).  It also turns on
15285 complete loop peeling (i.e.@: complete removal of loops with small constant
15286 number of iterations).
15288 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
15290 @opindex fmove-loop-invariants
15291 @item -fmove-loop-invariants
15292 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
15293 at level @option{-O1} and higher, except for @option{-Og}.
15295 @opindex fmove-loop-stores
15296 @item -fmove-loop-stores
15297 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
15298 moves invariant stores to after the end of the loop in exchange for
15299 carrying the stored value in a register across the iteration.
15300 Note for this option to have an effect @option{-ftree-loop-im} has to
15301 be enabled as well.  Enabled at level @option{-O1} and higher, except
15302 for @option{-Og}.
15304 @opindex fsplit-loops
15305 @item -fsplit-loops
15306 Split a loop into two if it contains a condition that's always true
15307 for one side of the iteration space and false for the other.
15309 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15311 @opindex funswitch-loops
15312 @item -funswitch-loops
15313 Move branches with loop invariant conditions out of the loop, with duplicates
15314 of the loop on both branches (modified according to result of the condition).
15316 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15318 @opindex fversion-loops-for-strides
15319 @item -fversion-loops-for-strides
15320 If a loop iterates over an array with a variable stride, create another
15321 version of the loop that assumes the stride is always one.  For example:
15323 @smallexample
15324 for (int i = 0; i < n; ++i)
15325   x[i * stride] = @dots{};
15326 @end smallexample
15328 becomes:
15330 @smallexample
15331 if (stride == 1)
15332   for (int i = 0; i < n; ++i)
15333     x[i] = @dots{};
15334 else
15335   for (int i = 0; i < n; ++i)
15336     x[i * stride] = @dots{};
15337 @end smallexample
15339 This is particularly useful for assumed-shape arrays in Fortran where
15340 (for example) it allows better vectorization assuming contiguous accesses.
15341 This flag is enabled by default at @option{-O3}.
15342 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
15344 @opindex ffunction-sections
15345 @opindex fdata-sections
15346 @item -ffunction-sections
15347 @itemx -fdata-sections
15348 Place each function or data item into its own section in the output
15349 file if the target supports arbitrary sections.  The name of the
15350 function or the name of the data item determines the section's name
15351 in the output file.
15353 Use these options on systems where the linker can perform optimizations to
15354 improve locality of reference in the instruction space.  Most systems using the
15355 ELF object format have linkers with such optimizations.  On AIX, the linker
15356 rearranges sections (CSECTs) based on the call graph.  The performance impact
15357 varies.
15359 Together with a linker garbage collection (linker @option{--gc-sections}
15360 option) these options may lead to smaller statically-linked executables (after
15361 stripping).
15363 On ELF/DWARF systems these options do not degenerate the quality of the debug
15364 information.  There could be issues with other object files/debug info formats.
15366 Only use these options when there are significant benefits from doing so.  When
15367 you specify these options, the assembler and linker create larger object and
15368 executable files and are also slower.  These options affect code generation.
15369 They prevent optimizations by the compiler and assembler using relative
15370 locations inside a translation unit since the locations are unknown until
15371 link time.  An example of such an optimization is relaxing calls to short call
15372 instructions.
15374 @opindex fstdarg-opt
15375 @item -fstdarg-opt
15376 Optimize the prologue of variadic argument functions with respect to usage of
15377 those arguments.
15379 @opindex fsection-anchors
15380 @item -fsection-anchors
15381 Try to reduce the number of symbolic address calculations by using
15382 shared ``anchor'' symbols to address nearby objects.  This transformation
15383 can help to reduce the number of GOT entries and GOT accesses on some
15384 targets.
15386 For example, the implementation of the following function @code{foo}:
15388 @smallexample
15389 static int a, b, c;
15390 int foo (void) @{ return a + b + c; @}
15391 @end smallexample
15393 @noindent
15394 usually calculates the addresses of all three variables, but if you
15395 compile it with @option{-fsection-anchors}, it accesses the variables
15396 from a common anchor point instead.  The effect is similar to the
15397 following pseudocode (which isn't valid C):
15399 @smallexample
15400 int foo (void)
15402   register int *xr = &x;
15403   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
15405 @end smallexample
15407 Not all targets support this option.
15409 @opindex fzero-call-used-regs
15410 @item -fzero-call-used-regs=@var{choice}
15411 Zero call-used registers at function return to increase program
15412 security by either mitigating Return-Oriented Programming (ROP)
15413 attacks or preventing information leakage through registers.
15415 The possible values of @var{choice} are the same as for the
15416 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
15417 The default is @samp{skip}.
15419 You can control this behavior for a specific function by using the function
15420 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
15422 @opindex param
15423 @item --param @var{name}=@var{value}
15424 In some places, GCC uses various constants to control the amount of
15425 optimization that is done.  For example, GCC does not inline functions
15426 that contain more than a certain number of instructions.  You can
15427 control some of these constants on the command line using the
15428 @option{--param} option.
15430 The names of specific parameters, and the meaning of the values, are
15431 tied to the internals of the compiler, and are subject to change
15432 without notice in future releases.
15434 In order to get the minimal, maximal and default values of a parameter,
15435 use the @option{--help=param -Q} options.
15437 In each case, the @var{value} is an integer.  The following choices
15438 of @var{name} are recognized for all targets:
15440 @table @gcctabopt
15441 @item predictable-branch-outcome
15442 When branch is predicted to be taken with probability lower than this threshold
15443 (in percent), then it is considered well predictable.
15445 @item max-rtl-if-conversion-insns
15446 RTL if-conversion tries to remove conditional branches around a block and
15447 replace them with conditionally executed instructions.  This parameter
15448 gives the maximum number of instructions in a block which should be
15449 considered for if-conversion.  The compiler will
15450 also use other heuristics to decide whether if-conversion is likely to be
15451 profitable.
15453 @item max-rtl-if-conversion-predictable-cost
15454 RTL if-conversion will try to remove conditional branches around a block
15455 and replace them with conditionally executed instructions.  These parameters
15456 give the maximum permissible cost for the sequence that would be generated
15457 by if-conversion depending on whether the branch is statically determined
15458 to be predictable or not.  The units for this parameter are the same as
15459 those for the GCC internal seq_cost metric.  The compiler will try to
15460 provide a reasonable default for this parameter using the BRANCH_COST
15461 target macro.
15463 @item max-crossjump-edges
15464 The maximum number of incoming edges to consider for cross-jumping.
15465 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15466 the number of edges incoming to each block.  Increasing values mean
15467 more aggressive optimization, making the compilation time increase with
15468 probably small improvement in executable size.
15470 @item min-crossjump-insns
15471 The minimum number of instructions that must be matched at the end
15472 of two blocks before cross-jumping is performed on them.  This
15473 value is ignored in the case where all instructions in the block being
15474 cross-jumped from are matched.
15476 @item max-grow-copy-bb-insns
15477 The maximum code size expansion factor when copying basic blocks
15478 instead of jumping.  The expansion is relative to a jump instruction.
15480 @item max-goto-duplication-insns
15481 The maximum number of instructions to duplicate to a block that jumps
15482 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15483 passes, GCC factors computed gotos early in the compilation process,
15484 and unfactors them as late as possible.  Only computed jumps at the
15485 end of a basic blocks with no more than max-goto-duplication-insns are
15486 unfactored.
15488 @item max-delay-slot-insn-search
15489 The maximum number of instructions to consider when looking for an
15490 instruction to fill a delay slot.  If more than this arbitrary number of
15491 instructions are searched, the time savings from filling the delay slot
15492 are minimal, so stop searching.  Increasing values mean more
15493 aggressive optimization, making the compilation time increase with probably
15494 small improvement in execution time.
15496 @item max-delay-slot-live-search
15497 When trying to fill delay slots, the maximum number of instructions to
15498 consider when searching for a block with valid live register
15499 information.  Increasing this arbitrarily chosen value means more
15500 aggressive optimization, increasing the compilation time.  This parameter
15501 should be removed when the delay slot code is rewritten to maintain the
15502 control-flow graph.
15504 @item max-gcse-memory
15505 The approximate maximum amount of memory in @code{kB} that can be allocated in
15506 order to perform the global common subexpression elimination
15507 optimization.  If more memory than specified is required, the
15508 optimization is not done.
15510 @item max-gcse-insertion-ratio
15511 If the ratio of expression insertions to deletions is larger than this value
15512 for any expression, then RTL PRE inserts or removes the expression and thus
15513 leaves partially redundant computations in the instruction stream.
15515 @item max-pending-list-length
15516 The maximum number of pending dependencies scheduling allows
15517 before flushing the current state and starting over.  Large functions
15518 with few branches or calls can create excessively large lists which
15519 needlessly consume memory and resources.
15521 @item max-modulo-backtrack-attempts
15522 The maximum number of backtrack attempts the scheduler should make
15523 when modulo scheduling a loop.  Larger values can exponentially increase
15524 compilation time.
15526 @item max-inline-functions-called-once-loop-depth
15527 Maximal loop depth of a call considered by inline heuristics that tries to
15528 inline all functions called once.
15530 @item max-inline-functions-called-once-insns
15531 Maximal estimated size of functions produced while inlining functions called
15532 once.
15534 @item max-inline-insns-single
15535 Several parameters control the tree inliner used in GCC@.  This number sets the
15536 maximum number of instructions (counted in GCC's internal representation) in a
15537 single function that the tree inliner considers for inlining.  This only
15538 affects functions declared inline and methods implemented in a class
15539 declaration (C++). 
15542 @item max-inline-insns-auto
15543 When you use @option{-finline-functions} (included in @option{-O3}),
15544 a lot of functions that would otherwise not be considered for inlining
15545 by the compiler are investigated.  To those functions, a different
15546 (more restrictive) limit compared to functions declared inline can
15547 be applied (@option{--param max-inline-insns-auto}).
15549 @item max-inline-insns-small
15550 This is bound applied to calls which are considered relevant with
15551 @option{-finline-small-functions}.
15553 @item max-inline-insns-size
15554 This is bound applied to calls which are optimized for size. Small growth
15555 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15557 @item uninlined-function-insns
15558 Number of instructions accounted by inliner for function overhead such as
15559 function prologue and epilogue.
15561 @item uninlined-function-time
15562 Extra time accounted by inliner for function overhead such as time needed to
15563 execute function prologue and epilogue.
15565 @item inline-heuristics-hint-percent
15566 The scale (in percents) applied to @option{inline-insns-single},
15567 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15568 when inline heuristics hints that inlining is
15569 very profitable (will enable later optimizations).
15571 @item uninlined-thunk-insns
15572 @item uninlined-thunk-time
15573 Same as @option{--param uninlined-function-insns} and
15574 @option{--param uninlined-function-time} but applied to function thunks.
15576 @item inline-min-speedup
15577 When estimated performance improvement of caller + callee runtime exceeds this
15578 threshold (in percent), the function can be inlined regardless of the limit on
15579 @option{--param max-inline-insns-single} and @option{--param
15580 max-inline-insns-auto}.
15582 @item large-function-insns
15583 The limit specifying really large functions.  For functions larger than this
15584 limit after inlining, inlining is constrained by
15585 @option{--param large-function-growth}.  This parameter is useful primarily
15586 to avoid extreme compilation time caused by non-linear algorithms used by the
15587 back end.
15589 @item large-function-growth
15590 Specifies maximal growth of large function caused by inlining in percents.
15591 For example, parameter value 100 limits large function growth to 2.0 times
15592 the original size.
15594 @item large-unit-insns
15595 The limit specifying large translation unit.  Growth caused by inlining of
15596 units larger than this limit is limited by @option{--param inline-unit-growth}.
15597 For small units this might be too tight.
15598 For example, consider a unit consisting of function A
15599 that is inline and B that just calls A three times.  If B is small relative to
15600 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15601 large units consisting of small inlineable functions, however, the overall unit
15602 growth limit is needed to avoid exponential explosion of code size.  Thus for
15603 smaller units, the size is increased to @option{--param large-unit-insns}
15604 before applying @option{--param inline-unit-growth}.
15606 @item lazy-modules
15607 Maximum number of concurrently open C++ module files when lazy loading.
15609 @item inline-unit-growth
15610 Specifies maximal overall growth of the compilation unit caused by inlining.
15611 For example, parameter value 20 limits unit growth to 1.2 times the original
15612 size. Cold functions (either marked cold via an attribute or by profile
15613 feedback) are not accounted into the unit size.
15615 @item ipa-cp-unit-growth
15616 Specifies maximal overall growth of the compilation unit caused by
15617 interprocedural constant propagation.  For example, parameter value 10 limits
15618 unit growth to 1.1 times the original size.
15620 @item ipa-cp-large-unit-insns
15621 The size of translation unit that IPA-CP pass considers large.
15623 @item large-stack-frame
15624 The limit specifying large stack frames.  While inlining the algorithm is trying
15625 to not grow past this limit too much.
15627 @item large-stack-frame-growth
15628 Specifies maximal growth of large stack frames caused by inlining in percents.
15629 For example, parameter value 1000 limits large stack frame growth to 11 times
15630 the original size.
15632 @item max-inline-insns-recursive
15633 @itemx max-inline-insns-recursive-auto
15634 Specifies the maximum number of instructions an out-of-line copy of a
15635 self-recursive inline
15636 function can grow into by performing recursive inlining.
15638 @option{--param max-inline-insns-recursive} applies to functions
15639 declared inline.
15640 For functions not declared inline, recursive inlining
15641 happens only when @option{-finline-functions} (included in @option{-O3}) is
15642 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15644 @item max-inline-recursive-depth
15645 @itemx max-inline-recursive-depth-auto
15646 Specifies the maximum recursion depth used for recursive inlining.
15648 @option{--param max-inline-recursive-depth} applies to functions
15649 declared inline.  For functions not declared inline, recursive inlining
15650 happens only when @option{-finline-functions} (included in @option{-O3}) is
15651 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15653 @item min-inline-recursive-probability
15654 Recursive inlining is profitable only for function having deep recursion
15655 in average and can hurt for function having little recursion depth by
15656 increasing the prologue size or complexity of function body to other
15657 optimizers.
15659 When profile feedback is available (see @option{-fprofile-generate}) the actual
15660 recursion depth can be guessed from the probability that function recurses
15661 via a given call expression.  This parameter limits inlining only to call
15662 expressions whose probability exceeds the given threshold (in percents).
15664 @item early-inlining-insns
15665 Specify growth that the early inliner can make.  In effect it increases
15666 the amount of inlining for code having a large abstraction penalty.
15668 @item max-early-inliner-iterations
15669 Limit of iterations of the early inliner.  This basically bounds
15670 the number of nested indirect calls the early inliner can resolve.
15671 Deeper chains are still handled by late inlining.
15673 @item comdat-sharing-probability
15674 Probability (in percent) that C++ inline function with comdat visibility
15675 are shared across multiple compilation units.
15677 @item modref-max-bases
15678 @item modref-max-refs
15679 @item modref-max-accesses
15680 Specifies the maximal number of base pointers, references and accesses stored
15681 for a single function by mod/ref analysis.
15683 @item modref-max-tests
15684 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15685 memory locations using the mod/ref information.  This parameter ought to be
15686 bigger than @option{--param modref-max-bases} and @option{--param
15687 modref-max-refs}.
15689 @item modref-max-depth
15690 Specifies the maximum depth of DFS walk used by modref escape analysis.
15691 Setting to 0 disables the analysis completely.
15693 @item modref-max-escape-points
15694 Specifies the maximum number of escape points tracked by modref per SSA-name.
15696 @item modref-max-adjustments
15697 Specifies the maximum number the access range is enlarged during modref dataflow
15698 analysis.
15700 @item profile-func-internal-id
15701 A parameter to control whether to use function internal id in profile
15702 database lookup. If the value is 0, the compiler uses an id that
15703 is based on function assembler name and filename, which makes old profile
15704 data more tolerant to source changes such as function reordering etc.
15706 @item min-vect-loop-bound
15707 The minimum number of iterations under which loops are not vectorized
15708 when @option{-ftree-vectorize} is used.  The number of iterations after
15709 vectorization needs to be greater than the value specified by this option
15710 to allow vectorization.
15712 @item gcse-cost-distance-ratio
15713 Scaling factor in calculation of maximum distance an expression
15714 can be moved by GCSE optimizations.  This is currently supported only in the
15715 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15716 is with simple expressions, i.e., the expressions that have cost
15717 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15718 hoisting of simple expressions.
15720 @item gcse-unrestricted-cost
15721 Cost, roughly measured as the cost of a single typical machine
15722 instruction, at which GCSE optimizations do not constrain
15723 the distance an expression can travel.  This is currently
15724 supported only in the code hoisting pass.  The lesser the cost,
15725 the more aggressive code hoisting is.  Specifying 0 
15726 allows all expressions to travel unrestricted distances.
15728 @item max-hoist-depth
15729 The depth of search in the dominator tree for expressions to hoist.
15730 This is used to avoid quadratic behavior in hoisting algorithm.
15731 The value of 0 does not limit on the search, but may slow down compilation
15732 of huge functions.
15734 @item max-tail-merge-comparisons
15735 The maximum amount of similar bbs to compare a bb with.  This is used to
15736 avoid quadratic behavior in tree tail merging.
15738 @item max-tail-merge-iterations
15739 The maximum amount of iterations of the pass over the function.  This is used to
15740 limit compilation time in tree tail merging.
15742 @item store-merging-allow-unaligned
15743 Allow the store merging pass to introduce unaligned stores if it is legal to
15744 do so.
15746 @item max-stores-to-merge
15747 The maximum number of stores to attempt to merge into wider stores in the store
15748 merging pass.
15750 @item max-store-chains-to-track
15751 The maximum number of store chains to track at the same time in the attempt
15752 to merge them into wider stores in the store merging pass.
15754 @item max-stores-to-track
15755 The maximum number of stores to track at the same time in the attemt to
15756 to merge them into wider stores in the store merging pass.
15758 @item max-unrolled-insns
15759 The maximum number of instructions that a loop may have to be unrolled.
15760 If a loop is unrolled, this parameter also determines how many times
15761 the loop code is unrolled.
15763 @item max-average-unrolled-insns
15764 The maximum number of instructions biased by probabilities of their execution
15765 that a loop may have to be unrolled.  If a loop is unrolled,
15766 this parameter also determines how many times the loop code is unrolled.
15768 @item max-unroll-times
15769 The maximum number of unrollings of a single loop.
15771 @item max-peeled-insns
15772 The maximum number of instructions that a loop may have to be peeled.
15773 If a loop is peeled, this parameter also determines how many times
15774 the loop code is peeled.
15776 @item max-peel-times
15777 The maximum number of peelings of a single loop.
15779 @item max-peel-branches
15780 The maximum number of branches on the hot path through the peeled sequence.
15782 @item max-completely-peeled-insns
15783 The maximum number of insns of a completely peeled loop.
15785 @item max-completely-peel-times
15786 The maximum number of iterations of a loop to be suitable for complete peeling.
15788 @item max-completely-peel-loop-nest-depth
15789 The maximum depth of a loop nest suitable for complete peeling.
15791 @item max-unswitch-insns
15792 The maximum number of insns of an unswitched loop.
15794 @item max-unswitch-depth
15795 The maximum depth of a loop nest to be unswitched.
15797 @item lim-expensive
15798 The minimum cost of an expensive expression in the loop invariant motion.
15800 @item min-loop-cond-split-prob
15801 When FDO profile information is available, @option{min-loop-cond-split-prob}
15802 specifies minimum threshold for probability of semi-invariant condition
15803 statement to trigger loop split.
15805 @item iv-consider-all-candidates-bound
15806 Bound on number of candidates for induction variables, below which
15807 all candidates are considered for each use in induction variable
15808 optimizations.  If there are more candidates than this,
15809 only the most relevant ones are considered to avoid quadratic time complexity.
15811 @item iv-max-considered-uses
15812 The induction variable optimizations give up on loops that contain more
15813 induction variable uses.
15815 @item iv-always-prune-cand-set-bound
15816 If the number of candidates in the set is smaller than this value,
15817 always try to remove unnecessary ivs from the set
15818 when adding a new one.
15820 @item avg-loop-niter
15821 Average number of iterations of a loop.
15823 @item dse-max-object-size
15824 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15825 Larger values may result in larger compilation times.
15827 @item dse-max-alias-queries-per-store
15828 Maximum number of queries into the alias oracle per store.
15829 Larger values result in larger compilation times and may result in more
15830 removed dead stores.
15832 @item scev-max-expr-size
15833 Bound on size of expressions used in the scalar evolutions analyzer.
15834 Large expressions slow the analyzer.
15836 @item scev-max-expr-complexity
15837 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15838 Complex expressions slow the analyzer.
15840 @item max-tree-if-conversion-phi-args
15841 Maximum number of arguments in a PHI supported by TREE if conversion
15842 unless the loop is marked with simd pragma.
15844 @item vect-max-layout-candidates
15845 The maximum number of possible vector layouts (such as permutations)
15846 to consider when optimizing to-be-vectorized code.
15848 @item vect-max-version-for-alignment-checks
15849 The maximum number of run-time checks that can be performed when
15850 doing loop versioning for alignment in the vectorizer.
15852 @item vect-max-version-for-alias-checks
15853 The maximum number of run-time checks that can be performed when
15854 doing loop versioning for alias in the vectorizer.
15856 @item vect-max-peeling-for-alignment
15857 The maximum number of loop peels to enhance access alignment
15858 for vectorizer. Value -1 means no limit.
15860 @item max-iterations-to-track
15861 The maximum number of iterations of a loop the brute-force algorithm
15862 for analysis of the number of iterations of the loop tries to evaluate.
15864 @item hot-bb-count-fraction
15865 The denominator n of fraction 1/n of the maximal execution count of a
15866 basic block in the entire program that a basic block needs to at least
15867 have in order to be considered hot.  The default is 10000, which means
15868 that a basic block is considered hot if its execution count is greater
15869 than 1/10000 of the maximal execution count.  0 means that it is never
15870 considered hot.  Used in non-LTO mode.
15872 @item hot-bb-count-ws-permille
15873 The number of most executed permilles, ranging from 0 to 1000, of the
15874 profiled execution of the entire program to which the execution count
15875 of a basic block must be part of in order to be considered hot.  The
15876 default is 990, which means that a basic block is considered hot if
15877 its execution count contributes to the upper 990 permilles, or 99.0%,
15878 of the profiled execution of the entire program.  0 means that it is
15879 never considered hot.  Used in LTO mode.
15881 @item hot-bb-frequency-fraction
15882 The denominator n of fraction 1/n of the execution frequency of the
15883 entry block of a function that a basic block of this function needs
15884 to at least have in order to be considered hot.  The default is 1000,
15885 which means that a basic block is considered hot in a function if it
15886 is executed more frequently than 1/1000 of the frequency of the entry
15887 block of the function.  0 means that it is never considered hot.
15889 @item unlikely-bb-count-fraction
15890 The denominator n of fraction 1/n of the number of profiled runs of
15891 the entire program below which the execution count of a basic block
15892 must be in order for the basic block to be considered unlikely executed.
15893 The default is 20, which means that a basic block is considered unlikely
15894 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15895 the program.  0 means that it is always considered unlikely executed.
15897 @item max-predicted-iterations
15898 The maximum number of loop iterations we predict statically.  This is useful
15899 in cases where a function contains a single loop with known bound and
15900 another loop with unknown bound.
15901 The known number of iterations is predicted correctly, while
15902 the unknown number of iterations average to roughly 10.  This means that the
15903 loop without bounds appears artificially cold relative to the other one.
15905 @item builtin-expect-probability
15906 Control the probability of the expression having the specified value. This
15907 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15909 @item builtin-string-cmp-inline-length
15910 The maximum length of a constant string for a builtin string cmp call 
15911 eligible for inlining.
15913 @item align-threshold
15915 Select fraction of the maximal frequency of executions of a basic block in
15916 a function to align the basic block.
15918 @item align-loop-iterations
15920 A loop expected to iterate at least the selected number of iterations is
15921 aligned.
15923 @item tracer-dynamic-coverage
15924 @itemx tracer-dynamic-coverage-feedback
15926 This value is used to limit superblock formation once the given percentage of
15927 executed instructions is covered.  This limits unnecessary code size
15928 expansion.
15930 The @option{tracer-dynamic-coverage-feedback} parameter
15931 is used only when profile
15932 feedback is available.  The real profiles (as opposed to statically estimated
15933 ones) are much less balanced allowing the threshold to be larger value.
15935 @item tracer-max-code-growth
15936 Stop tail duplication once code growth has reached given percentage.  This is
15937 a rather artificial limit, as most of the duplicates are eliminated later in
15938 cross jumping, so it may be set to much higher values than is the desired code
15939 growth.
15941 @item tracer-min-branch-ratio
15943 Stop reverse growth when the reverse probability of best edge is less than this
15944 threshold (in percent).
15946 @item tracer-min-branch-probability
15947 @itemx tracer-min-branch-probability-feedback
15949 Stop forward growth if the best edge has probability lower than this
15950 threshold.
15952 Similarly to @option{tracer-dynamic-coverage} two parameters are
15953 provided.  @option{tracer-min-branch-probability-feedback} is used for
15954 compilation with profile feedback and @option{tracer-min-branch-probability}
15955 compilation without.  The value for compilation with profile feedback
15956 needs to be more conservative (higher) in order to make tracer
15957 effective.
15959 @item stack-clash-protection-guard-size
15960 Specify the size of the operating system provided stack guard as
15961 2 raised to @var{num} bytes.  Higher values may reduce the
15962 number of explicit probes, but a value larger than the operating system
15963 provided guard will leave code vulnerable to stack clash style attacks.
15965 @item stack-clash-protection-probe-interval
15966 Stack clash protection involves probing stack space as it is allocated.  This
15967 param controls the maximum distance between probes into the stack as 2 raised
15968 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15969 larger than the operating system provided guard will leave code vulnerable to
15970 stack clash style attacks.
15972 @item max-cse-path-length
15974 The maximum number of basic blocks on path that CSE considers.
15976 @item max-cse-insns
15977 The maximum number of instructions CSE processes before flushing.
15979 @item ggc-min-expand
15981 GCC uses a garbage collector to manage its own memory allocation.  This
15982 parameter specifies the minimum percentage by which the garbage
15983 collector's heap should be allowed to expand between collections.
15984 Tuning this may improve compilation speed; it has no effect on code
15985 generation.
15987 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15988 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15989 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15990 GCC is not able to calculate RAM on a particular platform, the lower
15991 bound of 30% is used.  Setting this parameter and
15992 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15993 every opportunity.  This is extremely slow, but can be useful for
15994 debugging.
15996 @item ggc-min-heapsize
15998 Minimum size of the garbage collector's heap before it begins bothering
15999 to collect garbage.  The first collection occurs after the heap expands
16000 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
16001 tuning this may improve compilation speed, and has no effect on code
16002 generation.
16004 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
16005 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
16006 with a lower bound of 4096 (four megabytes) and an upper bound of
16007 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
16008 particular platform, the lower bound is used.  Setting this parameter
16009 very large effectively disables garbage collection.  Setting this
16010 parameter and @option{ggc-min-expand} to zero causes a full collection
16011 to occur at every opportunity.
16013 @item max-reload-search-insns
16014 The maximum number of instruction reload should look backward for equivalent
16015 register.  Increasing values mean more aggressive optimization, making the
16016 compilation time increase with probably slightly better performance.
16018 @item max-cselib-memory-locations
16019 The maximum number of memory locations cselib should take into account.
16020 Increasing values mean more aggressive optimization, making the compilation time
16021 increase with probably slightly better performance.
16023 @item max-sched-ready-insns
16024 The maximum number of instructions ready to be issued the scheduler should
16025 consider at any given time during the first scheduling pass.  Increasing
16026 values mean more thorough searches, making the compilation time increase
16027 with probably little benefit.
16029 @item max-sched-region-blocks
16030 The maximum number of blocks in a region to be considered for
16031 interblock scheduling.
16033 @item max-pipeline-region-blocks
16034 The maximum number of blocks in a region to be considered for
16035 pipelining in the selective scheduler.
16037 @item max-sched-region-insns
16038 The maximum number of insns in a region to be considered for
16039 interblock scheduling.
16041 @item max-pipeline-region-insns
16042 The maximum number of insns in a region to be considered for
16043 pipelining in the selective scheduler.
16045 @item min-spec-prob
16046 The minimum probability (in percents) of reaching a source block
16047 for interblock speculative scheduling.
16049 @item max-sched-extend-regions-iters
16050 The maximum number of iterations through CFG to extend regions.
16051 A value of 0 disables region extensions.
16053 @item max-sched-insn-conflict-delay
16054 The maximum conflict delay for an insn to be considered for speculative motion.
16056 @item sched-spec-prob-cutoff
16057 The minimal probability of speculation success (in percents), so that
16058 speculative insns are scheduled.
16060 @item sched-state-edge-prob-cutoff
16061 The minimum probability an edge must have for the scheduler to save its
16062 state across it.
16064 @item sched-mem-true-dep-cost
16065 Minimal distance (in CPU cycles) between store and load targeting same
16066 memory locations.
16068 @item selsched-max-lookahead
16069 The maximum size of the lookahead window of selective scheduling.  It is a
16070 depth of search for available instructions.
16072 @item selsched-max-sched-times
16073 The maximum number of times that an instruction is scheduled during
16074 selective scheduling.  This is the limit on the number of iterations
16075 through which the instruction may be pipelined.
16077 @item selsched-insns-to-rename
16078 The maximum number of best instructions in the ready list that are considered
16079 for renaming in the selective scheduler.
16081 @item sms-min-sc
16082 The minimum value of stage count that swing modulo scheduler
16083 generates.
16085 @item max-last-value-rtl
16086 The maximum size measured as number of RTLs that can be recorded in an expression
16087 in combiner for a pseudo register as last known value of that register.
16089 @item max-combine-insns
16090 The maximum number of instructions the RTL combiner tries to combine.
16092 @item integer-share-limit
16093 Small integer constants can use a shared data structure, reducing the
16094 compiler's memory usage and increasing its speed.  This sets the maximum
16095 value of a shared integer constant.
16097 @item ssp-buffer-size
16098 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
16099 protection when @option{-fstack-protector} is used.
16101 @item min-size-for-stack-sharing
16102 The minimum size of variables taking part in stack slot sharing when not
16103 optimizing.
16105 @item max-jump-thread-duplication-stmts
16106 Maximum number of statements allowed in a block that needs to be
16107 duplicated when threading jumps.
16109 @item max-jump-thread-paths
16110 The maximum number of paths to consider when searching for jump threading
16111 opportunities.  When arriving at a block, incoming edges are only considered
16112 if the number of paths to be searched so far multiplied by the number of
16113 incoming edges does not exhaust the specified maximum number of paths to
16114 consider.
16116 @item max-fields-for-field-sensitive
16117 Maximum number of fields in a structure treated in
16118 a field sensitive manner during pointer analysis.
16120 @item prefetch-latency
16121 Estimate on average number of instructions that are executed before
16122 prefetch finishes.  The distance prefetched ahead is proportional
16123 to this constant.  Increasing this number may also lead to less
16124 streams being prefetched (see @option{simultaneous-prefetches}).
16126 @item simultaneous-prefetches
16127 Maximum number of prefetches that can run at the same time.
16129 @item l1-cache-line-size
16130 The size of cache line in L1 data cache, in bytes.
16132 @item l1-cache-size
16133 The size of L1 data cache, in kilobytes.
16135 @item l2-cache-size
16136 The size of L2 data cache, in kilobytes.
16138 @item prefetch-dynamic-strides
16139 Whether the loop array prefetch pass should issue software prefetch hints
16140 for strides that are non-constant.  In some cases this may be
16141 beneficial, though the fact the stride is non-constant may make it
16142 hard to predict when there is clear benefit to issuing these hints.
16144 Set to 1 if the prefetch hints should be issued for non-constant
16145 strides.  Set to 0 if prefetch hints should be issued only for strides that
16146 are known to be constant and below @option{prefetch-minimum-stride}.
16148 @item prefetch-minimum-stride
16149 Minimum constant stride, in bytes, to start using prefetch hints for.  If
16150 the stride is less than this threshold, prefetch hints will not be issued.
16152 This setting is useful for processors that have hardware prefetchers, in
16153 which case there may be conflicts between the hardware prefetchers and
16154 the software prefetchers.  If the hardware prefetchers have a maximum
16155 stride they can handle, it should be used here to improve the use of
16156 software prefetchers.
16158 A value of -1 means we don't have a threshold and therefore
16159 prefetch hints can be issued for any constant stride.
16161 This setting is only useful for strides that are known and constant.
16163 @item destructive-interference-size
16164 @item constructive-interference-size
16165 The values for the C++17 variables
16166 @code{std::hardware_destructive_interference_size} and
16167 @code{std::hardware_constructive_interference_size}.  The destructive
16168 interference size is the minimum recommended offset between two
16169 independent concurrently-accessed objects; the constructive
16170 interference size is the maximum recommended size of contiguous memory
16171 accessed together.  Typically both will be the size of an L1 cache
16172 line for the target, in bytes.  For a generic target covering a range of L1
16173 cache line sizes, typically the constructive interference size will be
16174 the small end of the range and the destructive size will be the large
16175 end.
16177 The destructive interference size is intended to be used for layout,
16178 and thus has ABI impact.  The default value is not expected to be
16179 stable, and on some targets varies with @option{-mtune}, so use of
16180 this variable in a context where ABI stability is important, such as
16181 the public interface of a library, is strongly discouraged; if it is
16182 used in that context, users can stabilize the value using this
16183 option.
16185 The constructive interference size is less sensitive, as it is
16186 typically only used in a @samp{static_assert} to make sure that a type
16187 fits within a cache line.
16189 See also @option{-Winterference-size}.
16191 @item loop-interchange-max-num-stmts
16192 The maximum number of stmts in a loop to be interchanged.
16194 @item loop-interchange-stride-ratio
16195 The minimum ratio between stride of two loops for interchange to be profitable.
16197 @item min-insn-to-prefetch-ratio
16198 The minimum ratio between the number of instructions and the
16199 number of prefetches to enable prefetching in a loop.
16201 @item prefetch-min-insn-to-mem-ratio
16202 The minimum ratio between the number of instructions and the
16203 number of memory references to enable prefetching in a loop.
16205 @item use-canonical-types
16206 Whether the compiler should use the ``canonical'' type system.
16207 Should always be 1, which uses a more efficient internal
16208 mechanism for comparing types in C++ and Objective-C++.  However, if
16209 bugs in the canonical type system are causing compilation failures,
16210 set this value to 0 to disable canonical types.
16212 @item switch-conversion-max-branch-ratio
16213 Switch initialization conversion refuses to create arrays that are
16214 bigger than @option{switch-conversion-max-branch-ratio} times the number of
16215 branches in the switch.
16217 @item max-partial-antic-length
16218 Maximum length of the partial antic set computed during the tree
16219 partial redundancy elimination optimization (@option{-ftree-pre}) when
16220 optimizing at @option{-O3} and above.  For some sorts of source code
16221 the enhanced partial redundancy elimination optimization can run away,
16222 consuming all of the memory available on the host machine.  This
16223 parameter sets a limit on the length of the sets that are computed,
16224 which prevents the runaway behavior.  Setting a value of 0 for
16225 this parameter allows an unlimited set length.
16227 @item rpo-vn-max-loop-depth
16228 Maximum loop depth that is value-numbered optimistically.
16229 When the limit hits the innermost
16230 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
16231 loop nest are value-numbered optimistically and the remaining ones not.
16233 @item sccvn-max-alias-queries-per-access
16234 Maximum number of alias-oracle queries we perform when looking for
16235 redundancies for loads and stores.  If this limit is hit the search
16236 is aborted and the load or store is not considered redundant.  The
16237 number of queries is algorithmically limited to the number of
16238 stores on all paths from the load to the function entry.
16240 @item ira-max-loops-num
16241 IRA uses regional register allocation by default.  If a function
16242 contains more loops than the number given by this parameter, only at most
16243 the given number of the most frequently-executed loops form regions
16244 for regional register allocation.
16246 @item ira-max-conflict-table-size 
16247 Although IRA uses a sophisticated algorithm to compress the conflict
16248 table, the table can still require excessive amounts of memory for
16249 huge functions.  If the conflict table for a function could be more
16250 than the size in MB given by this parameter, the register allocator
16251 instead uses a faster, simpler, and lower-quality
16252 algorithm that does not require building a pseudo-register conflict table.  
16254 @item ira-loop-reserved-regs
16255 IRA can be used to evaluate more accurate register pressure in loops
16256 for decisions to move loop invariants (see @option{-O3}).  The number
16257 of available registers reserved for some other purposes is given
16258 by this parameter.  Default of the parameter
16259 is the best found from numerous experiments.
16261 @item ira-consider-dup-in-all-alts
16262 Make IRA to consider matching constraint (duplicated operand number)
16263 heavily in all available alternatives for preferred register class.
16264 If it is set as zero, it means IRA only respects the matching
16265 constraint when it's in the only available alternative with an
16266 appropriate register class.  Otherwise, it means IRA will check all
16267 available alternatives for preferred register class even if it has
16268 found some choice with an appropriate register class and respect the
16269 found qualified matching constraint.
16271 @item ira-simple-lra-insn-threshold
16272 Approximate function insn number in 1K units triggering simple local RA.
16274 @item lra-inheritance-ebb-probability-cutoff
16275 LRA tries to reuse values reloaded in registers in subsequent insns.
16276 This optimization is called inheritance.  EBB is used as a region to
16277 do this optimization.  The parameter defines a minimal fall-through
16278 edge probability in percentage used to add BB to inheritance EBB in
16279 LRA.  The default value was chosen
16280 from numerous runs of SPEC2000 on x86-64.
16282 @item loop-invariant-max-bbs-in-loop
16283 Loop invariant motion can be very expensive, both in compilation time and
16284 in amount of needed compile-time memory, with very large loops.  Loops
16285 with more basic blocks than this parameter won't have loop invariant
16286 motion optimization performed on them.
16288 @item loop-max-datarefs-for-datadeps
16289 Building data dependencies is expensive for very large loops.  This
16290 parameter limits the number of data references in loops that are
16291 considered for data dependence analysis.  These large loops are no
16292 handled by the optimizations using loop data dependencies.
16294 @item max-vartrack-size
16295 Sets a maximum number of hash table slots to use during variable
16296 tracking dataflow analysis of any function.  If this limit is exceeded
16297 with variable tracking at assignments enabled, analysis for that
16298 function is retried without it, after removing all debug insns from
16299 the function.  If the limit is exceeded even without debug insns, var
16300 tracking analysis is completely disabled for the function.  Setting
16301 the parameter to zero makes it unlimited.
16303 @item max-vartrack-expr-depth
16304 Sets a maximum number of recursion levels when attempting to map
16305 variable names or debug temporaries to value expressions.  This trades
16306 compilation time for more complete debug information.  If this is set too
16307 low, value expressions that are available and could be represented in
16308 debug information may end up not being used; setting this higher may
16309 enable the compiler to find more complex debug expressions, but compile
16310 time and memory use may grow.
16312 @item max-debug-marker-count
16313 Sets a threshold on the number of debug markers (e.g.@: begin stmt
16314 markers) to avoid complexity explosion at inlining or expanding to RTL.
16315 If a function has more such gimple stmts than the set limit, such stmts
16316 will be dropped from the inlined copy of a function, and from its RTL
16317 expansion.
16319 @item min-nondebug-insn-uid
16320 Use uids starting at this parameter for nondebug insns.  The range below
16321 the parameter is reserved exclusively for debug insns created by
16322 @option{-fvar-tracking-assignments}, but debug insns may get
16323 (non-overlapping) uids above it if the reserved range is exhausted.
16325 @item ipa-sra-deref-prob-threshold
16326 IPA-SRA replaces a pointer which is known not be NULL with one or more
16327 new parameters only when the probability (in percent, relative to
16328 function entry) of it being dereferenced is higher than this parameter.
16330 @item ipa-sra-ptr-growth-factor
16331 IPA-SRA replaces a pointer to an aggregate with one or more new
16332 parameters only when their cumulative size is less or equal to
16333 @option{ipa-sra-ptr-growth-factor} times the size of the original
16334 pointer parameter.
16336 @item ipa-sra-ptrwrap-growth-factor
16337 Additional maximum allowed growth of total size of new parameters
16338 that ipa-sra replaces a pointer to an aggregate with,
16339 if it points to a local variable that the caller only writes to and
16340 passes it as an argument to other functions.
16342 @item ipa-sra-max-replacements
16343 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
16344 consequence, it is also the maximum number of replacements of a formal
16345 parameter.
16347 @item sra-max-scalarization-size-Ospeed
16348 @itemx sra-max-scalarization-size-Osize
16349 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
16350 replace scalar parts of aggregates with uses of independent scalar
16351 variables.  These parameters control the maximum size, in storage units,
16352 of aggregate which is considered for replacement when compiling for
16353 speed
16354 (@option{sra-max-scalarization-size-Ospeed}) or size
16355 (@option{sra-max-scalarization-size-Osize}) respectively.
16357 @item sra-max-propagations
16358 The maximum number of artificial accesses that Scalar Replacement of
16359 Aggregates (SRA) will track, per one local variable, in order to
16360 facilitate copy propagation.
16362 @item tm-max-aggregate-size
16363 When making copies of thread-local variables in a transaction, this
16364 parameter specifies the size in bytes after which variables are
16365 saved with the logging functions as opposed to save/restore code
16366 sequence pairs.  This option only applies when using
16367 @option{-fgnu-tm}.
16369 @item graphite-max-nb-scop-params
16370 To avoid exponential effects in the Graphite loop transforms, the
16371 number of parameters in a Static Control Part (SCoP) is bounded.
16372 A value of zero can be used to lift
16373 the bound.  A variable whose value is unknown at compilation time and
16374 defined outside a SCoP is a parameter of the SCoP.
16376 @item hardcfr-max-blocks
16377 Disable @option{-fharden-control-flow-redundancy} for functions with a
16378 larger number of blocks than the specified value.  Zero removes any
16379 limit.
16381 @item hardcfr-max-inline-blocks
16382 Force @option{-fharden-control-flow-redundancy} to use out-of-line
16383 checking for functions with a larger number of basic blocks than the
16384 specified value.
16386 @item loop-block-tile-size
16387 Loop blocking or strip mining transforms, enabled with
16388 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
16389 loop in the loop nest by a given number of iterations.  The strip
16390 length can be changed using the @option{loop-block-tile-size}
16391 parameter.
16393 @item ipa-jump-function-lookups
16394 Specifies number of statements visited during jump function offset discovery.
16396 @item ipa-cp-value-list-size
16397 IPA-CP attempts to track all possible values and types passed to a function's
16398 parameter in order to propagate them and perform devirtualization.
16399 @option{ipa-cp-value-list-size} is the maximum number of values and types it
16400 stores per one formal parameter of a function.
16402 @item ipa-cp-eval-threshold
16403 IPA-CP calculates its own score of cloning profitability heuristics
16404 and performs those cloning opportunities with scores that exceed
16405 @option{ipa-cp-eval-threshold}.
16407 @item ipa-cp-max-recursive-depth
16408 Maximum depth of recursive cloning for self-recursive function.
16410 @item ipa-cp-min-recursive-probability
16411 Recursive cloning only when the probability of call being executed exceeds
16412 the parameter.
16414 @item ipa-cp-profile-count-base
16415 When using @option{-fprofile-use} option, IPA-CP will consider the measured
16416 execution count of a call graph edge at this percentage position in their
16417 histogram as the basis for its heuristics calculation.
16419 @item ipa-cp-recursive-freq-factor
16420 The number of times interprocedural copy propagation expects recursive
16421 functions to call themselves.
16423 @item ipa-cp-recursion-penalty
16424 Percentage penalty the recursive functions will receive when they
16425 are evaluated for cloning.
16427 @item ipa-cp-single-call-penalty
16428 Percentage penalty functions containing a single call to another
16429 function will receive when they are evaluated for cloning.
16431 @item ipa-max-agg-items
16432 IPA-CP is also capable to propagate a number of scalar values passed
16433 in an aggregate. @option{ipa-max-agg-items} controls the maximum
16434 number of such values per one parameter.
16436 @item ipa-cp-loop-hint-bonus
16437 When IPA-CP determines that a cloning candidate would make the number
16438 of iterations of a loop known, it adds a bonus of
16439 @option{ipa-cp-loop-hint-bonus} to the profitability score of
16440 the candidate.
16442 @item ipa-max-loop-predicates
16443 The maximum number of different predicates IPA will use to describe when
16444 loops in a function have known properties.
16446 @item ipa-max-aa-steps
16447 During its analysis of function bodies, IPA-CP employs alias analysis
16448 in order to track values pointed to by function parameters.  In order
16449 not spend too much time analyzing huge functions, it gives up and
16450 consider all memory clobbered after examining
16451 @option{ipa-max-aa-steps} statements modifying memory.
16453 @item ipa-max-switch-predicate-bounds
16454 Maximal number of boundary endpoints of case ranges of switch statement.
16455 For switch exceeding this limit, IPA-CP will not construct cloning cost
16456 predicate, which is used to estimate cloning benefit, for default case
16457 of the switch statement.
16459 @item ipa-max-param-expr-ops
16460 IPA-CP will analyze conditional statement that references some function
16461 parameter to estimate benefit for cloning upon certain constant value.
16462 But if number of operations in a parameter expression exceeds
16463 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16464 one, and is not handled by IPA analysis.
16466 @item lto-partitions
16467 Specify desired number of partitions produced during WHOPR compilation.
16468 The number of partitions should exceed the number of CPUs used for compilation.
16470 @item lto-min-partition
16471 Size of minimal partition for WHOPR (in estimated instructions).
16472 This prevents expenses of splitting very small programs into too many
16473 partitions.
16475 @item lto-max-partition
16476 Size of max partition for WHOPR (in estimated instructions).
16477 to provide an upper bound for individual size of partition.
16478 Meant to be used only with balanced partitioning.
16480 @item lto-max-streaming-parallelism
16481 Maximal number of parallel processes used for LTO streaming.
16483 @item cxx-max-namespaces-for-diagnostic-help
16484 The maximum number of namespaces to consult for suggestions when C++
16485 name lookup fails for an identifier.
16487 @item sink-frequency-threshold
16488 The maximum relative execution frequency (in percents) of the target block
16489 relative to a statement's original block to allow statement sinking of a
16490 statement.  Larger numbers result in more aggressive statement sinking.
16491 A small positive adjustment is applied for
16492 statements with memory operands as those are even more profitable so sink.
16494 @item max-stores-to-sink
16495 The maximum number of conditional store pairs that can be sunk.  Set to 0
16496 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16497 (@option{-ftree-loop-if-convert}) is disabled.
16499 @item case-values-threshold
16500 The smallest number of different values for which it is best to use a
16501 jump-table instead of a tree of conditional branches.  If the value is
16502 0, use the default for the machine.
16504 @item jump-table-max-growth-ratio-for-size
16505 The maximum code size growth ratio when expanding
16506 into a jump table (in percent).  The parameter is used when
16507 optimizing for size.
16509 @item jump-table-max-growth-ratio-for-speed
16510 The maximum code size growth ratio when expanding
16511 into a jump table (in percent).  The parameter is used when
16512 optimizing for speed.
16514 @item tree-reassoc-width
16515 Set the maximum number of instructions executed in parallel in
16516 reassociated tree. This parameter overrides target dependent
16517 heuristics used by default if has non zero value.
16519 @item sched-pressure-algorithm
16520 Choose between the two available implementations of
16521 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16522 and is the more likely to prevent instructions from being reordered.
16523 Algorithm 2 was designed to be a compromise between the relatively
16524 conservative approach taken by algorithm 1 and the rather aggressive
16525 approach taken by the default scheduler.  It relies more heavily on
16526 having a regular register file and accurate register pressure classes.
16527 See @file{haifa-sched.cc} in the GCC sources for more details.
16529 The default choice depends on the target.
16531 @item max-slsr-cand-scan
16532 Set the maximum number of existing candidates that are considered when
16533 seeking a basis for a new straight-line strength reduction candidate.
16535 @item asan-globals
16536 Enable buffer overflow detection for global objects.  This kind
16537 of protection is enabled by default if you are using
16538 @option{-fsanitize=address} option.
16539 To disable global objects protection use @option{--param asan-globals=0}.
16541 @item asan-stack
16542 Enable buffer overflow detection for stack objects.  This kind of
16543 protection is enabled by default when using @option{-fsanitize=address}.
16544 To disable stack protection use @option{--param asan-stack=0} option.
16546 @item asan-instrument-reads
16547 Enable buffer overflow detection for memory reads.  This kind of
16548 protection is enabled by default when using @option{-fsanitize=address}.
16549 To disable memory reads protection use
16550 @option{--param asan-instrument-reads=0}.
16552 @item asan-instrument-writes
16553 Enable buffer overflow detection for memory writes.  This kind of
16554 protection is enabled by default when using @option{-fsanitize=address}.
16555 To disable memory writes protection use
16556 @option{--param asan-instrument-writes=0} option.
16558 @item asan-memintrin
16559 Enable detection for built-in functions.  This kind of protection
16560 is enabled by default when using @option{-fsanitize=address}.
16561 To disable built-in functions protection use
16562 @option{--param asan-memintrin=0}.
16564 @item asan-use-after-return
16565 Enable detection of use-after-return.  This kind of protection
16566 is enabled by default when using the @option{-fsanitize=address} option.
16567 To disable it use @option{--param asan-use-after-return=0}.
16569 Note: By default the check is disabled at run time.  To enable it,
16570 add @code{detect_stack_use_after_return=1} to the environment variable
16571 @env{ASAN_OPTIONS}.
16573 @item asan-instrumentation-with-call-threshold
16574 If number of memory accesses in function being instrumented
16575 is greater or equal to this number, use callbacks instead of inline checks.
16576 E.g. to disable inline code use
16577 @option{--param asan-instrumentation-with-call-threshold=0}.
16579 @item asan-kernel-mem-intrinsic-prefix
16580 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16581 with @samp{__asan_} or @samp{__hwasan_}
16582 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16583 respectively.
16585 @item hwasan-instrument-stack
16586 Enable hwasan instrumentation of statically sized stack-allocated variables.
16587 This kind of instrumentation is enabled by default when using
16588 @option{-fsanitize=hwaddress} and disabled by default when using
16589 @option{-fsanitize=kernel-hwaddress}.
16590 To disable stack instrumentation use
16591 @option{--param hwasan-instrument-stack=0}, and to enable it use
16592 @option{--param hwasan-instrument-stack=1}.
16594 @item hwasan-random-frame-tag
16595 When using stack instrumentation, decide tags for stack variables using a
16596 deterministic sequence beginning at a random tag for each frame.  With this
16597 parameter unset tags are chosen using the same sequence but beginning from 1.
16598 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16599 for @option{-fsanitize=kernel-hwaddress}.
16600 To disable it use @option{--param hwasan-random-frame-tag=0}.
16602 @item hwasan-instrument-allocas
16603 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16604 This kind of instrumentation is enabled by default when using
16605 @option{-fsanitize=hwaddress} and disabled by default when using
16606 @option{-fsanitize=kernel-hwaddress}.
16607 To disable instrumentation of such variables use
16608 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16609 @option{--param hwasan-instrument-allocas=1}.
16611 @item hwasan-instrument-reads
16612 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16613 default for both @option{-fsanitize=hwaddress} and
16614 @option{-fsanitize=kernel-hwaddress}.
16615 To disable checking memory reads use
16616 @option{--param hwasan-instrument-reads=0}.
16618 @item hwasan-instrument-writes
16619 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16620 default for both @option{-fsanitize=hwaddress} and
16621 @option{-fsanitize=kernel-hwaddress}.
16622 To disable checking memory writes use
16623 @option{--param hwasan-instrument-writes=0}.
16625 @item hwasan-instrument-mem-intrinsics
16626 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16627 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16628 and @option{-fsanitize=kernel-hwaddress}.
16629 To disable instrumentation of builtin functions use
16630 @option{--param hwasan-instrument-mem-intrinsics=0}.
16632 @item use-after-scope-direct-emission-threshold
16633 If the size of a local variable in bytes is smaller or equal to this
16634 number, directly poison (or unpoison) shadow memory instead of using
16635 run-time callbacks.
16637 @item tsan-distinguish-volatile
16638 Emit special instrumentation for accesses to volatiles.
16640 @item tsan-instrument-func-entry-exit
16641 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16643 @item max-fsm-thread-path-insns
16644 Maximum number of instructions to copy when duplicating blocks on a
16645 finite state automaton jump thread path.
16647 @item threader-debug
16648 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16650 @item parloops-chunk-size
16651 Chunk size of omp schedule for loops parallelized by parloops.
16653 @item parloops-schedule
16654 Schedule type of omp schedule for loops parallelized by parloops (static,
16655 dynamic, guided, auto, runtime).
16657 @item parloops-min-per-thread
16658 The minimum number of iterations per thread of an innermost parallelized
16659 loop for which the parallelized variant is preferred over the single threaded
16660 one.  Note that for a parallelized loop nest the
16661 minimum number of iterations of the outermost loop per thread is two.
16663 @item max-ssa-name-query-depth
16664 Maximum depth of recursion when querying properties of SSA names in things
16665 like fold routines.  One level of recursion corresponds to following a
16666 use-def chain.
16668 @item max-speculative-devirt-maydefs
16669 The maximum number of may-defs we analyze when looking for a must-def
16670 specifying the dynamic type of an object that invokes a virtual call
16671 we may be able to devirtualize speculatively.
16673 @item ranger-debug
16674 Specifies the type of debug output to be issued for ranges.
16676 @item unroll-jam-min-percent
16677 The minimum percentage of memory references that must be optimized
16678 away for the unroll-and-jam transformation to be considered profitable.
16680 @item unroll-jam-max-unroll
16681 The maximum number of times the outer loop should be unrolled by
16682 the unroll-and-jam transformation.
16684 @item max-rtl-if-conversion-unpredictable-cost
16685 Maximum permissible cost for the sequence that would be generated
16686 by the RTL if-conversion pass for a branch that is considered unpredictable.
16688 @item max-variable-expansions-in-unroller
16689 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16690 of times that an individual variable will be expanded during loop unrolling.
16692 @item partial-inlining-entry-probability
16693 Maximum probability of the entry BB of split region
16694 (in percent relative to entry BB of the function)
16695 to make partial inlining happen.
16697 @item max-tracked-strlens
16698 Maximum number of strings for which strlen optimization pass will
16699 track string lengths.
16701 @item gcse-after-reload-partial-fraction
16702 The threshold ratio for performing partial redundancy
16703 elimination after reload.
16705 @item gcse-after-reload-critical-fraction
16706 The threshold ratio of critical edges execution count that
16707 permit performing redundancy elimination after reload.
16709 @item max-loop-header-insns
16710 The maximum number of insns in loop header duplicated
16711 by the copy loop headers pass.
16713 @item vect-epilogues-nomask
16714 Enable loop epilogue vectorization using smaller vector size.
16716 @item vect-partial-vector-usage
16717 Controls when the loop vectorizer considers using partial vector loads
16718 and stores as an alternative to falling back to scalar code.  0 stops
16719 the vectorizer from ever using partial vector loads and stores.  1 allows
16720 partial vector loads and stores if vectorization removes the need for the
16721 code to iterate.  2 allows partial vector loads and stores in all loops.
16722 The parameter only has an effect on targets that support partial
16723 vector loads and stores.
16725 @item vect-inner-loop-cost-factor
16726 The maximum factor which the loop vectorizer applies to the cost of statements
16727 in an inner loop relative to the loop being vectorized.  The factor applied
16728 is the maximum of the estimated number of iterations of the inner loop and
16729 this parameter.  The default value of this parameter is 50.
16731 @item vect-induction-float
16732 Enable loop vectorization of floating point inductions.
16734 @item vrp-sparse-threshold
16735 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16737 @item vrp-switch-limit
16738 Maximum number of outgoing edges in a switch before VRP will not process it.
16740 @item vrp-vector-threshold
16741 Maximum number of basic blocks for VRP to use a basic cache vector.
16743 @item avoid-fma-max-bits
16744 Maximum number of bits for which we avoid creating FMAs.
16746 @item fully-pipelined-fma
16747 Whether the target fully pipelines FMA instructions.  If non-zero,
16748 reassociation considers the benefit of parallelizing FMA's multiplication
16749 part and addition part, assuming FMUL and FMA use the same units that can
16750 also do FADD.
16752 @item sms-loop-average-count-threshold
16753 A threshold on the average loop count considered by the swing modulo scheduler.
16755 @item sms-dfa-history
16756 The number of cycles the swing modulo scheduler considers when checking
16757 conflicts using DFA.
16759 @item graphite-allow-codegen-errors
16760 Whether codegen errors should be ICEs when @option{-fchecking}.
16762 @item sms-max-ii-factor
16763 A factor for tuning the upper bound that swing modulo scheduler
16764 uses for scheduling a loop.
16766 @item lra-max-considered-reload-pseudos
16767 The max number of reload pseudos which are considered during
16768 spilling a non-reload pseudo.
16770 @item max-pow-sqrt-depth
16771 Maximum depth of sqrt chains to use when synthesizing exponentiation
16772 by a real constant.
16774 @item max-dse-active-local-stores
16775 Maximum number of active local stores in RTL dead store elimination.
16777 @item asan-instrument-allocas
16778 Enable asan allocas/VLAs protection.
16780 @item max-iterations-computation-cost
16781 Bound on the cost of an expression to compute the number of iterations.
16783 @item max-isl-operations
16784 Maximum number of isl operations, 0 means unlimited.
16786 @item graphite-max-arrays-per-scop
16787 Maximum number of arrays per scop.
16789 @item max-vartrack-reverse-op-size
16790 Max. size of loc list for which reverse ops should be added.
16792 @item fsm-scale-path-stmts
16793 Scale factor to apply to the number of statements in a threading path
16794 crossing a loop backedge when comparing to
16795 @option{--param=max-jump-thread-duplication-stmts}.
16797 @item uninit-control-dep-attempts
16798 Maximum number of nested calls to search for control dependencies
16799 during uninitialized variable analysis.
16801 @item uninit-max-chain-len
16802 Maximum number of predicates anded for each predicate ored in the normalized
16803 predicate chain.
16805 @item uninit-max-num-chains
16806 Maximum number of predicates ored in the normalized predicate chain.
16808 @item sched-autopref-queue-depth
16809 Hardware autoprefetcher scheduler model control flag.
16810 Number of lookahead cycles the model looks into; at '
16811 ' only enable instruction sorting heuristic.
16813 @item loop-versioning-max-inner-insns
16814 The maximum number of instructions that an inner loop can have
16815 before the loop versioning pass considers it too big to copy.
16817 @item loop-versioning-max-outer-insns
16818 The maximum number of instructions that an outer loop can have
16819 before the loop versioning pass considers it too big to copy,
16820 discounting any instructions in inner loops that directly benefit
16821 from versioning.
16823 @item ssa-name-def-chain-limit
16824 The maximum number of SSA_NAME assignments to follow in determining
16825 a property of a variable such as its value.  This limits the number
16826 of iterations or recursive calls GCC performs when optimizing certain
16827 statements or when determining their validity prior to issuing
16828 diagnostics.
16830 @item store-merging-max-size
16831 Maximum size of a single store merging region in bytes.
16833 @item hash-table-verification-limit
16834 The number of elements for which hash table verification is done
16835 for each searched element.
16837 @item max-find-base-term-values
16838 Maximum number of VALUEs handled during a single find_base_term call.
16840 @item analyzer-max-enodes-per-program-point
16841 The maximum number of exploded nodes per program point within
16842 the analyzer, before terminating analysis of that point.
16844 @item analyzer-max-constraints
16845 The maximum number of constraints per state.
16847 @item analyzer-min-snodes-for-call-summary
16848 The minimum number of supernodes within a function for the
16849 analyzer to consider summarizing its effects at call sites.
16851 @item analyzer-max-enodes-for-full-dump
16852 The maximum depth of exploded nodes that should appear in a dot dump
16853 before switching to a less verbose format.
16855 @item analyzer-max-recursion-depth
16856 The maximum number of times a callsite can appear in a call stack
16857 within the analyzer, before terminating analysis of a call that would
16858 recurse deeper.
16860 @item analyzer-max-svalue-depth
16861 The maximum depth of a symbolic value, before approximating
16862 the value as unknown.
16864 @item analyzer-max-infeasible-edges
16865 The maximum number of infeasible edges to reject before declaring
16866 a diagnostic as infeasible.
16868 @item gimple-fe-computed-hot-bb-threshold
16869 The number of executions of a basic block which is considered hot.
16870 The parameter is used only in GIMPLE FE.
16872 @item analyzer-bb-explosion-factor
16873 The maximum number of 'after supernode' exploded nodes within the analyzer
16874 per supernode, before terminating analysis.
16876 @item analyzer-text-art-string-ellipsis-threshold
16877 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16879 @item analyzer-text-art-ideal-canvas-width
16880 The ideal width in characters of text art diagrams generated by the analyzer.
16882 @item analyzer-text-art-string-ellipsis-head-len
16883 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16885 @item analyzer-text-art-string-ellipsis-tail-len
16886 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16888 @item ranger-logical-depth
16889 Maximum depth of logical expression evaluation ranger will look through
16890 when evaluating outgoing edge ranges.
16892 @item ranger-recompute-depth
16893 Maximum depth of instruction chains to consider for recomputation
16894 in the outgoing range calculator.
16896 @item relation-block-limit
16897 Maximum number of relations the oracle will register in a basic block.
16899 @item min-pagesize
16900 Minimum page size for warning purposes.
16902 @item openacc-kernels
16903 Specify mode of OpenACC `kernels' constructs handling.
16904 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16905 constructs are decomposed into parts, a sequence of compute
16906 constructs, each then handled individually.
16907 This is work in progress.
16908 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16909 constructs are handled by the @samp{parloops} pass, en bloc.
16910 This is the current default.
16912 @item openacc-privatization
16913 Control whether the @option{-fopt-info-omp-note} and applicable
16914 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16915 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16916 This is the current default.
16917 With @option{--param=openacc-privatization=noisy}, do diagnose.
16919 @end table
16921 The following choices of @var{name} are available on AArch64 targets:
16923 @table @gcctabopt
16924 @item aarch64-vect-compare-costs
16925 When vectorizing, consider using multiple different approaches and use
16926 the cost model to choose the cheapest one.  This includes:
16928 @itemize
16929 @item
16930 Trying both SVE and Advanced SIMD, when SVE is available.
16932 @item
16933 Trying to use 64-bit Advanced SIMD vectors for the smallest data elements,
16934 rather than using 128-bit vectors for everything.
16936 @item
16937 Trying to use ``unpacked'' SVE vectors for smaller elements.  This includes
16938 storing smaller elements in larger containers and accessing elements with
16939 extending loads and truncating stores.
16940 @end itemize
16942 @item aarch64-float-recp-precision
16943 The number of Newton iterations for calculating the reciprocal for float type.
16944 The precision of division is proportional to this param when division
16945 approximation is enabled.  The default value is 1.
16947 @item aarch64-double-recp-precision
16948 The number of Newton iterations for calculating the reciprocal for double type.
16949 The precision of division is propotional to this param when division
16950 approximation is enabled.  The default value is 2.
16952 @item aarch64-autovec-preference
16953 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16954 0 to 4, inclusive.
16955 @table @samp
16956 @item 0
16957 Use the default heuristics.
16958 @item 1
16959 Use only Advanced SIMD for auto-vectorization.
16960 @item 2
16961 Use only SVE for auto-vectorization.
16962 @item 3
16963 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16964 deemed equal.
16965 @item 4
16966 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16967 @end table
16968 The default value is 0.
16970 @item aarch64-ldp-policy
16971 Fine-grained policy for load pairs.
16972 With @option{--param=aarch64-ldp-policy=default}, use the policy of the
16973 tuning structure.  This is the current default.
16974 With @option{--param=aarch64-ldp-policy=always}, emit ldp regardless
16975 of alignment.
16976 With @option{--param=aarch64-ldp-policy=never}, do not emit ldp.
16977 With @option{--param=aarch64-ldp-policy=aligned}, emit ldp only if the
16978 source pointer is aligned to at least double the alignment of the type.
16980 @item aarch64-stp-policy
16981 Fine-grained policy for store pairs.
16982 With @option{--param=aarch64-stp-policy=default}, use the policy of the
16983 tuning structure.  This is the current default.
16984 With @option{--param=aarch64-stp-policy=always}, emit stp regardless
16985 of alignment.
16986 With @option{--param=aarch64-stp-policy=never}, do not emit stp.
16987 With @option{--param=aarch64-stp-policy=aligned}, emit stp only if the
16988 source pointer is aligned to at least double the alignment of the type.
16990 @item aarch64-ldp-alias-check-limit
16991 Limit on the number of alias checks performed by the AArch64 load/store pair
16992 fusion pass when attempting to form an ldp/stp.  Higher values make the pass
16993 more aggressive at re-ordering loads over stores, at the expense of increased
16994 compile time.
16996 @item aarch64-ldp-writeback
16997 Param to control which writeback opportunities we try to handle in the AArch64
16998 load/store pair fusion pass.  A value of zero disables writeback handling.  One
16999 means we try to form pairs involving one or more existing individual writeback
17000 accesses where possible.  A value of two means we also try to opportunistically
17001 form writeback opportunities by folding in trailing destructive updates of the
17002 base register used by a pair.
17004 @item aarch64-loop-vect-issue-rate-niters
17005 The tuning for some AArch64 CPUs tries to take both latencies and issue
17006 rates into account when deciding whether a loop should be vectorized
17007 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
17008 If this parameter is set to @var{n}, GCC will not use this heuristic
17009 for loops that are known to execute in fewer than @var{n} Advanced
17010 SIMD iterations.
17012 @item aarch64-vect-unroll-limit
17013 The vectorizer will use available tuning information to determine whether it
17014 would be beneficial to unroll the main vectorized loop and by how much.  This
17015 parameter set's the upper bound of how much the vectorizer will unroll the main
17016 loop.  The default value is four.
17018 @end table
17020 The following choices of @var{name} are available on i386 and x86_64 targets:
17022 @table @gcctabopt
17023 @item x86-stlf-window-ninsns
17024 Instructions number above which STFL stall penalty can be compensated.
17026 @item x86-stv-max-visits
17027 The maximum number of use and def visits when discovering a STV chain before
17028 the discovery is aborted.
17030 @end table
17032 @end table
17034 @node Instrumentation Options
17035 @section Program Instrumentation Options
17036 @cindex instrumentation options
17037 @cindex program instrumentation options
17038 @cindex run-time error checking options
17039 @cindex profiling options
17040 @cindex options, program instrumentation
17041 @cindex options, run-time error checking
17042 @cindex options, profiling
17044 GCC supports a number of command-line options that control adding
17045 run-time instrumentation to the code it normally generates.  
17046 For example, one purpose of instrumentation is collect profiling
17047 statistics for use in finding program hot spots, code coverage
17048 analysis, or profile-guided optimizations.
17049 Another class of program instrumentation is adding run-time checking 
17050 to detect programming errors like invalid pointer
17051 dereferences or out-of-bounds array accesses, as well as deliberately
17052 hostile attacks such as stack smashing or C++ vtable hijacking.
17053 There is also a general hook which can be used to implement other
17054 forms of tracing or function-level instrumentation for debug or
17055 program analysis purposes.
17057 @table @gcctabopt
17058 @cindex @command{prof}
17059 @cindex @command{gprof}
17060 @opindex p
17061 @opindex pg
17062 @item -p
17063 @itemx -pg
17064 Generate extra code to write profile information suitable for the
17065 analysis program @command{prof} (for @option{-p}) or @command{gprof}
17066 (for @option{-pg}).  You must use this option when compiling
17067 the source files you want data about, and you must also use it when
17068 linking.
17070 You can use the function attribute @code{no_instrument_function} to
17071 suppress profiling of individual functions when compiling with these options.
17072 @xref{Common Function Attributes}.
17074 @opindex fprofile-arcs
17075 @item -fprofile-arcs
17076 Add code so that program flow @dfn{arcs} are instrumented.  During
17077 execution the program records how many times each branch and call is
17078 executed and how many times it is taken or returns.  On targets that support
17079 constructors with priority support, profiling properly handles constructors,
17080 destructors and C++ constructors (and destructors) of classes which are used
17081 as a type of a global variable.
17083 When the compiled
17084 program exits it saves this data to a file called
17085 @file{@var{auxname}.gcda} for each source file.  The data may be used for
17086 profile-directed optimizations (@option{-fbranch-probabilities}), or for
17087 test coverage analysis (@option{-ftest-coverage}).  Each object file's
17088 @var{auxname} is generated from the name of the output file, if
17089 explicitly specified and it is not the final executable, otherwise it is
17090 the basename of the source file.  In both cases any suffix is removed
17091 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
17092 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
17094 Note that if a command line directly links source files, the corresponding
17095 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
17096 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
17097 @file{binary-b.gcda} files.
17099 @item -fcondition-coverage
17100 @opindex fcondition-coverage
17101 Add code so that program conditions are instrumented.  During execution the
17102 program records what terms in a conditional contributes to a decision, which
17103 can be used to verify that all terms in a Boolean function are tested and have
17104 an independent effect on the outcome of a decision.  The result can be read
17105 with @code{gcov --conditions}.
17107 @xref{Cross-profiling}.
17109 @cindex @command{gcov}
17110 @opindex coverage
17111 @item --coverage
17113 This option is used to compile and link code instrumented for coverage
17114 analysis.  The option is a synonym for @option{-fprofile-arcs}
17115 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
17116 linking).  See the documentation for those options for more details.
17118 @itemize
17120 @item
17121 Compile the source files with @option{-fprofile-arcs} plus optimization
17122 and code generation options.  For test coverage analysis, use the
17123 additional @option{-ftest-coverage} option.  You do not need to profile
17124 every source file in a program.
17126 @item
17127 Compile the source files additionally with @option{-fprofile-abs-path}
17128 to create absolute path names in the @file{.gcno} files.  This allows
17129 @command{gcov} to find the correct sources in projects where compilations
17130 occur with different working directories.
17132 @item
17133 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
17134 (the latter implies the former).
17136 @item
17137 Run the program on a representative workload to generate the arc profile
17138 information.  This may be repeated any number of times.  You can run
17139 concurrent instances of your program, and provided that the file system
17140 supports locking, the data files will be correctly updated.  Unless
17141 a strict ISO C dialect option is in effect, @code{fork} calls are
17142 detected and correctly handled without double counting.
17144 Moreover, an object file can be recompiled multiple times
17145 and the corresponding @file{.gcda} file merges as long as
17146 the source file and the compiler options are unchanged.
17148 @item
17149 For profile-directed optimizations, compile the source files again with
17150 the same optimization and code generation options plus
17151 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
17152 Control Optimization}).
17154 @item
17155 For test coverage analysis, use @command{gcov} to produce human readable
17156 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
17157 @command{gcov} documentation for further information.
17159 @end itemize
17161 With @option{-fprofile-arcs}, for each function of your program GCC
17162 creates a program flow graph, then finds a spanning tree for the graph.
17163 Only arcs that are not on the spanning tree have to be instrumented: the
17164 compiler adds code to count the number of times that these arcs are
17165 executed.  When an arc is the only exit or only entrance to a block, the
17166 instrumentation code can be added to the block; otherwise, a new basic
17167 block must be created to hold the instrumentation code.
17169 With @option{-fcondition-coverage}, for each conditional in your program GCC
17170 creates a bitset and records the exercised boolean values that have an
17171 independent effect on the outcome of that expression.
17173 @need 2000
17174 @opindex ftest-coverage
17175 @item -ftest-coverage
17176 Produce a notes file that the @command{gcov} code-coverage utility
17177 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
17178 show program coverage.  Each source file's note file is called
17179 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
17180 above for a description of @var{auxname} and instructions on how to
17181 generate test coverage data.  Coverage data matches the source files
17182 more closely if you do not optimize.
17184 @opindex fprofile-abs-path
17185 @item -fprofile-abs-path
17186 Automatically convert relative source file names to absolute path names
17187 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
17188 sources in projects where compilations occur with different working
17189 directories.
17191 @opindex fprofile-dir
17192 @item -fprofile-dir=@var{path}
17194 Set the directory to search for the profile data files in to @var{path}.
17195 This option affects only the profile data generated by
17196 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
17197 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
17198 and its related options.  Both absolute and relative paths can be used.
17199 By default, GCC uses the current directory as @var{path}, thus the
17200 profile data file appears in the same directory as the object file.
17201 In order to prevent the file name clashing, if the object file name is
17202 not an absolute path, we mangle the absolute path of the
17203 @file{@var{sourcename}.gcda} file and use it as the file name of a
17204 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
17205 See similar option @option{-fprofile-note}.
17207 When an executable is run in a massive parallel environment, it is recommended
17208 to save profile to different folders.  That can be done with variables
17209 in @var{path} that are exported during run-time:
17211 @table @gcctabopt
17213 @item %p
17214 process ID.
17216 @item %q@{VAR@}
17217 value of environment variable @var{VAR}
17219 @end table
17221 @opindex fprofile-generate
17222 @item -fprofile-generate
17223 @itemx -fprofile-generate=@var{path}
17225 Enable options usually used for instrumenting application to produce
17226 profile useful for later recompilation with profile feedback based
17227 optimization.  You must use @option{-fprofile-generate} both when
17228 compiling and when linking your program.
17230 The following options are enabled:
17231 @option{-fprofile-arcs}, @option{-fprofile-values},
17232 @option{-finline-functions}, and @option{-fipa-bit-cp}.
17234 If @var{path} is specified, GCC looks at the @var{path} to find
17235 the profile feedback data files. See @option{-fprofile-dir}.
17237 To optimize the program based on the collected profile information, use
17238 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
17240 @opindex fprofile-info-section
17241 @item -fprofile-info-section
17242 @itemx -fprofile-info-section=@var{name}
17244 Register the profile information in the specified section instead of using a
17245 constructor/destructor.  The section name is @var{name} if it is specified,
17246 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
17247 profile information generated by @option{-fprofile-arcs} is placed in the
17248 specified section for each translation unit.  This option disables the profile
17249 information registration through a constructor and it disables the profile
17250 information processing through a destructor.  This option is not intended to be
17251 used in hosted environments such as GNU/Linux.  It targets freestanding
17252 environments (for example embedded systems) with limited resources which do not
17253 support constructors/destructors or the C library file I/O.
17255 The linker could collect the input sections in a continuous memory block and
17256 define start and end symbols.  A GNU linker script example which defines a
17257 linker output section follows:
17259 @smallexample
17260   .gcov_info      :
17261   @{
17262     PROVIDE (__gcov_info_start = .);
17263     KEEP (*(.gcov_info))
17264     PROVIDE (__gcov_info_end = .);
17265   @}
17266 @end smallexample
17268 The program could dump the profiling information registered in this linker set
17269 for example like this:
17271 @smallexample
17272 #include <gcov.h>
17273 #include <stdio.h>
17274 #include <stdlib.h>
17276 extern const struct gcov_info *const __gcov_info_start[];
17277 extern const struct gcov_info *const __gcov_info_end[];
17279 static void
17280 dump (const void *d, unsigned n, void *arg)
17282   const unsigned char *c = d;
17284   for (unsigned i = 0; i < n; ++i)
17285     printf ("%02x", c[i]);
17288 static void
17289 filename (const char *f, void *arg)
17291   __gcov_filename_to_gcfn (f, dump, arg );
17294 static void *
17295 allocate (unsigned length, void *arg)
17297   return malloc (length);
17300 static void
17301 dump_gcov_info (void)
17303   const struct gcov_info *const *info = __gcov_info_start;
17304   const struct gcov_info *const *end = __gcov_info_end;
17306   /* Obfuscate variable to prevent compiler optimizations.  */
17307   __asm__ ("" : "+r" (info));
17309   while (info != end)
17310   @{
17311     void *arg = NULL;
17312     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
17313     putchar ('\n');
17314     ++info;
17315   @}
17319 main (void)
17321   dump_gcov_info ();
17322   return 0;
17324 @end smallexample
17326 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
17327 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
17328 @code{__gcov_info_to_gcda} functions and merge the profile information into
17329 @file{.gcda} files on the host filesystem.
17331 @opindex fprofile-note
17332 @item -fprofile-note=@var{path}
17334 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
17335 location.  If you combine the option with multiple source files,
17336 the @file{.gcno} file will be overwritten.
17338 @opindex fprofile-prefix-path
17339 @item -fprofile-prefix-path=@var{path}
17341 This option can be used in combination with
17342 @option{profile-generate=}@var{profile_dir} and
17343 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
17344 directory of built source tree.  By default @var{profile_dir} will contain
17345 files with mangled absolute paths of all object files in the built project.
17346 This is not desirable when directory used to build the instrumented binary
17347 differs from the directory used to build the binary optimized with profile
17348 feedback because the profile data will not be found during the optimized build.
17349 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
17350 pointing to the base directory of the build can be used to strip the irrelevant
17351 part of the path and keep all file names relative to the main build directory.
17353 @opindex fprofile-prefix-map
17354 @item -fprofile-prefix-map=@var{old}=@var{new}
17355 When compiling files residing in directory @file{@var{old}}, record
17356 profiling information (with @option{--coverage})
17357 describing them as if the files resided in
17358 directory @file{@var{new}} instead.
17359 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
17361 @opindex fprofile-update
17362 @item -fprofile-update=@var{method}
17364 Alter the update method for an application instrumented for profile
17365 feedback based optimization.  The @var{method} argument should be one of
17366 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
17367 The first one is useful for single-threaded applications,
17368 while the second one prevents profile corruption by emitting thread-safe code.
17370 @strong{Warning:} When an application does not properly join all threads
17371 (or creates an detached thread), a profile file can be still corrupted.
17373 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
17374 when supported by a target, or to @samp{single} otherwise.  The GCC driver
17375 automatically selects @samp{prefer-atomic} when @option{-pthread}
17376 is present in the command line, otherwise the default method is @samp{single}.
17378 If @samp{atomic} is selected, then the profile information is updated using
17379 atomic operations on a best-effort basis.  Ideally, the profile information is
17380 updated through atomic operations in hardware.  If the target platform does not
17381 support the required atomic operations in hardware, however, @file{libatomic}
17382 is available, then the profile information is updated through calls to
17383 @file{libatomic}.  If the target platform neither supports the required atomic
17384 operations in hardware nor @file{libatomic}, then the profile information is
17385 not atomically updated and a warning is issued.  In this case, the obtained
17386 profiling information may be corrupt for multi-threaded applications.
17388 For performance reasons, if 64-bit counters are used for the profiling
17389 information and the target platform only supports 32-bit atomic operations in
17390 hardware, then the performance critical profiling updates are done using two
17391 32-bit atomic operations for each counter update.  If a signal interrupts these
17392 two operations updating a counter, then the profiling information may be in an
17393 inconsistent state.
17395 @opindex fprofile-filter-files
17396 @item -fprofile-filter-files=@var{regex}
17398 Instrument only functions from files whose name matches
17399 any of the regular expressions (separated by semi-colons).
17401 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
17402 only @file{main.c} and all C files starting with 'module'.
17404 @opindex fprofile-exclude-files
17405 @item -fprofile-exclude-files=@var{regex}
17407 Instrument only functions from files whose name does not match
17408 any of the regular expressions (separated by semi-colons).
17410 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
17411 of all files that are located in the @file{/usr/} folder.
17413 @opindex fprofile-reproducible
17414 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
17415 Control level of reproducibility of profile gathered by
17416 @code{-fprofile-generate}.  This makes it possible to rebuild program
17417 with same outcome which is useful, for example, for distribution
17418 packages.
17420 With @option{-fprofile-reproducible=serial} the profile gathered by
17421 @option{-fprofile-generate} is reproducible provided the trained program
17422 behaves the same at each invocation of the train run, it is not
17423 multi-threaded and profile data streaming is always done in the same
17424 order.  Note that profile streaming happens at the end of program run but
17425 also before @code{fork} function is invoked.
17427 Note that it is quite common that execution counts of some part of
17428 programs depends, for example, on length of temporary file names or
17429 memory space randomization (that may affect hash-table collision rate).
17430 Such non-reproducible part of programs may be annotated by
17431 @code{no_instrument_function} function attribute. @command{gcov-dump} with
17432 @option{-l} can be used to dump gathered data and verify that they are
17433 indeed reproducible.
17435 With @option{-fprofile-reproducible=parallel-runs} collected profile
17436 stays reproducible regardless the order of streaming of the data into
17437 gcda files.  This setting makes it possible to run multiple instances of
17438 instrumented program in parallel (such as with @code{make -j}). This
17439 reduces quality of gathered data, in particular of indirect call
17440 profiling.
17442 @opindex fsanitize=address
17443 @item -fsanitize=address
17444 Enable AddressSanitizer, a fast memory error detector.
17445 Memory access instructions are instrumented to detect
17446 out-of-bounds and use-after-free bugs.
17447 The option enables @option{-fsanitize-address-use-after-scope}.
17448 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
17449 more details.  The run-time behavior can be influenced using the
17450 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
17451 the available options are shown at startup of the instrumented program.  See
17452 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
17453 for a list of supported options.
17454 The option cannot be combined with @option{-fsanitize=thread} or
17455 @option{-fsanitize=hwaddress}.  Note that the only target
17456 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
17458 To get more accurate stack traces, it is possible to use options such as
17459 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
17460 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
17461 optimizing sibling and tail recursive calls; this option is implicit for
17462 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
17463 disables Identical Code Folding for functions).  Since multiple runs of the
17464 program may yield backtraces with different addresses due to ASLR (Address
17465 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
17466 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
17468 @opindex fsanitize=kernel-address
17469 @item -fsanitize=kernel-address
17470 Enable AddressSanitizer for Linux kernel.
17471 See @uref{https://github.com/google/kernel-sanitizers} for more details.
17473 @opindex fsanitize=hwaddress
17474 @item -fsanitize=hwaddress
17475 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
17476 ignore the top byte of a pointer to allow the detection of memory errors with
17477 a low memory overhead.
17478 Memory access instructions are instrumented to detect out-of-bounds and
17479 use-after-free bugs.
17480 The option enables @option{-fsanitize-address-use-after-scope}.
17482 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
17483 for more details.  The run-time behavior can be influenced using the
17484 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
17485 the available options are shown at startup of the instrumented program.
17486 The option cannot be combined with @option{-fsanitize=thread} or
17487 @option{-fsanitize=address}, and is currently only available on AArch64.
17489 @opindex fsanitize=kernel-hwaddress
17490 @item -fsanitize=kernel-hwaddress
17491 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
17492 Similar to @option{-fsanitize=kernel-address} but using an alternate
17493 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
17494 instrumentation differences necessary for compiling the Linux kernel.
17495 These differences are to avoid hwasan library initialization calls and to
17496 account for the stack pointer having a different value in its top byte.
17498 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
17499 Instrumenting the stack and alloca calls are not on by default but are still
17500 possible by specifying the command-line options
17501 @option{--param hwasan-instrument-stack=1} and
17502 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
17503 tag is not implemented for kernel instrumentation.
17505 @opindex fsanitize=pointer-compare
17506 @item -fsanitize=pointer-compare
17507 Instrument comparison operation (<, <=, >, >=) with pointer operands.
17508 The option must be combined with either @option{-fsanitize=kernel-address} or
17509 @option{-fsanitize=address}
17510 The option cannot be combined with @option{-fsanitize=thread}.
17511 Note: By default the check is disabled at run time.  To enable it,
17512 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17513 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17514 invalid operation only when both pointers are non-null.
17516 @opindex fsanitize=pointer-subtract
17517 @item -fsanitize=pointer-subtract
17518 Instrument subtraction with pointer operands.
17519 The option must be combined with either @option{-fsanitize=kernel-address} or
17520 @option{-fsanitize=address}
17521 The option cannot be combined with @option{-fsanitize=thread}.
17522 Note: By default the check is disabled at run time.  To enable it,
17523 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17524 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17525 invalid operation only when both pointers are non-null.
17527 @opindex fsanitize=shadow-call-stack
17528 @item -fsanitize=shadow-call-stack
17529 Enable ShadowCallStack, a security enhancement mechanism used to protect
17530 programs against return address overwrites (e.g. stack buffer overflows.)
17531 It works by saving a function's return address to a separately allocated
17532 shadow call stack in the function prologue and restoring the return address
17533 from the shadow call stack in the function epilogue.  Instrumentation only
17534 occurs in functions that need to save the return address to the stack.
17536 Currently it only supports the aarch64 platform.  It is specifically
17537 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17538 For the user space programs, runtime support is not currently provided
17539 in libc and libgcc.  Users who want to use this feature in user space need
17540 to provide their own support for the runtime.  It should be noted that
17541 this may cause the ABI rules to be broken.
17543 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17544 This generally means that any code that may run on the same thread as code
17545 compiled with ShadowCallStack must be compiled with the flag
17546 @option{-ffixed-x18}, otherwise functions compiled without
17547 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17548 stack pointer.
17550 Also, because there is no userspace runtime support, code compiled with
17551 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17552 to turn off exceptions.
17554 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17555 details.
17557 @opindex fsanitize=thread
17558 @item -fsanitize=thread
17559 Enable ThreadSanitizer, a fast data race detector.
17560 Memory access instructions are instrumented to detect
17561 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17562 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17563 environment variable; see
17564 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17565 supported options.
17566 The option cannot be combined with @option{-fsanitize=address},
17567 @option{-fsanitize=leak}.
17569 Note that sanitized atomic builtins cannot throw exceptions when
17570 operating on invalid memory addresses with non-call exceptions
17571 (@option{-fnon-call-exceptions}).
17573 @opindex fsanitize=leak
17574 @item -fsanitize=leak
17575 Enable LeakSanitizer, a memory leak detector.
17576 This option only matters for linking of executables.
17577 The executable is linked against a library that overrides @code{malloc}
17578 and other allocator functions.  See
17579 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17580 details.  The run-time behavior can be influenced using the
17581 @env{LSAN_OPTIONS} environment variable.
17582 The option cannot be combined with @option{-fsanitize=thread}.
17584 @opindex fsanitize=undefined
17585 @item -fsanitize=undefined
17586 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17587 Various computations are instrumented to detect undefined behavior
17588 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17589 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17591 @table @gcctabopt
17593 @opindex fsanitize=shift
17594 @item -fsanitize=shift
17595 This option enables checking that the result of a shift operation is
17596 not undefined.  Note that what exactly is considered undefined differs
17597 slightly between C and C++, as well as between ISO C90 and C99, etc.
17598 This option has two suboptions, @option{-fsanitize=shift-base} and
17599 @option{-fsanitize=shift-exponent}.
17601 @opindex fsanitize=shift-exponent
17602 @item -fsanitize=shift-exponent
17603 This option enables checking that the second argument of a shift operation
17604 is not negative and is smaller than the precision of the promoted first
17605 argument.
17607 @opindex fsanitize=shift-base
17608 @item -fsanitize=shift-base
17609 If the second argument of a shift operation is within range, check that the
17610 result of a shift operation is not undefined.  Note that what exactly is
17611 considered undefined differs slightly between C and C++, as well as between
17612 ISO C90 and C99, etc.
17614 @opindex fsanitize=integer-divide-by-zero
17615 @item -fsanitize=integer-divide-by-zero
17616 Detect integer division by zero.
17618 @opindex fsanitize=unreachable
17619 @item -fsanitize=unreachable
17620 With this option, the compiler turns the @code{__builtin_unreachable}
17621 call into a diagnostics message call instead.  When reaching the
17622 @code{__builtin_unreachable} call, the behavior is undefined.
17624 @opindex fsanitize=vla-bound
17625 @item -fsanitize=vla-bound
17626 This option instructs the compiler to check that the size of a variable
17627 length array is positive.
17629 @opindex fsanitize=null
17630 @item -fsanitize=null
17631 This option enables pointer checking.  Particularly, the application
17632 built with this option turned on will issue an error message when it
17633 tries to dereference a NULL pointer, or if a reference (possibly an
17634 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17635 on an object pointed by a NULL pointer.
17637 @opindex fsanitize=return
17638 @item -fsanitize=return
17639 This option enables return statement checking.  Programs
17640 built with this option turned on will issue an error message
17641 when the end of a non-void function is reached without actually
17642 returning a value.  This option works in C++ only.
17644 @opindex fsanitize=signed-integer-overflow
17645 @item -fsanitize=signed-integer-overflow
17646 This option enables signed integer overflow checking.  We check that
17647 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17648 does not overflow in the signed arithmetics.  This also detects
17649 @code{INT_MIN / -1} signed division.  Note, integer promotion
17650 rules must be taken into account.  That is, the following is not an
17651 overflow:
17652 @smallexample
17653 signed char a = SCHAR_MAX;
17654 a++;
17655 @end smallexample
17657 @opindex fsanitize=bounds
17658 @item -fsanitize=bounds
17659 This option enables instrumentation of array bounds.  Various out of bounds
17660 accesses are detected.  Flexible array members, flexible array member-like
17661 arrays, and initializers of variables with static storage are not
17662 instrumented, with the exception of flexible array member-like arrays
17663 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17664 options or @code{strict_flex_array} attributes say they shouldn't be treated
17665 like flexible array member-like arrays.
17667 @opindex fsanitize=bounds-strict
17668 @item -fsanitize=bounds-strict
17669 This option enables strict instrumentation of array bounds.  Most out of bounds
17670 accesses are detected, including flexible array member-like arrays.
17671 Initializers of variables with static storage are not instrumented.
17673 @opindex fsanitize=alignment
17674 @item -fsanitize=alignment
17676 This option enables checking of alignment of pointers when they are
17677 dereferenced, or when a reference is bound to insufficiently aligned target,
17678 or when a method or constructor is invoked on insufficiently aligned object.
17680 @opindex fsanitize=object-size
17681 @item -fsanitize=object-size
17682 This option enables instrumentation of memory references using the
17683 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17684 pointer accesses are detected.
17686 @opindex fsanitize=float-divide-by-zero
17687 @item -fsanitize=float-divide-by-zero
17688 Detect floating-point division by zero.  Unlike other similar options,
17689 @option{-fsanitize=float-divide-by-zero} is not enabled by
17690 @option{-fsanitize=undefined}, since floating-point division by zero can
17691 be a legitimate way of obtaining infinities and NaNs.
17693 @opindex fsanitize=float-cast-overflow
17694 @item -fsanitize=float-cast-overflow
17695 This option enables floating-point type to integer conversion checking.
17696 We check that the result of the conversion does not overflow.
17697 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17698 not enabled by @option{-fsanitize=undefined}.
17699 This option does not work well with @code{FE_INVALID} exceptions enabled.
17701 @opindex fsanitize=nonnull-attribute
17702 @item -fsanitize=nonnull-attribute
17704 This option enables instrumentation of calls, checking whether null values
17705 are not passed to arguments marked as requiring a non-null value by the
17706 @code{nonnull} function attribute.
17708 @opindex fsanitize=returns-nonnull-attribute
17709 @item -fsanitize=returns-nonnull-attribute
17711 This option enables instrumentation of return statements in functions
17712 marked with @code{returns_nonnull} function attribute, to detect returning
17713 of null values from such functions.
17715 @opindex fsanitize=bool
17716 @item -fsanitize=bool
17718 This option enables instrumentation of loads from bool.  If a value other
17719 than 0/1 is loaded, a run-time error is issued.
17721 @opindex fsanitize=enum
17722 @item -fsanitize=enum
17724 This option enables instrumentation of loads from an enum type.  If
17725 a value outside the range of values for the enum type is loaded,
17726 a run-time error is issued.
17728 @opindex fsanitize=vptr
17729 @item -fsanitize=vptr
17731 This option enables instrumentation of C++ member function calls, member
17732 accesses and some conversions between pointers to base and derived classes,
17733 to verify the referenced object has the correct dynamic type.
17735 @opindex fsanitize=pointer-overflow
17736 @item -fsanitize=pointer-overflow
17738 This option enables instrumentation of pointer arithmetics.  If the pointer
17739 arithmetics overflows, a run-time error is issued.
17741 @opindex fsanitize=builtin
17742 @item -fsanitize=builtin
17744 This option enables instrumentation of arguments to selected builtin
17745 functions.  If an invalid value is passed to such arguments, a run-time
17746 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17747 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17748 by this option.
17750 @end table
17752 Note that sanitizers tend to increase the rate of false positive
17753 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17754 We recommend against combining @option{-Werror} and [the use of]
17755 sanitizers.
17757 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17758 @option{-fsanitize=undefined} gives a diagnostic message.
17759 This currently works only for the C family of languages.
17761 @opindex fno-sanitize=all
17762 @item -fno-sanitize=all
17764 This option disables all previously enabled sanitizers.
17765 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17766 together.
17768 @opindex fasan-shadow-offset
17769 @item -fasan-shadow-offset=@var{number}
17770 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17771 It is useful for experimenting with different shadow memory layouts in
17772 Kernel AddressSanitizer.
17774 @opindex fsanitize-sections
17775 @item -fsanitize-sections=@var{s1},@var{s2},...
17776 Sanitize global variables in selected user-defined sections.  @var{si} may
17777 contain wildcards.
17779 @opindex fsanitize-recover
17780 @opindex fno-sanitize-recover
17781 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17782 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17783 mentioned in comma-separated list of @var{opts}.  Enabling this option
17784 for a sanitizer component causes it to attempt to continue
17785 running the program as if no error happened.  This means multiple
17786 runtime errors can be reported in a single program run, and the exit
17787 code of the program may indicate success even when errors
17788 have been reported.  The @option{-fno-sanitize-recover=} option
17789 can be used to alter
17790 this behavior: only the first detected error is reported
17791 and program then exits with a non-zero exit code.
17793 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17794 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17795 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17796 @option{-fsanitize=bounds-strict},
17797 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17798 For these sanitizers error recovery is turned on by default,
17799 except @option{-fsanitize=address}, for which this feature is experimental.
17800 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17801 accepted, the former enables recovery for all sanitizers that support it,
17802 the latter disables recovery for all sanitizers that support it.
17804 Even if a recovery mode is turned on the compiler side, it needs to be also
17805 enabled on the runtime library side, otherwise the failures are still fatal.
17806 The runtime library defaults to @code{halt_on_error=0} for
17807 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17808 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17809 setting the @code{halt_on_error} flag in the corresponding environment variable.
17811 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17812 equivalent to specifying an @var{opts} list of:
17814 @smallexample
17815 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17816 @end smallexample
17818 @opindex fsanitize-address-use-after-scope
17819 @item -fsanitize-address-use-after-scope
17820 Enable sanitization of local variables to detect use-after-scope bugs.
17821 The option sets @option{-fstack-reuse} to @samp{none}.
17823 @opindex fsanitize-trap
17824 @opindex fno-sanitize-trap
17825 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17826 The @option{-fsanitize-trap=} option instructs the compiler to
17827 report for sanitizers mentioned in comma-separated list of @var{opts}
17828 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17829 library routine.  If this option is enabled for certain sanitizer,
17830 it takes precedence over the @option{-fsanitizer-recover=} for that
17831 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17832 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17834 The advantage of this is that the @code{libubsan} library is not needed
17835 and is not linked in, so this is usable even in freestanding environments.
17837 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17838 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17839 @option{-fsanitize=float-divide-by-zero} and
17840 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17841 specified, which enables it for @code{undefined} suboptions,
17842 @option{-fsanitize=float-cast-overflow},
17843 @option{-fsanitize=float-divide-by-zero} and
17844 @option{-fsanitize=bounds-strict}.
17845 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17846 and @code{-fsanitize=vptr} is enabled on the command line, the
17847 instrumentation is silently ignored as the instrumentation always needs
17848 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17850 @opindex fsanitize-undefined-trap-on-error
17851 @item -fsanitize-undefined-trap-on-error
17852 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17853 equivalent of @option{-fsanitize-trap=all}.
17855 @opindex fsanitize-coverage=trace-pc
17856 @item -fsanitize-coverage=trace-pc
17857 Enable coverage-guided fuzzing code instrumentation.
17858 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17860 @opindex fsanitize-coverage=trace-cmp
17861 @item -fsanitize-coverage=trace-cmp
17862 Enable dataflow guided fuzzing code instrumentation.
17863 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17864 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17865 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17866 variable or @code{__sanitizer_cov_trace_const_cmp1},
17867 @code{__sanitizer_cov_trace_const_cmp2},
17868 @code{__sanitizer_cov_trace_const_cmp4} or
17869 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17870 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17871 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17872 @code{__sanitizer_cov_trace_switch} for switch statements.
17874 @opindex fcf-protection
17875 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17876 Enable code instrumentation of control-flow transfers to increase
17877 program security by checking that target addresses of control-flow
17878 transfer instructions (such as indirect function call, function return,
17879 indirect jump) are valid.  This prevents diverting the flow of control
17880 to an unexpected target.  This is intended to protect against such
17881 threats as Return-oriented Programming (ROP), and similarly
17882 call/jmp-oriented programming (COP/JOP).
17884 The value @code{branch} tells the compiler to implement checking of
17885 validity of control-flow transfer at the point of indirect branch
17886 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17887 implements checking of validity at the point of returning from a
17888 function.  The value @code{full} is an alias for specifying both
17889 @code{branch} and @code{return}. The value @code{none} turns off
17890 instrumentation.
17892 To override @option{-fcf-protection}, @option{-fcf-protection=none}
17893 needs to be added and then with @option{-fcf-protection=xxx}.
17895 The value @code{check} is used for the final link with link-time
17896 optimization (LTO).  An error is issued if LTO object files are
17897 compiled with different @option{-fcf-protection} values.  The
17898 value @code{check} is ignored at the compile time.
17900 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17901 used.  The first bit of @code{__CET__} is set to 1 for the value
17902 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17903 the @code{return}.
17905 You can also use the @code{nocf_check} attribute to identify
17906 which functions and calls should be skipped from instrumentation
17907 (@pxref{Function Attributes}).
17909 Currently the x86 GNU/Linux target provides an implementation based
17910 on Intel Control-flow Enforcement Technology (CET) which works for
17911 i686 processor or newer.
17913 @opindex fharden-compares
17914 @item -fharden-compares
17915 For every logical test that survives gimple optimizations and is
17916 @emph{not} the condition in a conditional branch (for example,
17917 conditions tested for conditional moves, or to store in boolean
17918 variables), emit extra code to compute and verify the reversed
17919 condition, and to call @code{__builtin_trap} if the results do not
17920 match.  Use with @samp{-fharden-conditional-branches} to cover all
17921 conditionals.
17923 @opindex fharden-conditional-branches
17924 @item -fharden-conditional-branches
17925 For every non-vectorized conditional branch that survives gimple
17926 optimizations, emit extra code to compute and verify the reversed
17927 condition, and to call @code{__builtin_trap} if the result is
17928 unexpected.  Use with @samp{-fharden-compares} to cover all
17929 conditionals.
17931 @opindex fharden-control-flow-redundancy
17932 @item -fharden-control-flow-redundancy
17933 Emit extra code to set booleans when entering basic blocks, and to
17934 verify and trap, at function exits, when the booleans do not form an
17935 execution path that is compatible with the control flow graph.
17937 Verification takes place before returns, before mandatory tail calls
17938 (see below) and, optionally, before escaping exceptions with
17939 @option{-fhardcfr-check-exceptions}, before returning calls with
17940 @option{-fhardcfr-check-returning-calls}, and before noreturn calls with
17941 @option{-fhardcfr-check-noreturn-calls}).  Tuning options
17942 @option{--param hardcfr-max-blocks} and @option{--param
17943 hardcfr-max-inline-blocks} are available.
17945 Tail call optimization takes place too late to affect control flow
17946 redundancy, but calls annotated as mandatory tail calls by language
17947 front-ends, and any calls marked early enough as potential tail calls
17948 would also have verification issued before the call, but these
17949 possibilities are merely theoretical, as these conditions can only be
17950 met when using custom compiler plugins.
17952 @opindex fhardcfr-skip-leaf
17953 @item -fhardcfr-skip-leaf
17954 Disable @option{-fharden-control-flow-redundancy} in leaf functions.
17956 @opindex fhardcfr-check-exceptions
17957 @opindex fno-hardcfr-check-exceptions
17958 @item -fhardcfr-check-exceptions
17959 When @option{-fharden-control-flow-redundancy} is active, check the
17960 recorded execution path against the control flow graph at exception
17961 escape points, as if the function body was wrapped with a cleanup
17962 handler that performed the check and reraised.  This option is enabled
17963 by default; use @option{-fno-hardcfr-check-exceptions} to disable it.
17965 @opindex fhardcfr-check-returning-calls
17966 @opindex fno-hardcfr-check-returning-calls
17967 @item -fhardcfr-check-returning-calls
17968 When @option{-fharden-control-flow-redundancy} is active, check the
17969 recorded execution path against the control flow graph before any
17970 function call immediately followed by a return of its result, if any, so
17971 as to not prevent tail-call optimization, whether or not it is
17972 ultimately optimized to a tail call.
17974 This option is enabled by default whenever sibling call optimizations
17975 are enabled (see @option{-foptimize-sibling-calls}), but it can be
17976 enabled (or disabled, using its negated form) explicitly, regardless of
17977 the optimizations.
17979 @opindex fhardcfr-check-noreturn-calls
17980 @item -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
17981 When @option{-fharden-control-flow-redundancy} is active, check the
17982 recorded execution path against the control flow graph before
17983 @code{noreturn} calls, either all of them (@option{always}), those that
17984 aren't expected to return control to the caller through an exception
17985 (@option{no-xthrow}, the default), those that may not return control to
17986 the caller through an exception either (@option{nothrow}), or none of
17987 them (@option{never}).
17989 Checking before a @code{noreturn} function that may return control to
17990 the caller through an exception may cause checking to be performed more
17991 than once, if the exception is caught in the caller, whether by a
17992 handler or a cleanup.  When @option{-fhardcfr-check-exceptions} is also
17993 enabled, the compiler will avoid associating a @code{noreturn} call with
17994 the implicitly-added cleanup handler, since it would be redundant with
17995 the check performed before the call, but other handlers or cleanups in
17996 the function, if activated, will modify the recorded execution path and
17997 check it again when another checkpoint is hit.  The checkpoint may even
17998 be another @code{noreturn} call, so checking may end up performed
17999 multiple times.
18001 Various optimizers may cause calls to be marked as @code{noreturn}
18002 and/or @code{nothrow}, even in the absence of the corresponding
18003 attributes, which may affect the placement of checks before calls, as
18004 well as the addition of implicit cleanup handlers for them.  This
18005 unpredictability, and the fact that raising and reraising exceptions
18006 frequently amounts to implicitly calling @code{noreturn} functions, have
18007 made @option{no-xthrow} the default setting for this option: it excludes
18008 from the @code{noreturn} treatment only internal functions used to
18009 (re)raise exceptions, that are not affected by these optimizations.
18011 @opindex fhardened
18012 @item -fhardened
18013 Enable a set of flags for C and C++ that improve the security of the
18014 generated code without affecting its ABI.  The precise flags enabled
18015 may change between major releases of GCC, but are currently:
18017 @c Keep this in sync with print_help_hardened!
18018 @gccoptlist{
18019 -D_FORTIFY_SOURCE=3
18020 -D_GLIBCXX_ASSERTIONS
18021 -ftrivial-auto-var-init=zero
18022 -fPIE  -pie  -Wl,-z,relro,-z,now
18023 -fstack-protector-strong
18024 -fstack-clash-protection
18025 -fcf-protection=full @r{(x86 GNU/Linux only)}
18028 The list of options enabled by @option{-fhardened} can be generated using
18029 the @option{--help=hardened} option.
18031 When the system glibc is older than 2.35, @option{-D_FORTIFY_SOURCE=2}
18032 is used instead.
18034 This option is intended to be used in production builds, not merely
18035 in debug builds.
18037 Currently, @option{-fhardened} is only supported on GNU/Linux targets.
18039 @option{-fhardened} only enables a particular option if it wasn't
18040 already specified anywhere on the command line.  For instance,
18041 @option{-fhardened} @option{-fstack-protector} will only enable
18042 @option{-fstack-protector}, but not @option{-fstack-protector-strong}.
18044 @opindex fstack-protector
18045 @item -fstack-protector
18046 Emit extra code to check for buffer overflows, such as stack smashing
18047 attacks.  This is done by adding a guard variable to functions with
18048 vulnerable objects.  This includes functions that call @code{alloca}, and
18049 functions with buffers larger than or equal to 8 bytes.  The guards are
18050 initialized when a function is entered and then checked when the function
18051 exits.  If a guard check fails, an error message is printed and the program
18052 exits.  Only variables that are actually allocated on the stack are
18053 considered, optimized away variables or variables allocated in registers
18054 don't count.
18056 @opindex fstack-protector-all
18057 @item -fstack-protector-all
18058 Like @option{-fstack-protector} except that all functions are protected.
18060 @opindex fstack-protector-strong
18061 @item -fstack-protector-strong
18062 Like @option{-fstack-protector} but includes additional functions to
18063 be protected --- those that have local array definitions, or have
18064 references to local frame addresses.  Only variables that are actually
18065 allocated on the stack are considered, optimized away variables or variables
18066 allocated in registers don't count.
18068 @opindex fstack-protector-explicit
18069 @item -fstack-protector-explicit
18070 Like @option{-fstack-protector} but only protects those functions which
18071 have the @code{stack_protect} attribute.
18073 @opindex fstack-check
18074 @item -fstack-check
18075 Generate code to verify that you do not go beyond the boundary of the
18076 stack.  You should specify this flag if you are running in an
18077 environment with multiple threads, but you only rarely need to specify it in
18078 a single-threaded environment since stack overflow is automatically
18079 detected on nearly all systems if there is only one stack.
18081 Note that this switch does not actually cause checking to be done; the
18082 operating system or the language runtime must do that.  The switch causes
18083 generation of code to ensure that they see the stack being extended.
18085 You can additionally specify a string parameter: @samp{no} means no
18086 checking, @samp{generic} means force the use of old-style checking,
18087 @samp{specific} means use the best checking method and is equivalent
18088 to bare @option{-fstack-check}.
18090 Old-style checking is a generic mechanism that requires no specific
18091 target support in the compiler but comes with the following drawbacks:
18093 @enumerate
18094 @item
18095 Modified allocation strategy for large objects: they are always
18096 allocated dynamically if their size exceeds a fixed threshold.  Note this
18097 may change the semantics of some code.
18099 @item
18100 Fixed limit on the size of the static frame of functions: when it is
18101 topped by a particular function, stack checking is not reliable and
18102 a warning is issued by the compiler.
18104 @item
18105 Inefficiency: because of both the modified allocation strategy and the
18106 generic implementation, code performance is hampered.
18107 @end enumerate
18109 Note that old-style stack checking is also the fallback method for
18110 @samp{specific} if no target support has been added in the compiler.
18112 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
18113 and stack overflows.  @samp{specific} is an excellent choice when compiling
18114 Ada code.  It is not generally sufficient to protect against stack-clash
18115 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
18117 @opindex fstack-clash-protection
18118 @item -fstack-clash-protection
18119 Generate code to prevent stack clash style attacks.  When this option is
18120 enabled, the compiler will only allocate one page of stack space at a time
18121 and each page is accessed immediately after allocation.  Thus, it prevents
18122 allocations from jumping over any stack guard page provided by the
18123 operating system.
18125 Most targets do not fully support stack clash protection.  However, on
18126 those targets @option{-fstack-clash-protection} will protect dynamic stack
18127 allocations.  @option{-fstack-clash-protection} may also provide limited
18128 protection for static stack allocations if the target supports
18129 @option{-fstack-check=specific}.
18131 @opindex fstack-limit-register
18132 @opindex fstack-limit-symbol
18133 @opindex fno-stack-limit
18134 @item -fstack-limit-register=@var{reg}
18135 @itemx -fstack-limit-symbol=@var{sym}
18136 @itemx -fno-stack-limit
18137 Generate code to ensure that the stack does not grow beyond a certain value,
18138 either the value of a register or the address of a symbol.  If a larger
18139 stack is required, a signal is raised at run time.  For most targets,
18140 the signal is raised before the stack overruns the boundary, so
18141 it is possible to catch the signal without taking special precautions.
18143 For instance, if the stack starts at absolute address @samp{0x80000000}
18144 and grows downwards, you can use the flags
18145 @option{-fstack-limit-symbol=__stack_limit} and
18146 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18147 of 128KB@.  Note that this may only work with the GNU linker.
18149 You can locally override stack limit checking by using the
18150 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
18152 @opindex fsplit-stack
18153 @item -fsplit-stack
18154 Generate code to automatically split the stack before it overflows.
18155 The resulting program has a discontiguous stack which can only
18156 overflow if the program is unable to allocate any more memory.  This
18157 is most useful when running threaded programs, as it is no longer
18158 necessary to calculate a good stack size to use for each thread.  This
18159 is currently only implemented for the x86 targets running
18160 GNU/Linux.
18162 When code compiled with @option{-fsplit-stack} calls code compiled
18163 without @option{-fsplit-stack}, there may not be much stack space
18164 available for the latter code to run.  If compiling all code,
18165 including library code, with @option{-fsplit-stack} is not an option,
18166 then the linker can fix up these calls so that the code compiled
18167 without @option{-fsplit-stack} always has a large stack.  Support for
18168 this is implemented in the gold linker in GNU binutils release 2.21
18169 and later.
18171 @opindex -fstrub=disable
18172 @item -fstrub=disable
18173 Disable stack scrubbing entirely, ignoring any @code{strub} attributes.
18174 See @xref{Common Type Attributes}.
18176 @opindex fstrub=strict
18177 @item -fstrub=strict
18178 Functions default to @code{strub} mode @code{disabled}, and apply
18179 @option{strict}ly the restriction that only functions associated with
18180 @code{strub}-@code{callable} modes (@code{at-calls}, @code{callable} and
18181 @code{always_inline} @code{internal}) are @code{callable} by functions
18182 with @code{strub}-enabled modes (@code{at-calls} and @code{internal}).
18184 @opindex fstrub=relaxed
18185 @item -fstrub=relaxed
18186 Restore the default stack scrub (@code{strub}) setting, namely,
18187 @code{strub} is only enabled as required by @code{strub} attributes
18188 associated with function and data types.  @code{Relaxed} means that
18189 strub contexts are only prevented from calling functions explicitly
18190 associated with @code{strub} mode @code{disabled}.  This option is only
18191 useful to override other @option{-fstrub=*} options that precede it in
18192 the command line.
18194 @opindex fstrub=at-calls
18195 @item -fstrub=at-calls
18196 Enable @code{at-calls} @code{strub} mode where viable.  The primary use
18197 of this option is for testing.  It exercises the @code{strub} machinery
18198 in scenarios strictly local to a translation unit.  This @code{strub}
18199 mode modifies function interfaces, so any function that is visible to
18200 other translation units, or that has its address taken, will @emph{not}
18201 be affected by this option.  Optimization options may also affect
18202 viability.  See the @code{strub} attribute documentation for details on
18203 viability and eligibility requirements.
18205 @opindex fstrub=internal
18206 @item -fstrub=internal
18207 Enable @code{internal} @code{strub} mode where viable.  The primary use
18208 of this option is for testing.  This option is intended to exercise
18209 thoroughly parts of the @code{strub} machinery that implement the less
18210 efficient, but interface-preserving @code{strub} mode.  Functions that
18211 would not be affected by this option are quite uncommon.
18213 @opindex fstrub=all
18214 @item -fstrub=all
18215 Enable some @code{strub} mode where viable.  When both strub modes are
18216 viable, @code{at-calls} is preferred.  @option{-fdump-ipa-strubm} adds
18217 function attributes that tell which mode was selected for each function.
18218 The primary use of this option is for testing, to exercise thoroughly
18219 the @code{strub} machinery.
18221 @opindex fvtable-verify
18222 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
18223 This option is only available when compiling C++ code.
18224 It turns on (or off, if using @option{-fvtable-verify=none}) the security
18225 feature that verifies at run time, for every virtual call, that
18226 the vtable pointer through which the call is made is valid for the type of
18227 the object, and has not been corrupted or overwritten.  If an invalid vtable
18228 pointer is detected at run time, an error is reported and execution of the
18229 program is immediately halted.
18231 This option causes run-time data structures to be built at program startup,
18232 which are used for verifying the vtable pointers.  
18233 The options @samp{std} and @samp{preinit}
18234 control the timing of when these data structures are built.  In both cases the
18235 data structures are built before execution reaches @code{main}.  Using
18236 @option{-fvtable-verify=std} causes the data structures to be built after
18237 shared libraries have been loaded and initialized.
18238 @option{-fvtable-verify=preinit} causes them to be built before shared
18239 libraries have been loaded and initialized.
18241 If this option appears multiple times in the command line with different
18242 values specified, @samp{none} takes highest priority over both @samp{std} and
18243 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
18245 @opindex fvtv-debug
18246 @item -fvtv-debug
18247 When used in conjunction with @option{-fvtable-verify=std} or 
18248 @option{-fvtable-verify=preinit}, causes debug versions of the 
18249 runtime functions for the vtable verification feature to be called.  
18250 This flag also causes the compiler to log information about which 
18251 vtable pointers it finds for each class.
18252 This information is written to a file named @file{vtv_set_ptr_data.log} 
18253 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
18254 if that is defined or the current working directory otherwise.
18256 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
18257 file, be sure to delete any existing one.
18259 @opindex fvtv-counts
18260 @item -fvtv-counts
18261 This is a debugging flag.  When used in conjunction with
18262 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
18263 causes the compiler to keep track of the total number of virtual calls
18264 it encounters and the number of verifications it inserts.  It also
18265 counts the number of calls to certain run-time library functions
18266 that it inserts and logs this information for each compilation unit.
18267 The compiler writes this information to a file named
18268 @file{vtv_count_data.log} in the directory named by the environment
18269 variable @env{VTV_LOGS_DIR} if that is defined or the current working
18270 directory otherwise.  It also counts the size of the vtable pointer sets
18271 for each class, and writes this information to @file{vtv_class_set_sizes.log}
18272 in the same directory.
18274 Note:  This feature @emph{appends} data to the log files.  To get fresh log
18275 files, be sure to delete any existing ones.
18277 @opindex finstrument-functions
18278 @item -finstrument-functions
18279 Generate instrumentation calls for entry and exit to functions.  Just
18280 after function entry and just before function exit, the following
18281 profiling functions are called with the address of the current
18282 function and its call site.  (On some platforms,
18283 @code{__builtin_return_address} does not work beyond the current
18284 function, so the call site information may not be available to the
18285 profiling functions otherwise.)
18287 @smallexample
18288 void __cyg_profile_func_enter (void *this_fn,
18289                                void *call_site);
18290 void __cyg_profile_func_exit  (void *this_fn,
18291                                void *call_site);
18292 @end smallexample
18294 The first argument is the address of the start of the current function,
18295 which may be looked up exactly in the symbol table.
18297 This instrumentation is also done for functions expanded inline in other
18298 functions.  The profiling calls indicate where, conceptually, the
18299 inline function is entered and exited.  This means that addressable
18300 versions of such functions must be available.  If all your uses of a
18301 function are expanded inline, this may mean an additional expansion of
18302 code size.  If you use @code{extern inline} in your C code, an
18303 addressable version of such functions must be provided.  (This is
18304 normally the case anyway, but if you get lucky and the optimizer always
18305 expands the functions inline, you might have gotten away without
18306 providing static copies.)
18308 A function may be given the attribute @code{no_instrument_function}, in
18309 which case this instrumentation is not done.  This can be used, for
18310 example, for the profiling functions listed above, high-priority
18311 interrupt routines, and any functions from which the profiling functions
18312 cannot safely be called (perhaps signal handlers, if the profiling
18313 routines generate output or allocate memory).
18314 @xref{Common Function Attributes}.
18316 @opindex finstrument-functions-once
18317 @item -finstrument-functions-once
18318 This is similar to @option{-finstrument-functions}, but the profiling
18319 functions are called only once per instrumented function, i.e. the first
18320 profiling function is called after the first entry into the instrumented
18321 function and the second profiling function is called before the exit
18322 corresponding to this first entry.
18324 The definition of @code{once} for the purpose of this option is a little
18325 vague because the implementation is not protected against data races.
18326 As a result, the implementation only guarantees that the profiling
18327 functions are called at @emph{least} once per process and at @emph{most}
18328 once per thread, but the calls are always paired, that is to say, if a
18329 thread calls the first function, then it will call the second function,
18330 unless it never reaches the exit of the instrumented function.
18332 @opindex finstrument-functions-exclude-file-list
18333 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
18335 Set the list of functions that are excluded from instrumentation (see
18336 the description of @option{-finstrument-functions}).  If the file that
18337 contains a function definition matches with one of @var{file}, then
18338 that function is not instrumented.  The match is done on substrings:
18339 if the @var{file} parameter is a substring of the file name, it is
18340 considered to be a match.
18342 For example:
18344 @smallexample
18345 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
18346 @end smallexample
18348 @noindent
18349 excludes any inline function defined in files whose pathnames
18350 contain @file{/bits/stl} or @file{include/sys}.
18352 If, for some reason, you want to include letter @samp{,} in one of
18353 @var{sym}, write @samp{\,}. For example,
18354 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
18355 (note the single quote surrounding the option).
18357 @opindex finstrument-functions-exclude-function-list
18358 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
18360 This is similar to @option{-finstrument-functions-exclude-file-list},
18361 but this option sets the list of function names to be excluded from
18362 instrumentation.  The function name to be matched is its user-visible
18363 name, such as @code{vector<int> blah(const vector<int> &)}, not the
18364 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
18365 match is done on substrings: if the @var{sym} parameter is a substring
18366 of the function name, it is considered to be a match.  For C99 and C++
18367 extended identifiers, the function name must be given in UTF-8, not
18368 using universal character names.
18370 @opindex fpatchable-function-entry
18371 @item -fpatchable-function-entry=@var{N}[,@var{M}]
18372 Generate @var{N} NOPs right at the beginning
18373 of each function, with the function entry point before the @var{M}th NOP.
18374 If @var{M} is omitted, it defaults to @code{0} so the
18375 function entry points to the address just at the first NOP.
18376 The NOP instructions reserve extra space which can be used to patch in
18377 any desired instrumentation at run time, provided that the code segment
18378 is writable.  The amount of space is controllable indirectly via
18379 the number of NOPs; the NOP instruction used corresponds to the instruction
18380 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
18381 is target-specific and may also depend on the architecture variant and/or
18382 other compilation options.
18384 For run-time identification, the starting addresses of these areas,
18385 which correspond to their respective function entries minus @var{M},
18386 are additionally collected in the @code{__patchable_function_entries}
18387 section of the resulting binary.
18389 Note that the value of @code{__attribute__ ((patchable_function_entry
18390 (N,M)))} takes precedence over command-line option
18391 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
18392 the area size or to remove it completely on a single function.
18393 If @code{N=0}, no pad location is recorded.
18395 The NOP instructions are inserted at---and maybe before, depending on
18396 @var{M}---the function entry address, even before the prologue.  On
18397 PowerPC with the ELFv2 ABI, for a function with dual entry points,
18398 the local entry point is this function entry address.
18400 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
18401 ELFv2 ABI, for a function with dual entry points, the supported values
18402 for @var{M} are 0, 2, 6 and 14.
18403 @end table
18406 @node Preprocessor Options
18407 @section Options Controlling the Preprocessor
18408 @cindex preprocessor options
18409 @cindex options, preprocessor
18411 These options control the C preprocessor, which is run on each C source
18412 file before actual compilation.
18414 If you use the @option{-E} option, nothing is done except preprocessing.
18415 Some of these options make sense only together with @option{-E} because
18416 they cause the preprocessor output to be unsuitable for actual
18417 compilation.
18419 In addition to the options listed here, there are a number of options 
18420 to control search paths for include files documented in 
18421 @ref{Directory Options}.  
18422 Options to control preprocessor diagnostics are listed in 
18423 @ref{Warning Options}.
18425 @table @gcctabopt
18426 @include cppopts.texi
18428 @opindex Wp
18429 @item -Wp,@var{option}
18430 You can use @option{-Wp,@var{option}} to bypass the compiler driver
18431 and pass @var{option} directly through to the preprocessor.  If
18432 @var{option} contains commas, it is split into multiple options at the
18433 commas.  However, many options are modified, translated or interpreted
18434 by the compiler driver before being passed to the preprocessor, and
18435 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
18436 interface is undocumented and subject to change, so whenever possible
18437 you should avoid using @option{-Wp} and let the driver handle the
18438 options instead.
18440 @opindex Xpreprocessor
18441 @item -Xpreprocessor @var{option}
18442 Pass @var{option} as an option to the preprocessor.  You can use this to
18443 supply system-specific preprocessor options that GCC does not 
18444 recognize.
18446 If you want to pass an option that takes an argument, you must use
18447 @option{-Xpreprocessor} twice, once for the option and once for the argument.
18449 @opindex no-integrated-cpp
18450 @item -no-integrated-cpp
18451 Perform preprocessing as a separate pass before compilation.
18452 By default, GCC performs preprocessing as an integrated part of
18453 input tokenization and parsing.
18454 If this option is provided, the appropriate language front end
18455 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
18456 and Objective-C, respectively) is instead invoked twice,
18457 once for preprocessing only and once for actual compilation
18458 of the preprocessed input.
18459 This option may be useful in conjunction with the @option{-B} or
18460 @option{-wrapper} options to specify an alternate preprocessor or
18461 perform additional processing of the program source between
18462 normal preprocessing and compilation.
18464 @opindex flarge-source-files
18465 @item -flarge-source-files
18466 Adjust GCC to expect large source files, at the expense of slower
18467 compilation and higher memory usage.
18469 Specifically, GCC normally tracks both column numbers and line numbers
18470 within source files and it normally prints both of these numbers in
18471 diagnostics.  However, once it has processed a certain number of source
18472 lines, it stops tracking column numbers and only tracks line numbers.
18473 This means that diagnostics for later lines do not include column numbers.
18474 It also means that options like @option{-Wmisleading-indentation} cease to work
18475 at that point, although the compiler prints a note if this happens.
18476 Passing @option{-flarge-source-files} significantly increases the number
18477 of source lines that GCC can process before it stops tracking columns.
18479 @end table
18481 @node Assembler Options
18482 @section Passing Options to the Assembler
18484 @c prevent bad page break with this line
18485 You can pass options to the assembler.
18487 @table @gcctabopt
18488 @opindex Wa
18489 @item -Wa,@var{option}
18490 Pass @var{option} as an option to the assembler.  If @var{option}
18491 contains commas, it is split into multiple options at the commas.
18493 @opindex Xassembler
18494 @item -Xassembler @var{option}
18495 Pass @var{option} as an option to the assembler.  You can use this to
18496 supply system-specific assembler options that GCC does not
18497 recognize.
18499 If you want to pass an option that takes an argument, you must use
18500 @option{-Xassembler} twice, once for the option and once for the argument.
18502 @end table
18504 @node Link Options
18505 @section Options for Linking
18506 @cindex link options
18507 @cindex options, linking
18509 These options come into play when the compiler links object files into
18510 an executable output file.  They are meaningless if the compiler is
18511 not doing a link step.
18513 @table @gcctabopt
18514 @cindex file names
18515 @item @var{object-file-name}
18516 A file name that does not end in a special recognized suffix is
18517 considered to name an object file or library.  (Object files are
18518 distinguished from libraries by the linker according to the file
18519 contents.)  If linking is done, these object files are used as input
18520 to the linker.
18522 @opindex c
18523 @opindex S
18524 @opindex E
18525 @item -c
18526 @itemx -S
18527 @itemx -E
18528 If any of these options is used, then the linker is not run, and
18529 object file names should not be used as arguments.  @xref{Overall
18530 Options}.
18532 @opindex flinker-output
18533 @item -flinker-output=@var{type}
18534 This option controls code generation of the link-time optimizer.  By
18535 default the linker output is automatically determined by the linker
18536 plugin.  For debugging the compiler and if incremental linking with a 
18537 non-LTO object file is desired, it may be useful to control the type
18538 manually.
18540 If @var{type} is @samp{exec}, code generation produces a static
18541 binary. In this case @option{-fpic} and @option{-fpie} are both
18542 disabled.
18544 If @var{type} is @samp{dyn}, code generation produces a shared
18545 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
18546 but not enabled automatically.  This allows to build shared libraries
18547 without position-independent code on architectures where this is
18548 possible, i.e.@: on x86.
18550 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
18551 executable. This results in similar optimizations as @samp{exec}
18552 except that @option{-fpie} is not disabled if specified at compilation
18553 time.
18555 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
18556 done.  The sections containing intermediate code for link-time optimization are
18557 merged, pre-optimized, and output to the resulting object file. In addition, if
18558 @option{-ffat-lto-objects} is specified, binary code is produced for future
18559 non-LTO linking. The object file produced by incremental linking is smaller
18560 than a static library produced from the same object files.  At link time the
18561 result of incremental linking also loads faster than a static
18562 library assuming that the majority of objects in the library are used.
18564 Finally @samp{nolto-rel} configures the compiler for incremental linking where
18565 code generation is forced, a final binary is produced, and the intermediate
18566 code for later link-time optimization is stripped. When multiple object files
18567 are linked together the resulting code is better optimized than with
18568 link-time optimizations disabled (for example, cross-module inlining 
18569 happens), but most of benefits of whole program optimizations are lost. 
18571 During the incremental link (by @option{-r}) the linker plugin defaults to
18572 @option{rel}. With current interfaces to GNU Binutils it is however not
18573 possible to incrementally link LTO objects and non-LTO objects into a single
18574 mixed object file.  If any of object files in incremental link cannot
18575 be used for link-time optimization, the linker plugin issues a warning and
18576 uses @samp{nolto-rel}. To maintain whole program optimization, it is
18577 recommended to link such objects into static library instead. Alternatively it
18578 is possible to use H.J. Lu's binutils with support for mixed objects.
18580 @opindex fuse-ld=bfd
18581 @item -fuse-ld=bfd
18582 Use the @command{bfd} linker instead of the default linker.
18584 @opindex fuse-ld=gold
18585 @item -fuse-ld=gold
18586 Use the @command{gold} linker instead of the default linker.
18588 @opindex fuse-ld=lld
18589 @item -fuse-ld=lld
18590 Use the LLVM @command{lld} linker instead of the default linker.
18592 @opindex fuse-ld=mold
18593 @item -fuse-ld=mold
18594 Use the Modern Linker (@command{mold}) instead of the default linker.
18596 @cindex Libraries
18597 @opindex l
18598 @item -l@var{library}
18599 @itemx -l @var{library}
18600 Search the library named @var{library} when linking.  (The second
18601 alternative with the library as a separate argument is only for
18602 POSIX compliance and is not recommended.)
18604 The @option{-l} option is passed directly to the linker by GCC.  Refer
18605 to your linker documentation for exact details.  The general
18606 description below applies to the GNU linker.  
18608 The linker searches a standard list of directories for the library.
18609 The directories searched include several standard system directories
18610 plus any that you specify with @option{-L}.
18612 Static libraries are archives of object files, and have file names
18613 like @file{lib@var{library}.a}.  Some targets also support shared
18614 libraries, which typically have names like @file{lib@var{library}.so}.
18615 If both static and shared libraries are found, the linker gives
18616 preference to linking with the shared library unless the
18617 @option{-static} option is used.
18619 It makes a difference where in the command you write this option; the
18620 linker searches and processes libraries and object files in the order they
18621 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
18622 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
18623 to functions in @samp{z}, those functions may not be loaded.
18625 @opindex lobjc
18626 @item -lobjc
18627 You need this special case of the @option{-l} option in order to
18628 link an Objective-C or Objective-C++ program.
18630 @opindex nostartfiles
18631 @item -nostartfiles
18632 Do not use the standard system startup files when linking.
18633 The standard system libraries are used normally, unless @option{-nostdlib},
18634 @option{-nolibc}, or @option{-nodefaultlibs} is used.
18636 @opindex nodefaultlibs
18637 @item -nodefaultlibs
18638 Do not use the standard system libraries when linking.
18639 Only the libraries you specify are passed to the linker, and options
18640 specifying linkage of the system libraries, such as @option{-static-libgcc}
18641 or @option{-shared-libgcc}, are ignored.  
18642 The standard startup files are used normally, unless @option{-nostartfiles}
18643 is used.  
18645 The compiler may generate calls to @code{memcmp},
18646 @code{memset}, @code{memcpy} and @code{memmove}.
18647 These entries are usually resolved by entries in
18648 libc.  These entry points should be supplied through some other
18649 mechanism when this option is specified.
18651 @opindex nolibc
18652 @item -nolibc
18653 Do not use the C library or system libraries tightly coupled with it when
18654 linking.  Still link with the startup files, @file{libgcc} or toolchain
18655 provided language support libraries such as @file{libgnat}, @file{libgfortran}
18656 or @file{libstdc++} unless options preventing their inclusion are used as
18657 well.  This typically removes @option{-lc} from the link command line, as well
18658 as system libraries that normally go with it and become meaningless when
18659 absence of a C library is assumed, for example @option{-lpthread} or
18660 @option{-lm} in some configurations.  This is intended for bare-board
18661 targets when there is indeed no C library available.
18663 @opindex nostdlib
18664 @item -nostdlib
18665 Do not use the standard system startup files or libraries when linking.
18666 No startup files and only the libraries you specify are passed to
18667 the linker, and options specifying linkage of the system libraries, such as
18668 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
18670 The compiler may generate calls to @code{memcmp}, @code{memset},
18671 @code{memcpy} and @code{memmove}.
18672 These entries are usually resolved by entries in
18673 libc.  These entry points should be supplied through some other
18674 mechanism when this option is specified.
18676 @cindex @option{-lgcc}, use with @option{-nostdlib}
18677 @cindex @option{-nostdlib} and unresolved references
18678 @cindex unresolved references and @option{-nostdlib}
18679 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
18680 @cindex @option{-nodefaultlibs} and unresolved references
18681 @cindex unresolved references and @option{-nodefaultlibs}
18682 One of the standard libraries bypassed by @option{-nostdlib} and
18683 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
18684 which GCC uses to overcome shortcomings of particular machines, or special
18685 needs for some languages.
18686 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
18687 Collection (GCC) Internals},
18688 for more discussion of @file{libgcc.a}.)
18689 In most cases, you need @file{libgcc.a} even when you want to avoid
18690 other standard libraries.  In other words, when you specify @option{-nostdlib}
18691 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
18692 This ensures that you have no unresolved references to internal GCC
18693 library subroutines.
18694 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18695 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18696 GNU Compiler Collection (GCC) Internals}.)
18698 @opindex nostdlib++
18699 @item -nostdlib++
18700 Do not implicitly link with standard C++ libraries.
18702 @opindex e
18703 @opindex entry
18704 @item -e @var{entry}
18705 @itemx --entry=@var{entry}
18707 Specify that the program entry point is @var{entry}.  The argument is
18708 interpreted by the linker; the GNU linker accepts either a symbol name
18709 or an address.
18711 @opindex pie
18712 @item -pie
18713 Produce a dynamically linked position independent executable on targets
18714 that support it.  For predictable results, you must also specify the same
18715 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18716 or model suboptions) when you specify this linker option.
18718 @opindex no-pie
18719 @item -no-pie
18720 Don't produce a dynamically linked position independent executable.
18722 @opindex static-pie
18723 @item -static-pie
18724 Produce a static position independent executable on targets that support
18725 it.  A static position independent executable is similar to a static
18726 executable, but can be loaded at any address without a dynamic linker.
18727 For predictable results, you must also specify the same set of options
18728 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18729 suboptions) when you specify this linker option.
18731 @opindex pthread
18732 @item -pthread
18733 Link with the POSIX threads library.  This option is supported on 
18734 GNU/Linux targets, most other Unix derivatives, and also on 
18735 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18736 flags for the preprocessor, so it should be used consistently for both
18737 compilation and linking.
18739 @opindex r
18740 @item -r
18741 Produce a relocatable object as output.  This is also known as partial
18742 linking.
18744 @opindex rdynamic
18745 @item -rdynamic
18746 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18747 that support it. This instructs the linker to add all symbols, not
18748 only used ones, to the dynamic symbol table. This option is needed
18749 for some uses of @code{dlopen} or to allow obtaining backtraces
18750 from within a program.
18752 @opindex s
18753 @item -s
18754 Remove all symbol table and relocation information from the executable.
18756 @opindex static
18757 @item -static
18758 On systems that support dynamic linking, this overrides @option{-pie}
18759 and prevents linking with the shared libraries.  On other systems, this
18760 option has no effect.
18762 @opindex shared
18763 @item -shared
18764 Produce a shared object which can then be linked with other objects to
18765 form an executable.  Not all systems support this option.  For predictable
18766 results, you must also specify the same set of options used for compilation
18767 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18768 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18769 needs to build supplementary stub code for constructors to work.  On
18770 multi-libbed systems, @samp{gcc -shared} must select the correct support
18771 libraries to link against.  Failing to supply the correct flags may lead
18772 to subtle defects.  Supplying them in cases where they are not necessary
18773 is innocuous.  @option{-shared} suppresses the addition of startup code
18774 to alter the floating-point environment as done with @option{-ffast-math},
18775 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18777 @opindex shared-libgcc
18778 @opindex static-libgcc
18779 @item -shared-libgcc
18780 @itemx -static-libgcc
18781 On systems that provide @file{libgcc} as a shared library, these options
18782 force the use of either the shared or static version, respectively.
18783 If no shared version of @file{libgcc} was built when the compiler was
18784 configured, these options have no effect.
18786 There are several situations in which an application should use the
18787 shared @file{libgcc} instead of the static version.  The most common
18788 of these is when the application wishes to throw and catch exceptions
18789 across different shared libraries.  In that case, each of the libraries
18790 as well as the application itself should use the shared @file{libgcc}.
18792 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18793 whenever you build a shared library or a main executable, because C++
18794 programs typically use exceptions, so this is the right thing to do.
18796 If, instead, you use the GCC driver to create shared libraries, you may
18797 find that they are not always linked with the shared @file{libgcc}.
18798 If GCC finds, at its configuration time, that you have a non-GNU linker
18799 or a GNU linker that does not support option @option{--eh-frame-hdr},
18800 it links the shared version of @file{libgcc} into shared libraries
18801 by default.  Otherwise, it takes advantage of the linker and optimizes
18802 away the linking with the shared version of @file{libgcc}, linking with
18803 the static version of libgcc by default.  This allows exceptions to
18804 propagate through such shared libraries, without incurring relocation
18805 costs at library load time.
18807 However, if a library or main executable is supposed to throw or catch
18808 exceptions, you must link it using the G++ driver, or using the option
18809 @option{-shared-libgcc}, such that it is linked with the shared
18810 @file{libgcc}.
18812 @opindex static-libasan
18813 @item -static-libasan
18814 When the @option{-fsanitize=address} option is used to link a program,
18815 the GCC driver automatically links against @option{libasan}.  If
18816 @file{libasan} is available as a shared library, and the @option{-static}
18817 option is not used, then this links against the shared version of
18818 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18819 driver to link @file{libasan} statically, without necessarily linking
18820 other libraries statically.
18822 @opindex static-libtsan
18823 @item -static-libtsan
18824 When the @option{-fsanitize=thread} option is used to link a program,
18825 the GCC driver automatically links against @option{libtsan}.  If
18826 @file{libtsan} is available as a shared library, and the @option{-static}
18827 option is not used, then this links against the shared version of
18828 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18829 driver to link @file{libtsan} statically, without necessarily linking
18830 other libraries statically.
18832 @opindex static-liblsan
18833 @item -static-liblsan
18834 When the @option{-fsanitize=leak} option is used to link a program,
18835 the GCC driver automatically links against @option{liblsan}.  If
18836 @file{liblsan} is available as a shared library, and the @option{-static}
18837 option is not used, then this links against the shared version of
18838 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18839 driver to link @file{liblsan} statically, without necessarily linking
18840 other libraries statically.
18842 @opindex static-libubsan
18843 @item -static-libubsan
18844 When the @option{-fsanitize=undefined} option is used to link a program,
18845 the GCC driver automatically links against @option{libubsan}.  If
18846 @file{libubsan} is available as a shared library, and the @option{-static}
18847 option is not used, then this links against the shared version of
18848 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18849 driver to link @file{libubsan} statically, without necessarily linking
18850 other libraries statically.
18852 @opindex static-libstdc++
18853 @item -static-libstdc++
18854 When the @command{g++} program is used to link a C++ program, it
18855 normally automatically links against @option{libstdc++}.  If
18856 @file{libstdc++} is available as a shared library, and the
18857 @option{-static} option is not used, then this links against the
18858 shared version of @file{libstdc++}.  That is normally fine.  However, it
18859 is sometimes useful to freeze the version of @file{libstdc++} used by
18860 the program without going all the way to a fully static link.  The
18861 @option{-static-libstdc++} option directs the @command{g++} driver to
18862 link @file{libstdc++} statically, without necessarily linking other
18863 libraries statically.
18865 @opindex symbolic
18866 @item -symbolic
18867 Bind references to global symbols when building a shared object.  Warn
18868 about any unresolved references (unless overridden by the link editor
18869 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18870 this option.
18872 @opindex T
18873 @cindex linker script
18874 @item -T @var{script}
18875 Use @var{script} as the linker script.  This option is supported by most
18876 systems using the GNU linker.  On some targets, such as bare-board
18877 targets without an operating system, the @option{-T} option may be required
18878 when linking to avoid references to undefined symbols.
18880 @opindex Xlinker
18881 @item -Xlinker @var{option}
18882 Pass @var{option} as an option to the linker.  You can use this to
18883 supply system-specific linker options that GCC does not recognize.
18885 If you want to pass an option that takes a separate argument, you must use
18886 @option{-Xlinker} twice, once for the option and once for the argument.
18887 For example, to pass @option{-assert definitions}, you must write
18888 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18889 @option{-Xlinker "-assert definitions"}, because this passes the entire
18890 string as a single argument, which is not what the linker expects.
18892 When using the GNU linker, it is usually more convenient to pass
18893 arguments to linker options using the @option{@var{option}=@var{value}}
18894 syntax than as separate arguments.  For example, you can specify
18895 @option{-Xlinker -Map=output.map} rather than
18896 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18897 this syntax for command-line options.
18899 @opindex Wl
18900 @item -Wl,@var{option}
18901 Pass @var{option} as an option to the linker.  If @var{option} contains
18902 commas, it is split into multiple options at the commas.  You can use this
18903 syntax to pass an argument to the option.
18904 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18905 linker.  When using the GNU linker, you can also get the same effect with
18906 @option{-Wl,-Map=output.map}.
18908 @opindex u
18909 @item -u @var{symbol}
18910 Pretend the symbol @var{symbol} is undefined, to force linking of
18911 library modules to define it.  You can use @option{-u} multiple times with
18912 different symbols to force loading of additional library modules.
18914 @opindex z
18915 @item -z @var{keyword}
18916 @option{-z} is passed directly on to the linker along with the keyword
18917 @var{keyword}. See the section in the documentation of your linker for
18918 permitted values and their meanings.
18919 @end table
18921 @node Directory Options
18922 @section Options for Directory Search
18923 @cindex directory options
18924 @cindex options, directory search
18925 @cindex search path
18927 These options specify directories to search for header files, for
18928 libraries and for parts of the compiler:
18930 @table @gcctabopt
18931 @include cppdiropts.texi
18933 @opindex iplugindir=
18934 @item -iplugindir=@var{dir}
18935 Set the directory to search for plugins that are passed
18936 by @option{-fplugin=@var{name}} instead of
18937 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18938 to be used by the user, but only passed by the driver.
18940 @opindex L
18941 @item -L@var{dir}
18942 Add directory @var{dir} to the list of directories to be searched
18943 for @option{-l}.
18945 @opindex B
18946 @item -B@var{prefix}
18947 This option specifies where to find the executables, libraries,
18948 include files, and data files of the compiler itself.
18950 The compiler driver program runs one or more of the subprograms
18951 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18952 @var{prefix} as a prefix for each program it tries to run, both with and
18953 without @samp{@var{machine}/@var{version}/} for the corresponding target
18954 machine and compiler version.
18956 For each subprogram to be run, the compiler driver first tries the
18957 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18958 is not specified, the driver tries two standard prefixes, 
18959 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18960 those results in a file name that is found, the unmodified program
18961 name is searched for using the directories specified in your
18962 @env{PATH} environment variable.
18964 The compiler checks to see if the path provided by @option{-B}
18965 refers to a directory, and if necessary it adds a directory
18966 separator character at the end of the path.
18968 @option{-B} prefixes that effectively specify directory names also apply
18969 to libraries in the linker, because the compiler translates these
18970 options into @option{-L} options for the linker.  They also apply to
18971 include files in the preprocessor, because the compiler translates these
18972 options into @option{-isystem} options for the preprocessor.  In this case,
18973 the compiler appends @samp{include} to the prefix.
18975 The runtime support file @file{libgcc.a} can also be searched for using
18976 the @option{-B} prefix, if needed.  If it is not found there, the two
18977 standard prefixes above are tried, and that is all.  The file is left
18978 out of the link if it is not found by those means.
18980 Another way to specify a prefix much like the @option{-B} prefix is to use
18981 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18982 Variables}.
18984 As a special kludge, if the path provided by @option{-B} is
18985 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18986 9, then it is replaced by @file{[dir/]include}.  This is to help
18987 with boot-strapping the compiler.
18989 @opindex no-canonical-prefixes
18990 @item -no-canonical-prefixes
18991 Do not expand any symbolic links, resolve references to @samp{/../}
18992 or @samp{/./}, or make the path absolute when generating a relative
18993 prefix.
18995 @opindex sysroot
18996 @item --sysroot=@var{dir}
18997 Use @var{dir} as the logical root directory for headers and libraries.
18998 For example, if the compiler normally searches for headers in
18999 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
19000 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
19002 If you use both this option and the @option{-isysroot} option, then
19003 the @option{--sysroot} option applies to libraries, but the
19004 @option{-isysroot} option applies to header files.
19006 The GNU linker (beginning with version 2.16) has the necessary support
19007 for this option.  If your linker does not support this option, the
19008 header file aspect of @option{--sysroot} still works, but the
19009 library aspect does not.
19011 @opindex no-sysroot-suffix
19012 @item --no-sysroot-suffix
19013 For some targets, a suffix is added to the root directory specified
19014 with @option{--sysroot}, depending on the other options used, so that
19015 headers may for example be found in
19016 @file{@var{dir}/@var{suffix}/usr/include} instead of
19017 @file{@var{dir}/usr/include}.  This option disables the addition of
19018 such a suffix.
19020 @end table
19022 @node Code Gen Options
19023 @section Options for Code Generation Conventions
19024 @cindex code generation conventions
19025 @cindex options, code generation
19026 @cindex run-time options
19028 These machine-independent options control the interface conventions
19029 used in code generation.
19031 Most of them have both positive and negative forms; the negative form
19032 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
19033 one of the forms is listed---the one that is not the default.  You
19034 can figure out the other form by either removing @samp{no-} or adding
19037 @table @gcctabopt
19038 @opindex fstack_reuse
19039 @item -fstack-reuse=@var{reuse-level}
19040 This option controls stack space reuse for user declared local/auto variables
19041 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
19042 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
19043 local variables and temporaries, @samp{named_vars} enables the reuse only for
19044 user defined local variables with names, and @samp{none} disables stack reuse
19045 completely. The default value is @samp{all}. The option is needed when the
19046 program extends the lifetime of a scoped local variable or a compiler generated
19047 temporary beyond the end point defined by the language.  When a lifetime of
19048 a variable ends, and if the variable lives in memory, the optimizing compiler
19049 has the freedom to reuse its stack space with other temporaries or scoped
19050 local variables whose live range does not overlap with it. Legacy code extending
19051 local lifetime is likely to break with the stack reuse optimization.
19053 For example,
19055 @smallexample
19056    int *p;
19057    @{
19058      int local1;
19060      p = &local1;
19061      local1 = 10;
19062      ....
19063    @}
19064    @{
19065       int local2;
19066       local2 = 20;
19067       ...
19068    @}
19070    if (*p == 10)  // out of scope use of local1
19071      @{
19073      @}
19074 @end smallexample
19076 Another example:
19077 @smallexample
19079    struct A
19080    @{
19081        A(int k) : i(k), j(k) @{ @}
19082        int i;
19083        int j;
19084    @};
19086    A *ap;
19088    void foo(const A& ar)
19089    @{
19090       ap = &ar;
19091    @}
19093    void bar()
19094    @{
19095       foo(A(10)); // temp object's lifetime ends when foo returns
19097       @{
19098         A a(20);
19099         ....
19100       @}
19101       ap->i+= 10;  // ap references out of scope temp whose space
19102                    // is reused with a. What is the value of ap->i?
19103    @}
19105 @end smallexample
19107 The lifetime of a compiler generated temporary is well defined by the C++
19108 standard. When a lifetime of a temporary ends, and if the temporary lives
19109 in memory, the optimizing compiler has the freedom to reuse its stack
19110 space with other temporaries or scoped local variables whose live range
19111 does not overlap with it. However some of the legacy code relies on
19112 the behavior of older compilers in which temporaries' stack space is
19113 not reused, the aggressive stack reuse can lead to runtime errors. This
19114 option is used to control the temporary stack reuse optimization.
19116 @opindex ftrapv
19117 @item -ftrapv
19118 This option generates traps for signed overflow on addition, subtraction,
19119 multiplication operations.
19120 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
19121 @option{-ftrapv} @option{-fwrapv} on the command-line results in
19122 @option{-fwrapv} being effective.  Note that only active options override, so
19123 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
19124 results in @option{-ftrapv} being effective.
19126 @opindex fwrapv
19127 @item -fwrapv
19128 This option instructs the compiler to assume that signed arithmetic
19129 overflow of addition, subtraction and multiplication wraps around
19130 using twos-complement representation.  This flag enables some optimizations
19131 and disables others.
19132 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
19133 @option{-ftrapv} @option{-fwrapv} on the command-line results in
19134 @option{-fwrapv} being effective.  Note that only active options override, so
19135 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
19136 results in @option{-ftrapv} being effective.
19138 @opindex fwrapv-pointer
19139 @item -fwrapv-pointer
19140 This option instructs the compiler to assume that pointer arithmetic
19141 overflow on addition and subtraction wraps around using twos-complement
19142 representation.  This flag disables some optimizations which assume
19143 pointer overflow is invalid.
19145 @opindex fstrict-overflow
19146 @item -fstrict-overflow
19147 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
19148 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
19150 @opindex fexceptions
19151 @item -fexceptions
19152 Enable exception handling.  Generates extra code needed to propagate
19153 exceptions.  For some targets, this implies GCC generates frame
19154 unwind information for all functions, which can produce significant data
19155 size overhead, although it does not affect execution.  If you do not
19156 specify this option, GCC enables it by default for languages like
19157 C++ that normally require exception handling, and disables it for
19158 languages like C that do not normally require it.  However, you may need
19159 to enable this option when compiling C code that needs to interoperate
19160 properly with exception handlers written in C++.  You may also wish to
19161 disable this option if you are compiling older C++ programs that don't
19162 use exception handling.
19164 @opindex fnon-call-exceptions
19165 @item -fnon-call-exceptions
19166 Generate code that allows trapping instructions to throw exceptions.
19167 Note that this requires platform-specific runtime support that does
19168 not exist everywhere.  Moreover, it only allows @emph{trapping}
19169 instructions to throw exceptions, i.e.@: memory references or floating-point
19170 instructions.  It does not allow exceptions to be thrown from
19171 arbitrary signal handlers such as @code{SIGALRM}.  This enables
19172 @option{-fexceptions}.
19174 @opindex fdelete-dead-exceptions
19175 @item -fdelete-dead-exceptions
19176 Consider that instructions that may throw exceptions but don't otherwise
19177 contribute to the execution of the program can be optimized away.
19178 This does not affect calls to functions except those with the
19179 @code{pure} or @code{const} attributes.
19180 This option is enabled by default for the Ada and C++ compilers, as permitted by
19181 the language specifications.
19182 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
19184 @opindex funwind-tables
19185 @item -funwind-tables
19186 Similar to @option{-fexceptions}, except that it just generates any needed
19187 static data, but does not affect the generated code in any other way.
19188 You normally do not need to enable this option; instead, a language processor
19189 that needs this handling enables it on your behalf.
19191 @opindex fasynchronous-unwind-tables
19192 @item -fasynchronous-unwind-tables
19193 Generate unwind table in DWARF format, if supported by target machine.  The
19194 table is exact at each instruction boundary, so it can be used for stack
19195 unwinding from asynchronous events (such as debugger or garbage collector).
19197 @opindex fno-gnu-unique
19198 @opindex fgnu-unique
19199 @item -fno-gnu-unique
19200 On systems with recent GNU assembler and C library, the C++ compiler
19201 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
19202 of template static data members and static local variables in inline
19203 functions are unique even in the presence of @code{RTLD_LOCAL}; this
19204 is necessary to avoid problems with a library used by two different
19205 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
19206 therefore disagreeing with the other one about the binding of the
19207 symbol.  But this causes @code{dlclose} to be ignored for affected
19208 DSOs; if your program relies on reinitialization of a DSO via
19209 @code{dlclose} and @code{dlopen}, you can use
19210 @option{-fno-gnu-unique}.
19212 @opindex fpcc-struct-return
19213 @item -fpcc-struct-return
19214 Return ``short'' @code{struct} and @code{union} values in memory like
19215 longer ones, rather than in registers.  This convention is less
19216 efficient, but it has the advantage of allowing intercallability between
19217 GCC-compiled files and files compiled with other compilers, particularly
19218 the Portable C Compiler (pcc).
19220 The precise convention for returning structures in memory depends
19221 on the target configuration macros.
19223 Short structures and unions are those whose size and alignment match
19224 that of some integer type.
19226 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
19227 switch is not binary compatible with code compiled with the
19228 @option{-freg-struct-return} switch.
19229 Use it to conform to a non-default application binary interface.
19231 @opindex freg-struct-return
19232 @item -freg-struct-return
19233 Return @code{struct} and @code{union} values in registers when possible.
19234 This is more efficient for small structures than
19235 @option{-fpcc-struct-return}.
19237 If you specify neither @option{-fpcc-struct-return} nor
19238 @option{-freg-struct-return}, GCC defaults to whichever convention is
19239 standard for the target.  If there is no standard convention, GCC
19240 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
19241 the principal compiler.  In those cases, we can choose the standard, and
19242 we chose the more efficient register return alternative.
19244 @strong{Warning:} code compiled with the @option{-freg-struct-return}
19245 switch is not binary compatible with code compiled with the
19246 @option{-fpcc-struct-return} switch.
19247 Use it to conform to a non-default application binary interface.
19249 @opindex fshort-enums
19250 @item -fshort-enums
19251 Allocate to an @code{enum} type only as many bytes as it needs for the
19252 declared range of possible values.  Specifically, the @code{enum} type
19253 is equivalent to the smallest integer type that has enough room.
19254 This option has no effect for an enumeration type with a fixed underlying
19255 type.
19257 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
19258 code that is not binary compatible with code generated without that switch.
19259 Use it to conform to a non-default application binary interface.
19261 @opindex fshort-wchar
19262 @item -fshort-wchar
19263 Override the underlying type for @code{wchar_t} to be @code{short
19264 unsigned int} instead of the default for the target.  This option is
19265 useful for building programs to run under WINE@.
19267 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
19268 code that is not binary compatible with code generated without that switch.
19269 Use it to conform to a non-default application binary interface.
19271 @opindex fcommon
19272 @opindex fno-common
19273 @cindex tentative definitions
19274 @item -fcommon
19275 In C code, this option controls the placement of global variables
19276 defined without an initializer, known as @dfn{tentative definitions}
19277 in the C standard.  Tentative definitions are distinct from declarations
19278 of a variable with the @code{extern} keyword, which do not allocate storage.
19280 The default is @option{-fno-common}, which specifies that the compiler places
19281 uninitialized global variables in the BSS section of the object file.
19282 This inhibits the merging of tentative definitions by the linker so you get a
19283 multiple-definition error if the same variable is accidentally defined in more
19284 than one compilation unit.
19286 The @option{-fcommon} places uninitialized global variables in a common block.
19287 This allows the linker to resolve all tentative definitions of the same variable
19288 in different compilation units to the same object, or to a non-tentative
19289 definition.  This behavior is inconsistent with C++, and on many targets implies
19290 a speed and code size penalty on global variable references.  It is mainly
19291 useful to enable legacy code to link without errors.
19293 @opindex fno-ident
19294 @opindex fident
19295 @item -fno-ident
19296 Ignore the @code{#ident} directive.
19298 @opindex finhibit-size-directive
19299 @item -finhibit-size-directive
19300 Don't output a @code{.size} assembler directive, or anything else that
19301 would cause trouble if the function is split in the middle, and the
19302 two halves are placed at locations far apart in memory.  This option is
19303 used when compiling @file{crtstuff.c}; you should not need to use it
19304 for anything else.
19306 @opindex fverbose-asm
19307 @item -fverbose-asm
19308 Put extra commentary information in the generated assembly code to
19309 make it more readable.  This option is generally only of use to those
19310 who actually need to read the generated assembly code (perhaps while
19311 debugging the compiler itself).
19313 @option{-fno-verbose-asm}, the default, causes the
19314 extra information to be omitted and is useful when comparing two assembler
19315 files.
19317 The added comments include:
19319 @itemize @bullet
19321 @item
19322 information on the compiler version and command-line options,
19324 @item
19325 the source code lines associated with the assembly instructions,
19326 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
19328 @item
19329 hints on which high-level expressions correspond to
19330 the various assembly instruction operands.
19332 @end itemize
19334 For example, given this C source file:
19336 @smallexample
19337 int test (int n)
19339   int i;
19340   int total = 0;
19342   for (i = 0; i < n; i++)
19343     total += i * i;
19345   return total;
19347 @end smallexample
19349 compiling to (x86_64) assembly via @option{-S} and emitting the result
19350 direct to stdout via @option{-o} @option{-}
19352 @smallexample
19353 gcc -S test.c -fverbose-asm -Os -o -
19354 @end smallexample
19356 gives output similar to this:
19358 @smallexample
19359         .file   "test.c"
19360 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
19361   [...snip...]
19362 # options passed:
19363   [...snip...]
19365         .text
19366         .globl  test
19367         .type   test, @@function
19368 test:
19369 .LFB0:
19370         .cfi_startproc
19371 # test.c:4:   int total = 0;
19372         xorl    %eax, %eax      # <retval>
19373 # test.c:6:   for (i = 0; i < n; i++)
19374         xorl    %edx, %edx      # i
19375 .L2:
19376 # test.c:6:   for (i = 0; i < n; i++)
19377         cmpl    %edi, %edx      # n, i
19378         jge     .L5     #,
19379 # test.c:7:     total += i * i;
19380         movl    %edx, %ecx      # i, tmp92
19381         imull   %edx, %ecx      # i, tmp92
19382 # test.c:6:   for (i = 0; i < n; i++)
19383         incl    %edx    # i
19384 # test.c:7:     total += i * i;
19385         addl    %ecx, %eax      # tmp92, <retval>
19386         jmp     .L2     #
19387 .L5:
19388 # test.c:10: @}
19389         ret
19390         .cfi_endproc
19391 .LFE0:
19392         .size   test, .-test
19393         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
19394         .section        .note.GNU-stack,"",@@progbits
19395 @end smallexample
19397 The comments are intended for humans rather than machines and hence the
19398 precise format of the comments is subject to change.
19400 @opindex frecord-gcc-switches
19401 @item -frecord-gcc-switches
19402 This switch causes the command line used to invoke the
19403 compiler to be recorded into the object file that is being created.
19404 This switch is only implemented on some targets and the exact format
19405 of the recording is target and binary file format dependent, but it
19406 usually takes the form of a section containing ASCII text.  This
19407 switch is related to the @option{-fverbose-asm} switch, but that
19408 switch only records information in the assembler output file as
19409 comments, so it never reaches the object file.
19410 See also @option{-grecord-gcc-switches} for another
19411 way of storing compiler options into the object file.
19413 @opindex fpic
19414 @cindex global offset table
19415 @cindex PIC
19416 @item -fpic
19417 Generate position-independent code (PIC) suitable for use in a shared
19418 library, if supported for the target machine.  Such code accesses all
19419 constant addresses through a global offset table (GOT)@.  The dynamic
19420 loader resolves the GOT entries when the program starts (the dynamic
19421 loader is not part of GCC; it is part of the operating system).  If
19422 the GOT size for the linked executable exceeds a machine-specific
19423 maximum size, you get an error message from the linker indicating that
19424 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
19425 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
19426 on the m68k and RS/6000.  The x86 has no such limit.)
19428 Position-independent code requires special support, and therefore works
19429 only on certain machines.  For the x86, GCC supports PIC for System V
19430 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
19431 position-independent.
19433 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
19434 are defined to 1.
19436 @opindex fPIC
19437 @item -fPIC
19438 If supported for the target machine, emit position-independent code,
19439 suitable for dynamic linking and avoiding any limit on the size of the
19440 global offset table.  This option makes a difference on AArch64, m68k,
19441 PowerPC and SPARC@.
19443 Position-independent code requires special support, and therefore works
19444 only on certain machines.
19446 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
19447 are defined to 2.
19449 @opindex fpie
19450 @opindex fPIE
19451 @item -fpie
19452 @itemx -fPIE
19453 These options are similar to @option{-fpic} and @option{-fPIC}, but the
19454 generated position-independent code can be only linked into executables.
19455 Usually these options are used to compile code that will be linked using
19456 the @option{-pie} GCC option.
19458 @option{-fpie} and @option{-fPIE} both define the macros
19459 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
19460 for @option{-fpie} and 2 for @option{-fPIE}.
19462 @opindex fno-plt
19463 @opindex fplt
19464 @item -fno-plt
19465 Do not use the PLT for external function calls in position-independent code.
19466 Instead, load the callee address at call sites from the GOT and branch to it.
19467 This leads to more efficient code by eliminating PLT stubs and exposing
19468 GOT loads to optimizations.  On architectures such as 32-bit x86 where
19469 PLT stubs expect the GOT pointer in a specific register, this gives more
19470 register allocation freedom to the compiler.
19471 Lazy binding requires use of the PLT; 
19472 with @option{-fno-plt} all external symbols are resolved at load time.
19474 Alternatively, the function attribute @code{noplt} can be used to avoid calls
19475 through the PLT for specific external functions.
19477 In position-dependent code, a few targets also convert calls to
19478 functions that are marked to not use the PLT to use the GOT instead.
19480 @opindex fno-jump-tables
19481 @opindex fjump-tables
19482 @item -fno-jump-tables
19483 Do not use jump tables for switch statements even where it would be
19484 more efficient than other code generation strategies.  This option is
19485 of use in conjunction with @option{-fpic} or @option{-fPIC} for
19486 building code that forms part of a dynamic linker and cannot
19487 reference the address of a jump table.  On some targets, jump tables
19488 do not require a GOT and this option is not needed.
19490 @opindex fno-bit-tests
19491 @opindex fbit-tests
19492 @item -fno-bit-tests
19493 Do not use bit tests for switch statements even where it would be
19494 more efficient than other code generation strategies.
19496 @opindex ffixed
19497 @item -ffixed-@var{reg}
19498 Treat the register named @var{reg} as a fixed register; generated code
19499 should never refer to it (except perhaps as a stack pointer, frame
19500 pointer or in some other fixed role).
19502 @var{reg} must be the name of a register.  The register names accepted
19503 are machine-specific and are defined in the @code{REGISTER_NAMES}
19504 macro in the machine description macro file.
19506 This flag does not have a negative form, because it specifies a
19507 three-way choice.
19509 @opindex fcall-used
19510 @item -fcall-used-@var{reg}
19511 Treat the register named @var{reg} as an allocable register that is
19512 clobbered by function calls.  It may be allocated for temporaries or
19513 variables that do not live across a call.  Functions compiled this way
19514 do not save and restore the register @var{reg}.
19516 It is an error to use this flag with the frame pointer or stack pointer.
19517 Use of this flag for other registers that have fixed pervasive roles in
19518 the machine's execution model produces disastrous results.
19520 This flag does not have a negative form, because it specifies a
19521 three-way choice.
19523 @opindex fcall-saved
19524 @item -fcall-saved-@var{reg}
19525 Treat the register named @var{reg} as an allocable register saved by
19526 functions.  It may be allocated even for temporaries or variables that
19527 live across a call.  Functions compiled this way save and restore
19528 the register @var{reg} if they use it.
19530 It is an error to use this flag with the frame pointer or stack pointer.
19531 Use of this flag for other registers that have fixed pervasive roles in
19532 the machine's execution model produces disastrous results.
19534 A different sort of disaster results from the use of this flag for
19535 a register in which function values may be returned.
19537 This flag does not have a negative form, because it specifies a
19538 three-way choice.
19540 @opindex fpack-struct
19541 @item -fpack-struct[=@var{n}]
19542 Without a value specified, pack all structure members together without
19543 holes.  When a value is specified (which must be a small power of two), pack
19544 structure members according to this value, representing the maximum
19545 alignment (that is, objects with default alignment requirements larger than
19546 this are output potentially unaligned at the next fitting location.
19548 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
19549 code that is not binary compatible with code generated without that switch.
19550 Additionally, it makes the code suboptimal.
19551 Use it to conform to a non-default application binary interface.
19553 @opindex fleading-underscore
19554 @item -fleading-underscore
19555 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19556 change the way C symbols are represented in the object file.  One use
19557 is to help link with legacy assembly code.
19559 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19560 generate code that is not binary compatible with code generated without that
19561 switch.  Use it to conform to a non-default application binary interface.
19562 Not all targets provide complete support for this switch.
19564 @opindex ftls-model
19565 @item -ftls-model=@var{model}
19566 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19567 The @var{model} argument should be one of @samp{global-dynamic},
19568 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
19569 Note that the choice is subject to optimization: the compiler may use
19570 a more efficient model for symbols not visible outside of the translation
19571 unit, or if @option{-fpic} is not given on the command line.
19573 The default without @option{-fpic} is @samp{initial-exec}; with
19574 @option{-fpic} the default is @samp{global-dynamic}.
19576 @opindex ftrampolines
19577 @item -ftrampolines
19578 For targets that normally need trampolines for nested functions, always
19579 generate them instead of using descriptors.  Otherwise, for targets that
19580 do not need them, like for example HP-PA or IA-64, do nothing.
19582 A trampoline is a small piece of code that is created at run time on the
19583 stack when the address of a nested function is taken, and is used to call
19584 the nested function indirectly.  Therefore, it requires the stack to be
19585 made executable in order for the program to work properly.
19587 @option{-fno-trampolines} is enabled by default on a language by language
19588 basis to let the compiler avoid generating them, if it computes that this
19589 is safe, and replace them with descriptors.  Descriptors are made up of data
19590 only, but the generated code must be prepared to deal with them.  As of this
19591 writing, @option{-fno-trampolines} is enabled by default only for Ada.
19593 Moreover, code compiled with @option{-ftrampolines} and code compiled with
19594 @option{-fno-trampolines} are not binary compatible if nested functions are
19595 present.  This option must therefore be used on a program-wide basis and be
19596 manipulated with extreme care.
19598 For languages other than Ada, the @code{-ftrampolines} and
19599 @code{-fno-trampolines} options currently have no effect, and
19600 trampolines are always generated on platforms that need them
19601 for nested functions.
19603 @opindex ftrampoline-impl
19604 @item -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
19605 By default, trampolines are generated on stack.  However, certain platforms
19606 (such as the Apple M1) do not permit an executable stack.  Compiling with
19607 @option{-ftrampoline-impl=heap} generate calls to
19608 @code{__gcc_nested_func_ptr_created} and
19609 @code{__gcc_nested_func_ptr_deleted} in order to allocate and
19610 deallocate trampoline space on the executable heap.  These functions are
19611 implemented in libgcc, and will only be provided on specific targets:
19612 x86_64 Darwin, x86_64 and aarch64 Linux.  @emph{PLEASE NOTE}: Heap
19613 trampolines are @emph{not} guaranteed to be correctly deallocated if you
19614 @code{setjmp}, instantiate nested functions, and then @code{longjmp} back
19615 to a state prior to having allocated those nested functions.
19617 @opindex fvisibility
19618 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
19619 Set the default ELF image symbol visibility to the specified option---all
19620 symbols are marked with this unless overridden within the code.
19621 Using this feature can very substantially improve linking and
19622 load times of shared object libraries, produce more optimized
19623 code, provide near-perfect API export and prevent symbol clashes.
19624 It is @strong{strongly} recommended that you use this in any shared objects
19625 you distribute.
19627 Despite the nomenclature, @samp{default} always means public; i.e.,
19628 available to be linked against from outside the shared object.
19629 @samp{protected} and @samp{internal} are pretty useless in real-world
19630 usage so the only other commonly used option is @samp{hidden}.
19631 The default if @option{-fvisibility} isn't specified is
19632 @samp{default}, i.e., make every symbol public.
19634 A good explanation of the benefits offered by ensuring ELF
19635 symbols have the correct visibility is given by ``How To Write
19636 Shared Libraries'' by Ulrich Drepper (which can be found at
19637 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
19638 solution made possible by this option to marking things hidden when
19639 the default is public is to make the default hidden and mark things
19640 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
19641 and @code{__attribute__ ((visibility("default")))} instead of
19642 @code{__declspec(dllexport)} you get almost identical semantics with
19643 identical syntax.  This is a great boon to those working with
19644 cross-platform projects.
19646 For those adding visibility support to existing code, you may find
19647 @code{#pragma GCC visibility} of use.  This works by you enclosing
19648 the declarations you wish to set visibility for with (for example)
19649 @code{#pragma GCC visibility push(hidden)} and
19650 @code{#pragma GCC visibility pop}.
19651 Bear in mind that symbol visibility should be viewed @strong{as
19652 part of the API interface contract} and thus all new code should
19653 always specify visibility when it is not the default; i.e., declarations
19654 only for use within the local DSO should @strong{always} be marked explicitly
19655 as hidden as so to avoid PLT indirection overheads---making this
19656 abundantly clear also aids readability and self-documentation of the code.
19657 Note that due to ISO C++ specification requirements, @code{operator new} and
19658 @code{operator delete} must always be of default visibility.
19660 Be aware that headers from outside your project, in particular system
19661 headers and headers from any other library you use, may not be
19662 expecting to be compiled with visibility other than the default.  You
19663 may need to explicitly say @code{#pragma GCC visibility push(default)}
19664 before including any such headers.
19666 @code{extern} declarations are not affected by @option{-fvisibility}, so
19667 a lot of code can be recompiled with @option{-fvisibility=hidden} with
19668 no modifications.  However, this means that calls to @code{extern}
19669 functions with no explicit visibility use the PLT, so it is more
19670 effective to use @code{__attribute ((visibility))} and/or
19671 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
19672 declarations should be treated as hidden.
19674 Note that @option{-fvisibility} does affect C++ vague linkage
19675 entities. This means that, for instance, an exception class that is
19676 be thrown between DSOs must be explicitly marked with default
19677 visibility so that the @samp{type_info} nodes are unified between
19678 the DSOs.
19680 An overview of these techniques, their benefits and how to use them
19681 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
19683 @opindex fstrict-volatile-bitfields
19684 @item -fstrict-volatile-bitfields
19685 This option should be used if accesses to volatile bit-fields (or other
19686 structure fields, although the compiler usually honors those types
19687 anyway) should use a single access of the width of the
19688 field's type, aligned to a natural alignment if possible.  For
19689 example, targets with memory-mapped peripheral registers might require
19690 all such accesses to be 16 bits wide; with this flag you can
19691 declare all peripheral bit-fields as @code{unsigned short} (assuming short
19692 is 16 bits on these targets) to force GCC to use 16-bit accesses
19693 instead of, perhaps, a more efficient 32-bit access.
19695 If this option is disabled, the compiler uses the most efficient
19696 instruction.  In the previous example, that might be a 32-bit load
19697 instruction, even though that accesses bytes that do not contain
19698 any portion of the bit-field, or memory-mapped registers unrelated to
19699 the one being updated.
19701 In some cases, such as when the @code{packed} attribute is applied to a 
19702 structure field, it may not be possible to access the field with a single
19703 read or write that is correctly aligned for the target machine.  In this
19704 case GCC falls back to generating multiple accesses rather than code that 
19705 will fault or truncate the result at run time.
19707 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
19708 not allowed to touch non bit-field members.  It is therefore recommended
19709 to define all bits of the field's type as bit-field members.
19711 The default value of this option is determined by the application binary
19712 interface for the target processor.
19714 @opindex fsync-libcalls
19715 @item -fsync-libcalls
19716 This option controls whether any out-of-line instance of the @code{__sync}
19717 family of functions may be used to implement the C++11 @code{__atomic}
19718 family of functions.
19720 The default value of this option is enabled, thus the only useful form
19721 of the option is @option{-fno-sync-libcalls}.  This option is used in
19722 the implementation of the @file{libatomic} runtime library.
19724 @end table
19726 @node Developer Options
19727 @section GCC Developer Options
19728 @cindex developer options
19729 @cindex debugging GCC
19730 @cindex debug dump options
19731 @cindex dump options
19732 @cindex compilation statistics
19734 This section describes command-line options that are primarily of
19735 interest to GCC developers, including options to support compiler
19736 testing and investigation of compiler bugs and compile-time
19737 performance problems.  This includes options that produce debug dumps
19738 at various points in the compilation; that print statistics such as
19739 memory use and execution time; and that print information about GCC's
19740 configuration, such as where it searches for libraries.  You should
19741 rarely need to use any of these options for ordinary compilation and
19742 linking tasks.
19744 Many developer options that cause GCC to dump output to a file take an
19745 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19746 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19747 error.
19749 If @samp{=@var{filename}} is omitted, a default dump file name is
19750 constructed by concatenating the base dump file name, a pass number,
19751 phase letter, and pass name.  The base dump file name is the name of
19752 output file produced by the compiler if explicitly specified and not
19753 an executable; otherwise it is the source file name.
19754 The pass number is determined by the order passes are registered with
19755 the compiler's pass manager. 
19756 This is generally the same as the order of execution, but passes
19757 registered by plugins, target-specific passes, or passes that are
19758 otherwise registered late are numbered higher than the pass named
19759 @samp{final}, even if they are executed earlier.  The phase letter is
19760 one of @samp{i} (inter-procedural analysis), @samp{l}
19761 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19762 The files are created in the directory of the output file. 
19764 @table @gcctabopt
19766 @opindex fcallgraph-info
19767 @item -fcallgraph-info
19768 @itemx -fcallgraph-info=@var{MARKERS}
19769 Makes the compiler output callgraph information for the program, on a
19770 per-object-file basis.  The information is generated in the common VCG
19771 format.  It can be decorated with additional, per-node and/or per-edge
19772 information, if a list of comma-separated markers is additionally
19773 specified.  When the @code{su} marker is specified, the callgraph is
19774 decorated with stack usage information; it is equivalent to
19775 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19776 callgraph is decorated with information about dynamically allocated
19777 objects.
19779 When compiling with @option{-flto}, no callgraph information is output
19780 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19781 may generate multiple callgraph information files next to intermediate
19782 LTO output files.
19784 @opindex d
19785 @opindex fdump-rtl-@var{pass}
19786 @item -d@var{letters}
19787 @itemx -fdump-rtl-@var{pass}
19788 @itemx -fdump-rtl-@var{pass}=@var{filename}
19789 Says to make debugging dumps during compilation at times specified by
19790 @var{letters}.  This is used for debugging the RTL-based passes of the
19791 compiler.
19793 Some @option{-d@var{letters}} switches have different meaning when
19794 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19795 for information about preprocessor-specific dump options.
19797 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19798 @option{-d} option @var{letters}.  Here are the possible
19799 letters for use in @var{pass} and @var{letters}, and their meanings:
19801 @table @gcctabopt
19803 @opindex fdump-rtl-alignments
19804 @item -fdump-rtl-alignments
19805 Dump after branch alignments have been computed.
19807 @opindex fdump-rtl-asmcons
19808 @item -fdump-rtl-asmcons
19809 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19811 @opindex fdump-rtl-auto_inc_dec
19812 @item -fdump-rtl-auto_inc_dec
19813 Dump after auto-inc-dec discovery.  This pass is only run on
19814 architectures that have auto inc or auto dec instructions.
19816 @opindex fdump-rtl-barriers
19817 @item -fdump-rtl-barriers
19818 Dump after cleaning up the barrier instructions.
19820 @opindex fdump-rtl-bbpart
19821 @item -fdump-rtl-bbpart
19822 Dump after partitioning hot and cold basic blocks.
19824 @opindex fdump-rtl-bbro
19825 @item -fdump-rtl-bbro
19826 Dump after block reordering.
19828 @opindex fdump-rtl-btl2
19829 @opindex fdump-rtl-btl2
19830 @item -fdump-rtl-btl1
19831 @itemx -fdump-rtl-btl2
19832 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19833 after the two branch
19834 target load optimization passes.
19836 @opindex fdump-rtl-bypass
19837 @item -fdump-rtl-bypass
19838 Dump after jump bypassing and control flow optimizations.
19840 @opindex fdump-rtl-combine
19841 @item -fdump-rtl-combine
19842 Dump after the RTL instruction combination pass.
19844 @opindex fdump-rtl-compgotos
19845 @item -fdump-rtl-compgotos
19846 Dump after duplicating the computed gotos.
19848 @opindex fdump-rtl-ce1
19849 @opindex fdump-rtl-ce2
19850 @opindex fdump-rtl-ce3
19851 @item -fdump-rtl-ce1
19852 @itemx -fdump-rtl-ce2
19853 @itemx -fdump-rtl-ce3
19854 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19855 @option{-fdump-rtl-ce3} enable dumping after the three
19856 if conversion passes.
19858 @opindex fdump-rtl-cprop_hardreg
19859 @item -fdump-rtl-cprop_hardreg
19860 Dump after hard register copy propagation.
19862 @opindex fdump-rtl-csa
19863 @item -fdump-rtl-csa
19864 Dump after combining stack adjustments.
19866 @opindex fdump-rtl-cse1
19867 @opindex fdump-rtl-cse2
19868 @item -fdump-rtl-cse1
19869 @itemx -fdump-rtl-cse2
19870 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19871 the two common subexpression elimination passes.
19873 @opindex fdump-rtl-dce
19874 @item -fdump-rtl-dce
19875 Dump after the standalone dead code elimination passes.
19877 @opindex fdump-rtl-dbr
19878 @item -fdump-rtl-dbr
19879 Dump after delayed branch scheduling.
19881 @opindex fdump-rtl-dce1
19882 @opindex fdump-rtl-dce2
19883 @item -fdump-rtl-dce1
19884 @itemx -fdump-rtl-dce2
19885 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19886 the two dead store elimination passes.
19888 @opindex fdump-rtl-eh
19889 @item -fdump-rtl-eh
19890 Dump after finalization of EH handling code.
19892 @opindex fdump-rtl-eh_ranges
19893 @item -fdump-rtl-eh_ranges
19894 Dump after conversion of EH handling range regions.
19896 @opindex fdump-rtl-expand
19897 @item -fdump-rtl-expand
19898 Dump after RTL generation.
19900 @opindex fdump-rtl-fwprop1
19901 @opindex fdump-rtl-fwprop2
19902 @item -fdump-rtl-fwprop1
19903 @itemx -fdump-rtl-fwprop2
19904 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19905 dumping after the two forward propagation passes.
19907 @opindex fdump-rtl-gcse1
19908 @opindex fdump-rtl-gcse2
19909 @item -fdump-rtl-gcse1
19910 @itemx -fdump-rtl-gcse2
19911 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19912 after global common subexpression elimination.
19914 @opindex fdump-rtl-init-regs
19915 @item -fdump-rtl-init-regs
19916 Dump after the initialization of the registers.
19918 @opindex fdump-rtl-initvals
19919 @item -fdump-rtl-initvals
19920 Dump after the computation of the initial value sets.
19922 @opindex fdump-rtl-into_cfglayout
19923 @item -fdump-rtl-into_cfglayout
19924 Dump after converting to cfglayout mode.
19926 @opindex fdump-rtl-ira
19927 @item -fdump-rtl-ira
19928 Dump after iterated register allocation.
19930 @opindex fdump-rtl-jump
19931 @item -fdump-rtl-jump
19932 Dump after the second jump optimization.
19934 @opindex fdump-rtl-loop2
19935 @item -fdump-rtl-loop2
19936 @option{-fdump-rtl-loop2} enables dumping after the rtl
19937 loop optimization passes.
19939 @opindex fdump-rtl-mach
19940 @item -fdump-rtl-mach
19941 Dump after performing the machine dependent reorganization pass, if that
19942 pass exists.
19944 @opindex fdump-rtl-mode_sw
19945 @item -fdump-rtl-mode_sw
19946 Dump after removing redundant mode switches.
19948 @opindex fdump-rtl-rnreg
19949 @item -fdump-rtl-rnreg
19950 Dump after register renumbering.
19952 @opindex fdump-rtl-outof_cfglayout
19953 @item -fdump-rtl-outof_cfglayout
19954 Dump after converting from cfglayout mode.
19956 @opindex fdump-rtl-peephole2
19957 @item -fdump-rtl-peephole2
19958 Dump after the peephole pass.
19960 @opindex fdump-rtl-postreload
19961 @item -fdump-rtl-postreload
19962 Dump after post-reload optimizations.
19964 @opindex fdump-rtl-pro_and_epilogue
19965 @item -fdump-rtl-pro_and_epilogue
19966 Dump after generating the function prologues and epilogues.
19968 @opindex fdump-rtl-sched1
19969 @opindex fdump-rtl-sched2
19970 @item -fdump-rtl-sched1
19971 @itemx -fdump-rtl-sched2
19972 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19973 after the basic block scheduling passes.
19975 @opindex fdump-rtl-ree
19976 @item -fdump-rtl-ree
19977 Dump after sign/zero extension elimination.
19979 @opindex fdump-rtl-seqabstr
19980 @item -fdump-rtl-seqabstr
19981 Dump after common sequence discovery.
19983 @opindex fdump-rtl-shorten
19984 @item -fdump-rtl-shorten
19985 Dump after shortening branches.
19987 @opindex fdump-rtl-sibling
19988 @item -fdump-rtl-sibling
19989 Dump after sibling call optimizations.
19991 @opindex fdump-rtl-split1
19992 @opindex fdump-rtl-split2
19993 @opindex fdump-rtl-split3
19994 @opindex fdump-rtl-split4
19995 @opindex fdump-rtl-split5
19996 @item -fdump-rtl-split1
19997 @itemx -fdump-rtl-split2
19998 @itemx -fdump-rtl-split3
19999 @itemx -fdump-rtl-split4
20000 @itemx -fdump-rtl-split5
20001 These options enable dumping after five rounds of
20002 instruction splitting.
20004 @opindex fdump-rtl-sms
20005 @item -fdump-rtl-sms
20006 Dump after modulo scheduling.  This pass is only run on some
20007 architectures.
20009 @opindex fdump-rtl-stack
20010 @item -fdump-rtl-stack
20011 Dump after conversion from GCC's ``flat register file'' registers to the
20012 x87's stack-like registers.  This pass is only run on x86 variants.
20014 @opindex fdump-rtl-subreg1
20015 @opindex fdump-rtl-subreg2
20016 @item -fdump-rtl-subreg1
20017 @itemx -fdump-rtl-subreg2
20018 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
20019 the two subreg expansion passes.
20021 @opindex fdump-rtl-unshare
20022 @item -fdump-rtl-unshare
20023 Dump after all rtl has been unshared.
20025 @opindex fdump-rtl-vartrack
20026 @item -fdump-rtl-vartrack
20027 Dump after variable tracking.
20029 @opindex fdump-rtl-vregs
20030 @item -fdump-rtl-vregs
20031 Dump after converting virtual registers to hard registers.
20033 @opindex fdump-rtl-web
20034 @item -fdump-rtl-web
20035 Dump after live range splitting.
20037 @opindex fdump-rtl-regclass
20038 @opindex fdump-rtl-subregs_of_mode_init
20039 @opindex fdump-rtl-subregs_of_mode_finish
20040 @opindex fdump-rtl-dfinit
20041 @opindex fdump-rtl-dfinish
20042 @item -fdump-rtl-regclass
20043 @itemx -fdump-rtl-subregs_of_mode_init
20044 @itemx -fdump-rtl-subregs_of_mode_finish
20045 @itemx -fdump-rtl-dfinit
20046 @itemx -fdump-rtl-dfinish
20047 These dumps are defined but always produce empty files.
20049 @opindex da
20050 @opindex fdump-rtl-all
20051 @item -da
20052 @itemx -fdump-rtl-all
20053 Produce all the dumps listed above.
20055 @opindex dA
20056 @item -dA
20057 Annotate the assembler output with miscellaneous debugging information.
20059 @opindex dD
20060 @item -dD
20061 Dump all macro definitions, at the end of preprocessing, in addition to
20062 normal output.
20064 @opindex dH
20065 @item -dH
20066 Produce a core dump whenever an error occurs.
20068 @opindex dp
20069 @item -dp
20070 Annotate the assembler output with a comment indicating which
20071 pattern and alternative is used.  The length and cost of each instruction are
20072 also printed.
20074 @opindex dP
20075 @item -dP
20076 Dump the RTL in the assembler output as a comment before each instruction.
20077 Also turns on @option{-dp} annotation.
20079 @opindex dx
20080 @item -dx
20081 Just generate RTL for a function instead of compiling it.  Usually used
20082 with @option{-fdump-rtl-expand}.
20083 @end table
20085 @opindex fdump-debug
20086 @item -fdump-debug
20087 Dump debugging information generated during the debug
20088 generation phase.
20090 @opindex fdump-earlydebug
20091 @item -fdump-earlydebug
20092 Dump debugging information generated during the early debug
20093 generation phase.
20095 @opindex fdump-noaddr
20096 @item -fdump-noaddr
20097 When doing debugging dumps, suppress address output.  This makes it more
20098 feasible to use diff on debugging dumps for compiler invocations with
20099 different compiler binaries and/or different
20100 text / bss / data / heap / stack / dso start locations.
20102 @opindex freport-bug
20103 @item -freport-bug
20104 Collect and dump debug information into a temporary file if an
20105 internal compiler error (ICE) occurs.
20107 @opindex fdump-unnumbered
20108 @item -fdump-unnumbered
20109 When doing debugging dumps, suppress instruction numbers and address output.
20110 This makes it more feasible to use diff on debugging dumps for compiler
20111 invocations with different options, in particular with and without
20112 @option{-g}.
20114 @opindex fdump-unnumbered-links
20115 @item -fdump-unnumbered-links
20116 When doing debugging dumps (see @option{-d} option above), suppress
20117 instruction numbers for the links to the previous and next instructions
20118 in a sequence.
20120 @opindex fdump-ipa
20121 @item -fdump-ipa-@var{switch}
20122 @itemx -fdump-ipa-@var{switch}-@var{options}
20123 Control the dumping at various stages of inter-procedural analysis
20124 language tree to a file.  The file name is generated by appending a
20125 switch specific suffix to the source file name, and the file is created
20126 in the same directory as the output file.  The following dumps are
20127 possible:
20129 @table @samp
20130 @item all
20131 Enables all inter-procedural analysis dumps.
20133 @item cgraph
20134 Dumps information about call-graph optimization, unused function removal,
20135 and inlining decisions.
20137 @item inline
20138 Dump after function inlining.
20140 @item strubm
20141 Dump after selecting @code{strub} modes, and recording the selections as
20142 function attributes.
20144 @item strub
20145 Dump @code{strub} transformations: interface changes, function wrapping,
20146 and insertion of builtin calls for stack scrubbing and watermarking.
20148 @end table
20150 Additionally, the options @option{-optimized}, @option{-missed},
20151 @option{-note}, and @option{-all} can be provided, with the same meaning
20152 as for @option{-fopt-info}, defaulting to @option{-optimized}.
20154 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
20155 information on callsites that were inlined, along with callsites
20156 that were not inlined.
20158 By default, the dump will contain messages about successful
20159 optimizations (equivalent to @option{-optimized}) together with
20160 low-level details about the analysis.
20162 @opindex fdump-lang
20163 @item -fdump-lang
20164 Dump language-specific information.  The file name is made by appending
20165 @file{.lang} to the source file name.
20167 @opindex fdump-lang-all
20168 @opindex fdump-lang
20169 @item -fdump-lang-all
20170 @itemx -fdump-lang-@var{switch}
20171 @itemx -fdump-lang-@var{switch}-@var{options}
20172 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
20173 Control the dumping of language-specific information.  The @var{options}
20174 and @var{filename} portions behave as described in the
20175 @option{-fdump-tree} option.  The following @var{switch} values are
20176 accepted:
20178 @table @samp
20179 @item all
20181 Enable all language-specific dumps.
20183 @item class
20184 Dump class hierarchy information.  Virtual table information is emitted
20185 unless '@option{slim}' is specified.  This option is applicable to C++ only.
20187 @item module
20188 Dump module information.  Options @option{lineno} (locations),
20189 @option{graph} (reachability), @option{blocks} (clusters),
20190 @option{uid} (serialization), @option{alias} (mergeable),
20191 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
20192 (macros) may provide additional information.  This option is
20193 applicable to C++ only.
20195 @item raw
20196 Dump the raw internal tree data.  This option is applicable to C++ only.
20198 @end table
20200 @opindex fdump-passes
20201 @item -fdump-passes
20202 Print on @file{stderr} the list of optimization passes that are turned
20203 on and off by the current command-line options.
20205 @opindex fdump-statistics
20206 @item -fdump-statistics-@var{option}
20207 Enable and control dumping of pass statistics in a separate file.  The
20208 file name is generated by appending a suffix ending in
20209 @samp{.statistics} to the source file name, and the file is created in
20210 the same directory as the output file.  If the @samp{-@var{option}}
20211 form is used, @samp{-stats} causes counters to be summed over the
20212 whole compilation unit while @samp{-details} dumps every event as
20213 the passes generate them.  The default with no option is to sum
20214 counters for each function compiled.
20216 @opindex fdump-tree-all
20217 @opindex fdump-tree
20218 @item -fdump-tree-all
20219 @itemx -fdump-tree-@var{switch}
20220 @itemx -fdump-tree-@var{switch}-@var{options}
20221 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
20222 Control the dumping at various stages of processing the intermediate
20223 language tree to a file.  If the @samp{-@var{options}}
20224 form is used, @var{options} is a list of @samp{-} separated options
20225 which control the details of the dump.  Not all options are applicable
20226 to all dumps; those that are not meaningful are ignored.  The
20227 following options are available
20229 @table @samp
20230 @item address
20231 Print the address of each node.  Usually this is not meaningful as it
20232 changes according to the environment and source file.  Its primary use
20233 is for tying up a dump file with a debug environment.
20234 @item asmname
20235 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
20236 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
20237 use working backward from mangled names in the assembly file.
20238 @item slim
20239 When dumping front-end intermediate representations, inhibit dumping
20240 of members of a scope or body of a function merely because that scope
20241 has been reached.  Only dump such items when they are directly reachable
20242 by some other path.
20244 When dumping pretty-printed trees, this option inhibits dumping the
20245 bodies of control structures.
20247 When dumping RTL, print the RTL in slim (condensed) form instead of
20248 the default LISP-like representation.
20249 @item raw
20250 Print a raw representation of the tree.  By default, trees are
20251 pretty-printed into a C-like representation.
20252 @item details
20253 Enable more detailed dumps (not honored by every dump option). Also
20254 include information from the optimization passes.
20255 @item stats
20256 Enable dumping various statistics about the pass (not honored by every dump
20257 option).
20258 @item blocks
20259 Enable showing basic block boundaries (disabled in raw dumps).
20260 @item graph
20261 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
20262 dump a representation of the control flow graph suitable for viewing with
20263 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
20264 the file is pretty-printed as a subgraph, so that GraphViz can render them
20265 all in a single plot.
20267 This option currently only works for RTL dumps, and the RTL is always
20268 dumped in slim form.
20269 @item vops
20270 Enable showing virtual operands for every statement.
20271 @item lineno
20272 Enable showing line numbers for statements.
20273 @item uid
20274 Enable showing the unique ID (@code{DECL_UID}) for each variable.
20275 @item verbose
20276 Enable showing the tree dump for each statement.
20277 @item eh
20278 Enable showing the EH region number holding each statement.
20279 @item scev
20280 Enable showing scalar evolution analysis details.
20281 @item optimized
20282 Enable showing optimization information (only available in certain
20283 passes).
20284 @item missed
20285 Enable showing missed optimization information (only available in certain
20286 passes).
20287 @item note
20288 Enable other detailed optimization information (only available in
20289 certain passes).
20290 @item all
20291 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
20292 and @option{lineno}.
20293 @item optall
20294 Turn on all optimization options, i.e., @option{optimized},
20295 @option{missed}, and @option{note}.
20296 @end table
20298 To determine what tree dumps are available or find the dump for a pass
20299 of interest follow the steps below.
20301 @enumerate
20302 @item
20303 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
20304 look for a code that corresponds to the pass you are interested in.
20305 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
20306 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
20307 The number at the end distinguishes distinct invocations of the same pass.
20308 @item
20309 To enable the creation of the dump file, append the pass code to
20310 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
20311 to enable the dump from the Early Value Range Propagation pass, invoke
20312 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
20313 specify the name of the dump file.  If you don't specify one, GCC
20314 creates as described below.
20315 @item
20316 Find the pass dump in a file whose name is composed of three components
20317 separated by a period: the name of the source file GCC was invoked to
20318 compile, a numeric suffix indicating the pass number followed by the
20319 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
20320 and finally the pass code.  For example, the Early VRP pass dump might
20321 be in a file named @file{myfile.c.038t.evrp} in the current working
20322 directory.  Note that the numeric codes are not stable and may change
20323 from one version of GCC to another.
20324 @end enumerate
20326 @opindex fopt-info
20327 @item -fopt-info
20328 @itemx -fopt-info-@var{options}
20329 @itemx -fopt-info-@var{options}=@var{filename}
20330 Controls optimization dumps from various optimization passes. If the
20331 @samp{-@var{options}} form is used, @var{options} is a list of
20332 @samp{-} separated option keywords to select the dump details and
20333 optimizations.  
20335 The @var{options} can be divided into three groups:
20336 @enumerate
20337 @item
20338 options describing what kinds of messages should be emitted,
20339 @item
20340 options describing the verbosity of the dump, and
20341 @item
20342 options describing which optimizations should be included.
20343 @end enumerate
20344 The options from each group can be freely mixed as they are
20345 non-overlapping. However, in case of any conflicts,
20346 the later options override the earlier options on the command
20347 line. 
20349 The following options control which kinds of messages should be emitted:
20351 @table @samp
20352 @item optimized
20353 Print information when an optimization is successfully applied. It is
20354 up to a pass to decide which information is relevant. For example, the
20355 vectorizer passes print the source location of loops which are
20356 successfully vectorized.
20357 @item missed
20358 Print information about missed optimizations. Individual passes
20359 control which information to include in the output. 
20360 @item note
20361 Print verbose information about optimizations, such as certain
20362 transformations, more detailed messages about decisions etc.
20363 @item all
20364 Print detailed optimization information. This includes
20365 @samp{optimized}, @samp{missed}, and @samp{note}.
20366 @end table
20368 The following option controls the dump verbosity:
20370 @table @samp
20371 @item internals
20372 By default, only ``high-level'' messages are emitted. This option enables
20373 additional, more detailed, messages, which are likely to only be of interest
20374 to GCC developers.
20375 @end table
20377 One or more of the following option keywords can be used to describe a
20378 group of optimizations:
20380 @table @samp
20381 @item ipa
20382 Enable dumps from all interprocedural optimizations.
20383 @item loop
20384 Enable dumps from all loop optimizations.
20385 @item inline
20386 Enable dumps from all inlining optimizations.
20387 @item omp
20388 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
20389 @item vec
20390 Enable dumps from all vectorization optimizations.
20391 @item optall
20392 Enable dumps from all optimizations. This is a superset of
20393 the optimization groups listed above.
20394 @end table
20396 If @var{options} is
20397 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
20398 about successful optimizations from all the passes, omitting messages
20399 that are treated as ``internals''.
20401 If the @var{filename} is provided, then the dumps from all the
20402 applicable optimizations are concatenated into the @var{filename}.
20403 Otherwise the dump is output onto @file{stderr}. Though multiple
20404 @option{-fopt-info} options are accepted, only one of them can include
20405 a @var{filename}. If other filenames are provided then all but the
20406 first such option are ignored.
20408 Note that the output @var{filename} is overwritten
20409 in case of multiple translation units. If a combined output from
20410 multiple translation units is desired, @file{stderr} should be used
20411 instead.
20413 In the following example, the optimization info is output to
20414 @file{stderr}:
20416 @smallexample
20417 gcc -O3 -fopt-info
20418 @end smallexample
20420 This example:
20421 @smallexample
20422 gcc -O3 -fopt-info-missed=missed.all
20423 @end smallexample
20425 @noindent
20426 outputs missed optimization report from all the passes into
20427 @file{missed.all}, and this one:
20429 @smallexample
20430 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
20431 @end smallexample
20433 @noindent
20434 prints information about missed optimization opportunities from
20435 vectorization passes on @file{stderr}.  
20436 Note that @option{-fopt-info-vec-missed} is equivalent to 
20437 @option{-fopt-info-missed-vec}.  The order of the optimization group
20438 names and message types listed after @option{-fopt-info} does not matter.
20440 As another example,
20441 @smallexample
20442 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
20443 @end smallexample
20445 @noindent
20446 outputs information about missed optimizations as well as
20447 optimized locations from all the inlining passes into
20448 @file{inline.txt}.
20450 Finally, consider:
20452 @smallexample
20453 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
20454 @end smallexample
20456 @noindent
20457 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
20458 in conflict since only one output file is allowed. In this case, only
20459 the first option takes effect and the subsequent options are
20460 ignored. Thus only @file{vec.miss} is produced which contains
20461 dumps from the vectorizer about missed opportunities.
20463 @opindex fsave-optimization-record
20464 @item -fsave-optimization-record
20465 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
20466 were performed, for those optimizations that support @option{-fopt-info}.
20468 This option is experimental and the format of the data within the
20469 compressed JSON file is subject to change.
20471 It is roughly equivalent to a machine-readable version of
20472 @option{-fopt-info-all}, as a collection of messages with source file,
20473 line number and column number, with the following additional data for
20474 each message:
20476 @itemize @bullet
20478 @item
20479 the execution count of the code being optimized, along with metadata about
20480 whether this was from actual profile data, or just an estimate, allowing
20481 consumers to prioritize messages by code hotness,
20483 @item
20484 the function name of the code being optimized, where applicable,
20486 @item
20487 the ``inlining chain'' for the code being optimized, so that when
20488 a function is inlined into several different places (which might
20489 themselves be inlined), the reader can distinguish between the copies,
20491 @item
20492 objects identifying those parts of the message that refer to expressions,
20493 statements or symbol-table nodes, which of these categories they are, and,
20494 when available, their source code location,
20496 @item
20497 the GCC pass that emitted the message, and
20499 @item
20500 the location in GCC's own code from which the message was emitted
20502 @end itemize
20504 Additionally, some messages are logically nested within other
20505 messages, reflecting implementation details of the optimization
20506 passes.
20508 @opindex fsched-verbose
20509 @item -fsched-verbose=@var{n}
20510 On targets that use instruction scheduling, this option controls the
20511 amount of debugging output the scheduler prints to the dump files.
20513 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
20514 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
20515 For @var{n} greater than one, it also output basic block probabilities,
20516 detailed ready list information and unit/insn info.  For @var{n} greater
20517 than two, it includes RTL at abort point, control-flow and regions info.
20518 And for @var{n} over four, @option{-fsched-verbose} also includes
20519 dependence info.
20523 @opindex fdisable-
20524 @opindex fenable-
20525 @item -fenable-@var{kind}-@var{pass}
20526 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
20528 This is a set of options that are used to explicitly disable/enable
20529 optimization passes.  These options are intended for use for debugging GCC.
20530 Compiler users should use regular options for enabling/disabling
20531 passes instead.
20533 @table @gcctabopt
20535 @item -fdisable-ipa-@var{pass}
20536 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
20537 statically invoked in the compiler multiple times, the pass name should be
20538 appended with a sequential number starting from 1.
20540 @item -fdisable-rtl-@var{pass}
20541 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
20542 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20543 statically invoked in the compiler multiple times, the pass name should be
20544 appended with a sequential number starting from 1.  @var{range-list} is a 
20545 comma-separated list of function ranges or assembler names.  Each range is a number
20546 pair separated by a colon.  The range is inclusive in both ends.  If the range
20547 is trivial, the number pair can be simplified as a single number.  If the
20548 function's call graph node's @var{uid} falls within one of the specified ranges,
20549 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
20550 function header of a dump file, and the pass names can be dumped by using
20551 option @option{-fdump-passes}.
20553 @item -fdisable-tree-@var{pass}
20554 @itemx -fdisable-tree-@var{pass}=@var{range-list}
20555 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
20556 option arguments.
20558 @item -fenable-ipa-@var{pass}
20559 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20560 statically invoked in the compiler multiple times, the pass name should be
20561 appended with a sequential number starting from 1.
20563 @item -fenable-rtl-@var{pass}
20564 @itemx -fenable-rtl-@var{pass}=@var{range-list}
20565 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
20566 description and examples.
20568 @item -fenable-tree-@var{pass}
20569 @itemx -fenable-tree-@var{pass}=@var{range-list}
20570 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
20571 of option arguments.
20573 @end table
20575 Here are some examples showing uses of these options.
20577 @smallexample
20579 # disable ccp1 for all functions
20580    -fdisable-tree-ccp1
20581 # disable complete unroll for function whose cgraph node uid is 1
20582    -fenable-tree-cunroll=1
20583 # disable gcse2 for functions at the following ranges [1,1],
20584 # [300,400], and [400,1000]
20585 # disable gcse2 for functions foo and foo2
20586    -fdisable-rtl-gcse2=foo,foo2
20587 # disable early inlining
20588    -fdisable-tree-einline
20589 # disable ipa inlining
20590    -fdisable-ipa-inline
20591 # enable tree full unroll
20592    -fenable-tree-unroll
20594 @end smallexample
20596 @opindex fchecking
20597 @opindex fno-checking
20598 @item -fchecking
20599 @itemx -fchecking=@var{n}
20600 Enable internal consistency checking.  The default depends on
20601 the compiler configuration.  @option{-fchecking=2} enables further
20602 internal consistency checking that might affect code generation.
20604 @opindex frandom-seed
20605 @item -frandom-seed=@var{string}
20606 This option provides a seed that GCC uses in place of
20607 random numbers in generating certain symbol names
20608 that have to be different in every compiled file.  It is also used to
20609 place unique stamps in coverage data files and the object files that
20610 produce them.  You can use the @option{-frandom-seed} option to produce
20611 reproducibly identical object files.
20613 The @var{string} can either be a number (decimal, octal or hex) or an
20614 arbitrary string (in which case it's converted to a number by
20615 computing CRC32).
20617 The @var{string} should be different for every file you compile.
20619 @opindex save-temps
20620 @item -save-temps
20621 Store the usual ``temporary'' intermediate files permanently; name them
20622 as auxiliary output files, as specified described under
20623 @option{-dumpbase} and @option{-dumpdir}.
20625 When used in combination with the @option{-x} command-line option,
20626 @option{-save-temps} is sensible enough to avoid overwriting an
20627 input source file with the same extension as an intermediate file.
20628 The corresponding intermediate file may be obtained by renaming the
20629 source file before using @option{-save-temps}.
20631 @opindex save-temps=cwd
20632 @item -save-temps=cwd
20633 Equivalent to @option{-save-temps -dumpdir ./}.
20635 @opindex save-temps=obj
20636 @item -save-temps=obj
20637 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
20638 @file{outdir/} is the directory of the output file specified after the
20639 @option{-o} option, including any directory separators.  If the
20640 @option{-o} option is not used, the @option{-save-temps=obj} switch
20641 behaves like @option{-save-temps=cwd}.
20643 @opindex time
20644 @item -time@r{[}=@var{file}@r{]}
20645 Report the CPU time taken by each subprocess in the compilation
20646 sequence.  For C source files, this is the compiler proper and assembler
20647 (plus the linker if linking is done).
20649 Without the specification of an output file, the output looks like this:
20651 @smallexample
20652 # cc1 0.12 0.01
20653 # as 0.00 0.01
20654 @end smallexample
20656 The first number on each line is the ``user time'', that is time spent
20657 executing the program itself.  The second number is ``system time'',
20658 time spent executing operating system routines on behalf of the program.
20659 Both numbers are in seconds.
20661 With the specification of an output file, the output is appended to the
20662 named file, and it looks like this:
20664 @smallexample
20665 0.12 0.01 cc1 @var{options}
20666 0.00 0.01 as @var{options}
20667 @end smallexample
20669 The ``user time'' and the ``system time'' are moved before the program
20670 name, and the options passed to the program are displayed, so that one
20671 can later tell what file was being compiled, and with which options.
20673 @opindex fdump-final-insns
20674 @item -fdump-final-insns@r{[}=@var{file}@r{]}
20675 Dump the final internal representation (RTL) to @var{file}.  If the
20676 optional argument is omitted (or if @var{file} is @code{.}), the name
20677 of the dump file is determined by appending @code{.gkd} to the
20678 dump base name, see @option{-dumpbase}.
20680 @opindex fcompare-debug
20681 @opindex fno-compare-debug
20682 @item -fcompare-debug@r{[}=@var{opts}@r{]}
20683 If no error occurs during compilation, run the compiler a second time,
20684 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
20685 passed to the second compilation.  Dump the final internal
20686 representation in both compilations, and print an error if they differ.
20688 If the equal sign is omitted, the default @option{-gtoggle} is used.
20690 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
20691 and nonzero, implicitly enables @option{-fcompare-debug}.  If
20692 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
20693 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
20694 is used.
20696 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
20697 is equivalent to @option{-fno-compare-debug}, which disables the dumping
20698 of the final representation and the second compilation, preventing even
20699 @env{GCC_COMPARE_DEBUG} from taking effect.
20701 To verify full coverage during @option{-fcompare-debug} testing, set
20702 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
20703 which GCC rejects as an invalid option in any actual compilation
20704 (rather than preprocessing, assembly or linking).  To get just a
20705 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
20706 not overridden} will do.
20708 @opindex fcompare-debug-second
20709 @item -fcompare-debug-second
20710 This option is implicitly passed to the compiler for the second
20711 compilation requested by @option{-fcompare-debug}, along with options to
20712 silence warnings, and omitting other options that would cause the compiler
20713 to produce output to files or to standard output as a side effect.  Dump
20714 files and preserved temporary files are renamed so as to contain the
20715 @code{.gk} additional extension during the second compilation, to avoid
20716 overwriting those generated by the first.
20718 When this option is passed to the compiler driver, it causes the
20719 @emph{first} compilation to be skipped, which makes it useful for little
20720 other than debugging the compiler proper.
20722 @opindex gtoggle
20723 @item -gtoggle
20724 Turn off generation of debug info, if leaving out this option
20725 generates it, or turn it on at level 2 otherwise.  The position of this
20726 argument in the command line does not matter; it takes effect after all
20727 other options are processed, and it does so only once, no matter how
20728 many times it is given.  This is mainly intended to be used with
20729 @option{-fcompare-debug}.
20731 @opindex fvar-tracking-assignments-toggle
20732 @opindex fno-var-tracking-assignments-toggle
20733 @item -fvar-tracking-assignments-toggle
20734 Toggle @option{-fvar-tracking-assignments}, in the same way that
20735 @option{-gtoggle} toggles @option{-g}.
20737 @opindex Q
20738 @item -Q
20739 Makes the compiler print out each function name as it is compiled, and
20740 print some statistics about each pass when it finishes.
20742 @opindex ftime-report
20743 @item -ftime-report
20744 Makes the compiler print some statistics to stderr about the time consumed
20745 by each pass when it finishes.
20747 If SARIF output of diagnostics was requested via
20748 @option{-fdiagnostics-format=sarif-file} or
20749 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20750 information is instead emitted in JSON form as part of SARIF output.  The
20751 precise format of this JSON data is subject to change, and the values may
20752 not exactly match those emitted to stderr due to being written out at a
20753 slightly different place within the compiler.
20755 @opindex ftime-report-details
20756 @item -ftime-report-details
20757 Record the time consumed by infrastructure parts separately for each pass.
20759 @opindex fira-verbose
20760 @item -fira-verbose=@var{n}
20761 Control the verbosity of the dump file for the integrated register allocator.
20762 The default value is 5.  If the value @var{n} is greater or equal to 10,
20763 the dump output is sent to stderr using the same format as @var{n} minus 10.
20765 @opindex flto-report
20766 @item -flto-report
20767 Prints a report with internal details on the workings of the link-time
20768 optimizer.  The contents of this report vary from version to version.
20769 It is meant to be useful to GCC developers when processing object
20770 files in LTO mode (via @option{-flto}).
20772 Disabled by default.
20774 @opindex flto-report-wpa
20775 @item -flto-report-wpa
20776 Like @option{-flto-report}, but only print for the WPA phase of link-time
20777 optimization.
20779 @opindex fmem-report
20780 @item -fmem-report
20781 Makes the compiler print some statistics about permanent memory
20782 allocation when it finishes.
20784 @opindex fmem-report-wpa
20785 @item -fmem-report-wpa
20786 Makes the compiler print some statistics about permanent memory
20787 allocation for the WPA phase only.
20789 @opindex fpre-ipa-mem-report
20790 @opindex fpost-ipa-mem-report
20791 @item -fpre-ipa-mem-report
20792 @item -fpost-ipa-mem-report
20793 Makes the compiler print some statistics about permanent memory
20794 allocation before or after interprocedural optimization.
20796 @opindex fmultiflags
20797 @item -fmultiflags
20798 This option enables multilib-aware @code{TFLAGS} to be used to build
20799 target libraries with options different from those the compiler is
20800 configured to use by default, through the use of specs (@pxref{Spec
20801 Files}) set up by compiler internals, by the target, or by builders at
20802 configure time.
20804 Like @code{TFLAGS}, this allows the target libraries to be built for
20805 portable baseline environments, while the compiler defaults to more
20806 demanding ones.  That's useful because users can easily override the
20807 defaults the compiler is configured to use to build their own programs,
20808 if the defaults are not ideal for their target environment, whereas
20809 rebuilding the runtime libraries is usually not as easy or desirable.
20811 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20812 selected for different multilibs.  The way to accomplish that is to
20813 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20814 @samp{--with-specs=%@{fmultiflags:...@}}.
20816 This option is discarded by the driver once it's done processing driver
20817 self spec.
20819 It is also useful to check that @code{TFLAGS} are being used to build
20820 all target libraries, by configuring a non-bootstrap compiler
20821 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20822 the compiler and target libraries.
20824 @opindex fprofile-report
20825 @item -fprofile-report
20826 Makes the compiler print some statistics about consistency of the
20827 (estimated) profile and effect of individual passes.
20829 @opindex fstack-usage
20830 @item -fstack-usage
20831 Makes the compiler output stack usage information for the program, on a
20832 per-function basis.  The filename for the dump is made by appending
20833 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20834 the output file, if explicitly specified and it is not an executable,
20835 otherwise it is the basename of the source file.  An entry is made up
20836 of three fields:
20838 @itemize
20839 @item
20840 The name of the function.
20841 @item
20842 A number of bytes.
20843 @item
20844 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20845 @end itemize
20847 The qualifier @code{static} means that the function manipulates the stack
20848 statically: a fixed number of bytes are allocated for the frame on function
20849 entry and released on function exit; no stack adjustments are otherwise made
20850 in the function.  The second field is this fixed number of bytes.
20852 The qualifier @code{dynamic} means that the function manipulates the stack
20853 dynamically: in addition to the static allocation described above, stack
20854 adjustments are made in the body of the function, for example to push/pop
20855 arguments around function calls.  If the qualifier @code{bounded} is also
20856 present, the amount of these adjustments is bounded at compile time and
20857 the second field is an upper bound of the total amount of stack used by
20858 the function.  If it is not present, the amount of these adjustments is
20859 not bounded at compile time and the second field only represents the
20860 bounded part.
20862 @opindex fstats
20863 @item -fstats
20864 Emit statistics about front-end processing at the end of the compilation.
20865 This option is supported only by the C++ front end, and
20866 the information is generally only useful to the G++ development team.
20868 @opindex fdbg-cnt-list
20869 @item -fdbg-cnt-list
20870 Print the name and the counter upper bound for all debug counters.
20873 @opindex fdbg-cnt
20874 @item -fdbg-cnt=@var{counter-value-list}
20875 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20876 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20877 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20878 the name of the counter and list of closed intervals.
20879 The @var{lower_bound} is optional and is zero
20880 initialized if not set.
20881 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20882 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20883 eleventh invocation.
20884 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20886 @opindex print-file-name
20887 @item -print-file-name=@var{library}
20888 Print the full absolute name of the library file @var{library} that
20889 would be used when linking---and don't do anything else.  With this
20890 option, GCC does not compile or link anything; it just prints the
20891 file name.
20893 @opindex print-multi-directory
20894 @item -print-multi-directory
20895 Print the directory name corresponding to the multilib selected by any
20896 other switches present in the command line.  This directory is supposed
20897 to exist in @env{GCC_EXEC_PREFIX}.
20899 @opindex print-multi-lib
20900 @item -print-multi-lib
20901 Print the mapping from multilib directory names to compiler switches
20902 that enable them.  The directory name is separated from the switches by
20903 @samp{;}, and each switch starts with an @samp{@@} instead of the
20904 @samp{-}, without spaces between multiple switches.  This is supposed to
20905 ease shell processing.
20907 @opindex print-multi-os-directory
20908 @item -print-multi-os-directory
20909 Print the path to OS libraries for the selected
20910 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20911 present in the @file{lib} subdirectory and no multilibs are used, this is
20912 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20913 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20914 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20915 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20917 @opindex print-multiarch
20918 @item -print-multiarch
20919 Print the path to OS libraries for the selected multiarch,
20920 relative to some @file{lib} subdirectory.
20922 @opindex print-prog-name
20923 @item -print-prog-name=@var{program}
20924 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20926 @opindex print-libgcc-file-name
20927 @item -print-libgcc-file-name
20928 Same as @option{-print-file-name=libgcc.a}.
20930 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20931 but you do want to link with @file{libgcc.a}.  You can do:
20933 @smallexample
20934 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20935 @end smallexample
20937 @opindex print-search-dirs
20938 @item -print-search-dirs
20939 Print the name of the configured installation directory and a list of
20940 program and library directories @command{gcc} searches---and don't do anything else.
20942 This is useful when @command{gcc} prints the error message
20943 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20944 To resolve this you either need to put @file{cpp0} and the other compiler
20945 components where @command{gcc} expects to find them, or you can set the environment
20946 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20947 Don't forget the trailing @samp{/}.
20948 @xref{Environment Variables}.
20950 @opindex print-sysroot
20951 @item -print-sysroot
20952 Print the target sysroot directory that is used during
20953 compilation.  This is the target sysroot specified either at configure
20954 time or using the @option{--sysroot} option, possibly with an extra
20955 suffix that depends on compilation options.  If no target sysroot is
20956 specified, the option prints nothing.
20958 @opindex print-sysroot-headers-suffix
20959 @item -print-sysroot-headers-suffix
20960 Print the suffix added to the target sysroot when searching for
20961 headers, or give an error if the compiler is not configured with such
20962 a suffix---and don't do anything else.
20964 @opindex dumpmachine
20965 @item -dumpmachine
20966 Print the compiler's target machine (for example,
20967 @samp{i686-pc-linux-gnu})---and don't do anything else.
20969 @opindex dumpversion
20970 @item -dumpversion
20971 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20972 anything else.  This is the compiler version used in filesystem paths and
20973 specs. Depending on how the compiler has been configured it can be just
20974 a single number (major version), two numbers separated by a dot (major and
20975 minor version) or three numbers separated by dots (major, minor and patchlevel
20976 version).
20978 @opindex dumpfullversion
20979 @item -dumpfullversion
20980 Print the full compiler version---and don't do anything else. The output is
20981 always three numbers separated by dots, major, minor and patchlevel version.
20983 @opindex dumpspecs
20984 @item -dumpspecs
20985 Print the compiler's built-in specs---and don't do anything else.  (This
20986 is used when GCC itself is being built.)  @xref{Spec Files}.
20987 @end table
20989 @node Submodel Options
20990 @section Machine-Dependent Options
20991 @cindex submodel options
20992 @cindex specifying hardware config
20993 @cindex hardware models and configurations, specifying
20994 @cindex target-dependent options
20995 @cindex machine-dependent options
20997 Each target machine supported by GCC can have its own options---for
20998 example, to allow you to compile for a particular processor variant or
20999 ABI, or to control optimizations specific to that machine.  By
21000 convention, the names of machine-specific options start with
21001 @samp{-m}.
21003 Some configurations of the compiler also support additional target-specific
21004 options, usually for compatibility with other compilers on the same
21005 platform.
21007 @c This list is ordered alphanumerically by subsection name.
21008 @c It should be the same order and spelling as these options are listed
21009 @c in Machine Dependent Options
21011 @menu
21012 * AArch64 Options::
21013 * Adapteva Epiphany Options::
21014 * AMD GCN Options::
21015 * ARC Options::
21016 * ARM Options::
21017 * AVR Options::
21018 * Blackfin Options::
21019 * C6X Options::
21020 * CRIS Options::
21021 * C-SKY Options::
21022 * Darwin Options::
21023 * DEC Alpha Options::
21024 * eBPF Options::
21025 * FR30 Options::
21026 * FT32 Options::
21027 * FRV Options::
21028 * GNU/Linux Options::
21029 * H8/300 Options::
21030 * HPPA Options::
21031 * IA-64 Options::
21032 * LM32 Options::
21033 * LoongArch Options::
21034 * M32C Options::
21035 * M32R/D Options::
21036 * M680x0 Options::
21037 * MCore Options::
21038 * MicroBlaze Options::
21039 * MIPS Options::
21040 * MMIX Options::
21041 * MN10300 Options::
21042 * Moxie Options::
21043 * MSP430 Options::
21044 * NDS32 Options::
21045 * Nios II Options::
21046 * Nvidia PTX Options::
21047 * OpenRISC Options::
21048 * PDP-11 Options::
21049 * PowerPC Options::
21050 * PRU Options::
21051 * RISC-V Options::
21052 * RL78 Options::
21053 * RS/6000 and PowerPC Options::
21054 * RX Options::
21055 * S/390 and zSeries Options::
21056 * SH Options::
21057 * Solaris 2 Options::
21058 * SPARC Options::
21059 * System V Options::
21060 * V850 Options::
21061 * VAX Options::
21062 * Visium Options::
21063 * VMS Options::
21064 * VxWorks Options::
21065 * x86 Options::
21066 * x86 Windows Options::
21067 * Xstormy16 Options::
21068 * Xtensa Options::
21069 * zSeries Options::
21070 @end menu
21072 @node AArch64 Options
21073 @subsection AArch64 Options
21074 @cindex AArch64 Options
21076 These options are defined for AArch64 implementations:
21078 @table @gcctabopt
21080 @opindex mabi
21081 @item -mabi=@var{name}
21082 Generate code for the specified data model.  Permissible values
21083 are @samp{ilp32} for SysV-like data model where int, long int and pointers
21084 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
21085 but long int and pointers are 64 bits.
21087 The default depends on the specific target configuration.  Note that
21088 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
21089 entire program with the same ABI, and link with a compatible set of libraries.
21091 @opindex mbig-endian
21092 @item -mbig-endian
21093 Generate big-endian code.  This is the default when GCC is configured for an
21094 @samp{aarch64_be-*-*} target.
21096 @opindex mgeneral-regs-only
21097 @item -mgeneral-regs-only
21098 Generate code which uses only the general-purpose registers.  This will prevent
21099 the compiler from using floating-point and Advanced SIMD registers but will not
21100 impose any restrictions on the assembler.
21102 @opindex mlittle-endian
21103 @item -mlittle-endian
21104 Generate little-endian code.  This is the default when GCC is configured for an
21105 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
21107 @opindex mcmodel=tiny
21108 @item -mcmodel=tiny
21109 Generate code for the tiny code model.  The program and its statically defined
21110 symbols must be within 1MB of each other.  Programs can be statically or
21111 dynamically linked.
21113 @opindex mcmodel=small
21114 @item -mcmodel=small
21115 Generate code for the small code model.  The program and its statically defined
21116 symbols must be within 4GB of each other.  Programs can be statically or
21117 dynamically linked.  This is the default code model.
21119 @opindex mcmodel=large
21120 @item -mcmodel=large
21121 Generate code for the large code model.  This makes no assumptions about
21122 addresses and sizes of sections.  Programs can be statically linked only.  The
21123 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
21124 @option{-fpic} and @option{-fPIC}.
21126 @item -mtp=@var{name}
21127 @opindex mtp
21128 Specify the system register to use as a thread pointer.  The valid values
21129 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
21130 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
21131 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
21132 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
21133 code intended to interoperate with the same value of this option to avoid
21134 accessing a different thread pointer from the wrong exception level.
21136 @opindex mstrict-align
21137 @opindex mno-strict-align
21138 @item -mstrict-align
21139 @itemx -mno-strict-align
21140 Avoid or allow generating memory accesses that may not be aligned on a natural
21141 object boundary as described in the architecture specification.
21143 @opindex momit-leaf-frame-pointer
21144 @opindex mno-omit-leaf-frame-pointer
21145 @item -momit-leaf-frame-pointer
21146 @itemx -mno-omit-leaf-frame-pointer
21147 Omit or keep the frame pointer in leaf functions.  The former behavior is the
21148 default.
21150 @opindex mstack-protector-guard
21151 @opindex mstack-protector-guard-reg
21152 @opindex mstack-protector-guard-offset
21153 @item -mstack-protector-guard=@var{guard}
21154 @itemx -mstack-protector-guard-reg=@var{reg}
21155 @itemx -mstack-protector-guard-offset=@var{offset}
21156 Generate stack protection code using canary at @var{guard}.  Supported
21157 locations are @samp{global} for a global canary or @samp{sysreg} for a
21158 canary in an appropriate system register.
21160 With the latter choice the options
21161 @option{-mstack-protector-guard-reg=@var{reg}} and
21162 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
21163 which system register to use as base register for reading the canary,
21164 and from what offset from that base register. There is no default
21165 register or offset as this is entirely for use within the Linux
21166 kernel.
21168 @opindex mtls-dialect=desc
21169 @item -mtls-dialect=desc
21170 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
21171 of TLS variables.  This is the default.
21173 @opindex mtls-dialect=traditional
21174 @item -mtls-dialect=traditional
21175 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
21176 of TLS variables.
21178 @opindex mtls-size
21179 @item -mtls-size=@var{size}
21180 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
21181 This option requires binutils 2.26 or newer.
21183 @opindex mfix-cortex-a53-835769
21184 @opindex mno-fix-cortex-a53-835769
21185 @item -mfix-cortex-a53-835769
21186 @itemx -mno-fix-cortex-a53-835769
21187 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
21188 This involves inserting a NOP instruction between memory instructions and
21189 64-bit integer multiply-accumulate instructions.
21191 @opindex mfix-cortex-a53-843419
21192 @opindex mno-fix-cortex-a53-843419
21193 @item -mfix-cortex-a53-843419
21194 @itemx -mno-fix-cortex-a53-843419
21195 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
21196 This erratum workaround is made at link time and this will only pass the
21197 corresponding flag to the linker.
21199 @opindex mlow-precision-recip-sqrt
21200 @opindex mno-low-precision-recip-sqrt
21201 @item -mlow-precision-recip-sqrt
21202 @itemx -mno-low-precision-recip-sqrt
21203 Enable or disable the reciprocal square root approximation.
21204 This option only has an effect if @option{-ffast-math} or
21205 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21206 precision of reciprocal square root results to about 16 bits for
21207 single precision and to 32 bits for double precision.
21209 @opindex mlow-precision-sqrt
21210 @opindex mno-low-precision-sqrt
21211 @item -mlow-precision-sqrt
21212 @itemx -mno-low-precision-sqrt
21213 Enable or disable the square root approximation.
21214 This option only has an effect if @option{-ffast-math} or
21215 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21216 precision of square root results to about 16 bits for
21217 single precision and to 32 bits for double precision.
21218 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
21220 @opindex mlow-precision-div
21221 @opindex mno-low-precision-div
21222 @item -mlow-precision-div
21223 @itemx -mno-low-precision-div
21224 Enable or disable the division approximation.
21225 This option only has an effect if @option{-ffast-math} or
21226 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
21227 precision of division results to about 16 bits for
21228 single precision and to 32 bits for double precision.
21230 @item -mtrack-speculation
21231 @itemx -mno-track-speculation
21232 Enable or disable generation of additional code to track speculative
21233 execution through conditional branches.  The tracking state can then
21234 be used by the compiler when expanding calls to
21235 @code{__builtin_speculation_safe_copy} to permit a more efficient code
21236 sequence to be generated.
21238 @item -moutline-atomics
21239 @itemx -mno-outline-atomics
21240 Enable or disable calls to out-of-line helpers to implement atomic operations.
21241 These helpers will, at runtime, determine if the LSE instructions from
21242 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
21243 instructions that are present in the base ARMv8.0 ISA.
21245 This option is only applicable when compiling for the base ARMv8.0
21246 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
21247 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
21248 used directly.  The same applies when using @option{-mcpu=} when the
21249 selected cpu supports the @samp{lse} feature.
21250 This option is on by default.
21252 @opindex march
21253 @item -march=@var{name}
21254 Specify the name of the target architecture and, optionally, one or
21255 more feature modifiers.  This option has the form
21256 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
21258 The table below summarizes the permissible values for @var{arch}
21259 and the features that they enable by default:
21261 @multitable @columnfractions 0.20 0.20 0.60
21262 @headitem @var{arch} value @tab Architecture @tab Includes by default
21263 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
21264 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
21265 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
21266 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
21267 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
21268 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
21269 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
21270 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
21271 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
21272 @item @samp{armv8.9-a} @tab Armv8.9-a @tab @samp{armv8.8-a}
21273 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
21274 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
21275 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
21276 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
21277 @item @samp{armv9.4-a} @tab Armv9.4-A @tab @samp{armv9.3-a}
21278 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
21279 @end multitable
21281 The value @samp{native} is available on native AArch64 GNU/Linux and
21282 causes the compiler to pick the architecture of the host system.  This
21283 option has no effect if the compiler is unable to recognize the
21284 architecture of the host system,
21286 The permissible values for @var{feature} are listed in the sub-section
21287 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
21288 Feature Modifiers}.  Where conflicting feature modifiers are
21289 specified, the right-most feature is used.
21291 GCC uses @var{name} to determine what kind of instructions it can emit
21292 when generating assembly code.  If @option{-march} is specified
21293 without either of @option{-mtune} or @option{-mcpu} also being
21294 specified, the code is tuned to perform well across a range of target
21295 processors implementing the target architecture.
21297 @opindex mtune
21298 @item -mtune=@var{name}
21299 Specify the name of the target processor for which GCC should tune the
21300 performance of the code.  Permissible values for this option are:
21301 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
21302 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
21303 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
21304 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
21305 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
21306 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
21307 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
21308 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
21309 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
21310 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
21311 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
21312 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
21313 @samp{octeontx2f95mm},
21314 @samp{a64fx},
21315 @samp{thunderx}, @samp{thunderxt88},
21316 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
21317 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
21318 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21319 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
21320 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
21321 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
21322 @samp{cortex-x3}, @samp{cortex-x4}, @samp{cortex-a510}, @samp{cortex-a520},
21323 @samp{cortex-a710}, @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1},
21324 @samp{ampere1a}, @samp{ampere1b}, @samp{cobalt-100} and @samp{native}.
21326 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
21327 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
21328 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
21329 should tune for a big.LITTLE system.
21331 The value @samp{neoverse-512tvb} specifies that GCC should tune
21332 for Neoverse cores that (a) implement SVE and (b) have a total vector
21333 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
21334 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
21335 instructions a cycle and that can execute an equivalent number of SVE
21336 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
21337 This is more general than tuning for a specific core like Neoverse V1
21338 but is more specific than the default tuning described below.
21340 Additionally on native AArch64 GNU/Linux systems the value
21341 @samp{native} tunes performance to the host system.  This option has no effect
21342 if the compiler is unable to recognize the processor of the host system.
21344 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
21345 are specified, the code is tuned to perform well across a range
21346 of target processors.
21348 This option cannot be suffixed by feature modifiers.
21350 @opindex mcpu
21351 @item -mcpu=@var{name}
21352 Specify the name of the target processor, optionally suffixed by one
21353 or more feature modifiers.  This option has the form
21354 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
21355 the permissible values for @var{cpu} are the same as those available
21356 for @option{-mtune}.  The permissible values for @var{feature} are
21357 documented in the sub-section on
21358 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
21359 Feature Modifiers}.  Where conflicting feature modifiers are
21360 specified, the right-most feature is used.
21362 GCC uses @var{name} to determine what kind of instructions it can emit when
21363 generating assembly code (as if by @option{-march}) and to determine
21364 the target processor for which to tune for performance (as if
21365 by @option{-mtune}).  Where this option is used in conjunction
21366 with @option{-march} or @option{-mtune}, those options take precedence
21367 over the appropriate part of this option.
21369 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
21370 to a specific core, but instead refers to all Neoverse cores that
21371 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
21372 a cycle.  Unless overridden by @option{-march},
21373 @option{-mcpu=neoverse-512tvb} generates code that can run on a
21374 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
21375 these properties.  Unless overridden by @option{-mtune},
21376 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
21377 @option{-mtune=neoverse-512tvb}.
21379 @opindex moverride
21380 @item -moverride=@var{string}
21381 Override tuning decisions made by the back-end in response to a
21382 @option{-mtune=} switch.  The syntax, semantics, and accepted values
21383 for @var{string} in this option are not guaranteed to be consistent
21384 across releases.
21386 This option is only intended to be useful when developing GCC.
21388 @opindex mverbose-cost-dump
21389 @item -mverbose-cost-dump
21390 Enable verbose cost model dumping in the debug dump files.  This option is
21391 provided for use in debugging the compiler.
21393 @opindex mpc-relative-literal-loads
21394 @opindex mno-pc-relative-literal-loads
21395 @item -mpc-relative-literal-loads
21396 @itemx -mno-pc-relative-literal-loads
21397 Enable or disable PC-relative literal loads.  With this option literal pools are
21398 accessed using a single instruction and emitted after each function.  This
21399 limits the maximum size of functions to 1MB.  This is enabled by default for
21400 @option{-mcmodel=tiny}.
21402 @opindex msign-return-address
21403 @item -msign-return-address=@var{scope}
21404 Select the function scope on which return address signing will be applied.
21405 Permissible values are @samp{none}, which disables return address signing,
21406 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
21407 functions, and @samp{all}, which enables pointer signing for all functions.  The
21408 default value is @samp{none}. This option has been deprecated by
21409 -mbranch-protection.
21411 @opindex mbranch-protection
21412 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
21413 Select the branch protection features to use.
21414 @samp{none} is the default and turns off all types of branch protection.
21415 @samp{standard} turns on all types of branch protection features.  If a feature
21416 has additional tuning options, then @samp{standard} sets it to its standard
21417 level.
21418 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
21419 level: signing functions that save the return address to memory (non-leaf
21420 functions will practically always do this) using the a-key.  The optional
21421 argument @samp{leaf} can be used to extend the signing to include leaf
21422 functions.  The optional argument @samp{b-key} can be used to sign the functions
21423 with the B-key instead of the A-key.
21424 @samp{bti} turns on branch target identification mechanism.
21426 @opindex mharden-sls
21427 @item -mharden-sls=@var{opts}
21428 Enable compiler hardening against straight line speculation (SLS).
21429 @var{opts} is a comma-separated list of the following options:
21430 @table @samp
21431 @item retbr
21432 @item blr
21433 @end table
21434 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
21435 @samp{-mharden-sls=none} disables all SLS hardening.
21437 @opindex mearly-ra
21438 @item -mearly-ra=@var{scope}
21439 Determine when to enable an early register allocation pass.  This pass runs
21440 before instruction scheduling and tries to find a spill-free allocation of
21441 floating-point and vector code.  It also tries to make use of strided
21442 multi-register instructions, such as SME2's strided LD1 and ST1.
21444 The possible values of @var{scope} are: @var{all}, which runs the pass on
21445 all functions; @var{strided}, which runs the pass on functions that have
21446 access to strided multi-register instructions; and @var{none}, which
21447 disables the pass.
21449 @option{-mearly-ra=all} is the default for @option{-O2} and above, and for
21450 @option{-Os}.  @option{-mearly-ra=none} is the default otherwise.
21452 @opindex mearly-ldp-fusion
21453 @item -mearly-ldp-fusion
21454 Enable the copy of the AArch64 load/store pair fusion pass that runs before
21455 register allocation.  Enabled by default at @samp{-O} and above.
21457 @opindex mlate-ldp-fusion
21458 @item -mlate-ldp-fusion
21459 Enable the copy of the AArch64 load/store pair fusion pass that runs after
21460 register allocation.  Enabled by default at @samp{-O} and above.
21462 @opindex msve-vector-bits
21463 @item -msve-vector-bits=@var{bits}
21464 Specify the number of bits in an SVE vector register.  This option only has
21465 an effect when SVE is enabled.
21467 GCC supports two forms of SVE code generation: ``vector-length
21468 agnostic'' output that works with any size of vector register and
21469 ``vector-length specific'' output that allows GCC to make assumptions
21470 about the vector length when it is useful for optimization reasons.
21471 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
21472 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
21473 Specifying @samp{scalable} selects vector-length agnostic
21474 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
21475 agnostic output for big-endian targets.  All other values generate
21476 vector-length specific code.  The behavior of these values may change
21477 in future releases and no value except @samp{scalable} should be
21478 relied on for producing code that is portable across different
21479 hardware SVE vector lengths.
21481 The default is @samp{-msve-vector-bits=scalable}, which produces
21482 vector-length agnostic code.
21483 @end table
21485 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
21486 @anchor{aarch64-feature-modifiers}
21487 @cindex @option{-march} feature modifiers
21488 @cindex @option{-mcpu} feature modifiers
21489 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
21490 the following and their inverses @option{no@var{feature}}:
21492 @table @samp
21493 @item crc
21494 Enable CRC extension.  This is on by default for
21495 @option{-march=armv8.1-a}.
21496 @item crypto
21497 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
21498 instructions.
21499 @item fp
21500 Enable floating-point instructions.  This is on by default for all possible
21501 values for options @option{-march} and @option{-mcpu}.
21502 @item simd
21503 Enable Advanced SIMD instructions.  This also enables floating-point
21504 instructions.  This is on by default for all possible values for options
21505 @option{-march} and @option{-mcpu}.
21506 @item sve
21507 Enable Scalable Vector Extension instructions.  This also enables Advanced
21508 SIMD and floating-point instructions.
21509 @item lse
21510 Enable Large System Extension instructions.  This is on by default for
21511 @option{-march=armv8.1-a}.
21512 @item rdma
21513 Enable Round Double Multiply Accumulate instructions.  This is on by default
21514 for @option{-march=armv8.1-a}.
21515 @item fp16
21516 Enable FP16 extension.  This also enables floating-point instructions.
21517 @item fp16fml
21518 Enable FP16 fmla extension.  This also enables FP16 extensions and
21519 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.
21521 @item rcpc
21522 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
21523 load-acquire atomic semantics, and passes it on to the assembler, enabling
21524 inline asm statements to use instructions from the RCpc extension.
21525 @item dotprod
21526 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
21527 @item aes
21528 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
21529 SIMD instructions.
21530 @item sha2
21531 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
21532 @item sha3
21533 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
21534 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
21535 @item sm4
21536 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
21537 Use of this option with architectures prior to Armv8.2-A is not supported.
21538 @item profile
21539 Enable the Statistical Profiling extension.  This option is only to enable the
21540 extension at the assembler level and does not affect code generation.
21541 @item rng
21542 Enable the Armv8.5-a Random Number instructions.  This option is only to
21543 enable the extension at the assembler level and does not affect code
21544 generation.
21545 @item memtag
21546 Enable the Armv8.5-a Memory Tagging Extensions.
21547 Use of this option with architectures prior to Armv8.5-A is not supported.
21548 @item sb
21549 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
21550 enable the extension at the assembler level and does not affect code
21551 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21552 @item ssbs
21553 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
21554 is only to enable the extension at the assembler level and does not affect code
21555 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21556 @item predres
21557 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
21558 This option is only to enable the extension at the assembler level and does
21559 not affect code generation.  This option is enabled by default for
21560 @option{-march=armv8.5-a}.
21561 @item sve2
21562 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
21563 instructions.
21564 @item sve2-bitperm
21565 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
21566 @item sve2-sm4
21567 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
21568 @item sve2-aes
21569 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
21570 @item sve2-sha3
21571 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
21572 @item tme
21573 Enable the Transactional Memory Extension.
21574 @item i8mm
21575 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
21576 Advanced SIMD and floating-point instructions.  This option is enabled by
21577 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21578 prior to Armv8.2-A is not supported.
21579 @item f32mm
21580 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
21581 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21582 not supported.
21583 @item f64mm
21584 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
21585 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21586 not supported.
21587 @item bf16
21588 Enable brain half-precision floating-point instructions.  This also enables
21589 Advanced SIMD and floating-point instructions.  This option is enabled by
21590 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21591 prior to Armv8.2-A is not supported.
21592 @item ls64
21593 Enable the 64-byte atomic load and store instructions for accelerators.
21594 This option is enabled by default for @option{-march=armv8.7-a}.
21595 @item mops
21596 Enable the instructions to accelerate memory operations like @code{memcpy},
21597 @code{memmove}, @code{memset}.  This option is enabled by default for
21598 @option{-march=armv8.8-a}
21599 @item flagm
21600 Enable the Flag Manipulation instructions Extension.
21601 @item pauth
21602 Enable the Pointer Authentication Extension.
21603 @item cssc
21604 Enable the Common Short Sequence Compression instructions.
21605 @item sme
21606 Enable the Scalable Matrix Extension.
21607 @item sme-i16i64
21608 Enable the FEAT_SME_I16I64 extension to SME.
21609 @item sme-f64f64
21610 Enable the FEAT_SME_F64F64 extension to SME.
21611 +@item sme2
21612 Enable the Scalable Matrix Extension 2.  This also enables SME instructions.
21613 @item lse128
21614 Enable the LSE128 128-bit atomic instructions extension.  This also
21615 enables LSE instructions.
21616 @item d128
21617 Enable support for 128-bit system register read/write instructions.
21618 This also enables the LSE128 extension.
21619 @item gcs
21620 Enable support for Armv9.4-a Guarded Control Stack extension.
21621 @item the
21622 Enable support for Armv8.9-a/9.4-a translation hardening extension.
21623 @item rcpc3
21624 Enable the RCpc3 (Release Consistency) extension.
21626 @end table
21628 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
21629 which implies @option{fp}.
21630 Conversely, @option{nofp} implies @option{nosimd}, which implies
21631 @option{nocrypto}, @option{noaes} and @option{nosha2}.
21633 @node Adapteva Epiphany Options
21634 @subsection Adapteva Epiphany Options
21636 These @samp{-m} options are defined for Adapteva Epiphany:
21638 @table @gcctabopt
21639 @opindex mhalf-reg-file
21640 @item -mhalf-reg-file
21641 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
21642 That allows code to run on hardware variants that lack these registers.
21644 @opindex mprefer-short-insn-regs
21645 @item -mprefer-short-insn-regs
21646 Preferentially allocate registers that allow short instruction generation.
21647 This can result in increased instruction count, so this may either reduce or
21648 increase overall code size.
21650 @opindex mbranch-cost
21651 @item -mbranch-cost=@var{num}
21652 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21653 This cost is only a heuristic and is not guaranteed to produce
21654 consistent results across releases.
21656 @opindex mcmove
21657 @item -mcmove
21658 Enable the generation of conditional moves.
21660 @opindex mnops
21661 @item -mnops=@var{num}
21662 Emit @var{num} NOPs before every other generated instruction.
21664 @opindex mno-soft-cmpsf
21665 @opindex msoft-cmpsf
21666 @item -mno-soft-cmpsf
21667 For single-precision floating-point comparisons, emit an @code{fsub} instruction
21668 and test the flags.  This is faster than a software comparison, but can
21669 get incorrect results in the presence of NaNs, or when two different small
21670 numbers are compared such that their difference is calculated as zero.
21671 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
21672 software comparisons.
21674 @opindex mstack-offset
21675 @item -mstack-offset=@var{num}
21676 Set the offset between the top of the stack and the stack pointer.
21677 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
21678 can be used by leaf functions without stack allocation.
21679 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
21680 Note also that this option changes the ABI; compiling a program with a
21681 different stack offset than the libraries have been compiled with
21682 generally does not work.
21683 This option can be useful if you want to evaluate if a different stack
21684 offset would give you better code, but to actually use a different stack
21685 offset to build working programs, it is recommended to configure the
21686 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
21688 @opindex mno-round-nearest
21689 @opindex mround-nearest
21690 @item -mno-round-nearest
21691 Make the scheduler assume that the rounding mode has been set to
21692 truncating.  The default is @option{-mround-nearest}.
21694 @opindex mlong-calls
21695 @item -mlong-calls
21696 If not otherwise specified by an attribute, assume all calls might be beyond
21697 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
21698 function address into a register before performing a (otherwise direct) call.
21699 This is the default.
21701 @opindex short-calls
21702 @item -mshort-calls
21703 If not otherwise specified by an attribute, assume all direct calls are
21704 in the range of the @code{b} / @code{bl} instructions, so use these instructions
21705 for direct calls.  The default is @option{-mlong-calls}.
21707 @opindex msmall16
21708 @item -msmall16
21709 Assume addresses can be loaded as 16-bit unsigned values.  This does not
21710 apply to function addresses for which @option{-mlong-calls} semantics
21711 are in effect.
21713 @opindex mfp-mode
21714 @item -mfp-mode=@var{mode}
21715 Set the prevailing mode of the floating-point unit.
21716 This determines the floating-point mode that is provided and expected
21717 at function call and return time.  Making this mode match the mode you
21718 predominantly need at function start can make your programs smaller and
21719 faster by avoiding unnecessary mode switches.
21721 @var{mode} can be set to one the following values:
21723 @table @samp
21724 @item caller
21725 Any mode at function entry is valid, and retained or restored when
21726 the function returns, and when it calls other functions.
21727 This mode is useful for compiling libraries or other compilation units
21728 you might want to incorporate into different programs with different
21729 prevailing FPU modes, and the convenience of being able to use a single
21730 object file outweighs the size and speed overhead for any extra
21731 mode switching that might be needed, compared with what would be needed
21732 with a more specific choice of prevailing FPU mode.
21734 @item truncate
21735 This is the mode used for floating-point calculations with
21736 truncating (i.e.@: round towards zero) rounding mode.  That includes
21737 conversion from floating point to integer.
21739 @item round-nearest
21740 This is the mode used for floating-point calculations with
21741 round-to-nearest-or-even rounding mode.
21743 @item int
21744 This is the mode used to perform integer calculations in the FPU, e.g.@:
21745 integer multiply, or integer multiply-and-accumulate.
21746 @end table
21748 The default is @option{-mfp-mode=caller}
21750 @opindex mno-split-lohi
21751 @opindex msplit-lohi
21752 @opindex mno-postinc
21753 @opindex mpostinc
21754 @opindex mno-postmodify
21755 @opindex mpostmodify
21756 @item -mno-split-lohi
21757 @itemx -mno-postinc
21758 @itemx -mno-postmodify
21759 Code generation tweaks that disable, respectively, splitting of 32-bit
21760 loads, generation of post-increment addresses, and generation of
21761 post-modify addresses.  The defaults are @option{msplit-lohi},
21762 @option{-mpost-inc}, and @option{-mpost-modify}.
21764 @opindex mno-vect-double
21765 @opindex mvect-double
21766 @item -mnovect-double
21767 Change the preferred SIMD mode to SImode.  The default is
21768 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21770 @opindex max-vect-align
21771 @item -max-vect-align=@var{num}
21772 The maximum alignment for SIMD vector mode types.
21773 @var{num} may be 4 or 8.  The default is 8.
21774 Note that this is an ABI change, even though many library function
21775 interfaces are unaffected if they don't use SIMD vector modes
21776 in places that affect size and/or alignment of relevant types.
21778 @opindex msplit-vecmove-early
21779 @item -msplit-vecmove-early
21780 Split vector moves into single word moves before reload.  In theory this
21781 can give better register allocation, but so far the reverse seems to be
21782 generally the case.
21784 @opindex m1reg-
21785 @item -m1reg-@var{reg}
21786 Specify a register to hold the constant @minus{}1, which makes loading small negative
21787 constants and certain bitmasks faster.
21788 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21789 which specify use of that register as a fixed register,
21790 and @samp{none}, which means that no register is used for this
21791 purpose.  The default is @option{-m1reg-none}.
21793 @end table
21795 @node AMD GCN Options
21796 @subsection AMD GCN Options
21797 @cindex AMD GCN Options
21799 These options are defined specifically for the AMD GCN port.
21801 @table @gcctabopt
21803 @opindex march
21804 @opindex mtune
21805 @item -march=@var{gpu}
21806 @itemx -mtune=@var{gpu}
21807 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21810 @table @samp
21811 @item fiji
21812 Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
21813 depends on how GCC has been configured, see @option{--with-arch} and
21814 @option{--with-multilib-list}.
21816 @item gfx900
21817 Compile for GCN5 Vega 10 devices (gfx900).
21819 @item gfx906
21820 Compile for GCN5 Vega 20 devices (gfx906).
21822 @item gfx908
21823 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21825 @item gfx90a
21826 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21828 @item gfx1030
21829 Compile for RDNA2 gfx1030 devices (GFX10 series).
21831 @item gfx1036
21832 Compile for RDNA2 gfx1036 devices (GFX10 series).
21834 @item gfx1100
21835 Compile for RDNA3 gfx1100 devices (GFX11 series).
21837 @item gfx1103
21838 Compile for RDNA3 gfx1103 devices (GFX11 series).
21840 @end table
21842 @opindex msram-ecc
21843 @item -msram-ecc=on
21844 @itemx -msram-ecc=off
21845 @itemx -msram-ecc=any
21846 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21847 disabled, or either mode.  This feature can be enabled per-process on some
21848 devices.  The compiled code must match the device mode. The default is
21849 @samp{any}, for devices that support it.
21851 @opindex mstack-size
21852 @item -mstack-size=@var{bytes}
21853 Specify how many @var{bytes} of stack space will be requested for each GPU
21854 thread (wave-front).  Beware that there may be many threads and limited memory
21855 available.  The size of the stack allocation may also have an impact on
21856 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21857 1MB otherwise.
21859 @opindex mxnack
21860 @item -mxnack=on
21861 @itemx -mxnack=off
21862 @itemx -mxnack=any
21863 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21864 or either mode.  Some devices always require XNACK and some allow the user to
21865 configure XNACK.  The compiled code must match the device mode.
21866 The default is @samp{-mxnack=any} on devices that support Unified Shared
21867 Memory, and @samp{-mxnack=no} otherwise.
21869 @end table
21871 @node ARC Options
21872 @subsection ARC Options
21873 @cindex ARC options
21875 The following options control the architecture variant for which code
21876 is being compiled:
21878 @c architecture variants
21879 @table @gcctabopt
21881 @opindex mbarrel-shifter
21882 @item -mbarrel-shifter
21883 Generate instructions supported by barrel shifter.  This is the default
21884 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21886 @opindex mjli-always
21887 @item -mjli-always
21888 Force to call a function using jli_s instruction.  This option is
21889 valid only for ARCv2 architecture.
21891 @opindex mcpu
21892 @item -mcpu=@var{cpu}
21893 Set architecture type, register usage, and instruction scheduling
21894 parameters for @var{cpu}.  There are also shortcut alias options
21895 available for backward compatibility and convenience.  Supported
21896 values for @var{cpu} are
21898 @table @samp
21899 @opindex mA6
21900 @opindex mARC600
21901 @item arc600
21902 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21904 @opindex mARC601
21905 @item arc601
21906 Compile for ARC601.  Alias: @option{-mARC601}.
21908 @opindex mA7
21909 @opindex mARC700
21910 @item arc700
21911 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21912 This is the default when configured with @option{--with-cpu=arc700}@.
21914 @item arcem
21915 Compile for ARC EM.
21917 @item archs
21918 Compile for ARC HS.
21920 @item em
21921 Compile for ARC EM CPU with no hardware extensions.
21923 @item em4
21924 Compile for ARC EM4 CPU.
21926 @item em4_dmips
21927 Compile for ARC EM4 DMIPS CPU.
21929 @item em4_fpus
21930 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21931 extension.
21933 @item em4_fpuda
21934 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21935 double assist instructions.
21937 @item hs
21938 Compile for ARC HS CPU with no hardware extensions except the atomic
21939 instructions.
21941 @item hs34
21942 Compile for ARC HS34 CPU.
21944 @item hs38
21945 Compile for ARC HS38 CPU.
21947 @item hs38_linux
21948 Compile for ARC HS38 CPU with all hardware extensions on.
21950 @item hs4x
21951 Compile for ARC HS4x CPU.
21953 @item hs4xd
21954 Compile for ARC HS4xD CPU.
21956 @item hs4x_rel31
21957 Compile for ARC HS4x CPU release 3.10a.
21959 @item arc600_norm
21960 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21962 @item arc600_mul32x16
21963 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21964 instructions enabled.
21966 @item arc600_mul64
21967 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21968 instructions enabled.
21970 @item arc601_norm
21971 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21973 @item arc601_mul32x16
21974 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21975 instructions enabled.
21977 @item arc601_mul64
21978 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21979 instructions enabled.
21981 @item nps400
21982 Compile for ARC 700 on NPS400 chip.
21984 @item em_mini
21985 Compile for ARC EM minimalist configuration featuring reduced register
21986 set.
21988 @end table
21990 @opindex mdpfp
21991 @opindex mdpfp-compact
21992 @item -mdpfp
21993 @itemx -mdpfp-compact
21994 Generate double-precision FPX instructions, tuned for the compact
21995 implementation.
21997 @opindex mdpfp-fast
21998 @item -mdpfp-fast
21999 Generate double-precision FPX instructions, tuned for the fast
22000 implementation.
22002 @opindex mno-dpfp-lrsr
22003 @item -mno-dpfp-lrsr
22004 Disable @code{lr} and @code{sr} instructions from using FPX extension
22005 aux registers.
22007 @opindex mea
22008 @item -mea
22009 Generate extended arithmetic instructions.  Currently only
22010 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
22011 supported.  Only valid for @option{-mcpu=ARC700}.
22013 @opindex mno-mpy
22014 @opindex mmpy
22015 @item -mno-mpy
22016 Do not generate @code{mpy}-family instructions for ARC700.  This option is
22017 deprecated.
22019 @opindex mmul32x16
22020 @item -mmul32x16
22021 Generate 32x16-bit multiply and multiply-accumulate instructions.
22023 @opindex mmul64
22024 @item -mmul64
22025 Generate @code{mul64} and @code{mulu64} instructions.  
22026 Only valid for @option{-mcpu=ARC600}.
22028 @opindex mnorm
22029 @item -mnorm
22030 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
22031 is in effect.
22033 @opindex mspfp
22034 @opindex mspfp-compact
22035 @item -mspfp
22036 @itemx -mspfp-compact
22037 Generate single-precision FPX instructions, tuned for the compact
22038 implementation.
22040 @opindex mspfp-fast
22041 @item -mspfp-fast
22042 Generate single-precision FPX instructions, tuned for the fast
22043 implementation.
22045 @opindex msimd
22046 @item -msimd
22047 Enable generation of ARC SIMD instructions via target-specific
22048 builtins.  Only valid for @option{-mcpu=ARC700}.
22050 @opindex msoft-float
22051 @item -msoft-float
22052 This option ignored; it is provided for compatibility purposes only.
22053 Software floating-point code is emitted by default, and this default
22054 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
22055 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
22056 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
22058 @opindex mswap
22059 @item -mswap
22060 Generate @code{swap} instructions.
22062 @opindex matomic
22063 @item -matomic
22064 This enables use of the locked load/store conditional extension to implement
22065 atomic memory built-in functions.  Not available for ARC 6xx or ARC
22066 EM cores.
22068 @opindex mdiv-rem
22069 @item -mdiv-rem
22070 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
22072 @opindex mcode-density
22073 @item -mcode-density
22074 Enable code density instructions for ARC EM.  
22075 This option is on by default for ARC HS.
22077 @opindex mll64
22078 @item -mll64
22079 Enable double load/store operations for ARC HS cores.
22081 @opindex mtp-regno
22082 @item -mtp-regno=@var{regno}
22083 Specify thread pointer register number.
22085 @opindex mmpy-option
22086 @item -mmpy-option=@var{multo}
22087 Compile ARCv2 code with a multiplier design option.  You can specify 
22088 the option using either a string or numeric value for @var{multo}.  
22089 @samp{wlh1} is the default value.  The recognized values are:
22091 @table @samp
22092 @item 0
22093 @itemx none
22094 No multiplier available.
22096 @item 1
22097 @itemx w
22098 16x16 multiplier, fully pipelined.
22099 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
22101 @item 2
22102 @itemx wlh1
22103 32x32 multiplier, fully
22104 pipelined (1 stage).  The following instructions are additionally
22105 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22107 @item 3
22108 @itemx wlh2
22109 32x32 multiplier, fully pipelined
22110 (2 stages).  The following instructions are additionally enabled: @code{mpy},
22111 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22113 @item 4
22114 @itemx wlh3
22115 Two 16x16 multipliers, blocking,
22116 sequential.  The following instructions are additionally enabled: @code{mpy},
22117 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22119 @item 5
22120 @itemx wlh4
22121 One 16x16 multiplier, blocking,
22122 sequential.  The following instructions are additionally enabled: @code{mpy},
22123 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22125 @item 6
22126 @itemx wlh5
22127 One 32x4 multiplier, blocking,
22128 sequential.  The following instructions are additionally enabled: @code{mpy},
22129 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
22131 @item 7
22132 @itemx plus_dmpy
22133 ARC HS SIMD support.
22135 @item 8
22136 @itemx plus_macd
22137 ARC HS SIMD support.
22139 @item 9
22140 @itemx plus_qmacw
22141 ARC HS SIMD support.
22143 @end table
22145 This option is only available for ARCv2 cores@.
22147 @opindex mfpu
22148 @item -mfpu=@var{fpu}
22149 Enables support for specific floating-point hardware extensions for ARCv2
22150 cores.  Supported values for @var{fpu} are:
22152 @table @samp
22154 @item fpus
22155 Enables support for single-precision floating-point hardware
22156 extensions@.
22158 @item fpud
22159 Enables support for double-precision floating-point hardware
22160 extensions.  The single-precision floating-point extension is also
22161 enabled.  Not available for ARC EM@.
22163 @item fpuda
22164 Enables support for double-precision floating-point hardware
22165 extensions using double-precision assist instructions.  The single-precision
22166 floating-point extension is also enabled.  This option is
22167 only available for ARC EM@.
22169 @item fpuda_div
22170 Enables support for double-precision floating-point hardware
22171 extensions using double-precision assist instructions.
22172 The single-precision floating-point, square-root, and divide 
22173 extensions are also enabled.  This option is
22174 only available for ARC EM@.
22176 @item fpuda_fma
22177 Enables support for double-precision floating-point hardware
22178 extensions using double-precision assist instructions.
22179 The single-precision floating-point and fused multiply and add 
22180 hardware extensions are also enabled.  This option is
22181 only available for ARC EM@.
22183 @item fpuda_all
22184 Enables support for double-precision floating-point hardware
22185 extensions using double-precision assist instructions.
22186 All single-precision floating-point hardware extensions are also
22187 enabled.  This option is only available for ARC EM@.
22189 @item fpus_div
22190 Enables support for single-precision floating-point, square-root and divide 
22191 hardware extensions@.
22193 @item fpud_div
22194 Enables support for double-precision floating-point, square-root and divide 
22195 hardware extensions.  This option
22196 includes option @samp{fpus_div}. Not available for ARC EM@.
22198 @item fpus_fma
22199 Enables support for single-precision floating-point and 
22200 fused multiply and add hardware extensions@.
22202 @item fpud_fma
22203 Enables support for double-precision floating-point and 
22204 fused multiply and add hardware extensions.  This option
22205 includes option @samp{fpus_fma}.  Not available for ARC EM@.
22207 @item fpus_all
22208 Enables support for all single-precision floating-point hardware
22209 extensions@.
22211 @item fpud_all
22212 Enables support for all single- and double-precision floating-point
22213 hardware extensions.  Not available for ARC EM@.
22215 @end table
22217 @opindex mirq-ctrl-saved
22218 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
22219 Specifies general-purposes registers that the processor automatically
22220 saves/restores on interrupt entry and exit.  @var{register-range} is
22221 specified as two registers separated by a dash.  The register range
22222 always starts with @code{r0}, the upper limit is @code{fp} register.
22223 @var{blink} and @var{lp_count} are optional.  This option is only
22224 valid for ARC EM and ARC HS cores.
22226 @opindex mrgf-banked-regs
22227 @item -mrgf-banked-regs=@var{number}
22228 Specifies the number of registers replicated in second register bank
22229 on entry to fast interrupt.  Fast interrupts are interrupts with the
22230 highest priority level P0.  These interrupts save only PC and STATUS32
22231 registers to avoid memory transactions during interrupt entry and exit
22232 sequences.  Use this option when you are using fast interrupts in an
22233 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
22235 @opindex mlpc-width
22236 @item -mlpc-width=@var{width}
22237 Specify the width of the @code{lp_count} register.  Valid values for
22238 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
22239 fixed to 32 bits.  If the width is less than 32, the compiler does not
22240 attempt to transform loops in your program to use the zero-delay loop
22241 mechanism unless it is known that the @code{lp_count} register can
22242 hold the required loop-counter value.  Depending on the width
22243 specified, the compiler and run-time library might continue to use the
22244 loop mechanism for various needs.  This option defines macro
22245 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
22247 @opindex mrf16
22248 @item -mrf16
22249 This option instructs the compiler to generate code for a 16-entry
22250 register file.  This option defines the @code{__ARC_RF16__}
22251 preprocessor macro.
22253 @opindex mbranch-index
22254 @item -mbranch-index
22255 Enable use of @code{bi} or @code{bih} instructions to implement jump
22256 tables.
22258 @end table
22260 The following options are passed through to the assembler, and also
22261 define preprocessor macro symbols.
22263 @c Flags used by the assembler, but for which we define preprocessor
22264 @c macro symbols as well.
22265 @table @gcctabopt
22266 @opindex mdsp-packa
22267 @item -mdsp-packa
22268 Passed down to the assembler to enable the DSP Pack A extensions.
22269 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
22270 deprecated.
22272 @opindex mdvbf
22273 @item -mdvbf
22274 Passed down to the assembler to enable the dual Viterbi butterfly
22275 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
22276 option is deprecated.
22278 @c ARC700 4.10 extension instruction
22279 @opindex mlock
22280 @item -mlock
22281 Passed down to the assembler to enable the locked load/store
22282 conditional extension.  Also sets the preprocessor symbol
22283 @code{__Xlock}.
22285 @opindex mmac-d16
22286 @item -mmac-d16
22287 Passed down to the assembler.  Also sets the preprocessor symbol
22288 @code{__Xxmac_d16}.  This option is deprecated.
22290 @opindex mmac-24
22291 @item -mmac-24
22292 Passed down to the assembler.  Also sets the preprocessor symbol
22293 @code{__Xxmac_24}.  This option is deprecated.
22295 @c ARC700 4.10 extension instruction
22296 @opindex mrtsc
22297 @item -mrtsc
22298 Passed down to the assembler to enable the 64-bit time-stamp counter
22299 extension instruction.  Also sets the preprocessor symbol
22300 @code{__Xrtsc}.  This option is deprecated.
22302 @c ARC700 4.10 extension instruction
22303 @opindex mswape
22304 @item -mswape
22305 Passed down to the assembler to enable the swap byte ordering
22306 extension instruction.  Also sets the preprocessor symbol
22307 @code{__Xswape}.
22309 @opindex mtelephony
22310 @item -mtelephony
22311 Passed down to the assembler to enable dual- and single-operand
22312 instructions for telephony.  Also sets the preprocessor symbol
22313 @code{__Xtelephony}.  This option is deprecated.
22315 @opindex mxy
22316 @item -mxy
22317 Passed down to the assembler to enable the XY memory extension.  Also
22318 sets the preprocessor symbol @code{__Xxy}.
22320 @end table
22322 The following options control how the assembly code is annotated:
22324 @c Assembly annotation options
22325 @table @gcctabopt
22326 @opindex misize
22327 @item -misize
22328 Annotate assembler instructions with estimated addresses.
22330 @opindex mannotate-align
22331 @item -mannotate-align
22332 Does nothing.  Preserved for backward compatibility.
22334 @end table
22336 The following options are passed through to the linker:
22338 @c options passed through to the linker
22339 @table @gcctabopt
22340 @opindex marclinux
22341 @item -marclinux
22342 Passed through to the linker, to specify use of the @code{arclinux} emulation.
22343 This option is enabled by default in tool chains built for
22344 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
22345 when profiling is not requested.
22347 @opindex marclinux_prof
22348 @item -marclinux_prof
22349 Passed through to the linker, to specify use of the
22350 @code{arclinux_prof} emulation.  This option is enabled by default in
22351 tool chains built for @w{@code{arc-linux-uclibc}} and
22352 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
22354 @end table
22356 The following options control the semantics of generated code:
22358 @c semantically relevant code generation options
22359 @table @gcctabopt
22360 @opindex mlong-calls
22361 @item -mlong-calls
22362 Generate calls as register indirect calls, thus providing access
22363 to the full 32-bit address range.
22365 @opindex mmedium-calls
22366 @item -mmedium-calls
22367 Don't use less than 25-bit addressing range for calls, which is the
22368 offset available for an unconditional branch-and-link
22369 instruction.  Conditional execution of function calls is suppressed, to
22370 allow use of the 25-bit range, rather than the 21-bit range with
22371 conditional branch-and-link.  This is the default for tool chains built
22372 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
22374 @opindex G
22375 @item -G @var{num}
22376 Put definitions of externally-visible data in a small data section if
22377 that data is no bigger than @var{num} bytes.  The default value of
22378 @var{num} is 4 for any ARC configuration, or 8 when we have double
22379 load/store operations.
22381 @opindex mno-sdata
22382 @opindex msdata
22383 @item -mno-sdata
22384 Do not generate sdata references.  This is the default for tool chains
22385 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
22386 targets.
22388 @opindex mvolatile-cache
22389 @item -mvolatile-cache
22390 Use ordinarily cached memory accesses for volatile references.  This is the
22391 default.
22393 @opindex mno-volatile-cache
22394 @opindex mvolatile-cache
22395 @item -mno-volatile-cache
22396 Enable cache bypass for volatile references.
22398 @end table
22400 The following options fine tune code generation:
22401 @c code generation tuning options
22402 @table @gcctabopt
22403 @opindex malign-call
22404 @item -malign-call
22405 Does nothing.  Preserved for backward compatibility.
22407 @opindex mauto-modify-reg
22408 @item -mauto-modify-reg
22409 Enable the use of pre/post modify with register displacement.
22411 @opindex mbbit-peephole
22412 @item -mbbit-peephole
22413 Does nothing.  Preserved for backward compatibility.
22415 @opindex mno-brcc
22416 @item -mno-brcc
22417 This option disables a target-specific pass in @file{arc_reorg} to
22418 generate compare-and-branch (@code{br@var{cc}}) instructions.  
22419 It has no effect on
22420 generation of these instructions driven by the combiner pass.
22422 @opindex mcase-vector-pcrel
22423 @item -mcase-vector-pcrel
22424 Use PC-relative switch case tables to enable case table shortening.
22425 This is the default for @option{-Os}.
22427 @opindex mcompact-casesi
22428 @item -mcompact-casesi
22429 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
22430 and only available for ARCv1 cores.  This option is deprecated.
22432 @opindex mno-cond-exec
22433 @item -mno-cond-exec
22434 Disable the ARCompact-specific pass to generate conditional 
22435 execution instructions.
22437 Due to delay slot scheduling and interactions between operand numbers,
22438 literal sizes, instruction lengths, and the support for conditional execution,
22439 the target-independent pass to generate conditional execution is often lacking,
22440 so the ARC port has kept a special pass around that tries to find more
22441 conditional execution generation opportunities after register allocation,
22442 branch shortening, and delay slot scheduling have been done.  This pass
22443 generally, but not always, improves performance and code size, at the cost of
22444 extra compilation time, which is why there is an option to switch it off.
22445 If you have a problem with call instructions exceeding their allowable
22446 offset range because they are conditionalized, you should consider using
22447 @option{-mmedium-calls} instead.
22449 @opindex mearly-cbranchsi
22450 @item -mearly-cbranchsi
22451 Enable pre-reload use of the @code{cbranchsi} pattern.
22453 @opindex mexpand-adddi
22454 @item -mexpand-adddi
22455 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
22456 @code{add.f}, @code{adc} etc.  This option is deprecated.
22458 @opindex mindexed-loads
22459 @item -mindexed-loads
22460 Enable the use of indexed loads.  This can be problematic because some
22461 optimizers then assume that indexed stores exist, which is not
22462 the case.
22464 @opindex mlra
22465 @item -mlra
22466 Enable Local Register Allocation.  This is still experimental for ARC,
22467 so by default the compiler uses standard reload
22468 (i.e.@: @option{-mno-lra}).
22470 @opindex mlra-priority-none
22471 @item -mlra-priority-none
22472 Don't indicate any priority for target registers.
22474 @opindex mlra-priority-compact
22475 @item -mlra-priority-compact
22476 Indicate target register priority for r0..r3 / r12..r15.
22478 @opindex mlra-priority-noncompact
22479 @item -mlra-priority-noncompact
22480 Reduce target register priority for r0..r3 / r12..r15.
22482 @opindex mmillicode
22483 @item -mmillicode
22484 When optimizing for size (using @option{-Os}), prologues and epilogues
22485 that have to save or restore a large number of registers are often
22486 shortened by using call to a special function in libgcc; this is
22487 referred to as a @emph{millicode} call.  As these calls can pose
22488 performance issues, and/or cause linking issues when linking in a
22489 nonstandard way, this option is provided to turn on or off millicode
22490 call generation.
22492 @opindex mcode-density-frame
22493 @item -mcode-density-frame
22494 This option enable the compiler to emit @code{enter} and @code{leave}
22495 instructions.  These instructions are only valid for CPUs with
22496 code-density feature.
22498 @opindex mmixed-code
22499 @item -mmixed-code
22500 Does nothing.  Preserved for backward compatibility.
22502 @opindex mq-class
22503 @item -mq-class
22504 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
22505 This is the default for @option{-Os}.
22507 @opindex mRcq
22508 @item -mRcq
22509 Does nothing.  Preserved for backward compatibility.
22511 @opindex mRcw
22512 @item -mRcw
22513 Does nothing.  Preserved for backward compatibility.
22515 @opindex msize-level
22516 @item -msize-level=@var{level}
22517 Fine-tune size optimization with regards to instruction lengths and alignment.
22518 The recognized values for @var{level} are:
22519 @table @samp
22520 @item 0
22521 No size optimization.  This level is deprecated and treated like @samp{1}.
22523 @item 1
22524 Short instructions are used opportunistically.
22526 @item 2
22527 In addition, alignment of loops and of code after barriers are dropped.
22529 @item 3
22530 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
22532 @end table
22534 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
22535 the behavior when this is not set is equivalent to level @samp{1}.
22537 @opindex mtune
22538 @item -mtune=@var{cpu}
22539 Set instruction scheduling parameters for @var{cpu}, overriding any implied
22540 by @option{-mcpu=}.
22542 Supported values for @var{cpu} are
22544 @table @samp
22545 @item ARC600
22546 Tune for ARC600 CPU.
22548 @item ARC601
22549 Tune for ARC601 CPU.
22551 @item ARC700
22552 Tune for ARC700 CPU with standard multiplier block.
22554 @item ARC700-xmac
22555 Tune for ARC700 CPU with XMAC block.
22557 @item ARC725D
22558 Tune for ARC725D CPU.
22560 @item ARC750D
22561 Tune for ARC750D CPU.
22563 @item core3
22564 Tune for ARCv2 core3 type CPU.  This option enable usage of
22565 @code{dbnz} instruction.
22567 @item release31a
22568 Tune for ARC4x release 3.10a.
22570 @end table
22572 @opindex mmultcost
22573 @item -mmultcost=@var{num}
22574 Cost to assume for a multiply instruction, with @samp{4} being equal to a
22575 normal instruction.
22577 @opindex munalign-prob-threshold
22578 @item -munalign-prob-threshold=@var{probability}
22579 Does nothing.  Preserved for backward compatibility.
22581 @end table
22583 The following options are maintained for backward compatibility, but
22584 are now deprecated and will be removed in a future release:
22586 @c Deprecated options
22587 @table @gcctabopt
22589 @opindex margonaut
22590 @item -margonaut
22591 Obsolete FPX.
22593 @opindex mbig-endian
22594 @opindex EB
22595 @item -mbig-endian
22596 @itemx -EB
22597 Compile code for big-endian targets.  Use of these options is now
22598 deprecated.  Big-endian code is supported by configuring GCC to build
22599 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
22600 for which big endian is the default.
22602 @opindex mlittle-endian
22603 @opindex EL
22604 @item -mlittle-endian
22605 @itemx -EL
22606 Compile code for little-endian targets.  Use of these options is now
22607 deprecated.  Little-endian code is supported by configuring GCC to build 
22608 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
22609 for which little endian is the default.
22611 @opindex mbarrel_shifter
22612 @item -mbarrel_shifter
22613 Replaced by @option{-mbarrel-shifter}.
22615 @opindex mdpfp_compact
22616 @item -mdpfp_compact
22617 Replaced by @option{-mdpfp-compact}.
22619 @opindex mdpfp_fast
22620 @item -mdpfp_fast
22621 Replaced by @option{-mdpfp-fast}.
22623 @opindex mdsp_packa
22624 @item -mdsp_packa
22625 Replaced by @option{-mdsp-packa}.
22627 @opindex mEA
22628 @item -mEA
22629 Replaced by @option{-mea}.
22631 @opindex mmac_24
22632 @item -mmac_24
22633 Replaced by @option{-mmac-24}.
22635 @opindex mmac_d16
22636 @item -mmac_d16
22637 Replaced by @option{-mmac-d16}.
22639 @opindex mspfp_compact
22640 @item -mspfp_compact
22641 Replaced by @option{-mspfp-compact}.
22643 @opindex mspfp_fast
22644 @item -mspfp_fast
22645 Replaced by @option{-mspfp-fast}.
22647 @opindex mtune
22648 @item -mtune=@var{cpu}
22649 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
22650 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
22651 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
22653 @opindex multcost
22654 @item -multcost=@var{num}
22655 Replaced by @option{-mmultcost}.
22657 @end table
22659 @node ARM Options
22660 @subsection ARM Options
22661 @cindex ARM options
22663 These @samp{-m} options are defined for the ARM port:
22665 @table @gcctabopt
22666 @opindex mabi
22667 @item -mabi=@var{name}
22668 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
22669 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
22671 @opindex mapcs-frame
22672 @item -mapcs-frame
22673 Generate a stack frame that is compliant with the ARM Procedure Call
22674 Standard for all functions, even if this is not strictly necessary for
22675 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
22676 with this option causes the stack frames not to be generated for
22677 leaf functions.  The default is @option{-mno-apcs-frame}.
22678 This option is deprecated.
22680 @opindex mapcs
22681 @item -mapcs
22682 This is a synonym for @option{-mapcs-frame} and is deprecated.
22684 @ignore
22685 @c not currently implemented
22686 @opindex mapcs-stack-check
22687 @item -mapcs-stack-check
22688 Generate code to check the amount of stack space available upon entry to
22689 every function (that actually uses some stack space).  If there is
22690 insufficient space available then either the function
22691 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
22692 called, depending upon the amount of stack space required.  The runtime
22693 system is required to provide these functions.  The default is
22694 @option{-mno-apcs-stack-check}, since this produces smaller code.
22696 @c not currently implemented
22697 @opindex mapcs-reentrant
22698 @item -mapcs-reentrant
22699 Generate reentrant, position-independent code.  The default is
22700 @option{-mno-apcs-reentrant}.
22701 @end ignore
22703 @opindex mthumb-interwork
22704 @item -mthumb-interwork
22705 Generate code that supports calling between the ARM and Thumb
22706 instruction sets.  Without this option, on pre-v5 architectures, the
22707 two instruction sets cannot be reliably used inside one program.  The
22708 default is @option{-mno-thumb-interwork}, since slightly larger code
22709 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
22710 configurations this option is meaningless.
22712 @opindex mno-sched-prolog
22713 @opindex msched-prolog
22714 @item -mno-sched-prolog
22715 Prevent the reordering of instructions in the function prologue, or the
22716 merging of those instruction with the instructions in the function's
22717 body.  This means that all functions start with a recognizable set
22718 of instructions (or in fact one of a choice from a small set of
22719 different function prologues), and this information can be used to
22720 locate the start of functions inside an executable piece of code.  The
22721 default is @option{-msched-prolog}.
22723 @opindex mfloat-abi
22724 @item -mfloat-abi=@var{name}
22725 Specifies which floating-point ABI to use.  Permissible values
22726 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22728 Specifying @samp{soft} causes GCC to generate output containing
22729 library calls for floating-point operations.
22730 @samp{softfp} allows the generation of code using hardware floating-point
22731 instructions, but still uses the soft-float calling conventions.
22732 @samp{hard} allows generation of floating-point instructions
22733 and uses FPU-specific calling conventions.
22735 The default depends on the specific target configuration.  Note that
22736 the hard-float and soft-float ABIs are not link-compatible; you must
22737 compile your entire program with the same ABI, and link with a
22738 compatible set of libraries.
22740 @opindex mgeneral-regs-only
22741 @item -mgeneral-regs-only
22742 Generate code which uses only the general-purpose registers.  This will prevent
22743 the compiler from using floating-point and Advanced SIMD registers but will not
22744 impose any restrictions on the assembler.
22746 @opindex mlittle-endian
22747 @item -mlittle-endian
22748 Generate code for a processor running in little-endian mode.  This is
22749 the default for all standard configurations.
22751 @opindex mbig-endian
22752 @item -mbig-endian
22753 Generate code for a processor running in big-endian mode; the default is
22754 to compile code for a little-endian processor.
22756 @opindex mbe8
22757 @item -mbe8
22758 @itemx -mbe32
22759 When linking a big-endian image select between BE8 and BE32 formats.
22760 The option has no effect for little-endian images and is ignored.  The
22761 default is dependent on the selected target architecture.  For ARMv6
22762 and later architectures the default is BE8, for older architectures
22763 the default is BE32.  BE32 format has been deprecated by ARM.
22765 @opindex march
22766 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
22767 This specifies the name of the target ARM architecture.  GCC uses this
22768 name to determine what kind of instructions it can emit when generating
22769 assembly code.  This option can be used in conjunction with or instead
22770 of the @option{-mcpu=} option.
22772 Permissible names are:
22773 @samp{armv4t},
22774 @samp{armv5t}, @samp{armv5te},
22775 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
22776 @samp{armv6z}, @samp{armv6zk},
22777 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22778 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22779 @samp{armv8.4-a},
22780 @samp{armv8.5-a},
22781 @samp{armv8.6-a},
22782 @samp{armv9-a},
22783 @samp{armv7-r},
22784 @samp{armv8-r},
22785 @samp{armv6-m}, @samp{armv6s-m},
22786 @samp{armv7-m}, @samp{armv7e-m},
22787 @samp{armv8-m.base}, @samp{armv8-m.main},
22788 @samp{armv8.1-m.main},
22789 @samp{armv9-a},
22790 @samp{iwmmxt} and @samp{iwmmxt2}.
22792 Additionally, the following architectures, which lack support for the
22793 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22795 Many of the architectures support extensions.  These can be added by
22796 appending @samp{+@var{extension}} to the architecture name.  Extension
22797 options are processed in order and capabilities accumulate.  An extension
22798 will also enable any necessary base extensions
22799 upon which it depends.  For example, the @samp{+crypto} extension
22800 will always enable the @samp{+simd} extension.  The exception to the
22801 additive construction is for extensions that are prefixed with
22802 @samp{+no@dots{}}: these extensions disable the specified option and
22803 any other extensions that may depend on the presence of that
22804 extension.
22806 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22807 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22808 entirely disabled by the @samp{+nofp} option that follows it.
22810 Most extension names are generically named, but have an effect that is
22811 dependent upon the architecture to which it is applied.  For example,
22812 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22813 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22814 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22815 variant for @samp{armv8-a}.
22817 The table below lists the supported extensions for each architecture.
22818 Architectures not mentioned do not support any extensions.
22820 @table @samp
22821 @item armv5te
22822 @itemx armv6
22823 @itemx armv6j
22824 @itemx armv6k
22825 @itemx armv6kz
22826 @itemx armv6t2
22827 @itemx armv6z
22828 @itemx armv6zk
22829 @table @samp
22830 @item +fp
22831 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22832 used as an alias for this extension.
22834 @item +nofp
22835 Disable the floating-point instructions.
22836 @end table
22838 @item armv7
22839 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22840 @table @samp
22841 @item +fp
22842 The VFPv3 floating-point instructions, with 16 double-precision
22843 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22844 for this extension.  Note that floating-point is not supported by the
22845 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22846 ARMv7-R architectures.
22848 @item +nofp
22849 Disable the floating-point instructions.
22850 @end table
22852 @item armv7-a
22853 @table @samp
22854 @item +mp
22855 The multiprocessing extension.
22857 @item +sec
22858 The security extension.
22860 @item +fp
22861 The VFPv3 floating-point instructions, with 16 double-precision
22862 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22863 for this extension.
22865 @item +simd
22866 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22867 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22868 for this extension.
22870 @item +vfpv3
22871 The VFPv3 floating-point instructions, with 32 double-precision
22872 registers.
22874 @item +vfpv3-d16-fp16
22875 The VFPv3 floating-point instructions, with 16 double-precision
22876 registers and the half-precision floating-point conversion operations.
22878 @item +vfpv3-fp16
22879 The VFPv3 floating-point instructions, with 32 double-precision
22880 registers and the half-precision floating-point conversion operations.
22882 @item +vfpv4-d16
22883 The VFPv4 floating-point instructions, with 16 double-precision
22884 registers.
22886 @item +vfpv4
22887 The VFPv4 floating-point instructions, with 32 double-precision
22888 registers.
22890 @item +neon-fp16
22891 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22892 the half-precision floating-point conversion operations.
22894 @item +neon-vfpv4
22895 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22897 @item +nosimd
22898 Disable the Advanced SIMD instructions (does not disable floating point).
22900 @item +nofp
22901 Disable the floating-point and Advanced SIMD instructions.
22902 @end table
22904 @item armv7ve
22905 The extended version of the ARMv7-A architecture with support for
22906 virtualization.
22907 @table @samp
22908 @item +fp
22909 The VFPv4 floating-point instructions, with 16 double-precision registers.
22910 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22912 @item +simd
22913 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22914 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22916 @item +vfpv3-d16
22917 The VFPv3 floating-point instructions, with 16 double-precision
22918 registers.
22920 @item +vfpv3
22921 The VFPv3 floating-point instructions, with 32 double-precision
22922 registers.
22924 @item +vfpv3-d16-fp16
22925 The VFPv3 floating-point instructions, with 16 double-precision
22926 registers and the half-precision floating-point conversion operations.
22928 @item +vfpv3-fp16
22929 The VFPv3 floating-point instructions, with 32 double-precision
22930 registers and the half-precision floating-point conversion operations.
22932 @item +vfpv4-d16
22933 The VFPv4 floating-point instructions, with 16 double-precision
22934 registers.
22936 @item +vfpv4
22937 The VFPv4 floating-point instructions, with 32 double-precision
22938 registers.
22940 @item +neon
22941 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22942 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22944 @item +neon-fp16
22945 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22946 the half-precision floating-point conversion operations.
22948 @item +nosimd
22949 Disable the Advanced SIMD instructions (does not disable floating point).
22951 @item +nofp
22952 Disable the floating-point and Advanced SIMD instructions.
22953 @end table
22955 @item armv8-a
22956 @table @samp
22957 @item +crc
22958 The Cyclic Redundancy Check (CRC) instructions.
22959 @item +simd
22960 The ARMv8-A Advanced SIMD and floating-point instructions.
22961 @item +crypto
22962 The cryptographic instructions.
22963 @item +nocrypto
22964 Disable the cryptographic instructions.
22965 @item +nofp
22966 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22967 @item +sb
22968 Speculation Barrier Instruction.
22969 @item +predres
22970 Execution and Data Prediction Restriction Instructions.
22971 @end table
22973 @item armv8.1-a
22974 @table @samp
22975 @item +simd
22976 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22978 @item +crypto
22979 The cryptographic instructions.  This also enables the Advanced SIMD and
22980 floating-point instructions.
22982 @item +nocrypto
22983 Disable the cryptographic instructions.
22985 @item +nofp
22986 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22988 @item +sb
22989 Speculation Barrier Instruction.
22991 @item +predres
22992 Execution and Data Prediction Restriction Instructions.
22993 @end table
22995 @item armv8.2-a
22996 @itemx armv8.3-a
22997 @table @samp
22998 @item +fp16
22999 The half-precision floating-point data processing instructions.
23000 This also enables the Advanced SIMD and floating-point instructions.
23002 @item +fp16fml
23003 The half-precision floating-point fmla extension.  This also enables
23004 the half-precision floating-point extension and Advanced SIMD and
23005 floating-point instructions.
23007 @item +simd
23008 The ARMv8.1-A Advanced SIMD and floating-point instructions.
23010 @item +crypto
23011 The cryptographic instructions.  This also enables the Advanced SIMD and
23012 floating-point instructions.
23014 @item +dotprod
23015 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
23017 @item +nocrypto
23018 Disable the cryptographic extension.
23020 @item +nofp
23021 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23023 @item +sb
23024 Speculation Barrier Instruction.
23026 @item +predres
23027 Execution and Data Prediction Restriction Instructions.
23029 @item +i8mm
23030 8-bit Integer Matrix Multiply instructions.
23031 This also enables Advanced SIMD and floating-point instructions.
23033 @item +bf16
23034 Brain half-precision floating-point instructions.
23035 This also enables Advanced SIMD and floating-point instructions.
23036 @end table
23038 @item armv8.4-a
23039 @table @samp
23040 @item +fp16
23041 The half-precision floating-point data processing instructions.
23042 This also enables the Advanced SIMD and floating-point instructions as well
23043 as the Dot Product extension and the half-precision floating-point fmla
23044 extension.
23046 @item +simd
23047 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23048 Dot Product extension.
23050 @item +crypto
23051 The cryptographic instructions.  This also enables the Advanced SIMD and
23052 floating-point instructions as well as the Dot Product extension.
23054 @item +nocrypto
23055 Disable the cryptographic extension.
23057 @item +nofp
23058 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23060 @item +sb
23061 Speculation Barrier Instruction.
23063 @item +predres
23064 Execution and Data Prediction Restriction Instructions.
23066 @item +i8mm
23067 8-bit Integer Matrix Multiply instructions.
23068 This also enables Advanced SIMD and floating-point instructions.
23070 @item +bf16
23071 Brain half-precision floating-point instructions.
23072 This also enables Advanced SIMD and floating-point instructions.
23073 @end table
23075 @item armv8.5-a
23076 @table @samp
23077 @item +fp16
23078 The half-precision floating-point data processing instructions.
23079 This also enables the Advanced SIMD and floating-point instructions as well
23080 as the Dot Product extension and the half-precision floating-point fmla
23081 extension.
23083 @item +simd
23084 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23085 Dot Product extension.
23087 @item +crypto
23088 The cryptographic instructions.  This also enables the Advanced SIMD and
23089 floating-point instructions as well as the Dot Product extension.
23091 @item +nocrypto
23092 Disable the cryptographic extension.
23094 @item +nofp
23095 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23097 @item +i8mm
23098 8-bit Integer Matrix Multiply instructions.
23099 This also enables Advanced SIMD and floating-point instructions.
23101 @item +bf16
23102 Brain half-precision floating-point instructions.
23103 This also enables Advanced SIMD and floating-point instructions.
23104 @end table
23106 @item armv8.6-a
23107 @table @samp
23108 @item +fp16
23109 The half-precision floating-point data processing instructions.
23110 This also enables the Advanced SIMD and floating-point instructions as well
23111 as the Dot Product extension and the half-precision floating-point fmla
23112 extension.
23114 @item +simd
23115 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
23116 Dot Product extension.
23118 @item +crypto
23119 The cryptographic instructions.  This also enables the Advanced SIMD and
23120 floating-point instructions as well as the Dot Product extension.
23122 @item +nocrypto
23123 Disable the cryptographic extension.
23125 @item +nofp
23126 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23128 @item +i8mm
23129 8-bit Integer Matrix Multiply instructions.
23130 This also enables Advanced SIMD and floating-point instructions.
23132 @item +bf16
23133 Brain half-precision floating-point instructions.
23134 This also enables Advanced SIMD and floating-point instructions.
23135 @end table
23137 @item armv7-r
23138 @table @samp
23139 @item +fp.sp
23140 The single-precision VFPv3 floating-point instructions.  The extension
23141 @samp{+vfpv3xd} can be used as an alias for this extension.
23143 @item +fp
23144 The VFPv3 floating-point instructions with 16 double-precision registers.
23145 The extension +vfpv3-d16 can be used as an alias for this extension.
23147 @item +vfpv3xd-d16-fp16
23148 The single-precision VFPv3 floating-point instructions with 16 double-precision
23149 registers and the half-precision floating-point conversion operations.
23151 @item +vfpv3-d16-fp16
23152 The VFPv3 floating-point instructions with 16 double-precision
23153 registers and the half-precision floating-point conversion operations.
23155 @item +nofp
23156 Disable the floating-point extension.
23158 @item +idiv
23159 The ARM-state integer division instructions.
23161 @item +noidiv
23162 Disable the ARM-state integer division extension.
23163 @end table
23165 @item armv7e-m
23166 @table @samp
23167 @item +fp
23168 The single-precision VFPv4 floating-point instructions.
23170 @item +fpv5
23171 The single-precision FPv5 floating-point instructions.
23173 @item +fp.dp
23174 The single- and double-precision FPv5 floating-point instructions.
23176 @item +nofp
23177 Disable the floating-point extensions.
23178 @end table
23180 @item  armv8.1-m.main
23181 @table @samp
23183 @item +dsp
23184 The DSP instructions.
23186 @item +mve
23187 The M-Profile Vector Extension (MVE) integer instructions.
23189 @item +mve.fp
23190 The M-Profile Vector Extension (MVE) integer and single precision
23191 floating-point instructions.
23193 @item +fp
23194 The single-precision floating-point instructions.
23196 @item +fp.dp
23197 The single- and double-precision floating-point instructions.
23199 @item +nofp
23200 Disable the floating-point extension.
23202 @item +cdecp0, +cdecp1, ... , +cdecp7
23203 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23204 to the numbers given in the options in the range 0 to 7.
23206 @item +pacbti
23207 Enable the Pointer Authentication and Branch Target Identification Extension.
23208 @end table
23210 @item  armv8-m.main
23211 @table @samp
23212 @item +dsp
23213 The DSP instructions.
23215 @item +nodsp
23216 Disable the DSP extension.
23218 @item +fp
23219 The single-precision floating-point instructions.
23221 @item +fp.dp
23222 The single- and double-precision floating-point instructions.
23224 @item +nofp
23225 Disable the floating-point extension.
23227 @item +cdecp0, +cdecp1, ... , +cdecp7
23228 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23229 to the numbers given in the options in the range 0 to 7.
23230 @end table
23232 @item armv8-r
23233 @table @samp
23234 @item +crc
23235 The Cyclic Redundancy Check (CRC) instructions.
23236 @item +fp.sp
23237 The single-precision FPv5 floating-point instructions.
23238 @item +simd
23239 The ARMv8-A Advanced SIMD and floating-point instructions.
23240 @item +crypto
23241 The cryptographic instructions.
23242 @item +nocrypto
23243 Disable the cryptographic instructions.
23244 @item +nofp
23245 Disable the floating-point, Advanced SIMD and cryptographic instructions.
23246 @end table
23248 @end table
23250 @option{-march=native} causes the compiler to auto-detect the architecture
23251 of the build computer.  At present, this feature is only supported on
23252 GNU/Linux, and not all architectures are recognized.  If the auto-detect
23253 is unsuccessful the option has no effect.
23255 @opindex mtune
23256 @item -mtune=@var{name}
23257 This option specifies the name of the target ARM processor for
23258 which GCC should tune the performance of the code.
23259 For some ARM implementations better performance can be obtained by using
23260 this option.
23261 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
23262 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
23263 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
23264 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
23265 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
23266 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
23267 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
23268 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
23269 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
23270 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
23271 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
23272 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
23273 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
23274 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
23275 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
23276 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
23277 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
23278 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
23279 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
23280 @samp{cortex-m35p}, @samp{cortex-m52}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
23281 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
23282 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
23283 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
23284 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
23285 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
23286 @samp{xgene1}.
23288 Additionally, this option can specify that GCC should tune the performance
23289 of the code for a big.LITTLE system.  Permissible names are:
23290 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
23291 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
23292 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
23293 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
23295 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
23296 performance for a blend of processors within architecture @var{arch}.
23297 The aim is to generate code that run well on the current most popular
23298 processors, balancing between optimizations that benefit some CPUs in the
23299 range, and avoiding performance pitfalls of other CPUs.  The effects of
23300 this option may change in future GCC versions as CPU models come and go.
23302 @option{-mtune} permits the same extension options as @option{-mcpu}, but
23303 the extension options do not affect the tuning of the generated code.
23305 @option{-mtune=native} causes the compiler to auto-detect the CPU
23306 of the build computer.  At present, this feature is only supported on
23307 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
23308 unsuccessful the option has no effect.
23310 @opindex mcpu
23311 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
23312 This specifies the name of the target ARM processor.  GCC uses this name
23313 to derive the name of the target ARM architecture (as if specified
23314 by @option{-march}) and the ARM processor type for which to tune for
23315 performance (as if specified by @option{-mtune}).  Where this option
23316 is used in conjunction with @option{-march} or @option{-mtune},
23317 those options take precedence over the appropriate part of this option.
23319 Many of the supported CPUs implement optional architectural
23320 extensions.  Where this is so the architectural extensions are
23321 normally enabled by default.  If implementations that lack the
23322 extension exist, then the extension syntax can be used to disable
23323 those extensions that have been omitted.  For floating-point and
23324 Advanced SIMD (Neon) instructions, the settings of the options
23325 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
23326 floating-point and Advanced SIMD instructions will only be used if
23327 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
23328 @option{-mfpu} other than @samp{auto} will override the available
23329 floating-point and SIMD extension instructions.
23331 For example, @samp{cortex-a9} can be found in three major
23332 configurations: integer only, with just a floating-point unit or with
23333 floating-point and Advanced SIMD.  The default is to enable all the
23334 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
23335 be used to disable just the SIMD or both the SIMD and floating-point
23336 instructions respectively.
23338 Permissible names for this option are the same as those for
23339 @option{-mtune}.
23341 The following extension options are common to the listed CPUs:
23343 @table @samp
23344 @item +nodsp
23345 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
23346 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23347 Also disable the M-Profile Vector Extension (MVE) integer and
23348 single precision floating-point instructions on
23349 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23351 @item +nopacbti
23352 Disable the Pointer Authentication and Branch Target Identification Extension
23353 on @samp{cortex-m52} and @samp{cortex-m85}.
23355 @item +nomve
23356 Disable the M-Profile Vector Extension (MVE) integer and single precision
23357 floating-point instructions on @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23359 @item +nomve.fp
23360 Disable the M-Profile Vector Extension (MVE) single precision floating-point
23361 instructions on @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23363 @item +cdecp0, +cdecp1, ... , +cdecp7
23364 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
23365 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m52} and @samp{cortex-m55}.
23367 @item  +nofp
23368 Disables the floating-point instructions on @samp{arm9e},
23369 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
23370 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
23371 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
23372 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
23373 @samp{cortex-m52}, @samp{cortex-m55} and @samp{cortex-m85}.
23374 Disables the floating-point and SIMD instructions on
23375 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
23376 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
23377 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
23378 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
23379 @samp{cortex-a53} and @samp{cortex-a55}.
23381 @item +nofp.dp
23382 Disables the double-precision component of the floating-point instructions
23383 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
23384 @samp{cortex-r52plus} and @samp{cortex-m7}.
23386 @item +nosimd
23387 Disables the SIMD (but not floating-point) instructions on
23388 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
23389 and @samp{cortex-a9}.
23391 @item +crypto
23392 Enables the cryptographic instructions on @samp{cortex-a32},
23393 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
23394 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
23395 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
23396 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
23397 @samp{cortex-a75.cortex-a55}.
23398 @end table
23400 Additionally the @samp{generic-armv7-a} pseudo target defaults to
23401 VFPv3 with 16 double-precision registers.  It supports the following
23402 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
23403 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
23404 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
23405 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
23406 the extensions to @option{-march=armv7-a}.
23408 @option{-mcpu=generic-@var{arch}} is also permissible, and is
23409 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
23410 See @option{-mtune} for more information.
23412 @option{-mcpu=native} causes the compiler to auto-detect the CPU
23413 of the build computer.  At present, this feature is only supported on
23414 GNU/Linux, and not all architectures are recognized.  If the auto-detect
23415 is unsuccessful the option has no effect.
23417 @opindex mfpu
23418 @item -mfpu=@var{name}
23419 This specifies what floating-point hardware (or hardware emulation) is
23420 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
23421 @samp{vfpv3},
23422 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
23423 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
23424 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
23425 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
23426 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
23427 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
23428 is an alias for @samp{vfpv2}.
23430 The setting @samp{auto} is the default and is special.  It causes the
23431 compiler to select the floating-point and Advanced SIMD instructions
23432 based on the settings of @option{-mcpu} and @option{-march}.
23434 If the selected floating-point hardware includes the NEON extension
23435 (e.g.@: @option{-mfpu=neon}), note that floating-point
23436 operations are not generated by GCC's auto-vectorization pass unless
23437 @option{-funsafe-math-optimizations} is also specified.  This is
23438 because NEON hardware does not fully implement the IEEE 754 standard for
23439 floating-point arithmetic (in particular denormal values are treated as
23440 zero), so the use of NEON instructions may lead to a loss of precision.
23442 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}).
23444 @opindex mfp16-format
23445 @item -mfp16-format=@var{name}
23446 Specify the format of the @code{__fp16} half-precision floating-point type.
23447 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
23448 the default is @samp{none}, in which case the @code{__fp16} type is not
23449 defined.  @xref{Half-Precision}, for more information.
23451 @opindex mstructure-size-boundary
23452 @item -mstructure-size-boundary=@var{n}
23453 The sizes of all structures and unions are rounded up to a multiple
23454 of the number of bits set by this option.  Permissible values are 8, 32
23455 and 64.  The default value varies for different toolchains.  For the COFF
23456 targeted toolchain the default value is 8.  A value of 64 is only allowed
23457 if the underlying ABI supports it.
23459 Specifying a larger number can produce faster, more efficient code, but
23460 can also increase the size of the program.  Different values are potentially
23461 incompatible.  Code compiled with one value cannot necessarily expect to
23462 work with code or libraries compiled with another value, if they exchange
23463 information using structures or unions.
23465 This option is deprecated.
23467 @opindex mabort-on-noreturn
23468 @item -mabort-on-noreturn
23469 Generate a call to the function @code{abort} at the end of a
23470 @code{noreturn} function.  It is executed if the function tries to
23471 return.
23473 @opindex mlong-calls
23474 @opindex mno-long-calls
23475 @item -mlong-calls
23476 @itemx -mno-long-calls
23477 Tells the compiler to perform function calls by first loading the
23478 address of the function into a register and then performing a subroutine
23479 call on this register.  This switch is needed if the target function
23480 lies outside of the 64-megabyte addressing range of the offset-based
23481 version of subroutine call instruction.
23483 Even if this switch is enabled, not all function calls are turned
23484 into long calls.  The heuristic is that static functions, functions
23485 that have the @code{short_call} attribute, functions that are inside
23486 the scope of a @code{#pragma no_long_calls} directive, and functions whose
23487 definitions have already been compiled within the current compilation
23488 unit are not turned into long calls.  The exceptions to this rule are
23489 that weak function definitions, functions with the @code{long_call}
23490 attribute or the @code{section} attribute, and functions that are within
23491 the scope of a @code{#pragma long_calls} directive are always
23492 turned into long calls.
23494 This feature is not enabled by default.  Specifying
23495 @option{-mno-long-calls} restores the default behavior, as does
23496 placing the function calls within the scope of a @code{#pragma
23497 long_calls_off} directive.  Note these switches have no effect on how
23498 the compiler generates code to handle function calls via function
23499 pointers.
23501 @opindex msingle-pic-base
23502 @item -msingle-pic-base
23503 Treat the register used for PIC addressing as read-only, rather than
23504 loading it in the prologue for each function.  The runtime system is
23505 responsible for initializing this register with an appropriate value
23506 before execution begins.
23508 @opindex mpic-register
23509 @item -mpic-register=@var{reg}
23510 Specify the register to be used for PIC addressing.
23511 For standard PIC base case, the default is any suitable register
23512 determined by compiler.  For single PIC base case, the default is
23513 @samp{R9} if target is EABI based or stack-checking is enabled,
23514 otherwise the default is @samp{R10}.
23516 @opindex mpic-data-is-text-relative
23517 @item -mpic-data-is-text-relative
23518 Assume that the displacement between the text and data segments is fixed
23519 at static link time.  This permits using PC-relative addressing
23520 operations to access data known to be in the data segment.  For
23521 non-VxWorks RTP targets, this option is enabled by default.  When
23522 disabled on such targets, it will enable @option{-msingle-pic-base} by
23523 default.
23525 @opindex mpoke-function-name
23526 @item -mpoke-function-name
23527 Write the name of each function into the text section, directly
23528 preceding the function prologue.  The generated code is similar to this:
23530 @smallexample
23531      t0
23532          .ascii "arm_poke_function_name", 0
23533          .align
23534      t1
23535          .word 0xff000000 + (t1 - t0)
23536      arm_poke_function_name
23537          mov     ip, sp
23538          stmfd   sp!, @{fp, ip, lr, pc@}
23539          sub     fp, ip, #4
23540 @end smallexample
23542 When performing a stack backtrace, code can inspect the value of
23543 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
23544 location @code{pc - 12} and the top 8 bits are set, then we know that
23545 there is a function name embedded immediately preceding this location
23546 and has length @code{((pc[-3]) & 0xff000000)}.
23548 @opindex marm
23549 @opindex mthumb
23550 @item -mthumb
23551 @itemx -marm
23553 Select between generating code that executes in ARM and Thumb
23554 states.  The default for most configurations is to generate code
23555 that executes in ARM state, but the default can be changed by
23556 configuring GCC with the @option{--with-mode=}@var{state}
23557 configure option.
23559 You can also override the ARM and Thumb mode for each function
23560 by using the @code{target("thumb")} and @code{target("arm")} function attributes
23561 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
23563 @opindex mflip-thumb
23564 @item -mflip-thumb 
23565 Switch ARM/Thumb modes on alternating functions.
23566 This option is provided for regression testing of mixed Thumb/ARM code
23567 generation, and is not intended for ordinary use in compiling code.
23569 @opindex mtpcs-frame
23570 @item -mtpcs-frame
23571 Generate a stack frame that is compliant with the Thumb Procedure Call
23572 Standard for all non-leaf functions.  (A leaf function is one that does
23573 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
23575 @opindex mtpcs-leaf-frame
23576 @item -mtpcs-leaf-frame
23577 Generate a stack frame that is compliant with the Thumb Procedure Call
23578 Standard for all leaf functions.  (A leaf function is one that does
23579 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
23581 @opindex mcallee-super-interworking
23582 @item -mcallee-super-interworking
23583 Gives all externally visible functions in the file being compiled an ARM
23584 instruction set header which switches to Thumb mode before executing the
23585 rest of the function.  This allows these functions to be called from
23586 non-interworking code.  This option is not valid in AAPCS configurations
23587 because interworking is enabled by default.
23589 @opindex mcaller-super-interworking
23590 @item -mcaller-super-interworking
23591 Allows calls via function pointers (including virtual functions) to
23592 execute correctly regardless of whether the target code has been
23593 compiled for interworking or not.  There is a small overhead in the cost
23594 of executing a function pointer if this option is enabled.  This option
23595 is not valid in AAPCS configurations because interworking is enabled
23596 by default.
23598 @opindex mtp
23599 @item -mtp=@var{name}
23600 Specify the access model for the thread local storage pointer.  The model
23601 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
23602 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
23603 the thread pointer from the corresponding system register directly
23604 (supported from the arm6k architecture and later).  These system registers
23605 are accessed through the CP15 co-processor interface and the argument
23606 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
23607 The argument @samp{auto} uses the best available method for the selected
23608 processor.  The default setting is @samp{auto}.
23610 @opindex mtls-dialect
23611 @item -mtls-dialect=@var{dialect}
23612 Specify the dialect to use for accessing thread local storage.  Two
23613 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
23614 @samp{gnu} dialect selects the original GNU scheme for supporting
23615 local and global dynamic TLS models.  The @samp{gnu2} dialect
23616 selects the GNU descriptor scheme, which provides better performance
23617 for shared libraries.  The GNU descriptor scheme is compatible with
23618 the original scheme, but does require new assembler, linker and
23619 library support.  Initial and local exec TLS models are unaffected by
23620 this option and always use the original scheme.
23622 @opindex mword-relocations
23623 @item -mword-relocations
23624 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
23625 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
23626 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
23627 is specified. This option conflicts with @option{-mslow-flash-data}.
23629 @opindex mfix-cortex-m3-ldrd
23630 @item -mfix-cortex-m3-ldrd
23631 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
23632 with overlapping destination and base registers are used.  This option avoids
23633 generating these instructions.  This option is enabled by default when
23634 @option{-mcpu=cortex-m3} is specified.
23636 @item -mfix-cortex-a57-aes-1742098
23637 @itemx -mno-fix-cortex-a57-aes-1742098
23638 @itemx -mfix-cortex-a72-aes-1655431
23639 @itemx -mno-fix-cortex-a72-aes-1655431
23640 Enable (disable) mitigation for an erratum on Cortex-A57 and
23641 Cortex-A72 that affects the AES cryptographic instructions.  This
23642 option is enabled by default when either @option{-mcpu=cortex-a57} or
23643 @option{-mcpu=cortex-a72} is specified.
23645 @opindex munaligned-access
23646 @opindex mno-unaligned-access
23647 @item -munaligned-access
23648 @itemx -mno-unaligned-access
23649 Enables (or disables) reading and writing of 16- and 32- bit values
23650 from addresses that are not 16- or 32- bit aligned.  By default
23651 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
23652 ARMv8-M Baseline architectures, and enabled for all other
23653 architectures.  If unaligned access is not enabled then words in packed
23654 data structures are accessed a byte at a time.
23656 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
23657 generated object file to either true or false, depending upon the
23658 setting of this option.  If unaligned access is enabled then the
23659 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
23660 defined.
23662 @opindex mneon-for-64bits
23663 @item -mneon-for-64bits
23664 This option is deprecated and has no effect.
23666 @opindex mslow-flash-data
23667 @item -mslow-flash-data
23668 Assume loading data from flash is slower than fetching instruction.
23669 Therefore literal load is minimized for better performance.
23670 This option is only supported when compiling for ARMv7 M-profile and
23671 off by default. It conflicts with @option{-mword-relocations}.
23673 @opindex masm-syntax-unified
23674 @item -masm-syntax-unified
23675 Assume inline assembler is using unified asm syntax.  The default is
23676 currently off which implies divided syntax.  This option has no impact
23677 on Thumb2. However, this may change in future releases of GCC.
23678 Divided syntax should be considered deprecated.
23680 @opindex mrestrict-it
23681 @item -mrestrict-it
23682 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
23683 IT blocks can only contain a single 16-bit instruction from a select
23684 set of instructions. This option is on by default for ARMv8-A Thumb mode.
23686 @opindex mprint-tune-info
23687 @item -mprint-tune-info
23688 Print CPU tuning information as comment in assembler file.  This is
23689 an option used only for regression testing of the compiler and not
23690 intended for ordinary use in compiling code.  This option is disabled
23691 by default.
23693 @opindex mverbose-cost-dump
23694 @item -mverbose-cost-dump
23695 Enable verbose cost model dumping in the debug dump files.  This option is
23696 provided for use in debugging the compiler.
23698 @opindex mpure-code
23699 @item -mpure-code
23700 Do not allow constant data to be placed in code sections.
23701 Additionally, when compiling for ELF object format give all text sections the
23702 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
23703 is only available when generating non-pic code for M-profile targets.
23705 @opindex mcmse
23706 @item -mcmse
23707 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
23708 Development Tools Engineering Specification", which can be found on
23709 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
23711 @opindex mfix-cmse-cve-2021-35465
23712 @item -mfix-cmse-cve-2021-35465
23713 Mitigate against a potential security issue with the @code{VLLDM} instruction
23714 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
23715 enabled by default when the option @option{-mcpu=} is used with
23716 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m52}, @code{cortex-m55},
23717 @code{cortex-m85} or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465}
23718 can be used to disable the mitigation.
23720 @opindex mstack-protector-guard
23721 @opindex mstack-protector-guard-offset
23722 @item -mstack-protector-guard=@var{guard}
23723 @itemx -mstack-protector-guard-offset=@var{offset}
23724 Generate stack protection code using canary at @var{guard}.  Supported
23725 locations are @samp{global} for a global canary or @samp{tls} for a
23726 canary accessible via the TLS register. The option
23727 @option{-mstack-protector-guard-offset=} is for use with
23728 @option{-fstack-protector-guard=tls} and not for use in user-land code.
23730 @opindex mfdpic
23731 @opindex mno-fdpic
23732 @item -mfdpic
23733 @itemx -mno-fdpic
23734 Select the FDPIC ABI, which uses 64-bit function descriptors to
23735 represent pointers to functions.  When the compiler is configured for
23736 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
23737 and implies @option{-fPIE} if none of the PIC/PIE-related options is
23738 provided.  On other targets, it only enables the FDPIC-specific code
23739 generation features, and the user should explicitly provide the
23740 PIC/PIE-related options as needed.
23742 Note that static linking is not supported because it would still
23743 involve the dynamic linker when the program self-relocates.  If such
23744 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
23746 The opposite @option{-mno-fdpic} option is useful (and required) to
23747 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
23748 toolchain as the one used to build the userland programs.
23750 @opindex mbranch-protection
23751 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
23752 Enable branch protection features (armv8.1-m.main only).
23753 @samp{none} generate code without branch protection or return address
23754 signing.
23755 @samp{standard[+@var{leaf}]} generate code with all branch protection
23756 features enabled at their standard level.
23757 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
23758 set to its standard level, which is to sign all functions that save
23759 the return address to memory.
23760 @samp{leaf} When return address signing is enabled, also sign leaf
23761 functions even if they do not write the return address to memory.
23762 +@samp{bti} Add landing-pad instructions at the permitted targets of
23763 indirect branch instructions.
23765 If the @samp{+pacbti} architecture extension is not enabled, then all
23766 branch protection and return address signing operations are
23767 constrained to use only the instructions defined in the
23768 architectural-NOP space. The generated code will remain
23769 backwards-compatible with earlier versions of the architecture, but
23770 the additional security can be enabled at run time on processors that
23771 support the @samp{PACBTI} extension.
23773 Branch target enforcement using BTI can only be enabled at runtime if
23774 all code in the application has been compiled with at least
23775 @samp{-mbranch-protection=bti}.
23777 Any setting other than @samp{none} is supported only on armv8-m.main
23778 or later.
23780 The default is to generate code without branch protection or return
23781 address signing.
23783 @end table
23785 @node AVR Options
23786 @subsection AVR Options
23787 @cindex AVR Options
23789 These options are defined for AVR implementations:
23791 @table @gcctabopt
23792 @opindex mmcu
23793 @item -mmcu=@var{mcu}
23794 Specify the AVR instruction set architecture (ISA) or device type.
23795 The default for this option is@tie{}@code{avr2}.
23797 The following AVR devices and ISAs are supported.
23798 @emph{Note:} A complete device support consists of
23799 startup code @code{crt@var{mcu}.o}, a device header @code{avr/io*.h},
23800 a device library @code{lib@var{mcu}.a} and a
23801 @uref{https://gcc.gnu.org/wiki/avr-gcc#spec-files,device-specs} file
23802 @code{specs-@var{mcu}}. Only the latter is provided by the compiler
23803 according the supported @code{@var{mcu}}s below.  The rest is supported
23804 by @w{@uref{https://www.nongnu.org/avr-libc/,AVR-LibC}}, or by means of
23805 @uref{https://gcc.gnu.org/wiki/avr-gcc#atpack,@code{atpack}} files
23806 from the hardware manufacturer.
23808 @c Auto-generated.  Re-build when new devices are added to avr-mcus.def
23809 @c by running "make avr-mcus" in $builddir/gcc.
23810 @include avr-mmcu.texi
23812 @opindex mabsdata
23813 @item -mabsdata
23815 Assume that all data in static storage can be accessed by LDS / STS
23816 instructions.  This option has only an effect on reduced Tiny devices like
23817 ATtiny40.  See also the @code{absdata}
23818 @ref{AVR Variable Attributes,variable attribute}.
23820 @opindex maccumulate-args
23821 @item -maccumulate-args
23822 Accumulate outgoing function arguments and acquire/release the needed
23823 stack space for outgoing function arguments once in function
23824 prologue/epilogue.  Without this option, outgoing arguments are pushed
23825 before calling a function and popped afterwards.
23827 Popping the arguments after the function call can be expensive on
23828 AVR so that accumulating the stack space might lead to smaller
23829 executables because arguments need not be removed from the
23830 stack after such a function call.
23832 This option can lead to reduced code size for functions that perform
23833 several calls to functions that get their arguments on the stack like
23834 calls to printf-like functions.
23836 @opindex mbranch-cost
23837 @item -mbranch-cost=@var{cost}
23838 Set the branch costs for conditional branch instructions to
23839 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23840 integers. The default branch cost is 0.
23842 @opindex mcall-prologues
23843 @item -mcall-prologues
23844 Functions prologues/epilogues are expanded as calls to appropriate
23845 subroutines.  Code size is smaller.
23847 @opindex mfuse-add
23848 @item -mfuse-add
23849 @itemx -mno-fuse-add
23850 @itemx -mfuse-add=@var{level}
23851 Optimize indirect memory accesses on reduced Tiny devices.
23852 The default uses @code{@var{level}=1} for optimizations @option{-Og}
23853 and @option{-O1}, and @code{@var{level}=2} for higher optimizations.
23854 Valid values for @var{level} are @code{0}, @code{1} and @code{2}.
23856 @opindex mdouble
23857 @opindex mlong-double
23858 @item -mdouble=@var{bits}
23859 @itemx -mlong-double=@var{bits}
23860 Set the size (in bits) of the @code{double} or @code{long double} type,
23861 respectively.  Possible values for @var{bits} are 32 and 64.
23862 Whether or not a specific value for @var{bits} is allowed depends on
23863 the @code{--with-double=} and @code{--with-long-double=}
23864 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23865 and the same applies for the default values of the options.
23867 @opindex mgas-isr-prologues
23868 @item -mgas-isr-prologues
23869 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23870 instruction supported by GNU Binutils.
23871 If this option is on, the feature can still be disabled for individual
23872 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23873 function attribute.  This feature is activated per default
23874 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23875 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23877 @opindex mint8
23878 @item -mint8
23879 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23880 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23881 and @code{long long} is 4 bytes.  Please note that this option does not
23882 conform to the C standards, but it results in smaller code
23883 size.
23885 @opindex mmain-is-OS_task
23886 @item -mmain-is-OS_task
23887 Do not save registers in @code{main}.  The effect is the same like
23888 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23889 to @code{main}. It is activated per default if optimization is on.
23891 @opindex mno-interrupts
23892 @item -mno-interrupts
23893 Generated code is not compatible with hardware interrupts.
23894 Code size is smaller.
23896 @opindex mrelax
23897 @item -mrelax
23898 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23899 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23900 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23901 the assembler's command line and the @option{--relax} option to the
23902 linker's command line.
23904 Jump relaxing is performed by the linker because jump offsets are not
23905 known before code is located. Therefore, the assembler code generated by the
23906 compiler is the same, but the instructions in the executable may
23907 differ from instructions in the assembler code.
23909 Relaxing must be turned on if linker stubs are needed, see the
23910 section on @code{EIND} and linker stubs below.
23912 @opindex mrodata-in-ram
23913 @item -mrodata-in-ram
23914 @itemx -mno-rodata-in-ram
23915 Locate the @code{.rodata} sections for read-only data in RAM resp.@:
23916 in program memory.
23917 For most devices, there is no choice and this option acts rather
23918 like an assertion.
23920 Since v14 and for the AVR64* and AVR128* devices, @code{.rodata}
23921 is located in flash memory per default, provided the required GNU Binutils
23922 support (@w{@uref{https://sourceware.org/PR31124,PR31124}}) is available.
23923 In that case, @option{-mrodata-in-ram} can be used to return to the old
23924 layout with @code{.rodata} in RAM.
23926 @opindex mstrict-X
23927 @item -mstrict-X
23928 Use address register @code{X} in a way proposed by the hardware.  This means
23929 that @code{X} is only used in indirect, post-increment or
23930 pre-decrement addressing.
23932 Without this option, the @code{X} register may be used in the same way
23933 as @code{Y} or @code{Z} which then is emulated by additional
23934 instructions.  
23935 For example, loading a value with @code{X+const} addressing with a
23936 small non-negative @code{const < 64} to a register @var{Rn} is
23937 performed as
23939 @example
23940 adiw r26, const   ; X += const
23941 ld   @var{Rn}, X        ; @var{Rn} = *X
23942 sbiw r26, const   ; X -= const
23943 @end example
23945 @opindex mtiny-stack
23946 @item -mtiny-stack
23947 Only change the lower 8@tie{}bits of the stack pointer.
23949 @opindex mfract-convert-truncate
23950 @item -mfract-convert-truncate
23951 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23953 @opindex nodevicelib
23954 @item -nodevicelib
23955 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23957 @opindex nodevicespecs
23958 @item -nodevicespecs
23959 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23960 command line.  The user takes responsibility for supplying the sub-processes
23961 like compiler proper, assembler and linker with appropriate command line
23962 options.  This means that the user has to supply her private device specs
23963 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23964 more need for option @option{-mmcu=@var{mcu}}.
23966 This option can also serve as a replacement for the older way of
23967 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23968 which contains a folder named @code{device-specs} which contains a specs file named
23969 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23971 @opindex Waddr-space-convert
23972 @opindex Wno-addr-space-convert
23973 @item -Waddr-space-convert
23974 Warn about conversions between address spaces in the case where the
23975 resulting address space is not contained in the incoming address space.
23977 @opindex Wmisspelled-isr
23978 @opindex Wno-misspelled-isr
23979 @item -Wmisspelled-isr
23980 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23981 Enabled by default.
23982 @end table
23984 @anchor{eind}
23985 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23986 @cindex @code{EIND}
23987 Pointers in the implementation are 16@tie{}bits wide.
23988 The address of a function or label is represented as word address so
23989 that indirect jumps and calls can target any code address in the
23990 range of 64@tie{}Ki words.
23992 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23993 bytes of program memory space, there is a special function register called
23994 @code{EIND} that serves as most significant part of the target address
23995 when @code{EICALL} or @code{EIJMP} instructions are used.
23997 Indirect jumps and calls on these devices are handled as follows by
23998 the compiler and are subject to some limitations:
24000 @itemize @bullet
24002 @item
24003 The compiler never sets @code{EIND}.
24005 @item
24006 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
24007 instructions or might read @code{EIND} directly in order to emulate an
24008 indirect call/jump by means of a @code{RET} instruction.
24010 @item
24011 The compiler assumes that @code{EIND} never changes during the startup
24012 code or during the application. In particular, @code{EIND} is not
24013 saved/restored in function or interrupt service routine
24014 prologue/epilogue.
24016 @item
24017 For indirect calls to functions and computed goto, the linker
24018 generates @emph{stubs}. Stubs are jump pads sometimes also called
24019 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
24020 The stub contains a direct jump to the desired address.
24022 @item
24023 Linker relaxation must be turned on so that the linker generates
24024 the stubs correctly in all situations. See the compiler option
24025 @option{-mrelax} and the linker option @option{--relax}.
24026 There are corner cases where the linker is supposed to generate stubs
24027 but aborts without relaxation and without a helpful error message.
24029 @item
24030 The default linker script is arranged for code with @code{EIND = 0}.
24031 If code is supposed to work for a setup with @code{EIND != 0}, a custom
24032 linker script has to be used in order to place the sections whose
24033 name start with @code{.trampolines} into the segment where @code{EIND}
24034 points to.
24036 @item
24037 The startup code from libgcc never sets @code{EIND}.
24038 Notice that startup code is a blend of code from libgcc and AVR-LibC.
24039 For the impact of AVR-LibC on @code{EIND}, see the
24040 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
24042 @item
24043 It is legitimate for user-specific startup code to set up @code{EIND}
24044 early, for example by means of initialization code located in
24045 section @code{.init3}. Such code runs prior to general startup code
24046 that initializes RAM and calls constructors, but after the bit
24047 of startup code from AVR-LibC that sets @code{EIND} to the segment
24048 where the vector table is located.
24049 @example
24050 #include <avr/io.h>
24052 static void
24053 __attribute__((section(".init3"),naked,used,no_instrument_function))
24054 init3_set_eind (void)
24056   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
24057                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
24059 @end example
24061 @noindent
24062 The @code{__trampolines_start} symbol is defined in the linker script.
24064 @item
24065 Stubs are generated automatically by the linker if
24066 the following two conditions are met:
24067 @itemize @minus
24069 @item The address of a label is taken by means of the @code{gs} modifier
24070 (short for @emph{generate stubs}) like so:
24071 @example
24072 LDI r24, lo8(gs(@var{func}))
24073 LDI r25, hi8(gs(@var{func}))
24074 @end example
24075 @item The final location of that label is in a code segment
24076 @emph{outside} the segment where the stubs are located.
24077 @end itemize
24079 @item
24080 The compiler emits such @code{gs} modifiers for code labels in the
24081 following situations:
24082 @itemize @minus
24083 @item Taking address of a function or code label.
24084 @item Computed goto.
24085 @item If prologue-save function is used, see @option{-mcall-prologues}
24086 command-line option.
24087 @item Switch/case dispatch tables. If you do not want such dispatch
24088 tables you can specify the @option{-fno-jump-tables} command-line option.
24089 @item C and C++ constructors/destructors called during startup/shutdown.
24090 @item If the tools hit a @code{gs()} modifier explained above.
24091 @end itemize
24093 @item
24094 Jumping to non-symbolic addresses like so is @emph{not} supported:
24096 @example
24097 int main (void)
24099     /* Call function at word address 0x2 */
24100     return ((int(*)(void)) 0x2)();
24102 @end example
24104 Instead, a stub has to be set up, i.e.@: the function has to be called
24105 through a symbol (@code{func_4} in the example):
24107 @example
24108 int main (void)
24110     extern int func_4 (void);
24112     /* Call function at byte address 0x4 */
24113     return func_4();
24115 @end example
24117 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
24118 Alternatively, @code{func_4} can be defined in the linker script.
24119 @end itemize
24121 @anchor{ramp}
24122 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
24123 @cindex @code{RAMPD}
24124 @cindex @code{RAMPX}
24125 @cindex @code{RAMPY}
24126 @cindex @code{RAMPZ}
24127 Some AVR devices support memories larger than the 64@tie{}KiB range
24128 that can be accessed with 16-bit pointers.  To access memory locations
24129 outside this 64@tie{}KiB range, the content of a @code{RAMP}
24130 register is used as high part of the address:
24131 The @code{X}, @code{Y}, @code{Z} address register is concatenated
24132 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
24133 register, respectively, to get a wide address. Similarly,
24134 @code{RAMPD} is used together with direct addressing.
24136 @itemize
24137 @item
24138 The startup code initializes the @code{RAMP} special function
24139 registers with zero.
24141 @item
24142 If a @ref{AVR Named Address Spaces,named address space} other than
24143 generic or @code{__flash} is used, then @code{RAMPZ} is set
24144 as needed before the operation.
24146 @item
24147 If the device supports RAM larger than 64@tie{}KiB and the compiler
24148 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
24149 is reset to zero after the operation.
24151 @item
24152 If the device comes with a specific @code{RAMP} register, the ISR
24153 prologue/epilogue saves/restores that SFR and initializes it with
24154 zero in case the ISR code might (implicitly) use it.
24156 @item
24157 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
24158 If you use inline assembler to read from locations outside the
24159 16-bit address range and change one of the @code{RAMP} registers,
24160 you must reset it to zero after the access.
24162 @end itemize
24164 @anchor{avr-macros}
24165 @subsubsection AVR Built-in Macros
24167 GCC defines several built-in macros so that the user code can test
24168 for the presence or absence of features.  Almost any of the following
24169 built-in macros are deduced from device capabilities and thus
24170 triggered by the @option{-mmcu=} command-line option.
24172 For even more AVR-specific built-in macros see
24173 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
24175 @table @code
24177 @item __AVR_ARCH__
24178 Build-in macro that resolves to a decimal number that identifies the
24179 architecture and depends on the @option{-mmcu=@var{mcu}} option.
24180 Possible values are:
24182 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
24183 @code{4}, @code{5}, @code{51}, @code{6}
24185 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
24186 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
24188 respectively and
24190 @code{100},
24191 @code{102}, @code{103}, @code{104},
24192 @code{105}, @code{106}, @code{107}
24194 for @var{mcu}=@code{avrtiny},
24195 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
24196 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
24197 If @var{mcu} specifies a device, this built-in macro is set
24198 accordingly. For example, with @option{-mmcu=atmega8} the macro is
24199 defined to @code{4}.
24201 @item __AVR_@var{Device}__
24202 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
24203 the device's name. For example, @option{-mmcu=atmega8} defines the
24204 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
24205 @code{__AVR_ATtiny261A__}, etc.
24207 The built-in macros' names follow
24208 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
24209 the device name as from the AVR user manual. The difference between
24210 @var{Device} in the built-in macro and @var{device} in
24211 @option{-mmcu=@var{device}} is that the latter is always lowercase.
24213 If @var{device} is not a device but only a core architecture like
24214 @samp{avr51}, this macro is not defined.
24216 @item __AVR_DEVICE_NAME__
24217 Setting @option{-mmcu=@var{device}} defines this built-in macro to
24218 the device's name. For example, with @option{-mmcu=atmega8} the macro
24219 is defined to @code{atmega8}.
24221 If @var{device} is not a device but only a core architecture like
24222 @samp{avr51}, this macro is not defined.
24224 @item __AVR_XMEGA__
24225 The device / architecture belongs to the XMEGA family of devices.
24227 @item __AVR_HAVE_ADIW__
24228 The device has the @code{ADIW} and @code{SBIW} instructions.
24230 @item __AVR_HAVE_ELPM__
24231 The device has the @code{ELPM} instruction.
24233 @item __AVR_HAVE_ELPMX__
24234 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
24235 R@var{n},Z+} instructions.
24237 @item __AVR_HAVE_LPMX__
24238 The device has the @code{LPM R@var{n},Z} and
24239 @code{LPM R@var{n},Z+} instructions.
24241 @item __AVR_HAVE_MOVW__
24242 The device has the @code{MOVW} instruction to perform 16-bit
24243 register-register moves.
24245 @item __AVR_HAVE_MUL__
24246 The device has a hardware multiplier. 
24248 @item __AVR_HAVE_JMP_CALL__
24249 The device has the @code{JMP} and @code{CALL} instructions.
24250 This is the case for devices with more than 8@tie{}KiB of program
24251 memory.
24253 @item __AVR_HAVE_EIJMP_EICALL__
24254 @itemx __AVR_3_BYTE_PC__
24255 The device has the @code{EIJMP} and @code{EICALL} instructions.
24256 This is the case for devices with more than 128@tie{}KiB of program memory.
24257 This also means that the program counter
24258 (PC) is 3@tie{}bytes wide.
24260 @item __AVR_2_BYTE_PC__
24261 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
24262 with up to 128@tie{}KiB of program memory.
24264 @item __AVR_HAVE_8BIT_SP__
24265 @itemx __AVR_HAVE_16BIT_SP__
24266 The stack pointer (SP) register is treated as 8-bit respectively
24267 16-bit register by the compiler.
24268 The definition of these macros is affected by @option{-mtiny-stack}.
24270 @item __AVR_HAVE_SPH__
24271 @itemx __AVR_SP8__
24272 The device has the SPH (high part of stack pointer) special function
24273 register or has an 8-bit stack pointer, respectively.
24274 The definition of these macros is affected by @option{-mmcu=} and
24275 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
24276 by @option{-msp8}.
24278 @item __AVR_HAVE_RAMPD__
24279 @itemx __AVR_HAVE_RAMPX__
24280 @itemx __AVR_HAVE_RAMPY__
24281 @itemx __AVR_HAVE_RAMPZ__
24282 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
24283 @code{RAMPZ} special function register, respectively.
24285 @item __NO_INTERRUPTS__
24286 This macro reflects the @option{-mno-interrupts} command-line option.
24288 @item __AVR_ERRATA_SKIP__
24289 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
24290 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
24291 instructions because of a hardware erratum.  Skip instructions are
24292 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
24293 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
24294 set.
24296 @item __AVR_ISA_RMW__
24297 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
24299 @item __AVR_SFR_OFFSET__=@var{offset}
24300 Instructions that can address I/O special function registers directly
24301 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
24302 address as if addressed by an instruction to access RAM like @code{LD}
24303 or @code{STS}. This offset depends on the device architecture and has
24304 to be subtracted from the RAM address in order to get the
24305 respective I/O@tie{}address.
24307 @item __AVR_SHORT_CALLS__
24308 The @option{-mshort-calls} command line option is set.
24310 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
24311 Some devices support reading from flash memory by means of @code{LD*}
24312 instructions.  The flash memory is seen in the data address space
24313 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
24314 is not defined, this feature is not available.  If defined,
24315 the address space is linear and there is no need to put
24316 @code{.rodata} into RAM.  This is handled by the default linker
24317 description file, and is currently available for
24318 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
24319 there is no need to use address spaces like @code{__flash} or
24320 features like attribute @code{progmem} and @code{pgm_read_*}.
24322 @item __AVR_HAVE_FLMAP__
24323 This macro is defined provided the following conditions are met:
24324 @itemize @bullet
24325 @item The device has the @code{NVMCTRL_CTRLB.FLMAP} bitfield.
24326 This applies to the AVR64* and AVR128* devices.
24327 @item It's not known at assembler-time which emulation will be used.
24328 @end itemize
24329 This implies the compiler was configured with GNU Binutils that implement
24330 @w{@uref{https://sourceware.org/PR31124,PR31124}}.
24332 @item __AVR_RODATA_IN_RAM__
24333 This macro is undefined when the code is compiled for a core architecture.
24335 When the code is compiled for a device, the macro is defined to@tie{}1
24336 when the @code{.rodata} sections for read-only data is located in RAM;
24337 and defined to@tie{}0, otherwise.
24339 @item __WITH_AVRLIBC__
24340 The compiler is configured to be used together with AVR-Libc.
24341 See the @option{--with-avrlibc} configure option.
24343 @item __HAVE_DOUBLE_MULTILIB__
24344 Defined if @option{-mdouble=} acts as a multilib option.
24346 @item __HAVE_DOUBLE32__
24347 @itemx __HAVE_DOUBLE64__
24348 Defined if the compiler supports 32-bit double resp. 64-bit double.
24349 The actual layout is specified by option @option{-mdouble=}.
24351 @item __DEFAULT_DOUBLE__
24352 The size in bits of @code{double} if @option{-mdouble=} is not set.
24353 To test the layout of @code{double} in a program, use the built-in
24354 macro @code{__SIZEOF_DOUBLE__}.
24356 @item __HAVE_LONG_DOUBLE32__
24357 @itemx __HAVE_LONG_DOUBLE64__
24358 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
24359 @itemx __DEFAULT_LONG_DOUBLE__
24360 Same as above, but for @code{long double} instead of @code{double}.
24362 @item __WITH_DOUBLE_COMPARISON__
24363 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
24364 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
24365 and is defined to @code{2} or @code{3}.
24367 @item __WITH_LIBF7_LIBGCC__
24368 @itemx __WITH_LIBF7_MATH__
24369 @itemx __WITH_LIBF7_MATH_SYMBOLS__
24370 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
24371 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
24373 @end table
24375 @subsubsection AVR Internal Options
24376 The following options are used internally by the compiler and to communicate
24377 between device specs files and the compiler proper. You don't need to set these
24378 options by hand, in particular they are not optimization options.
24379 Using these options in the wrong way may lead to sub-optimal or wrong code.
24380 They are documented for completeness, and in order to get a better
24381 understanding of
24382 @w{@uref{https://gcc.gnu.org/wiki/avr-gcc#spec-files,device specs}}
24383 files.
24385 @table @gcctabopt
24387 @opindex mn-flash
24388 @item -mn-flash=@var{num}
24389 Assume that the flash memory has a size of @var{num} times 64@tie{}KiB.
24390 This determines which @code{__flash@var{N}} address spaces are available.
24392 @opindex mflmap
24393 @item -mflmap
24394 The device has the @code{FLMAP} bit field located in special function
24395 register @code{NVMCTRL_CTRLB}.
24397 @opindex mrmw
24398 @item -mrmw
24399 Assume that the device supports the Read-Modify-Write
24400 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
24402 @opindex mshort-calls
24403 @item -mshort-calls
24405 Assume that @code{RJMP} and @code{RCALL} can target the whole
24406 program memory. This option is used for multilib generation and selection
24407 for the devices from architecture @code{avrxmega3}.
24409 @opindex mskip-bug
24410 @item -mskip-bug
24412 Generate code without skips (@code{CPSE}, @code{SBRS},
24413 @code{SBRC}, @code{SBIS}, @code{SBIC}) over 32-bit instructions.
24415 @opindex msp8
24416 @item -msp8
24417 Treat the stack pointer register as an 8-bit register,
24418 i.e.@: assume the high byte of the stack pointer is zero.
24419 This option is used by the compiler to select and
24420 build multilibs for architectures @code{avr2} and @code{avr25}.
24421 These architectures mix devices with and without @code{SPH}.
24423 @end table
24425 @node Blackfin Options
24426 @subsection Blackfin Options
24427 @cindex Blackfin Options
24429 @table @gcctabopt
24430 @opindex mcpu=
24431 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
24432 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
24433 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
24434 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
24435 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
24436 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
24437 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
24438 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
24439 @samp{bf561}, @samp{bf592}.
24441 The optional @var{sirevision} specifies the silicon revision of the target
24442 Blackfin processor.  Any workarounds available for the targeted silicon revision
24443 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
24444 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
24445 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
24446 hexadecimal digits representing the major and minor numbers in the silicon
24447 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
24448 is not defined.  If @var{sirevision} is @samp{any}, the
24449 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
24450 If this optional @var{sirevision} is not used, GCC assumes the latest known
24451 silicon revision of the targeted Blackfin processor.
24453 GCC defines a preprocessor macro for the specified @var{cpu}.
24454 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
24455 provided by libgloss to be linked in if @option{-msim} is not given.
24457 Without this option, @samp{bf532} is used as the processor by default.
24459 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
24460 only the preprocessor macro is defined.
24462 @opindex msim
24463 @item -msim
24464 Specifies that the program will be run on the simulator.  This causes
24465 the simulator BSP provided by libgloss to be linked in.  This option
24466 has effect only for @samp{bfin-elf} toolchain.
24467 Certain other options, such as @option{-mid-shared-library} and
24468 @option{-mfdpic}, imply @option{-msim}.
24470 @opindex momit-leaf-frame-pointer
24471 @item -momit-leaf-frame-pointer
24472 Don't keep the frame pointer in a register for leaf functions.  This
24473 avoids the instructions to save, set up and restore frame pointers and
24474 makes an extra register available in leaf functions.
24476 @opindex mspecld-anomaly
24477 @item -mspecld-anomaly
24478 When enabled, the compiler ensures that the generated code does not
24479 contain speculative loads after jump instructions. If this option is used,
24480 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
24482 @opindex mno-specld-anomaly
24483 @opindex mspecld-anomaly
24484 @item -mno-specld-anomaly
24485 Don't generate extra code to prevent speculative loads from occurring.
24487 @opindex mcsync-anomaly
24488 @item -mcsync-anomaly
24489 When enabled, the compiler ensures that the generated code does not
24490 contain CSYNC or SSYNC instructions too soon after conditional branches.
24491 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
24493 @opindex mno-csync-anomaly
24494 @opindex mcsync-anomaly
24495 @item -mno-csync-anomaly
24496 Don't generate extra code to prevent CSYNC or SSYNC instructions from
24497 occurring too soon after a conditional branch.
24499 @opindex mlow64k
24500 @item -mlow64k
24501 When enabled, the compiler is free to take advantage of the knowledge that
24502 the entire program fits into the low 64k of memory.
24504 @opindex mno-low64k
24505 @item -mno-low64k
24506 Assume that the program is arbitrarily large.  This is the default.
24508 @opindex mstack-check-l1
24509 @item -mstack-check-l1
24510 Do stack checking using information placed into L1 scratchpad memory by the
24511 uClinux kernel.
24513 @opindex mid-shared-library
24514 @item -mid-shared-library
24515 Generate code that supports shared libraries via the library ID method.
24516 This allows for execute in place and shared libraries in an environment
24517 without virtual memory management.  This option implies @option{-fPIC}.
24518 With a @samp{bfin-elf} target, this option implies @option{-msim}.
24520 @opindex mno-id-shared-library
24521 @opindex mid-shared-library
24522 @item -mno-id-shared-library
24523 Generate code that doesn't assume ID-based shared libraries are being used.
24524 This is the default.
24526 @opindex mleaf-id-shared-library
24527 @item -mleaf-id-shared-library
24528 Generate code that supports shared libraries via the library ID method,
24529 but assumes that this library or executable won't link against any other
24530 ID shared libraries.  That allows the compiler to use faster code for jumps
24531 and calls.
24533 @opindex mno-leaf-id-shared-library
24534 @opindex mleaf-id-shared-library
24535 @item -mno-leaf-id-shared-library
24536 Do not assume that the code being compiled won't link against any ID shared
24537 libraries.  Slower code is generated for jump and call insns.
24539 @opindex mshared-library-id
24540 @item -mshared-library-id=n
24541 Specifies the identification number of the ID-based shared library being
24542 compiled.  Specifying a value of 0 generates more compact code; specifying
24543 other values forces the allocation of that number to the current
24544 library but is no more space- or time-efficient than omitting this option.
24546 @opindex msep-data
24547 @item -msep-data
24548 Generate code that allows the data segment to be located in a different
24549 area of memory from the text segment.  This allows for execute in place in
24550 an environment without virtual memory management by eliminating relocations
24551 against the text section.
24553 @opindex mno-sep-data
24554 @opindex msep-data
24555 @item -mno-sep-data
24556 Generate code that assumes that the data segment follows the text segment.
24557 This is the default.
24559 @opindex mlong-calls
24560 @opindex mno-long-calls
24561 @item -mlong-calls
24562 @itemx -mno-long-calls
24563 Tells the compiler to perform function calls by first loading the
24564 address of the function into a register and then performing a subroutine
24565 call on this register.  This switch is needed if the target function
24566 lies outside of the 24-bit addressing range of the offset-based
24567 version of subroutine call instruction.
24569 This feature is not enabled by default.  Specifying
24570 @option{-mno-long-calls} restores the default behavior.  Note these
24571 switches have no effect on how the compiler generates code to handle
24572 function calls via function pointers.
24574 @opindex mfast-fp
24575 @item -mfast-fp
24576 Link with the fast floating-point library. This library relaxes some of
24577 the IEEE floating-point standard's rules for checking inputs against
24578 Not-a-Number (NAN), in the interest of performance.
24580 @opindex minline-plt
24581 @item -minline-plt
24582 Enable inlining of PLT entries in function calls to functions that are
24583 not known to bind locally.  It has no effect without @option{-mfdpic}.
24585 @opindex mmulticore
24586 @item -mmulticore
24587 Build a standalone application for multicore Blackfin processors. 
24588 This option causes proper start files and link scripts supporting 
24589 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
24590 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
24592 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
24593 selects the one-application-per-core programming model.  Without
24594 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
24595 programming model is used. In this model, the main function of Core B
24596 should be named as @code{coreb_main}.
24598 If this option is not used, the single-core application programming
24599 model is used.
24601 @opindex mcorea
24602 @item -mcorea
24603 Build a standalone application for Core A of BF561 when using
24604 the one-application-per-core programming model. Proper start files
24605 and link scripts are used to support Core A, and the macro
24606 @code{__BFIN_COREA} is defined.
24607 This option can only be used in conjunction with @option{-mmulticore}.
24609 @opindex mcoreb
24610 @item -mcoreb
24611 Build a standalone application for Core B of BF561 when using
24612 the one-application-per-core programming model. Proper start files
24613 and link scripts are used to support Core B, and the macro
24614 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
24615 should be used instead of @code{main}. 
24616 This option can only be used in conjunction with @option{-mmulticore}.
24618 @opindex msdram
24619 @item -msdram
24620 Build a standalone application for SDRAM. Proper start files and
24621 link scripts are used to put the application into SDRAM, and the macro
24622 @code{__BFIN_SDRAM} is defined.
24623 The loader should initialize SDRAM before loading the application.
24625 @opindex micplb
24626 @item -micplb
24627 Assume that ICPLBs are enabled at run time.  This has an effect on certain
24628 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
24629 are enabled; for standalone applications the default is off.
24630 @end table
24632 @node C6X Options
24633 @subsection C6X Options
24634 @cindex C6X Options
24636 @table @gcctabopt
24637 @opindex march
24638 @item -march=@var{name}
24639 This specifies the name of the target architecture.  GCC uses this
24640 name to determine what kind of instructions it can emit when generating
24641 assembly code.  Permissible names are: @samp{c62x},
24642 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
24644 @opindex mbig-endian
24645 @item -mbig-endian
24646 Generate code for a big-endian target.
24648 @opindex mlittle-endian
24649 @item -mlittle-endian
24650 Generate code for a little-endian target.  This is the default.
24652 @opindex msim
24653 @item -msim
24654 Choose startup files and linker script suitable for the simulator.
24656 @opindex msdata=default
24657 @item -msdata=default
24658 Put small global and static data in the @code{.neardata} section,
24659 which is pointed to by register @code{B14}.  Put small uninitialized
24660 global and static data in the @code{.bss} section, which is adjacent
24661 to the @code{.neardata} section.  Put small read-only data into the
24662 @code{.rodata} section.  The corresponding sections used for large
24663 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
24665 @opindex msdata=all
24666 @item -msdata=all
24667 Put all data, not just small objects, into the sections reserved for
24668 small data, and use addressing relative to the @code{B14} register to
24669 access them.
24671 @opindex msdata=none
24672 @item -msdata=none
24673 Make no use of the sections reserved for small data, and use absolute
24674 addresses to access all data.  Put all initialized global and static
24675 data in the @code{.fardata} section, and all uninitialized data in the
24676 @code{.far} section.  Put all constant data into the @code{.const}
24677 section.
24678 @end table
24680 @node CRIS Options
24681 @subsection CRIS Options
24682 @cindex CRIS Options
24684 These options are defined specifically for the CRIS ports.
24686 @table @gcctabopt
24687 @opindex march
24688 @opindex mcpu
24689 @item -march=@var{architecture-type}
24690 @itemx -mcpu=@var{architecture-type}
24691 Generate code for the specified architecture.  The choices for
24692 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
24693 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
24694 Default is @samp{v0}.
24696 @opindex mtune
24697 @item -mtune=@var{architecture-type}
24698 Tune to @var{architecture-type} everything applicable about the generated
24699 code, except for the ABI and the set of available instructions.  The
24700 choices for @var{architecture-type} are the same as for
24701 @option{-march=@var{architecture-type}}.
24703 @opindex mmax-stack-frame
24704 @item -mmax-stack-frame=@var{n}
24705 Warn when the stack frame of a function exceeds @var{n} bytes.
24707 @opindex metrax4
24708 @opindex metrax100
24709 @item -metrax4
24710 @itemx -metrax100
24711 The options @option{-metrax4} and @option{-metrax100} are synonyms for
24712 @option{-march=v3} and @option{-march=v8} respectively.
24714 @opindex mmul-bug-workaround
24715 @opindex mno-mul-bug-workaround
24716 @item -mmul-bug-workaround
24717 @itemx -mno-mul-bug-workaround
24718 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
24719 models where it applies.  This option is disabled by default.
24721 @opindex mpdebug
24722 @item -mpdebug
24723 Enable CRIS-specific verbose debug-related information in the assembly
24724 code.  This option also has the effect of turning off the @samp{#NO_APP}
24725 formatted-code indicator to the assembler at the beginning of the
24726 assembly file.
24728 @opindex mcc-init
24729 @item -mcc-init
24730 Do not use condition-code results from previous instruction; always emit
24731 compare and test instructions before use of condition codes.
24733 @opindex mno-side-effects
24734 @opindex mside-effects
24735 @item -mno-side-effects
24736 Do not emit instructions with side effects in addressing modes other than
24737 post-increment.
24739 @opindex mstack-align
24740 @opindex mno-stack-align
24741 @opindex mdata-align
24742 @opindex mno-data-align
24743 @opindex mconst-align
24744 @opindex mno-const-align
24745 @item -mstack-align
24746 @itemx -mno-stack-align
24747 @itemx -mdata-align
24748 @itemx -mno-data-align
24749 @itemx -mconst-align
24750 @itemx -mno-const-align
24751 These options (@samp{no-} options) arrange (eliminate arrangements) for the
24752 stack frame, individual data and constants to be aligned for the maximum
24753 single data access size for the chosen CPU model.  The default is to
24754 arrange for 32-bit alignment.  ABI details such as structure layout are
24755 not affected by these options.
24757 @opindex m32-bit
24758 @opindex m16-bit
24759 @opindex m8-bit
24760 @item -m32-bit
24761 @itemx -m16-bit
24762 @itemx -m8-bit
24763 Similar to the stack- data- and const-align options above, these options
24764 arrange for stack frame, writable data and constants to all be 32-bit,
24765 16-bit or 8-bit aligned.  The default is 32-bit alignment.
24767 @opindex mno-prologue-epilogue
24768 @opindex mprologue-epilogue
24769 @item -mno-prologue-epilogue
24770 @itemx -mprologue-epilogue
24771 With @option{-mno-prologue-epilogue}, the normal function prologue and
24772 epilogue which set up the stack frame are omitted and no return
24773 instructions or return sequences are generated in the code.  Use this
24774 option only together with visual inspection of the compiled code: no
24775 warnings or errors are generated when call-saved registers must be saved,
24776 or storage for local variables needs to be allocated.
24778 @opindex melf
24779 @item -melf
24780 Legacy no-op option.
24782 @opindex sim
24783 @item -sim
24784 This option arranges
24785 to link with input-output functions from a simulator library.  Code,
24786 initialized data and zero-initialized data are allocated consecutively.
24788 @opindex sim2
24789 @item -sim2
24790 Like @option{-sim}, but pass linker options to locate initialized data at
24791 0x40000000 and zero-initialized data at 0x80000000.
24792 @end table
24794 @node C-SKY Options
24795 @subsection C-SKY Options
24796 @cindex C-SKY Options
24798 GCC supports these options when compiling for C-SKY V2 processors.
24800 @table @gcctabopt
24802 @opindex march=
24803 @item -march=@var{arch}
24804 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
24805 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
24806 The default is @samp{ck810}.
24808 @opindex mcpu=
24809 @item -mcpu=@var{cpu}
24810 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
24811 @samp{ck801}, @samp{ck801t},
24812 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
24813 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
24814 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
24815 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
24816 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
24817 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
24818 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
24819 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
24820 @samp{ck803eftr1}, @samp{ck803efhtr1},
24821 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
24822 @samp{ck803sef}, @samp{ck803seft},
24823 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
24824 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
24825 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
24826 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
24828 @opindex mbig-endian
24829 @opindex EB
24830 @opindex mlittle-endian
24831 @opindex EL
24832 @item -mbig-endian
24833 @itemx -EB
24834 @itemx -mlittle-endian
24835 @itemx -EL
24837 Select big- or little-endian code.  The default is little-endian.
24839 @opindex mfloat-abi
24840 @item -mfloat-abi=@var{name}
24841 Specifies which floating-point ABI to use.  Permissible values
24842 are: @samp{soft}, @samp{softfp} and @samp{hard}.
24844 Specifying @samp{soft} causes GCC to generate output containing
24845 library calls for floating-point operations.
24846 @samp{softfp} allows the generation of code using hardware floating-point
24847 instructions, but still uses the soft-float calling conventions.
24848 @samp{hard} allows generation of floating-point instructions
24849 and uses FPU-specific calling conventions.
24851 The default depends on the specific target configuration.  Note that
24852 the hard-float and soft-float ABIs are not link-compatible; you must
24853 compile your entire program with the same ABI, and link with a
24854 compatible set of libraries.
24856 @opindex mhard-float
24857 @opindex msoft-float
24858 @item -mhard-float
24859 @itemx -msoft-float
24861 Select hardware or software floating-point implementations.
24862 The default is soft float.
24864 @opindex mdouble-float
24865 @item -mdouble-float
24866 @itemx -mno-double-float
24867 When @option{-mhard-float} is in effect, enable generation of
24868 double-precision float instructions.  This is the default except
24869 when compiling for CK803.
24871 @opindex mfdivdu
24872 @item -mfdivdu
24873 @itemx -mno-fdivdu
24874 When @option{-mhard-float} is in effect, enable generation of
24875 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24876 This is the default except when compiling for CK803.
24878 @opindex mfpu=
24879 @item -mfpu=@var{fpu}
24880 Select the floating-point processor.  This option can only be used with
24881 @option{-mhard-float}.
24882 Values for @var{fpu} are
24883 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24884 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24885 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24887 @opindex melrw
24888 @item -melrw
24889 @itemx -mno-elrw
24890 Enable the extended @code{lrw} instruction.  This option defaults to on
24891 for CK801 and off otherwise.
24893 @opindex mistack
24894 @item -mistack
24895 @itemx -mno-istack
24896 Enable interrupt stack instructions; the default is off.
24898 The @option{-mistack} option is required to handle the
24899 @code{interrupt} and @code{isr} function attributes
24900 (@pxref{C-SKY Function Attributes}).
24902 @opindex mmp
24903 @item -mmp
24904 Enable multiprocessor instructions; the default is off.
24906 @opindex mcp
24907 @item -mcp
24908 Enable coprocessor instructions; the default is off.
24910 @opindex mcache
24911 @item -mcache
24912 Enable coprocessor instructions; the default is off.
24914 @opindex msecurity
24915 @item -msecurity
24916 Enable C-SKY security instructions; the default is off.
24918 @opindex mtrust
24919 @item -mtrust
24920 Enable C-SKY trust instructions; the default is off.
24922 @opindex mdsp
24923 @opindex medsp
24924 @opindex mvdsp
24925 @item -mdsp
24926 @itemx -medsp
24927 @itemx -mvdsp
24928 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24929 All of these options default to off.
24931 @opindex mdiv
24932 @item -mdiv
24933 @itemx -mno-div
24934 Generate divide instructions.  Default is off.
24936 @opindex msmart
24937 @item -msmart
24938 @itemx -mno-smart
24939 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24940 use of 16-bit instructions.  This option is ignored for CK801 where this
24941 is the required behavior, and it defaults to on for CK802.
24942 For other targets, the default is off.
24944 @opindex mhigh-registers
24945 @item -mhigh-registers
24946 @itemx -mno-high-registers
24947 Generate code using the high registers numbered 16-31.  This option
24948 is not supported on CK801, CK802, or CK803, and is enabled by default
24949 for other processors.
24951 @opindex manchor
24952 @item -manchor
24953 @itemx -mno-anchor
24954 Generate code using global anchor symbol addresses.
24956 @opindex mpushpop
24957 @item -mpushpop
24958 @itemx -mno-pushpop
24959 Generate code using @code{push} and @code{pop} instructions.  This option
24960 defaults to on.
24962 @opindex mmultiple-stld
24963 @item -mmultiple-stld
24964 @itemx -mstm
24965 @itemx -mno-multiple-stld
24966 @itemx -mno-stm
24967 Generate code using @code{stm} and @code{ldm} instructions.  This option
24968 isn't supported on CK801 but is enabled by default on other processors.
24970 @opindex mconstpool
24971 @item -mconstpool
24972 @itemx -mno-constpool
24973 Create constant pools in the compiler instead of deferring it to the
24974 assembler.  This option is the default and required for correct code
24975 generation on CK801 and CK802, and is optional on other processors.
24977 @opindex mstack-size
24978 @item -mstack-size
24979 @item -mno-stack-size
24980 Emit @code{.stack_size} directives for each function in the assembly
24981 output.  This option defaults to off.
24983 @opindex mccrt
24984 @item -mccrt
24985 @itemx -mno-ccrt
24986 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24987 option defaults to off.
24989 @opindex mbranch-cost=
24990 @item -mbranch-cost=@var{n}
24991 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24993 @opindex msched-prolog
24994 @item -msched-prolog
24995 @itemx -mno-sched-prolog
24996 Permit scheduling of function prologue and epilogue sequences.  Using
24997 this option can result in code that is not compliant with the C-SKY V2 ABI
24998 prologue requirements and that cannot be debugged or backtraced.
24999 It is disabled by default.
25001 @opindex msim
25002 @item -msim
25003 Links the library libsemi.a which is in compatible with simulator. Applicable
25004 to ELF compiler only.
25006 @end table
25008 @node Darwin Options
25009 @subsection Darwin Options
25010 @cindex Darwin options
25012 These options are defined for all architectures running the Darwin operating
25013 system.
25015 FSF GCC on Darwin does not create ``fat'' object files; it creates
25016 an object file for the single architecture that GCC was built to
25017 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
25018 @option{-arch} options are used; it does so by running the compiler or
25019 linker multiple times and joining the results together with
25020 @file{lipo}.
25022 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
25023 @samp{i686}) is determined by the flags that specify the ISA
25024 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
25025 @option{-force_cpusubtype_ALL} option can be used to override this.
25027 The Darwin tools vary in their behavior when presented with an ISA
25028 mismatch.  The assembler, @file{as}, only permits instructions to
25029 be used that are valid for the subtype of the file it is generating,
25030 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
25031 The linker for shared libraries, @file{/usr/bin/libtool}, fails
25032 and prints an error if asked to create a shared library with a less
25033 restrictive subtype than its input files (for instance, trying to put
25034 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
25035 for executables, @command{ld}, quietly gives the executable the most
25036 restrictive subtype of any of its input files.
25038 @table @gcctabopt
25039 @opindex F
25040 @item -F@var{dir}
25041 Add the framework directory @var{dir} to the head of the list of
25042 directories to be searched for header files.  These directories are
25043 interleaved with those specified by @option{-I} options and are
25044 scanned in a left-to-right order.
25046 A framework directory is a directory with frameworks in it.  A
25047 framework is a directory with a @file{Headers} and/or
25048 @file{PrivateHeaders} directory contained directly in it that ends
25049 in @file{.framework}.  The name of a framework is the name of this
25050 directory excluding the @file{.framework}.  Headers associated with
25051 the framework are found in one of those two directories, with
25052 @file{Headers} being searched first.  A subframework is a framework
25053 directory that is in a framework's @file{Frameworks} directory.
25054 Includes of subframework headers can only appear in a header of a
25055 framework that contains the subframework, or in a sibling subframework
25056 header.  Two subframeworks are siblings if they occur in the same
25057 framework.  A subframework should not have the same name as a
25058 framework; a warning is issued if this is violated.  Currently a
25059 subframework cannot have subframeworks; in the future, the mechanism
25060 may be extended to support this.  The standard frameworks can be found
25061 in @file{/System/Library/Frameworks} and
25062 @file{/Library/Frameworks}.  An example include looks like
25063 @code{#include <Framework/header.h>}, where @file{Framework} denotes
25064 the name of the framework and @file{header.h} is found in the
25065 @file{PrivateHeaders} or @file{Headers} directory.
25067 @opindex iframework
25068 @item -iframework@var{dir}
25069 Like @option{-F} except the directory is a treated as a system
25070 directory.  The main difference between this @option{-iframework} and
25071 @option{-F} is that with @option{-iframework} the compiler does not
25072 warn about constructs contained within header files found via
25073 @var{dir}.  This option is valid only for the C family of languages.
25075 @opindex gused
25076 @item -gused
25077 Emit debugging information for symbols that are used.  For stabs
25078 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
25079 This is by default ON@.
25081 @opindex gfull
25082 @item -gfull
25083 Emit debugging information for all symbols and types.
25085 @opindex fconstant-cfstrings
25086 @item -fconstant-cfstrings
25087 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
25089 @opindex mconstant-cfstrings
25090 @item -mconstant-cfstrings
25091 When the NeXT runtime is being used (the default on these systems), override
25092 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
25093 literals to be laid out as constant CoreFoundation strings.
25095 @opindex mmacosx-version-min
25096 @item -mmacosx-version-min=@var{version}
25097 The earliest version of MacOS X that this executable will run on is
25098 @var{version}.  Typical values supported for @var{version} include @code{12},
25099 @code{10.12}, and @code{10.5.8}.
25101 If the compiler was built to use the system's headers by default,
25102 then the default for this option is the system version on which the
25103 compiler is running, otherwise the default is to make choices that
25104 are compatible with as many systems and code bases as possible.
25106 @opindex mkernel
25107 @item -mkernel
25108 Enable kernel development mode.  The @option{-mkernel} option sets
25109 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
25110 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
25111 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
25112 applicable.  This mode also sets @option{-mno-altivec},
25113 @option{-msoft-float}, @option{-fno-builtin} and
25114 @option{-mlong-branch} for PowerPC targets.
25116 @opindex mone-byte-bool
25117 @item -mone-byte-bool
25118 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
25119 By default @code{sizeof(bool)} is @code{4} when compiling for
25120 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
25121 option has no effect on x86.
25123 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
25124 to generate code that is not binary compatible with code generated
25125 without that switch.  Using this switch may require recompiling all
25126 other modules in a program, including system libraries.  Use this
25127 switch to conform to a non-default data model.
25129 @opindex mfix-and-continue
25130 @opindex ffix-and-continue
25131 @opindex findirect-data
25132 @item -mfix-and-continue
25133 @itemx -ffix-and-continue
25134 @itemx -findirect-data
25135 Generate code suitable for fast turnaround development, such as to
25136 allow GDB to dynamically load @file{.o} files into already-running
25137 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
25138 are provided for backwards compatibility.
25140 @opindex all_load
25141 @item -all_load
25142 Loads all members of static archive libraries.
25143 See man ld(1) for more information.
25145 @opindex arch_errors_fatal
25146 @item -arch_errors_fatal
25147 Cause the errors having to do with files that have the wrong architecture
25148 to be fatal.
25150 @opindex bind_at_load
25151 @item -bind_at_load
25152 Causes the output file to be marked such that the dynamic linker will
25153 bind all undefined references when the file is loaded or launched.
25155 @opindex bundle
25156 @item -bundle
25157 Produce a Mach-o bundle format file.
25158 See man ld(1) for more information.
25160 @opindex bundle_loader
25161 @item -bundle_loader @var{executable}
25162 This option specifies the @var{executable} that will load the build
25163 output file being linked.  See man ld(1) for more information.
25165 @opindex dynamiclib
25166 @item -dynamiclib
25167 When passed this option, GCC produces a dynamic library instead of
25168 an executable when linking, using the Darwin @file{libtool} command.
25170 @opindex force_cpusubtype_ALL
25171 @item -force_cpusubtype_ALL
25172 This causes GCC's output file to have the @samp{ALL} subtype, instead of
25173 one controlled by the @option{-mcpu} or @option{-march} option.
25175 @opindex nodefaultrpaths
25176 @item -nodefaultrpaths
25177 Do not add default run paths for the compiler library directories to
25178 executables, modules or dynamic libraries. On macOS 10.5 and later,
25179 the embedded runpath is added by default unless the user adds
25180 @option{-nodefaultrpaths} to the link line. Run paths are needed
25181 (and therefore enforced) to build on macOS version 10.11 or later.
25183 @item -allowable_client  @var{client_name}
25184 @itemx -client_name
25185 @itemx -compatibility_version
25186 @itemx -current_version
25187 @itemx -dead_strip
25188 @itemx -dependency-file
25189 @itemx -dylib_file
25190 @itemx -dylinker_install_name
25191 @itemx -dynamic
25192 @itemx -exported_symbols_list
25193 @itemx -filelist
25194 @need 800
25195 @itemx -flat_namespace
25196 @itemx -force_flat_namespace
25197 @itemx -headerpad_max_install_names
25198 @itemx -image_base
25199 @itemx -init
25200 @itemx -install_name
25201 @itemx -keep_private_externs
25202 @itemx -multi_module
25203 @itemx -multiply_defined
25204 @itemx -multiply_defined_unused
25205 @need 800
25206 @itemx -noall_load
25207 @itemx -no_dead_strip_inits_and_terms
25208 @itemx -nofixprebinding
25209 @itemx -nomultidefs
25210 @itemx -noprebind
25211 @itemx -noseglinkedit
25212 @itemx -pagezero_size
25213 @itemx -prebind
25214 @itemx -prebind_all_twolevel_modules
25215 @itemx -private_bundle
25216 @need 800
25217 @itemx -read_only_relocs
25218 @itemx -sectalign
25219 @itemx -sectobjectsymbols
25220 @itemx -whyload
25221 @itemx -seg1addr
25222 @itemx -sectcreate
25223 @itemx -sectobjectsymbols
25224 @itemx -sectorder
25225 @itemx -segaddr
25226 @itemx -segs_read_only_addr
25227 @need 800
25228 @itemx -segs_read_write_addr
25229 @itemx -seg_addr_table
25230 @itemx -seg_addr_table_filename
25231 @itemx -seglinkedit
25232 @itemx -segprot
25233 @itemx -segs_read_only_addr
25234 @itemx -segs_read_write_addr
25235 @itemx -single_module
25236 @itemx -static
25237 @itemx -sub_library
25238 @need 800
25239 @opindex allowable_client
25240 @opindex client_name
25241 @opindex compatibility_version
25242 @opindex current_version
25243 @opindex dead_strip
25244 @opindex dependency-file
25245 @opindex dylib_file
25246 @opindex dylinker_install_name
25247 @opindex dynamic
25248 @opindex exported_symbols_list
25249 @opindex filelist
25250 @opindex flat_namespace
25251 @opindex force_flat_namespace
25252 @opindex headerpad_max_install_names
25253 @opindex image_base
25254 @opindex init
25255 @opindex install_name
25256 @opindex keep_private_externs
25257 @opindex multi_module
25258 @opindex multiply_defined
25259 @opindex multiply_defined_unused
25260 @opindex noall_load
25261 @opindex no_dead_strip_inits_and_terms
25262 @opindex nofixprebinding
25263 @opindex nomultidefs
25264 @opindex noprebind
25265 @opindex noseglinkedit
25266 @opindex pagezero_size
25267 @opindex prebind
25268 @opindex prebind_all_twolevel_modules
25269 @opindex private_bundle
25270 @opindex read_only_relocs
25271 @opindex sectalign
25272 @opindex sectobjectsymbols
25273 @opindex whyload
25274 @opindex seg1addr
25275 @opindex sectcreate
25276 @opindex sectobjectsymbols
25277 @opindex sectorder
25278 @opindex segaddr
25279 @opindex segs_read_only_addr
25280 @opindex segs_read_write_addr
25281 @opindex seg_addr_table
25282 @opindex seg_addr_table_filename
25283 @opindex seglinkedit
25284 @opindex segprot
25285 @opindex segs_read_only_addr
25286 @opindex segs_read_write_addr
25287 @opindex single_module
25288 @opindex static
25289 @opindex sub_library
25290 @opindex sub_umbrella
25291 @opindex twolevel_namespace
25292 @opindex umbrella
25293 @opindex undefined
25294 @opindex unexported_symbols_list
25295 @opindex weak_reference_mismatches
25296 @opindex whatsloaded
25297 @itemx -sub_umbrella
25298 @itemx -twolevel_namespace
25299 @itemx -umbrella
25300 @itemx -undefined
25301 @itemx -unexported_symbols_list
25302 @itemx -weak_reference_mismatches
25303 @itemx -whatsloaded
25304 These options are passed to the Darwin linker.  The Darwin linker man page
25305 describes them in detail.
25306 @end table
25308 @node DEC Alpha Options
25309 @subsection DEC Alpha Options
25311 These @samp{-m} options are defined for the DEC Alpha implementations:
25313 @table @gcctabopt
25314 @opindex mno-soft-float
25315 @opindex msoft-float
25316 @item -mno-soft-float
25317 @itemx -msoft-float
25318 Use (do not use) the hardware floating-point instructions for
25319 floating-point operations.  When @option{-msoft-float} is specified,
25320 functions in @file{libgcc.a} are used to perform floating-point
25321 operations.  Unless they are replaced by routines that emulate the
25322 floating-point operations, or compiled in such a way as to call such
25323 emulations routines, these routines issue floating-point
25324 operations.   If you are compiling for an Alpha without floating-point
25325 operations, you must ensure that the library is built so as not to call
25326 them.
25328 Note that Alpha implementations without floating-point operations are
25329 required to have floating-point registers.
25331 @opindex mfp-reg
25332 @opindex mno-fp-regs
25333 @item -mfp-reg
25334 @itemx -mno-fp-regs
25335 Generate code that uses (does not use) the floating-point register set.
25336 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
25337 register set is not used, floating-point operands are passed in integer
25338 registers as if they were integers and floating-point results are passed
25339 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
25340 so any function with a floating-point argument or return value called by code
25341 compiled with @option{-mno-fp-regs} must also be compiled with that
25342 option.
25344 A typical use of this option is building a kernel that does not use,
25345 and hence need not save and restore, any floating-point registers.
25347 @opindex mieee
25348 @item -mieee
25349 The Alpha architecture implements floating-point hardware optimized for
25350 maximum performance.  It is mostly compliant with the IEEE floating-point
25351 standard.  However, for full compliance, software assistance is
25352 required.  This option generates code fully IEEE-compliant code
25353 @emph{except} that the @var{inexact-flag} is not maintained (see below).
25354 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
25355 defined during compilation.  The resulting code is less efficient but is
25356 able to correctly support denormalized numbers and exceptional IEEE
25357 values such as not-a-number and plus/minus infinity.  Other Alpha
25358 compilers call this option @option{-ieee_with_no_inexact}.
25360 @opindex mieee-with-inexact
25361 @item -mieee-with-inexact
25362 This is like @option{-mieee} except the generated code also maintains
25363 the IEEE @var{inexact-flag}.  Turning on this option causes the
25364 generated code to implement fully-compliant IEEE math.  In addition to
25365 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
25366 macro.  On some Alpha implementations the resulting code may execute
25367 significantly slower than the code generated by default.  Since there is
25368 very little code that depends on the @var{inexact-flag}, you should
25369 normally not specify this option.  Other Alpha compilers call this
25370 option @option{-ieee_with_inexact}.
25372 @opindex mfp-trap-mode
25373 @item -mfp-trap-mode=@var{trap-mode}
25374 This option controls what floating-point related traps are enabled.
25375 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
25376 The trap mode can be set to one of four values:
25378 @table @samp
25379 @item n
25380 This is the default (normal) setting.  The only traps that are enabled
25381 are the ones that cannot be disabled in software (e.g., division by zero
25382 trap).
25384 @item u
25385 In addition to the traps enabled by @samp{n}, underflow traps are enabled
25386 as well.
25388 @item su
25389 Like @samp{u}, but the instructions are marked to be safe for software
25390 completion (see Alpha architecture manual for details).
25392 @item sui
25393 Like @samp{su}, but inexact traps are enabled as well.
25394 @end table
25396 @opindex mfp-rounding-mode
25397 @item -mfp-rounding-mode=@var{rounding-mode}
25398 Selects the IEEE rounding mode.  Other Alpha compilers call this option
25399 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
25402 @table @samp
25403 @item n
25404 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
25405 the nearest machine number or towards the even machine number in case
25406 of a tie.
25408 @item m
25409 Round towards minus infinity.
25411 @item c
25412 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
25414 @item d
25415 Dynamic rounding mode.  A field in the floating-point control register
25416 (@var{fpcr}, see Alpha architecture reference manual) controls the
25417 rounding mode in effect.  The C library initializes this register for
25418 rounding towards plus infinity.  Thus, unless your program modifies the
25419 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
25420 @end table
25422 @opindex mtrap-precision
25423 @item -mtrap-precision=@var{trap-precision}
25424 In the Alpha architecture, floating-point traps are imprecise.  This
25425 means without software assistance it is impossible to recover from a
25426 floating trap and program execution normally needs to be terminated.
25427 GCC can generate code that can assist operating system trap handlers
25428 in determining the exact location that caused a floating-point trap.
25429 Depending on the requirements of an application, different levels of
25430 precisions can be selected:
25432 @table @samp
25433 @item p
25434 Program precision.  This option is the default and means a trap handler
25435 can only identify which program caused a floating-point exception.
25437 @item f
25438 Function precision.  The trap handler can determine the function that
25439 caused a floating-point exception.
25441 @item i
25442 Instruction precision.  The trap handler can determine the exact
25443 instruction that caused a floating-point exception.
25444 @end table
25446 Other Alpha compilers provide the equivalent options called
25447 @option{-scope_safe} and @option{-resumption_safe}.
25449 @opindex mieee-conformant
25450 @item -mieee-conformant
25451 This option marks the generated code as IEEE conformant.  You must not
25452 use this option unless you also specify @option{-mtrap-precision=i} and either
25453 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
25454 is to emit the line @samp{.eflag 48} in the function prologue of the
25455 generated assembly file.
25457 @opindex mbuild-constants
25458 @item -mbuild-constants
25459 Normally GCC examines a 32- or 64-bit integer constant to
25460 see if it can construct it from smaller constants in two or three
25461 instructions.  If it cannot, it outputs the constant as a literal and
25462 generates code to load it from the data segment at run time.
25464 Use this option to require GCC to construct @emph{all} integer constants
25465 using code, even if it takes more instructions (the maximum is six).
25467 You typically use this option to build a shared library dynamic
25468 loader.  Itself a shared library, it must relocate itself in memory
25469 before it can find the variables and constants in its own data segment.
25471 @opindex mbwx
25472 @opindex mno-bwx
25473 @opindex mcix
25474 @opindex mno-cix
25475 @opindex mfix
25476 @opindex mno-fix
25477 @opindex mmax
25478 @opindex mno-max
25479 @item -mbwx
25480 @itemx -mno-bwx
25481 @itemx -mcix
25482 @itemx -mno-cix
25483 @itemx -mfix
25484 @itemx -mno-fix
25485 @itemx -mmax
25486 @itemx -mno-max
25487 Indicate whether GCC should generate code to use the optional BWX,
25488 CIX, FIX and MAX instruction sets.  The default is to use the instruction
25489 sets supported by the CPU type specified via @option{-mcpu=} option or that
25490 of the CPU on which GCC was built if none is specified.
25492 @opindex mfloat-vax
25493 @opindex mfloat-ieee
25494 @item -mfloat-vax
25495 @itemx -mfloat-ieee
25496 Generate code that uses (does not use) VAX F and G floating-point
25497 arithmetic instead of IEEE single and double precision.
25499 @opindex mexplicit-relocs
25500 @opindex mno-explicit-relocs
25501 @item -mexplicit-relocs
25502 @itemx -mno-explicit-relocs
25503 Older Alpha assemblers provided no way to generate symbol relocations
25504 except via assembler macros.  Use of these macros does not allow
25505 optimal instruction scheduling.  GNU binutils as of version 2.12
25506 supports a new syntax that allows the compiler to explicitly mark
25507 which relocations should apply to which instructions.  This option
25508 is mostly useful for debugging, as GCC detects the capabilities of
25509 the assembler when it is built and sets the default accordingly.
25511 @opindex msmall-data
25512 @opindex mlarge-data
25513 @item -msmall-data
25514 @itemx -mlarge-data
25515 When @option{-mexplicit-relocs} is in effect, static data is
25516 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
25517 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
25518 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
25519 16-bit relocations off of the @code{$gp} register.  This limits the
25520 size of the small data area to 64KB, but allows the variables to be
25521 directly accessed via a single instruction.
25523 The default is @option{-mlarge-data}.  With this option the data area
25524 is limited to just below 2GB@.  Programs that require more than 2GB of
25525 data must use @code{malloc} or @code{mmap} to allocate the data in the
25526 heap instead of in the program's data segment.
25528 When generating code for shared libraries, @option{-fpic} implies
25529 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
25531 @opindex msmall-text
25532 @opindex mlarge-text
25533 @item -msmall-text
25534 @itemx -mlarge-text
25535 When @option{-msmall-text} is used, the compiler assumes that the
25536 code of the entire program (or shared library) fits in 4MB, and is
25537 thus reachable with a branch instruction.  When @option{-msmall-data}
25538 is used, the compiler can assume that all local symbols share the
25539 same @code{$gp} value, and thus reduce the number of instructions
25540 required for a function call from 4 to 1.
25542 The default is @option{-mlarge-text}.
25544 @opindex mcpu
25545 @item -mcpu=@var{cpu_type}
25546 Set the instruction set and instruction scheduling parameters for
25547 machine type @var{cpu_type}.  You can specify either the @samp{EV}
25548 style name or the corresponding chip number.  GCC supports scheduling
25549 parameters for the EV4, EV5 and EV6 family of processors and
25550 chooses the default values for the instruction set from the processor
25551 you specify.  If you do not specify a processor type, GCC defaults
25552 to the processor on which the compiler was built.
25554 Supported values for @var{cpu_type} are
25556 @table @samp
25557 @item ev4
25558 @itemx ev45
25559 @itemx 21064
25560 Schedules as an EV4 and has no instruction set extensions.
25562 @item ev5
25563 @itemx 21164
25564 Schedules as an EV5 and has no instruction set extensions.
25566 @item ev56
25567 @itemx 21164a
25568 Schedules as an EV5 and supports the BWX extension.
25570 @item pca56
25571 @itemx 21164pc
25572 @itemx 21164PC
25573 Schedules as an EV5 and supports the BWX and MAX extensions.
25575 @item ev6
25576 @itemx 21264
25577 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
25579 @item ev67
25580 @itemx 21264a
25581 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
25582 @end table
25584 Native toolchains also support the value @samp{native},
25585 which selects the best architecture option for the host processor.
25586 @option{-mcpu=native} has no effect if GCC does not recognize
25587 the processor.
25589 @opindex mtune
25590 @item -mtune=@var{cpu_type}
25591 Set only the instruction scheduling parameters for machine type
25592 @var{cpu_type}.  The instruction set is not changed.
25594 Native toolchains also support the value @samp{native},
25595 which selects the best architecture option for the host processor.
25596 @option{-mtune=native} has no effect if GCC does not recognize
25597 the processor.
25599 @opindex mmemory-latency
25600 @item -mmemory-latency=@var{time}
25601 Sets the latency the scheduler should assume for typical memory
25602 references as seen by the application.  This number is highly
25603 dependent on the memory access patterns used by the application
25604 and the size of the external cache on the machine.
25606 Valid options for @var{time} are
25608 @table @samp
25609 @item @var{number}
25610 A decimal number representing clock cycles.
25612 @item L1
25613 @itemx L2
25614 @itemx L3
25615 @itemx main
25616 The compiler contains estimates of the number of clock cycles for
25617 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
25618 (also called Dcache, Scache, and Bcache), as well as to main memory.
25619 Note that L3 is only valid for EV5.
25621 @end table
25622 @end table
25624 @node eBPF Options
25625 @subsection eBPF Options
25626 @cindex eBPF Options
25628 @table @gcctabopt
25629 @item -mframe-limit=@var{bytes}
25630 This specifies the hard limit for frame sizes, in bytes.  Currently,
25631 the value that can be specified should be less than or equal to
25632 @samp{32767}.  Defaults to whatever limit is imposed by the version of
25633 the Linux kernel targeted.
25635 @opindex mbig-endian
25636 @item -mbig-endian
25637 Generate code for a big-endian target.
25639 @opindex mlittle-endian
25640 @item -mlittle-endian
25641 Generate code for a little-endian target.  This is the default.
25643 @opindex mjmpext
25644 @item -mjmpext
25645 @itemx -mno-jmpext
25646 Enable or disable generation of extra conditional-branch instructions.
25647 Enabled for CPU v2 and above.
25649 @opindex mjmp32
25650 @item -mjmp32
25651 @itemx -mno-jmp32
25652 Enable or disable generation of 32-bit jump instructions.
25653 Enabled for CPU v3 and above.
25655 @opindex malu32
25656 @item -malu32
25657 @itemx -mno-alu32
25658 Enable or disable generation of 32-bit ALU instructions.
25659 Enabled for CPU v3 and above.
25661 @opindex mv3-atomics
25662 @item -mv3-atomics
25663 @itemx -mno-v3-atomics
25664 Enable or disable instructions for general atomic operations introduced
25665 in CPU v3.  Enabled for CPU v3 and above.
25667 @opindex mbswap
25668 @item -mbswap
25669 @itemx -mno-bswap
25670 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
25672 @opindex msdiv
25673 @item -msdiv
25674 @itemx -mno-sdiv
25675 Enable or disable signed division and modulus instructions.  Enabled for
25676 CPU v4 and above.
25678 @opindex msmov
25679 @item -msmov
25680 @itemx -mno-smov
25681 Enable or disable sign-extending move and memory load instructions.
25682 Enabled for CPU v4 and above.
25684 @opindex mcpu
25685 @item -mcpu=@var{version}
25686 This specifies which version of the eBPF ISA to target. Newer versions
25687 may not be supported by all kernels. The default is @samp{v4}.
25689 Supported values for @var{version} are:
25691 @table @samp
25692 @item v1
25693 The first stable eBPF ISA with no special features or extensions.
25695 @item v2
25696 Supports the jump extensions, as in @option{-mjmpext}.
25698 @item v3
25699 All features of v2, plus:
25700 @itemize @minus
25701 @item 32-bit jump operations, as in @option{-mjmp32}
25702 @item 32-bit ALU operations, as in @option{-malu32}
25703 @item general atomic operations, as in @option{-mv3-atomics}
25704 @end itemize
25706 @item v4
25707 All features of v3, plus:
25708 @itemize @minus
25709 @item Byte swap instructions, as in @option{-mbswap}
25710 @item Signed division and modulus instructions, as in @option{-msdiv}
25711 @item Sign-extending move and memory load instructions, as in @option{-msmov}
25712 @end itemize
25713 @end table
25715 @opindex mco-re
25716 @item -mco-re
25717 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
25718 is implied by @option{-gbtf}.
25720 @opindex mno-co-re
25721 @item -mno-co-re
25722 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
25723 support is enabled by default when generating BTF debug information for
25724 the BPF target.
25726 @item -mxbpf
25727 Generate code for an expanded version of BPF, which relaxes some of
25728 the restrictions imposed by the BPF architecture:
25729 @itemize @minus
25730 @item Save and restore callee-saved registers at function entry and
25731 exit, respectively.
25732 @end itemize
25734 @opindex masm=@var{dialect}
25735 @item -masm=@var{dialect}
25736 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
25737 is @samp{normal}.
25739 Supported values for @var{dialect} are:
25741 @table @samp
25742 @item normal
25743 Outputs normal assembly dialect.
25745 @item pseudoc
25746 Outputs pseudo-c assembly dialect.
25748 @end table
25750 @opindex -minline-memops-threshold
25751 @item -minline-memops-threshold=@var{bytes}
25752 Specifies a size threshold in bytes at or below which memmove, memcpy
25753 and memset shall always be expanded inline.  Operations dealing with
25754 sizes larger than this threshold would have to be be implemented using
25755 a library call instead of being expanded inline, but since BPF doesn't
25756 allow libcalls, exceeding this threshold results in a compile-time
25757 error.  The default is @samp{1024} bytes.
25759 @end table
25761 @node FR30 Options
25762 @subsection FR30 Options
25763 @cindex FR30 Options
25765 These options are defined specifically for the FR30 port.
25767 @table @gcctabopt
25769 @opindex msmall-model
25770 @item -msmall-model
25771 Use the small address space model.  This can produce smaller code, but
25772 it does assume that all symbolic values and addresses fit into a
25773 20-bit range.
25775 @opindex mno-lsim
25776 @item -mno-lsim
25777 Assume that runtime support has been provided and so there is no need
25778 to include the simulator library (@file{libsim.a}) on the linker
25779 command line.
25781 @end table
25783 @node FT32 Options
25784 @subsection FT32 Options
25785 @cindex FT32 Options
25787 These options are defined specifically for the FT32 port.
25789 @table @gcctabopt
25791 @opindex msim
25792 @item -msim
25793 Specifies that the program will be run on the simulator.  This causes
25794 an alternate runtime startup and library to be linked.
25795 You must not use this option when generating programs that will run on
25796 real hardware; you must provide your own runtime library for whatever
25797 I/O functions are needed.
25799 @opindex mlra
25800 @item -mlra
25801 Enable Local Register Allocation.  This is still experimental for FT32,
25802 so by default the compiler uses standard reload.
25804 @opindex mnodiv
25805 @item -mnodiv
25806 Do not use div and mod instructions.
25808 @opindex mft32b
25809 @item -mft32b
25810 Enable use of the extended instructions of the FT32B processor.
25812 @opindex mcompress
25813 @item -mcompress
25814 Compress all code using the Ft32B code compression scheme.
25816 @opindex  mnopm
25817 @item -mnopm
25818 Do not generate code that reads program memory.
25820 @end table
25822 @node FRV Options
25823 @subsection FRV Options
25824 @cindex FRV Options
25826 @table @gcctabopt
25827 @opindex mgpr-32
25828 @item -mgpr-32
25830 Only use the first 32 general-purpose registers.
25832 @opindex mgpr-64
25833 @item -mgpr-64
25835 Use all 64 general-purpose registers.
25837 @opindex mfpr-32
25838 @item -mfpr-32
25840 Use only the first 32 floating-point registers.
25842 @opindex mfpr-64
25843 @item -mfpr-64
25845 Use all 64 floating-point registers.
25847 @opindex mhard-float
25848 @item -mhard-float
25850 Use hardware instructions for floating-point operations.
25852 @opindex msoft-float
25853 @item -msoft-float
25855 Use library routines for floating-point operations.
25857 @opindex malloc-cc
25858 @item -malloc-cc
25860 Dynamically allocate condition code registers.
25862 @opindex mfixed-cc
25863 @item -mfixed-cc
25865 Do not try to dynamically allocate condition code registers, only
25866 use @code{icc0} and @code{fcc0}.
25868 @opindex mdword
25869 @item -mdword
25871 Change ABI to use double word insns.
25873 @opindex mno-dword
25874 @opindex mdword
25875 @item -mno-dword
25877 Do not use double word instructions.
25879 @opindex mdouble
25880 @item -mdouble
25882 Use floating-point double instructions.
25884 @opindex mno-double
25885 @item -mno-double
25887 Do not use floating-point double instructions.
25889 @opindex mmedia
25890 @item -mmedia
25892 Use media instructions.
25894 @opindex mno-media
25895 @item -mno-media
25897 Do not use media instructions.
25899 @opindex mmuladd
25900 @item -mmuladd
25902 Use multiply and add/subtract instructions.
25904 @opindex mno-muladd
25905 @item -mno-muladd
25907 Do not use multiply and add/subtract instructions.
25909 @opindex mfdpic
25910 @item -mfdpic
25912 Select the FDPIC ABI, which uses function descriptors to represent
25913 pointers to functions.  Without any PIC/PIE-related options, it
25914 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25915 assumes GOT entries and small data are within a 12-bit range from the
25916 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25917 are computed with 32 bits.
25918 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25920 @opindex minline-plt
25921 @item -minline-plt
25923 Enable inlining of PLT entries in function calls to functions that are
25924 not known to bind locally.  It has no effect without @option{-mfdpic}.
25925 It's enabled by default if optimizing for speed and compiling for
25926 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25927 optimization option such as @option{-O3} or above is present in the
25928 command line.
25930 @opindex mTLS
25931 @item -mTLS
25933 Assume a large TLS segment when generating thread-local code.
25935 @opindex mtls
25936 @item -mtls
25938 Do not assume a large TLS segment when generating thread-local code.
25940 @opindex mgprel-ro
25941 @item -mgprel-ro
25943 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25944 that is known to be in read-only sections.  It's enabled by default,
25945 except for @option{-fpic} or @option{-fpie}: even though it may help
25946 make the global offset table smaller, it trades 1 instruction for 4.
25947 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25948 one of which may be shared by multiple symbols, and it avoids the need
25949 for a GOT entry for the referenced symbol, so it's more likely to be a
25950 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25952 @opindex multilib-library-pic
25953 @item -multilib-library-pic
25955 Link with the (library, not FD) pic libraries.  It's implied by
25956 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25957 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25958 it explicitly.
25960 @opindex mlinked-fp
25961 @item -mlinked-fp
25963 Follow the EABI requirement of always creating a frame pointer whenever
25964 a stack frame is allocated.  This option is enabled by default and can
25965 be disabled with @option{-mno-linked-fp}.
25967 @opindex mlong-calls
25968 @item -mlong-calls
25970 Use indirect addressing to call functions outside the current
25971 compilation unit.  This allows the functions to be placed anywhere
25972 within the 32-bit address space.
25974 @opindex malign-labels
25975 @item -malign-labels
25977 Try to align labels to an 8-byte boundary by inserting NOPs into the
25978 previous packet.  This option only has an effect when VLIW packing
25979 is enabled.  It doesn't create new packets; it merely adds NOPs to
25980 existing ones.
25982 @opindex mlibrary-pic
25983 @item -mlibrary-pic
25985 Generate position-independent EABI code.
25987 @opindex macc-4
25988 @item -macc-4
25990 Use only the first four media accumulator registers.
25992 @opindex macc-8
25993 @item -macc-8
25995 Use all eight media accumulator registers.
25997 @opindex mpack
25998 @item -mpack
26000 Pack VLIW instructions.
26002 @opindex mno-pack
26003 @item -mno-pack
26005 Do not pack VLIW instructions.
26007 @opindex mno-eflags
26008 @item -mno-eflags
26010 Do not mark ABI switches in e_flags.
26012 @opindex mcond-move
26013 @item -mcond-move
26015 Enable the use of conditional-move instructions (default).
26017 This switch is mainly for debugging the compiler and will likely be removed
26018 in a future version.
26020 @opindex mno-cond-move
26021 @item -mno-cond-move
26023 Disable the use of conditional-move instructions.
26025 This switch is mainly for debugging the compiler and will likely be removed
26026 in a future version.
26028 @opindex mscc
26029 @item -mscc
26031 Enable the use of conditional set instructions (default).
26033 This switch is mainly for debugging the compiler and will likely be removed
26034 in a future version.
26036 @opindex mno-scc
26037 @item -mno-scc
26039 Disable the use of conditional set instructions.
26041 This switch is mainly for debugging the compiler and will likely be removed
26042 in a future version.
26044 @opindex mcond-exec
26045 @item -mcond-exec
26047 Enable the use of conditional execution (default).
26049 This switch is mainly for debugging the compiler and will likely be removed
26050 in a future version.
26052 @opindex mno-cond-exec
26053 @item -mno-cond-exec
26055 Disable the use of conditional execution.
26057 This switch is mainly for debugging the compiler and will likely be removed
26058 in a future version.
26060 @opindex mvliw-branch
26061 @item -mvliw-branch
26063 Run a pass to pack branches into VLIW instructions (default).
26065 This switch is mainly for debugging the compiler and will likely be removed
26066 in a future version.
26068 @opindex mno-vliw-branch
26069 @item -mno-vliw-branch
26071 Do not run a pass to pack branches into VLIW instructions.
26073 This switch is mainly for debugging the compiler and will likely be removed
26074 in a future version.
26076 @opindex mmulti-cond-exec
26077 @item -mmulti-cond-exec
26079 Enable optimization of @code{&&} and @code{||} in conditional execution
26080 (default).
26082 This switch is mainly for debugging the compiler and will likely be removed
26083 in a future version.
26085 @opindex mno-multi-cond-exec
26086 @item -mno-multi-cond-exec
26088 Disable optimization of @code{&&} and @code{||} in conditional execution.
26090 This switch is mainly for debugging the compiler and will likely be removed
26091 in a future version.
26093 @opindex mnested-cond-exec
26094 @item -mnested-cond-exec
26096 Enable nested conditional execution optimizations (default).
26098 This switch is mainly for debugging the compiler and will likely be removed
26099 in a future version.
26101 @opindex mno-nested-cond-exec
26102 @item -mno-nested-cond-exec
26104 Disable nested conditional execution optimizations.
26106 This switch is mainly for debugging the compiler and will likely be removed
26107 in a future version.
26109 @opindex moptimize-membar
26110 @item -moptimize-membar
26112 This switch removes redundant @code{membar} instructions from the
26113 compiler-generated code.  It is enabled by default.
26115 @opindex mno-optimize-membar
26116 @opindex moptimize-membar
26117 @item -mno-optimize-membar
26119 This switch disables the automatic removal of redundant @code{membar}
26120 instructions from the generated code.
26122 @opindex mtomcat-stats
26123 @item -mtomcat-stats
26125 Cause gas to print out tomcat statistics.
26127 @opindex mcpu
26128 @item -mcpu=@var{cpu}
26130 Select the processor type for which to generate code.  Possible values are
26131 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
26132 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
26134 @end table
26136 @node GNU/Linux Options
26137 @subsection GNU/Linux Options
26139 These @samp{-m} options are defined for GNU/Linux targets:
26141 @table @gcctabopt
26142 @opindex mglibc
26143 @item -mglibc
26144 Use the GNU C library.  This is the default except
26145 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
26146 @samp{*-*-linux-*android*} targets.
26148 @opindex muclibc
26149 @item -muclibc
26150 Use uClibc C library.  This is the default on
26151 @samp{*-*-linux-*uclibc*} targets.
26153 @opindex mmusl
26154 @item -mmusl
26155 Use the musl C library.  This is the default on
26156 @samp{*-*-linux-*musl*} targets.
26158 @opindex mbionic
26159 @item -mbionic
26160 Use Bionic C library.  This is the default on
26161 @samp{*-*-linux-*android*} targets.
26163 @opindex mandroid
26164 @item -mandroid
26165 Compile code compatible with Android platform.  This is the default on
26166 @samp{*-*-linux-*android*} targets.
26168 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
26169 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
26170 this option makes the GCC driver pass Android-specific options to the linker.
26171 Finally, this option causes the preprocessor macro @code{__ANDROID__}
26172 to be defined.
26174 @opindex tno-android-cc
26175 @item -tno-android-cc
26176 Disable compilation effects of @option{-mandroid}, i.e., do not enable
26177 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
26178 @option{-fno-rtti} by default.
26180 @opindex tno-android-ld
26181 @item -tno-android-ld
26182 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
26183 linking options to the linker.
26185 @end table
26187 @node H8/300 Options
26188 @subsection H8/300 Options
26190 These @samp{-m} options are defined for the H8/300 implementations:
26192 @table @gcctabopt
26193 @opindex mrelax
26194 @item -mrelax
26195 Shorten some address references at link time, when possible; uses the
26196 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
26197 ld, Using ld}, for a fuller description.
26199 @opindex mh
26200 @item -mh
26201 Generate code for the H8/300H@.
26203 @opindex ms
26204 @item -ms
26205 Generate code for the H8S@.
26207 @opindex mn
26208 @item -mn
26209 Generate code for the H8S and H8/300H in the normal mode.  This switch
26210 must be used either with @option{-mh} or @option{-ms}.
26212 @opindex ms2600
26213 @item -ms2600
26214 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
26216 @opindex mexr
26217 @item -mexr
26218 Extended registers are stored on stack before execution of function
26219 with monitor attribute. Default option is @option{-mexr}.
26220 This option is valid only for H8S targets.
26222 @opindex mno-exr
26223 @opindex mexr
26224 @item -mno-exr
26225 Extended registers are not stored on stack before execution of function 
26226 with monitor attribute. Default option is @option{-mno-exr}. 
26227 This option is valid only for H8S targets.
26229 @opindex mint32
26230 @item -mint32
26231 Make @code{int} data 32 bits by default.
26233 @opindex malign-300
26234 @item -malign-300
26235 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
26236 The default for the H8/300H and H8S is to align longs and floats on
26237 4-byte boundaries.
26238 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
26239 This option has no effect on the H8/300.
26240 @end table
26242 @node HPPA Options
26243 @subsection HPPA Options
26244 @cindex HPPA Options
26246 These @samp{-m} options are defined for the HPPA family of computers:
26248 @table @gcctabopt
26249 @opindex march
26250 @item -march=@var{architecture-type}
26251 Generate code for the specified architecture.  The choices for
26252 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
26253 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
26254 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
26255 architecture option for your machine.  Code compiled for lower numbered
26256 architectures runs on higher numbered architectures, but not the
26257 other way around.
26259 @opindex mpa-risc-1-0
26260 @opindex mpa-risc-1-1
26261 @opindex mpa-risc-2-0
26262 @item -mpa-risc-1-0
26263 @itemx -mpa-risc-1-1
26264 @itemx -mpa-risc-2-0
26265 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
26267 @opindex matomic-libcalls
26268 @opindex mno-atomic-libcalls
26269 @item -matomic-libcalls
26270 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
26271 This option is enabled by default.  It only affects the generation of
26272 atomic libcalls by the HPPA backend.
26274 Both the sync and @file{libatomic} libcall implementations use locking.
26275 As a result, processor stores are not atomic with respect to other
26276 atomic operations.  Processor loads up to DImode are atomic with
26277 respect to other atomic operations provided they are implemented as
26278 a single access.
26280 The PA-RISC architecture does not support any atomic operations in
26281 hardware except for the @code{ldcw} instruction.  Thus, all atomic
26282 support is implemented using sync and atomic libcalls.  Sync libcall
26283 support is in @file{libgcc.a}.  Atomic libcall support is in
26284 @file{libatomic}.
26286 This option generates @code{__atomic_exchange} calls for atomic stores.
26287 It also provides special handling for atomic DImode accesses on 32-bit
26288 targets.
26290 @opindex mbig-switch
26291 @item -mbig-switch
26292 Does nothing.  Preserved for backward compatibility.
26294 @opindex mcaller-copies
26295 @item -mcaller-copies
26296 The caller copies function arguments passed by hidden reference.  This
26297 option should be used with care as it is not compatible with the default
26298 32-bit runtime.  However, only aggregates larger than eight bytes are
26299 passed by hidden reference and the option provides better compatibility
26300 with OpenMP.
26302 @opindex mcoherent-ldcw
26303 @item -mcoherent-ldcw
26304 Use ldcw/ldcd coherent cache-control hint.
26306 @opindex mdisable-fpregs
26307 @item -mdisable-fpregs
26308 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
26310 @opindex mdisable-indexing
26311 @item -mdisable-indexing
26312 Prevent the compiler from using indexing address modes.  This avoids some
26313 rather obscure problems when compiling MIG generated code under MACH@.
26315 @opindex mfast-indirect-calls
26316 @item -mfast-indirect-calls
26317 Generate code that assumes calls never cross space boundaries.  This
26318 allows GCC to emit code that performs faster indirect calls.
26320 This option does not work in the presence of shared libraries or nested
26321 functions.
26323 @opindex mfixed-range
26324 @item -mfixed-range=@var{register-range}
26325 Generate code treating the given register range as fixed registers.
26326 A fixed register is one that the register allocator cannot use.  This is
26327 useful when compiling kernel code.  A register range is specified as
26328 two registers separated by a dash.  Multiple register ranges can be
26329 specified separated by a comma.
26331 @opindex mgas
26332 @item -mgas
26333 Enable the use of assembler directives only GAS understands.
26335 @opindex mgnu-ld
26336 @item -mgnu-ld
26337 Use options specific to GNU @command{ld}.
26338 This passes @option{-shared} to @command{ld} when
26339 building a shared library.  It is the default when GCC is configured,
26340 explicitly or implicitly, with the GNU linker.  This option does not
26341 affect which @command{ld} is called; it only changes what parameters
26342 are passed to that @command{ld}.
26343 The @command{ld} that is called is determined by the
26344 @option{--with-ld} configure option, GCC's program search path, and
26345 finally by the user's @env{PATH}.  The linker used by GCC can be printed
26346 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
26347 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
26349 @opindex mhp-ld
26350 @item -mhp-ld
26351 Use options specific to HP @command{ld}.
26352 This passes @option{-b} to @command{ld} when building
26353 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
26354 links.  It is the default when GCC is configured, explicitly or
26355 implicitly, with the HP linker.  This option does not affect
26356 which @command{ld} is called; it only changes what parameters are passed to that
26357 @command{ld}.
26358 The @command{ld} that is called is determined by the @option{--with-ld}
26359 configure option, GCC's program search path, and finally by the user's
26360 @env{PATH}.  The linker used by GCC can be printed using @samp{which
26361 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
26362 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
26364 @opindex mlinker-opt
26365 @item -mlinker-opt
26366 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
26367 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
26368 linkers in which they give bogus error messages when linking some programs.
26370 @opindex mno-long-calls
26371 @opindex mlong-calls
26372 @item -mlong-calls
26373 Generate code that uses long call sequences.  This ensures that a call
26374 is always able to reach linker generated stubs.  The default is to generate
26375 long calls only when the distance from the call site to the beginning
26376 of the function or translation unit, as the case may be, exceeds a
26377 predefined limit set by the branch type being used.  The limits for
26378 normal calls are 7,600,000 and 240,000 bytes, respectively for the
26379 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
26380 240,000 bytes.
26382 Distances are measured from the beginning of functions when using the
26383 @option{-ffunction-sections} option, or when using the @option{-mgas}
26384 and @option{-mno-portable-runtime} options together under HP-UX with
26385 the SOM linker.
26387 It is normally not desirable to use this option as it degrades
26388 performance.  However, it may be useful in large applications,
26389 particularly when partial linking is used to build the application.
26391 The types of long calls used depends on the capabilities of the
26392 assembler and linker, and the type of code being generated.  The
26393 impact on systems that support long absolute calls, and long pic
26394 symbol-difference or pc-relative calls should be relatively small.
26395 However, an indirect call is used on 32-bit ELF systems in pic code
26396 and it is quite long.
26398 @opindex mlong-load-store
26399 @item -mlong-load-store
26400 Generate 3-instruction load and store sequences as sometimes required by
26401 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
26402 the HP compilers.
26404 @opindex mjump-in-delay
26405 @item -mjump-in-delay
26406 This option is ignored and provided for compatibility purposes only.
26408 @opindex mno-space-regs
26409 @opindex mspace-regs
26410 @item -mno-space-regs
26411 Generate code that assumes the target has no space registers.  This allows
26412 GCC to generate faster indirect calls and use unscaled index address modes.
26414 Such code is suitable for level 0 PA systems and kernels.
26416 @opindex mordered
26417 @item -mordered
26418 Assume memory references are ordered and barriers are not needed.
26420 @opindex mportable-runtime
26421 @item -mportable-runtime
26422 Use the portable calling conventions proposed by HP for ELF systems.
26424 @opindex mschedule
26425 @item -mschedule=@var{cpu-type}
26426 Schedule code according to the constraints for the machine type
26427 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
26428 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
26429 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
26430 proper scheduling option for your machine.  The default scheduling is
26431 @samp{8000}.
26433 @opindex msio
26434 @item -msio
26435 Generate the predefine, @code{_SIO}, for server IO@.  The default is
26436 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
26437 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
26438 options are available under HP-UX and HI-UX@.
26440 @opindex msoft-float
26441 @item -msoft-float
26442 Generate output containing library calls for floating point.
26443 @strong{Warning:} the requisite libraries are not available for all HPPA
26444 targets.  Normally the facilities of the machine's usual C compiler are
26445 used, but this cannot be done directly in cross-compilation.  You must make
26446 your own arrangements to provide suitable library functions for
26447 cross-compilation.
26449 @option{-msoft-float} changes the calling convention in the output file;
26450 therefore, it is only useful if you compile @emph{all} of a program with
26451 this option.  In particular, you need to compile @file{libgcc.a}, the
26452 library that comes with GCC, with @option{-msoft-float} in order for
26453 this to work.
26455 @opindex msoft-mult
26456 @item -msoft-mult
26457 Use software integer multiplication.
26459 This disables the use of the @code{xmpyu} instruction.
26461 @opindex march
26462 @item -munix=@var{unix-std}
26463 Generate compiler predefines and select a startfile for the specified
26464 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
26465 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
26466 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
26467 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
26468 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
26469 and later.
26471 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
26472 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
26473 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
26474 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
26475 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
26476 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
26478 It is @emph{important} to note that this option changes the interfaces
26479 for various library routines.  It also affects the operational behavior
26480 of the C library.  Thus, @emph{extreme} care is needed in using this
26481 option.
26483 Library code that is intended to operate with more than one UNIX
26484 standard must test, set and restore the variable @code{__xpg4_extended_mask}
26485 as appropriate.  Most GNU software doesn't provide this capability.
26487 @opindex nolibdld
26488 @item -nolibdld
26489 Suppress the generation of link options to search libdld.sl when the
26490 @option{-static} option is specified on HP-UX 10 and later.
26492 @opindex static
26493 @item -static
26494 The HP-UX implementation of setlocale in libc has a dependency on
26495 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
26496 when the @option{-static} option is specified, special link options
26497 are needed to resolve this dependency.
26499 On HP-UX 10 and later, the GCC driver adds the necessary options to
26500 link with libdld.sl when the @option{-static} option is specified.
26501 This causes the resulting binary to be dynamic.  On the 64-bit port,
26502 the linkers generate dynamic binaries by default in any case.  The
26503 @option{-nolibdld} option can be used to prevent the GCC driver from
26504 adding these link options.
26506 @opindex threads
26507 @item -threads
26508 Add support for multithreading with the @dfn{dce thread} library
26509 under HP-UX@.  This option sets flags for both the preprocessor and
26510 linker.
26511 @end table
26513 @node IA-64 Options
26514 @subsection IA-64 Options
26515 @cindex IA-64 Options
26517 These are the @samp{-m} options defined for the Intel IA-64 architecture.
26519 @table @gcctabopt
26520 @opindex mbig-endian
26521 @item -mbig-endian
26522 Generate code for a big-endian target.  This is the default for HP-UX@.
26524 @opindex mlittle-endian
26525 @item -mlittle-endian
26526 Generate code for a little-endian target.  This is the default for AIX5
26527 and GNU/Linux.
26529 @opindex mgnu-as
26530 @opindex mno-gnu-as
26531 @item -mgnu-as
26532 @itemx -mno-gnu-as
26533 Generate (or don't) code for the GNU assembler.  This is the default.
26534 @c Also, this is the default if the configure option @option{--with-gnu-as}
26535 @c is used.
26537 @opindex mgnu-ld
26538 @opindex mno-gnu-ld
26539 @item -mgnu-ld
26540 @itemx -mno-gnu-ld
26541 Generate (or don't) code for the GNU linker.  This is the default.
26542 @c Also, this is the default if the configure option @option{--with-gnu-ld}
26543 @c is used.
26545 @opindex mno-pic
26546 @item -mno-pic
26547 Generate code that does not use a global pointer register.  The result
26548 is not position independent code, and violates the IA-64 ABI@.
26550 @opindex mvolatile-asm-stop
26551 @opindex mno-volatile-asm-stop
26552 @item -mvolatile-asm-stop
26553 @itemx -mno-volatile-asm-stop
26554 Generate (or don't) a stop bit immediately before and after volatile asm
26555 statements.
26557 @opindex mregister-names
26558 @opindex mno-register-names
26559 @item -mregister-names
26560 @itemx -mno-register-names
26561 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
26562 the stacked registers.  This may make assembler output more readable.
26564 @opindex mno-sdata
26565 @opindex msdata
26566 @item -mno-sdata
26567 @itemx -msdata
26568 Disable (or enable) optimizations that use the small data section.  This may
26569 be useful for working around optimizer bugs.
26571 @opindex mconstant-gp
26572 @item -mconstant-gp
26573 Generate code that uses a single constant global pointer value.  This is
26574 useful when compiling kernel code.
26576 @opindex mauto-pic
26577 @item -mauto-pic
26578 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
26579 This is useful when compiling firmware code.
26581 @opindex minline-float-divide-min-latency
26582 @item -minline-float-divide-min-latency
26583 Generate code for inline divides of floating-point values
26584 using the minimum latency algorithm.
26586 @opindex minline-float-divide-max-throughput
26587 @item -minline-float-divide-max-throughput
26588 Generate code for inline divides of floating-point values
26589 using the maximum throughput algorithm.
26591 @opindex mno-inline-float-divide
26592 @item -mno-inline-float-divide
26593 Do not generate inline code for divides of floating-point values.
26595 @opindex minline-int-divide-min-latency
26596 @item -minline-int-divide-min-latency
26597 Generate code for inline divides of integer values
26598 using the minimum latency algorithm.
26600 @opindex minline-int-divide-max-throughput
26601 @item -minline-int-divide-max-throughput
26602 Generate code for inline divides of integer values
26603 using the maximum throughput algorithm.
26605 @opindex mno-inline-int-divide
26606 @opindex minline-int-divide
26607 @item -mno-inline-int-divide
26608 Do not generate inline code for divides of integer values.
26610 @opindex minline-sqrt-min-latency
26611 @item -minline-sqrt-min-latency
26612 Generate code for inline square roots
26613 using the minimum latency algorithm.
26615 @opindex minline-sqrt-max-throughput
26616 @item -minline-sqrt-max-throughput
26617 Generate code for inline square roots
26618 using the maximum throughput algorithm.
26620 @opindex mno-inline-sqrt
26621 @item -mno-inline-sqrt
26622 Do not generate inline code for @code{sqrt}.
26624 @opindex mfused-madd
26625 @opindex mno-fused-madd
26626 @item -mfused-madd
26627 @itemx -mno-fused-madd
26628 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
26629 instructions.  The default is to use these instructions.
26631 @opindex mno-dwarf2-asm
26632 @opindex mdwarf2-asm
26633 @item -mno-dwarf2-asm
26634 @itemx -mdwarf2-asm
26635 Don't (or do) generate assembler code for the DWARF line number debugging
26636 info.  This may be useful when not using the GNU assembler.
26638 @opindex mearly-stop-bits
26639 @opindex mno-early-stop-bits
26640 @item -mearly-stop-bits
26641 @itemx -mno-early-stop-bits
26642 Allow stop bits to be placed earlier than immediately preceding the
26643 instruction that triggered the stop bit.  This can improve instruction
26644 scheduling, but does not always do so.
26646 @opindex mfixed-range
26647 @item -mfixed-range=@var{register-range}
26648 Generate code treating the given register range as fixed registers.
26649 A fixed register is one that the register allocator cannot use.  This is
26650 useful when compiling kernel code.  A register range is specified as
26651 two registers separated by a dash.  Multiple register ranges can be
26652 specified separated by a comma.
26654 @opindex mtls-size
26655 @item -mtls-size=@var{tls-size}
26656 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
26659 @opindex mtune
26660 @item -mtune=@var{cpu-type}
26661 Tune the instruction scheduling for a particular CPU, Valid values are
26662 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
26663 and @samp{mckinley}.
26665 @opindex milp32
26666 @opindex mlp64
26667 @item -milp32
26668 @itemx -mlp64
26669 Generate code for a 32-bit or 64-bit environment.
26670 The 32-bit environment sets int, long and pointer to 32 bits.
26671 The 64-bit environment sets int to 32 bits and long and pointer
26672 to 64 bits.  These are HP-UX specific flags.
26674 @opindex mno-sched-br-data-spec
26675 @opindex msched-br-data-spec
26676 @item -mno-sched-br-data-spec
26677 @itemx -msched-br-data-spec
26678 (Dis/En)able data speculative scheduling before reload.
26679 This results in generation of @code{ld.a} instructions and
26680 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26681 The default setting is disabled.
26683 @opindex msched-ar-data-spec
26684 @opindex mno-sched-ar-data-spec
26685 @item -msched-ar-data-spec
26686 @itemx -mno-sched-ar-data-spec
26687 (En/Dis)able data speculative scheduling after reload.
26688 This results in generation of @code{ld.a} instructions and
26689 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26690 The default setting is enabled.
26692 @opindex mno-sched-control-spec
26693 @opindex msched-control-spec
26694 @item -mno-sched-control-spec
26695 @itemx -msched-control-spec
26696 (Dis/En)able control speculative scheduling.  This feature is
26697 available only during region scheduling (i.e.@: before reload).
26698 This results in generation of the @code{ld.s} instructions and
26699 the corresponding check instructions @code{chk.s}.
26700 The default setting is disabled.
26702 @opindex msched-br-in-data-spec
26703 @opindex mno-sched-br-in-data-spec
26704 @item -msched-br-in-data-spec
26705 @itemx -mno-sched-br-in-data-spec
26706 (En/Dis)able speculative scheduling of the instructions that
26707 are dependent on the data speculative loads before reload.
26708 This is effective only with @option{-msched-br-data-spec} enabled.
26709 The default setting is enabled.
26711 @opindex msched-ar-in-data-spec
26712 @opindex mno-sched-ar-in-data-spec
26713 @item -msched-ar-in-data-spec
26714 @itemx -mno-sched-ar-in-data-spec
26715 (En/Dis)able speculative scheduling of the instructions that
26716 are dependent on the data speculative loads after reload.
26717 This is effective only with @option{-msched-ar-data-spec} enabled.
26718 The default setting is enabled.
26720 @opindex msched-in-control-spec
26721 @opindex mno-sched-in-control-spec
26722 @item -msched-in-control-spec
26723 @itemx -mno-sched-in-control-spec
26724 (En/Dis)able speculative scheduling of the instructions that
26725 are dependent on the control speculative loads.
26726 This is effective only with @option{-msched-control-spec} enabled.
26727 The default setting is enabled.
26729 @opindex mno-sched-prefer-non-data-spec-insns
26730 @opindex msched-prefer-non-data-spec-insns
26731 @item -mno-sched-prefer-non-data-spec-insns
26732 @itemx -msched-prefer-non-data-spec-insns
26733 If enabled, data-speculative instructions are chosen for schedule
26734 only if there are no other choices at the moment.  This makes
26735 the use of the data speculation much more conservative.
26736 The default setting is disabled.
26738 @opindex mno-sched-prefer-non-control-spec-insns
26739 @opindex msched-prefer-non-control-spec-insns
26740 @item -mno-sched-prefer-non-control-spec-insns
26741 @itemx -msched-prefer-non-control-spec-insns
26742 If enabled, control-speculative instructions are chosen for schedule
26743 only if there are no other choices at the moment.  This makes
26744 the use of the control speculation much more conservative.
26745 The default setting is disabled.
26747 @opindex mno-sched-count-spec-in-critical-path
26748 @opindex msched-count-spec-in-critical-path
26749 @item -mno-sched-count-spec-in-critical-path
26750 @itemx -msched-count-spec-in-critical-path
26751 If enabled, speculative dependencies are considered during
26752 computation of the instructions priorities.  This makes the use of the
26753 speculation a bit more conservative.
26754 The default setting is disabled.
26756 @opindex msched-spec-ldc
26757 @item -msched-spec-ldc
26758 Use a simple data speculation check.  This option is on by default.
26760 @opindex msched-spec-ldc
26761 @item -msched-control-spec-ldc
26762 Use a simple check for control speculation.  This option is on by default.
26764 @opindex msched-stop-bits-after-every-cycle
26765 @item -msched-stop-bits-after-every-cycle
26766 Place a stop bit after every cycle when scheduling.  This option is on
26767 by default.
26769 @opindex msched-fp-mem-deps-zero-cost
26770 @item -msched-fp-mem-deps-zero-cost
26771 Assume that floating-point stores and loads are not likely to cause a conflict
26772 when placed into the same instruction group.  This option is disabled by
26773 default.
26775 @opindex msel-sched-dont-check-control-spec
26776 @item -msel-sched-dont-check-control-spec
26777 Generate checks for control speculation in selective scheduling.
26778 This flag is disabled by default.
26780 @opindex msched-max-memory-insns
26781 @item -msched-max-memory-insns=@var{max-insns}
26782 Limit on the number of memory insns per instruction group, giving lower
26783 priority to subsequent memory insns attempting to schedule in the same
26784 instruction group. Frequently useful to prevent cache bank conflicts.
26785 The default value is 1.
26787 @opindex msched-max-memory-insns-hard-limit
26788 @item -msched-max-memory-insns-hard-limit
26789 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
26790 disallowing more than that number in an instruction group.
26791 Otherwise, the limit is ``soft'', meaning that non-memory operations
26792 are preferred when the limit is reached, but memory operations may still
26793 be scheduled.
26795 @end table
26797 @node LM32 Options
26798 @subsection LM32 Options
26799 @cindex LM32 options
26801 These @option{-m} options are defined for the LatticeMico32 architecture:
26803 @table @gcctabopt
26804 @opindex mbarrel-shift-enabled
26805 @item -mbarrel-shift-enabled
26806 Enable barrel-shift instructions.
26808 @opindex mdivide-enabled
26809 @item -mdivide-enabled
26810 Enable divide and modulus instructions.
26812 @opindex multiply-enabled
26813 @item -mmultiply-enabled
26814 Enable multiply instructions.
26816 @opindex msign-extend-enabled
26817 @item -msign-extend-enabled
26818 Enable sign extend instructions.
26820 @opindex muser-enabled
26821 @item -muser-enabled
26822 Enable user-defined instructions.
26824 @end table
26826 @node LoongArch Options
26827 @subsection LoongArch Options
26828 @cindex LoongArch Options
26830 These command-line options are defined for LoongArch targets:
26832 @table @gcctabopt
26833 @opindex march
26834 @item -march=@var{cpu-type}
26835 Generate instructions for the machine type @var{cpu-type}.  In contrast to
26836 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26837 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26838 to generate code that may not run at all on processors other than the one
26839 indicated.  Specifying @option{-march=@var{cpu-type}} implies
26840 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
26842 The choices for @var{cpu-type} are:
26844 @table @samp
26845 @item native
26846 This selects the CPU to generate code for at compilation time by determining
26847 the processor type of the compiling machine.  Using @option{-march=native}
26848 enables all instruction subsets supported by the local machine (hence
26849 the result might not run on different machines).  Using @option{-mtune=native}
26850 produces code optimized for the local machine under the constraints
26851 of the selected instruction set.
26852 @item loongarch64
26853 A generic CPU with 64-bit extensions.
26854 @item la464
26855 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
26856 @end table
26858 @opindex mtune
26859 @item -mtune=@var{cpu-type}
26860 Optimize the output for the given processor, specified by microarchitecture
26861 name.
26863 @opindex mabi
26864 @item -mabi=@var{base-abi-type}
26865 Generate code for the specified calling convention.
26866 @var{base-abi-type} can be one of:
26867 @table @samp
26868 @item lp64d
26869 Uses 64-bit general purpose registers and 32/64-bit floating-point
26870 registers for parameter passing.  Data model is LP64, where @samp{int}
26871 is 32 bits, while @samp{long int} and pointers are 64 bits.
26872 @item lp64f
26873 Uses 64-bit general purpose registers and 32-bit floating-point
26874 registers for parameter passing.  Data model is LP64, where @samp{int}
26875 is 32 bits, while @samp{long int} and pointers are 64 bits.
26876 @item lp64s
26877 Uses 64-bit general purpose registers and no floating-point
26878 registers for parameter passing.  Data model is LP64, where @samp{int}
26879 is 32 bits, while @samp{long int} and pointers are 64 bits.
26880 @end table
26882 @opindex mfpu
26883 @item -mfpu=@var{fpu-type}
26884 Generate code for the specified FPU type, which can be one of:
26885 @table @samp
26886 @item 64
26887 Allow the use of hardware floating-point instructions for 32-bit
26888 and 64-bit operations.
26889 @item 32
26890 Allow the use of hardware floating-point instructions for 32-bit
26891 operations.
26892 @item none
26893 @item 0
26894 Prevent the use of hardware floating-point instructions.
26895 @end table
26897 @opindex msimd
26898 @item -msimd=@var{simd-type}
26899 Enable generation of LoongArch SIMD instructions for vectorization
26900 and via builtin functions.  The value can be one of:
26901 @table @samp
26902 @item lasx
26903 Enable generating instructions from the 256-bit LoongArch Advanced
26904 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26905 @item lsx
26906 Enable generating instructions from the 128-bit LoongArch SIMD
26907 Extension (LSX).
26908 @item none
26909 No LoongArch SIMD instruction may be generated.
26910 @end table
26912 @opindex msoft-float
26913 @item -msoft-float
26914 Force @option{-mfpu=none} and prevents the use of floating-point
26915 registers for parameter passing.  This option may change the target
26916 ABI.
26918 @opindex msingle-float
26919 @item -msingle-float
26920 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26921 registers for parameter passing.  This option may change the target
26922 ABI.
26924 @opindex mdouble-float
26925 @item -mdouble-float
26926 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26927 registers for parameter passing.  This option may change the target
26928 ABI.
26930 @opindex ml[a]sx
26931 @item -mlasx
26932 @itemx -mno-lasx
26933 @item -mlsx
26934 @itemx -mno-lsx
26935 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26936 that can be used by the compiler for code generation.  Enabling LASX with
26937 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26938 automatically disables LASX.  These driver-only options act upon the final
26939 @option{msimd} configuration state and make incremental chagnes in the order
26940 they appear on the GCC driver's command line, deriving the final / canonicalized
26941 @option{msimd} option that is passed to the compiler proper.
26943 @opindex mbranch-cost
26944 @item -mbranch-cost=@var{n}
26945 Set the cost of branches to roughly @var{n} instructions.
26947 @opindex mcheck-zero-division
26948 @item -mcheck-zero-division
26949 @itemx -mno-check-zero-divison
26950 Trap (do not trap) on integer division by zero.  The default is
26951 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26952 @option{-mno-check-zero-division} for other optimization levels.
26954 @opindex mcond-move-int
26955 @item -mcond-move-int
26956 @itemx -mno-cond-move-int
26957 Conditional moves for integral data in general-purpose registers
26958 are enabled (disabled).  The default is @option{-mcond-move-int}.
26960 @opindex mcond-move-float
26961 @item -mcond-move-float
26962 @itemx -mno-cond-move-float
26963 Conditional moves for floating-point registers are enabled (disabled).
26964 The default is @option{-mcond-move-float}.
26966 @opindex mmemcpy
26967 @item -mmemcpy
26968 @itemx -mno-memcpy
26969 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26970 The default is @option{-mno-memcpy}, which allows GCC to inline most
26971 constant-sized copies.  Setting optimization level to @option{-Os} also
26972 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26973 behavior if explicitly specified, regardless of the order these options on
26974 the command line.
26976 @opindex mstrict-align
26977 @item -mstrict-align
26978 @itemx -mno-strict-align
26979 Avoid or allow generating memory accesses that may not be aligned on a natural
26980 object boundary as described in the architecture specification. The default is
26981 @option{-mno-strict-align}.
26983 @opindex msmall-data-limit
26984 @item -msmall-data-limit=@var{number}
26985 Put global and static data smaller than @var{number} bytes into a special
26986 section (on some targets).  The default value is 0.
26988 @opindex mmax-inline-memcpy-size
26989 @item -mmax-inline-memcpy-size=@var{n}
26990 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26991 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26993 @item -mcmodel=@var{code-model}
26994 Set the code model to one of:
26995 @table @samp
26996 @item tiny-static (Not implemented yet)
26997 @item tiny (Not implemented yet)
26999 @item normal
27000 The text segment must be within 128MB addressing space.  The data segment must
27001 be within 2GB addressing space.
27003 @item medium
27004 The text segment and data segment must be within 2GB addressing space.
27006 @item large (Not implemented yet)
27008 @item extreme
27009 This mode does not limit the size of the code segment and data segment.
27010 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt}
27011 and/or @option{-mexplicit-relocs=none}.
27012 @end table
27013 The default code model is @code{normal}.
27015 @item -mexplicit-relocs=@var{style}
27016 Set when to use assembler relocation operators when dealing with symbolic
27017 addresses.  The alternative is to use assembler macros instead, which may
27018 limit instruction scheduling but allow linker relaxation.
27019 with @option{-mexplicit-relocs=none} the assembler macros are always used,
27020 with @option{-mexplicit-relocs=always} the assembler relocation operators
27021 are always used, with @option{-mexplicit-relocs=auto} the compiler will
27022 use the relocation operators where the linker relaxation is impossible to
27023 improve the code quality, and macros elsewhere.  The default
27024 value for the option is determined with the assembler capability detected
27025 during GCC build-time and the setting of @option{-mrelax}:
27026 @option{-mexplicit-relocs=none} if the assembler does not support
27027 relocation operators at all,
27028 @option{-mexplicit-relocs=always} if the assembler supports relocation
27029 operators but @option{-mrelax} is not enabled,
27030 @option{-mexplicit-relocs=auto} if the assembler supports relocation
27031 operators and @option{-mrelax} is enabled.
27033 @opindex mexplicit-relocs
27034 @item -mexplicit-relocs
27035 An alias of @option{-mexplicit-relocs=always} for backward compatibility.
27037 @opindex mno-explicit-relocs
27038 @item -mno-explicit-relocs
27039 An alias of @option{-mexplicit-relocs=none} for backward compatibility.
27041 @opindex mdirect-extern-access
27042 @item -mdirect-extern-access
27043 @itemx -mno-direct-extern-access
27044 Do not use or use GOT to access external symbols.  The default is
27045 @option{-mno-direct-extern-access}: GOT is used for external symbols with
27046 default visibility, but not used for other external symbols.
27048 With @option{-mdirect-extern-access}, GOT is not used and all external
27049 symbols are PC-relatively addressed.  It is @strong{only} suitable for
27050 environments where no dynamic link is performed, like firmwares, OS
27051 kernels, executables linked with @option{-static} or @option{-static-pie}.
27052 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
27053 @option{-fpic}.
27055 @item -mrelax
27056 @itemx -mno-relax
27057 Take (do not take) advantage of linker relaxations.  If
27058 @option{-mpass-mrelax-to-as} is enabled, this option is also passed to
27059 the assembler.  The default is determined during GCC build-time by
27060 detecting corresponding assembler support:
27061 @option{-mrelax} if the assembler supports both the @option{-mrelax}
27062 option and the conditional branch relaxation (it's required or the
27063 @code{.align} directives and conditional branch instructions in the
27064 assembly code outputted by GCC may be rejected by the assembler because
27065 of a relocation overflow), @option{-mno-relax} otherwise.
27067 @item -mpass-mrelax-to-as
27068 @itemx -mno-pass-mrelax-to-as
27069 Pass (do not pass) the @option{-mrelax} or @option{-mno-relax} option
27070 to the assembler.  The default is determined during GCC build-time by
27071 detecting corresponding assembler support:
27072 @option{-mpass-mrelax-to-as} if the assembler supports the
27073 @option{-mrelax} option, @option{-mno-pass-mrelax-to-as} otherwise.
27074 This option is mostly useful for debugging, or interoperation with
27075 assemblers different from the build-time one.
27077 @opindex mrecip
27078 @item -mrecip
27079 This option enables use of the reciprocal estimate and reciprocal square
27080 root estimate instructions with additional Newton-Raphson steps to increase
27081 precision instead of doing a divide or square root and divide for
27082 floating-point arguments.
27083 These instructions are generated only when @option{-funsafe-math-optimizations}
27084 is enabled together with @option{-ffinite-math-only} and
27085 @option{-fno-trapping-math}.
27086 This option is off by default. Before you can use this option, you must sure the
27087 target CPU supports frecipe and frsqrte instructions.
27088 Note that while the throughput of the sequence is higher than the throughput of
27089 the non-reciprocal instruction, the precision of the sequence can be decreased
27090 by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27092 @opindex mrecip=opt
27093 @item -mrecip=@var{opt}
27094 This option controls which reciprocal estimate instructions
27095 may be used.  @var{opt} is a comma-separated list of options, which may
27096 be preceded by a @samp{!} to invert the option:
27098 @table @samp
27099 @item all
27100 Enable all estimate instructions.
27102 @item default
27103 Enable the default instructions, equivalent to @option{-mrecip}.
27105 @item none
27106 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27108 @item div
27109 Enable the approximation for scalar division.
27111 @item vec-div
27112 Enable the approximation for vectorized division.
27114 @item sqrt
27115 Enable the approximation for scalar square root.
27117 @item vec-sqrt
27118 Enable the approximation for vectorized square root.
27120 @item rsqrt
27121 Enable the approximation for scalar reciprocal square root.
27123 @item vec-rsqrt
27124 Enable the approximation for vectorized reciprocal square root.
27125 @end table
27127 So, for example, @option{-mrecip=all,!sqrt} enables
27128 all of the reciprocal approximations, except for scalar square root.
27130 @opindex mfrecipe
27131 @opindex mno-frecipe
27132 @item -mfrecipe
27133 @itemx -mno-frecipe
27134 Use (do not use) @code{frecipe.@{s/d@}} and @code{frsqrte.@{s/d@}}
27135 instructions.  When build with @option{-march=la664}, it is enabled by default.
27136 The default is @option{-mno-frecipe}.
27138 @opindex mdiv32
27139 @opindex mno-div32
27140 @item -mdiv32
27141 @itemx -mno-div32
27142 Use (do not use) @code{div.w[u]} and @code{mod.w[u]} instructions with input
27143 not sign-extended.  When build with @option{-march=la664}, it is enabled by
27144 default.  The default is @option{-mno-div32}.
27146 @opindex mlam-bh
27147 @opindex mno-lam-bh
27148 @item -mlam-bh
27149 @itemx -mno-lam-bh
27150 Use (do not use) @code{am@{swap/add@}[_db].@{b/h@}} instructions.  When build
27151 with @option{-march=la664}, it is enabled by default.  The default is
27152 @option{-mno-lam-bh}.
27154 @opindex mlamcas
27155 @opindex mno-lamcas
27156 @item -mlamcas
27157 @itemx -mno-lamcas
27158 Use (do not use) @code{amcas[_db].@{b/h/w/d@}} instructions.  When build with
27159 @option{-march=la664}, it is enabled by default.  The default is
27160 @option{-mno-lamcas}.
27162 @opindex mld-seq-sa
27163 @opindex mno-ld-seq-sa
27164 @item -mld-seq-sa
27165 @itemx -mno-ld-seq-sa
27166 Whether a load-load barrier (@code{dbar 0x700}) is needed.  When build with
27167 @option{-march=la664}, it is enabled by default.  The default is
27168 @option{-mno-ld-seq-sa}, the load-load barrier is needed.
27170 @opindex mtls-dialect
27171 @item -mtls-dialect=@var{opt}
27172 This option controls which tls dialect may be used for general dynamic and
27173 local dynamic TLS models.
27175 @table @samp
27176 @item trad
27177 Use traditional TLS. This is the default.
27179 @item desc
27180 Use TLS descriptors.
27181 @end table
27183 @item loongarch-vect-unroll-limit
27184 The vectorizer will use available tuning information to determine whether it
27185 would be beneficial to unroll the main vectorized loop and by how much.  This
27186 parameter set's the upper bound of how much the vectorizer will unroll the main
27187 loop.  The default value is six.
27189 @end table
27192 @node M32C Options
27193 @subsection M32C Options
27194 @cindex M32C options
27196 @table @gcctabopt
27197 @opindex mcpu=
27198 @item -mcpu=@var{name}
27199 Select the CPU for which code is generated.  @var{name} may be one of
27200 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
27201 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
27202 the M32C/80 series.
27204 @opindex msim
27205 @item -msim
27206 Specifies that the program will be run on the simulator.  This causes
27207 an alternate runtime library to be linked in which supports, for
27208 example, file I/O@.  You must not use this option when generating
27209 programs that will run on real hardware; you must provide your own
27210 runtime library for whatever I/O functions are needed.
27212 @opindex memregs=
27213 @item -memregs=@var{number}
27214 Specifies the number of memory-based pseudo-registers GCC uses
27215 during code generation.  These pseudo-registers are used like real
27216 registers, so there is a tradeoff between GCC's ability to fit the
27217 code into available registers, and the performance penalty of using
27218 memory instead of registers.  Note that all modules in a program must
27219 be compiled with the same value for this option.  Because of that, you
27220 must not use this option with GCC's default runtime libraries.
27222 @end table
27224 @node M32R/D Options
27225 @subsection M32R/D Options
27226 @cindex M32R/D options
27228 These @option{-m} options are defined for Renesas M32R/D architectures:
27230 @table @gcctabopt
27231 @opindex m32r2
27232 @item -m32r2
27233 Generate code for the M32R/2@.
27235 @opindex m32rx
27236 @item -m32rx
27237 Generate code for the M32R/X@.
27239 @opindex m32r
27240 @item -m32r
27241 Generate code for the M32R@.  This is the default.
27243 @opindex mmodel=small
27244 @item -mmodel=small
27245 Assume all objects live in the lower 16MB of memory (so that their addresses
27246 can be loaded with the @code{ld24} instruction), and assume all subroutines
27247 are reachable with the @code{bl} instruction.
27248 This is the default.
27250 The addressability of a particular object can be set with the
27251 @code{model} attribute.
27253 @opindex mmodel=medium
27254 @item -mmodel=medium
27255 Assume objects may be anywhere in the 32-bit address space (the compiler
27256 generates @code{seth/add3} instructions to load their addresses), and
27257 assume all subroutines are reachable with the @code{bl} instruction.
27259 @opindex mmodel=large
27260 @item -mmodel=large
27261 Assume objects may be anywhere in the 32-bit address space (the compiler
27262 generates @code{seth/add3} instructions to load their addresses), and
27263 assume subroutines may not be reachable with the @code{bl} instruction
27264 (the compiler generates the much slower @code{seth/add3/jl}
27265 instruction sequence).
27267 @opindex msdata=none
27268 @item -msdata=none
27269 Disable use of the small data area.  Variables are put into
27270 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
27271 @code{section} attribute has been specified).
27272 This is the default.
27274 The small data area consists of sections @code{.sdata} and @code{.sbss}.
27275 Objects may be explicitly put in the small data area with the
27276 @code{section} attribute using one of these sections.
27278 @opindex msdata=sdata
27279 @item -msdata=sdata
27280 Put small global and static data in the small data area, but do not
27281 generate special code to reference them.
27283 @opindex msdata=use
27284 @item -msdata=use
27285 Put small global and static data in the small data area, and generate
27286 special instructions to reference them.
27288 @opindex G
27289 @cindex smaller data references
27290 @item -G @var{num}
27291 Put global and static objects less than or equal to @var{num} bytes
27292 into the small data or BSS sections instead of the normal data or BSS
27293 sections.  The default value of @var{num} is 8.
27294 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
27295 for this option to have any effect.
27297 All modules should be compiled with the same @option{-G @var{num}} value.
27298 Compiling with different values of @var{num} may or may not work; if it
27299 doesn't the linker gives an error message---incorrect code is not
27300 generated.
27302 @opindex mdebug
27303 @item -mdebug
27304 Makes the M32R-specific code in the compiler display some statistics
27305 that might help in debugging programs.
27307 @opindex malign-loops
27308 @item -malign-loops
27309 Align all loops to a 32-byte boundary.
27311 @opindex mno-align-loops
27312 @item -mno-align-loops
27313 Do not enforce a 32-byte alignment for loops.  This is the default.
27315 @opindex missue-rate=@var{number}
27316 @item -missue-rate=@var{number}
27317 Issue @var{number} instructions per cycle.  @var{number} can only be 1
27318 or 2.
27320 @opindex mbranch-cost=@var{number}
27321 @item -mbranch-cost=@var{number}
27322 @var{number} can only be 1 or 2.  If it is 1 then branches are
27323 preferred over conditional code, if it is 2, then the opposite applies.
27325 @opindex mflush-trap=@var{number}
27326 @item -mflush-trap=@var{number}
27327 Specifies the trap number to use to flush the cache.  The default is
27328 12.  Valid numbers are between 0 and 15 inclusive.
27330 @opindex mno-flush-trap
27331 @item -mno-flush-trap
27332 Specifies that the cache cannot be flushed by using a trap.
27334 @opindex mflush-func=@var{name}
27335 @item -mflush-func=@var{name}
27336 Specifies the name of the operating system function to call to flush
27337 the cache.  The default is @samp{_flush_cache}, but a function call
27338 is only used if a trap is not available.
27340 @opindex mno-flush-func
27341 @item -mno-flush-func
27342 Indicates that there is no OS function for flushing the cache.
27344 @end table
27346 @node M680x0 Options
27347 @subsection M680x0 Options
27348 @cindex M680x0 options
27350 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
27351 The default settings depend on which architecture was selected when
27352 the compiler was configured; the defaults for the most common choices
27353 are given below.
27355 @table @gcctabopt
27356 @opindex march
27357 @item -march=@var{arch}
27358 Generate code for a specific M680x0 or ColdFire instruction set
27359 architecture.  Permissible values of @var{arch} for M680x0
27360 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
27361 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
27362 architectures are selected according to Freescale's ISA classification
27363 and the permissible values are: @samp{isaa}, @samp{isaaplus},
27364 @samp{isab} and @samp{isac}.
27366 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
27367 code for a ColdFire target.  The @var{arch} in this macro is one of the
27368 @option{-march} arguments given above.
27370 When used together, @option{-march} and @option{-mtune} select code
27371 that runs on a family of similar processors but that is optimized
27372 for a particular microarchitecture.
27374 @opindex mcpu
27375 @item -mcpu=@var{cpu}
27376 Generate code for a specific M680x0 or ColdFire processor.
27377 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
27378 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
27379 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
27380 below, which also classifies the CPUs into families:
27382 @multitable @columnfractions 0.20 0.80
27383 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
27384 @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}
27385 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
27386 @item @samp{5206e} @tab @samp{5206e}
27387 @item @samp{5208} @tab @samp{5207} @samp{5208}
27388 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
27389 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
27390 @item @samp{5216} @tab @samp{5214} @samp{5216}
27391 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
27392 @item @samp{5225} @tab @samp{5224} @samp{5225}
27393 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
27394 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
27395 @item @samp{5249} @tab @samp{5249}
27396 @item @samp{5250} @tab @samp{5250}
27397 @item @samp{5271} @tab @samp{5270} @samp{5271}
27398 @item @samp{5272} @tab @samp{5272}
27399 @item @samp{5275} @tab @samp{5274} @samp{5275}
27400 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
27401 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
27402 @item @samp{5307} @tab @samp{5307}
27403 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
27404 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
27405 @item @samp{5407} @tab @samp{5407}
27406 @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}
27407 @end multitable
27409 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
27410 @var{arch} is compatible with @var{cpu}.  Other combinations of
27411 @option{-mcpu} and @option{-march} are rejected.
27413 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
27414 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
27415 where the value of @var{family} is given by the table above.
27417 @opindex mtune
27418 @item -mtune=@var{tune}
27419 Tune the code for a particular microarchitecture within the
27420 constraints set by @option{-march} and @option{-mcpu}.
27421 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
27422 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
27423 and @samp{cpu32}.  The ColdFire microarchitectures
27424 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
27426 You can also use @option{-mtune=68020-40} for code that needs
27427 to run relatively well on 68020, 68030 and 68040 targets.
27428 @option{-mtune=68020-60} is similar but includes 68060 targets
27429 as well.  These two options select the same tuning decisions as
27430 @option{-m68020-40} and @option{-m68020-60} respectively.
27432 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
27433 when tuning for 680x0 architecture @var{arch}.  It also defines
27434 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
27435 option is used.  If GCC is tuning for a range of architectures,
27436 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
27437 it defines the macros for every architecture in the range.
27439 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
27440 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
27441 of the arguments given above.
27443 @opindex m68000
27444 @opindex mc68000
27445 @item -m68000
27446 @itemx -mc68000
27447 Generate output for a 68000.  This is the default
27448 when the compiler is configured for 68000-based systems.
27449 It is equivalent to @option{-march=68000}.
27451 Use this option for microcontrollers with a 68000 or EC000 core,
27452 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
27454 @opindex m68010
27455 @item -m68010
27456 Generate output for a 68010.  This is the default
27457 when the compiler is configured for 68010-based systems.
27458 It is equivalent to @option{-march=68010}.
27460 @opindex m68020
27461 @opindex mc68020
27462 @item -m68020
27463 @itemx -mc68020
27464 Generate output for a 68020.  This is the default
27465 when the compiler is configured for 68020-based systems.
27466 It is equivalent to @option{-march=68020}.
27468 @opindex m68030
27469 @item -m68030
27470 Generate output for a 68030.  This is the default when the compiler is
27471 configured for 68030-based systems.  It is equivalent to
27472 @option{-march=68030}.
27474 @opindex m68040
27475 @item -m68040
27476 Generate output for a 68040.  This is the default when the compiler is
27477 configured for 68040-based systems.  It is equivalent to
27478 @option{-march=68040}.
27480 This option inhibits the use of 68881/68882 instructions that have to be
27481 emulated by software on the 68040.  Use this option if your 68040 does not
27482 have code to emulate those instructions.
27484 @opindex m68060
27485 @item -m68060
27486 Generate output for a 68060.  This is the default when the compiler is
27487 configured for 68060-based systems.  It is equivalent to
27488 @option{-march=68060}.
27490 This option inhibits the use of 68020 and 68881/68882 instructions that
27491 have to be emulated by software on the 68060.  Use this option if your 68060
27492 does not have code to emulate those instructions.
27494 @opindex mcpu32
27495 @item -mcpu32
27496 Generate output for a CPU32.  This is the default
27497 when the compiler is configured for CPU32-based systems.
27498 It is equivalent to @option{-march=cpu32}.
27500 Use this option for microcontrollers with a
27501 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
27502 68336, 68340, 68341, 68349 and 68360.
27504 @opindex m5200
27505 @item -m5200
27506 Generate output for a 520X ColdFire CPU@.  This is the default
27507 when the compiler is configured for 520X-based systems.
27508 It is equivalent to @option{-mcpu=5206}, and is now deprecated
27509 in favor of that option.
27511 Use this option for microcontroller with a 5200 core, including
27512 the MCF5202, MCF5203, MCF5204 and MCF5206.
27514 @opindex m5206e
27515 @item -m5206e
27516 Generate output for a 5206e ColdFire CPU@.  The option is now
27517 deprecated in favor of the equivalent @option{-mcpu=5206e}.
27519 @opindex m528x
27520 @item -m528x
27521 Generate output for a member of the ColdFire 528X family.
27522 The option is now deprecated in favor of the equivalent
27523 @option{-mcpu=528x}.
27525 @opindex m5307
27526 @item -m5307
27527 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
27528 in favor of the equivalent @option{-mcpu=5307}.
27530 @opindex m5407
27531 @item -m5407
27532 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
27533 in favor of the equivalent @option{-mcpu=5407}.
27535 @opindex mcfv4e
27536 @item -mcfv4e
27537 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
27538 This includes use of hardware floating-point instructions.
27539 The option is equivalent to @option{-mcpu=547x}, and is now
27540 deprecated in favor of that option.
27542 @opindex m68020-40
27543 @item -m68020-40
27544 Generate output for a 68040, without using any of the new instructions.
27545 This results in code that can run relatively efficiently on either a
27546 68020/68881 or a 68030 or a 68040.  The generated code does use the
27547 68881 instructions that are emulated on the 68040.
27549 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
27551 @opindex m68020-60
27552 @item -m68020-60
27553 Generate output for a 68060, without using any of the new instructions.
27554 This results in code that can run relatively efficiently on either a
27555 68020/68881 or a 68030 or a 68040.  The generated code does use the
27556 68881 instructions that are emulated on the 68060.
27558 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
27560 @opindex mhard-float
27561 @opindex m68881
27562 @item -mhard-float
27563 @itemx -m68881
27564 Generate floating-point instructions.  This is the default for 68020
27565 and above, and for ColdFire devices that have an FPU@.  It defines the
27566 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
27567 on ColdFire targets.
27569 @opindex msoft-float
27570 @item -msoft-float
27571 Do not generate floating-point instructions; use library calls instead.
27572 This is the default for 68000, 68010, and 68832 targets.  It is also
27573 the default for ColdFire devices that have no FPU.
27575 @opindex mdiv
27576 @opindex mno-div
27577 @item -mdiv
27578 @itemx -mno-div
27579 Generate (do not generate) ColdFire hardware divide and remainder
27580 instructions.  If @option{-march} is used without @option{-mcpu},
27581 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
27582 architectures.  Otherwise, the default is taken from the target CPU
27583 (either the default CPU, or the one specified by @option{-mcpu}).  For
27584 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
27585 @option{-mcpu=5206e}.
27587 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
27589 @opindex mshort
27590 @item -mshort
27591 Consider type @code{int} to be 16 bits wide, like @code{short int}.
27592 Additionally, parameters passed on the stack are also aligned to a
27593 16-bit boundary even on targets whose API mandates promotion to 32-bit.
27595 @opindex mno-short
27596 @item -mno-short
27597 Do not consider type @code{int} to be 16 bits wide.  This is the default.
27599 @opindex mnobitfield
27600 @opindex mno-bitfield
27601 @item -mnobitfield
27602 @itemx -mno-bitfield
27603 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
27604 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
27606 @opindex mbitfield
27607 @item -mbitfield
27608 Do use the bit-field instructions.  The @option{-m68020} option implies
27609 @option{-mbitfield}.  This is the default if you use a configuration
27610 designed for a 68020.
27612 @opindex mrtd
27613 @item -mrtd
27614 Use a different function-calling convention, in which functions
27615 that take a fixed number of arguments return with the @code{rtd}
27616 instruction, which pops their arguments while returning.  This
27617 saves one instruction in the caller since there is no need to pop
27618 the arguments there.
27620 This calling convention is incompatible with the one normally
27621 used on Unix, so you cannot use it if you need to call libraries
27622 compiled with the Unix compiler.
27624 Also, you must provide function prototypes for all functions that
27625 take variable numbers of arguments (including @code{printf});
27626 otherwise incorrect code is generated for calls to those
27627 functions.
27629 In addition, seriously incorrect code results if you call a
27630 function with too many arguments.  (Normally, extra arguments are
27631 harmlessly ignored.)
27633 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
27634 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
27636 The default is @option{-mno-rtd}.
27638 @opindex malign-int
27639 @opindex mno-align-int
27640 @item -malign-int
27641 @itemx -mno-align-int
27642 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
27643 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
27644 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
27645 Aligning variables on 32-bit boundaries produces code that runs somewhat
27646 faster on processors with 32-bit busses at the expense of more memory.
27648 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
27649 aligns structures containing the above types differently than
27650 most published application binary interface specifications for the m68k.
27652 @opindex mpcrel
27653 Use the pc-relative addressing mode of the 68000 directly, instead of
27654 using a global offset table.  At present, this option implies @option{-fpic},
27655 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
27656 not presently supported with @option{-mpcrel}, though this could be supported for
27657 68020 and higher processors.
27659 @opindex mno-strict-align
27660 @opindex mstrict-align
27661 @item -mno-strict-align
27662 @itemx -mstrict-align
27663 Do not (do) assume that unaligned memory references are handled by
27664 the system.
27666 @item -msep-data
27667 Generate code that allows the data segment to be located in a different
27668 area of memory from the text segment.  This allows for execute-in-place in
27669 an environment without virtual memory management.  This option implies
27670 @option{-fPIC}.
27672 @item -mno-sep-data
27673 Generate code that assumes that the data segment follows the text segment.
27674 This is the default.
27676 @item -mid-shared-library
27677 Generate code that supports shared libraries via the library ID method.
27678 This allows for execute-in-place and shared libraries in an environment
27679 without virtual memory management.  This option implies @option{-fPIC}.
27681 @item -mno-id-shared-library
27682 Generate code that doesn't assume ID-based shared libraries are being used.
27683 This is the default.
27685 @item -mshared-library-id=n
27686 Specifies the identification number of the ID-based shared library being
27687 compiled.  Specifying a value of 0 generates more compact code; specifying
27688 other values forces the allocation of that number to the current
27689 library, but is no more space- or time-efficient than omitting this option.
27691 @opindex mxgot
27692 @opindex mno-xgot
27693 @item -mxgot
27694 @itemx -mno-xgot
27695 When generating position-independent code for ColdFire, generate code
27696 that works if the GOT has more than 8192 entries.  This code is
27697 larger and slower than code generated without this option.  On M680x0
27698 processors, this option is not needed; @option{-fPIC} suffices.
27700 GCC normally uses a single instruction to load values from the GOT@.
27701 While this is relatively efficient, it only works if the GOT
27702 is smaller than about 64k.  Anything larger causes the linker
27703 to report an error such as:
27705 @cindex relocation truncated to fit (ColdFire)
27706 @smallexample
27707 relocation truncated to fit: R_68K_GOT16O foobar
27708 @end smallexample
27710 If this happens, you should recompile your code with @option{-mxgot}.
27711 It should then work with very large GOTs.  However, code generated with
27712 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
27713 the value of a global symbol.
27715 Note that some linkers, including newer versions of the GNU linker,
27716 can create multiple GOTs and sort GOT entries.  If you have such a linker,
27717 you should only need to use @option{-mxgot} when compiling a single
27718 object file that accesses more than 8192 GOT entries.  Very few do.
27720 These options have no effect unless GCC is generating
27721 position-independent code.
27723 @opindex mlong-jump-table-offsets
27724 @item -mlong-jump-table-offsets
27725 Use 32-bit offsets in @code{switch} tables.  The default is to use
27726 16-bit offsets.
27728 @end table
27730 @node MCore Options
27731 @subsection MCore Options
27732 @cindex MCore options
27734 These are the @samp{-m} options defined for the Motorola M*Core
27735 processors.
27737 @table @gcctabopt
27739 @opindex mhardlit
27740 @opindex mno-hardlit
27741 @item -mhardlit
27742 @itemx -mno-hardlit
27743 Inline constants into the code stream if it can be done in two
27744 instructions or less.
27746 @opindex mdiv
27747 @opindex mno-div
27748 @item -mdiv
27749 @itemx -mno-div
27750 Use the divide instruction.  (Enabled by default).
27752 @opindex mrelax-immediate
27753 @opindex mno-relax-immediate
27754 @item -mrelax-immediate
27755 @itemx -mno-relax-immediate
27756 Allow arbitrary-sized immediates in bit operations.
27758 @opindex mwide-bitfields
27759 @opindex mno-wide-bitfields
27760 @item -mwide-bitfields
27761 @itemx -mno-wide-bitfields
27762 Always treat bit-fields as @code{int}-sized.
27764 @opindex m4byte-functions
27765 @opindex mno-4byte-functions
27766 @item -m4byte-functions
27767 @itemx -mno-4byte-functions
27768 Force all functions to be aligned to a 4-byte boundary.
27770 @opindex mcallgraph-data
27771 @opindex mno-callgraph-data
27772 @item -mcallgraph-data
27773 @itemx -mno-callgraph-data
27774 Emit callgraph information.
27776 @opindex mslow-bytes
27777 @opindex mno-slow-bytes
27778 @item -mslow-bytes
27779 @itemx -mno-slow-bytes
27780 Prefer word access when reading byte quantities.
27782 @opindex mlittle-endian
27783 @opindex mbig-endian
27784 @item -mlittle-endian
27785 @itemx -mbig-endian
27786 Generate code for a little-endian target.
27788 @opindex m210
27789 @opindex m340
27790 @item -m210
27791 @itemx -m340
27792 Generate code for the 210 processor.
27794 @opindex mno-lsim
27795 @item -mno-lsim
27796 Assume that runtime support has been provided and so omit the
27797 simulator library (@file{libsim.a)} from the linker command line.
27799 @opindex mstack-increment
27800 @item -mstack-increment=@var{size}
27801 Set the maximum amount for a single stack increment operation.  Large
27802 values can increase the speed of programs that contain functions
27803 that need a large amount of stack space, but they can also trigger a
27804 segmentation fault if the stack is extended too much.  The default
27805 value is 0x1000.
27807 @end table
27809 @node MicroBlaze Options
27810 @subsection MicroBlaze Options
27811 @cindex MicroBlaze Options
27813 @table @gcctabopt
27815 @opindex msoft-float
27816 @item -msoft-float
27817 Use software emulation for floating point (default).
27819 @opindex mhard-float
27820 @item -mhard-float
27821 Use hardware floating-point instructions.
27823 @opindex mmemcpy
27824 @item -mmemcpy
27825 Do not optimize block moves, use @code{memcpy}.
27827 @opindex mno-clearbss
27828 @item -mno-clearbss
27829 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
27831 @opindex mcpu=
27832 @item -mcpu=@var{cpu-type}
27833 Use features of, and schedule code for, the given CPU.
27834 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
27835 where @var{X} is a major version, @var{YY} is the minor version, and
27836 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
27837 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
27839 @opindex mxl-soft-mul
27840 @item -mxl-soft-mul
27841 Use software multiply emulation (default).
27843 @opindex mxl-soft-div
27844 @item -mxl-soft-div
27845 Use software emulation for divides (default).
27847 @opindex mxl-barrel-shift
27848 @item -mxl-barrel-shift
27849 Use the hardware barrel shifter.
27851 @opindex mxl-pattern-compare
27852 @item -mxl-pattern-compare
27853 Use pattern compare instructions.
27855 @opindex msmall-divides
27856 @item -msmall-divides
27857 Use table lookup optimization for small signed integer divisions.
27859 @opindex mxl-stack-check
27860 @item -mxl-stack-check
27861 This option is deprecated.  Use @option{-fstack-check} instead.
27863 @opindex mxl-gp-opt
27864 @item -mxl-gp-opt
27865 Use GP-relative @code{.sdata}/@code{.sbss} sections.
27867 @opindex mxl-multiply-high
27868 @item -mxl-multiply-high
27869 Use multiply high instructions for high part of 32x32 multiply.
27871 @opindex mxl-float-convert
27872 @item -mxl-float-convert
27873 Use hardware floating-point conversion instructions.
27875 @opindex mxl-float-sqrt
27876 @item -mxl-float-sqrt
27877 Use hardware floating-point square root instruction.
27879 @opindex mbig-endian
27880 @item -mbig-endian
27881 Generate code for a big-endian target.
27883 @opindex mlittle-endian
27884 @item -mlittle-endian
27885 Generate code for a little-endian target.
27887 @opindex mxl-reorder
27888 @item -mxl-reorder
27889 Use reorder instructions (swap and byte reversed load/store).
27891 @item -mxl-mode-@var{app-model}
27892 Select application model @var{app-model}.  Valid models are
27893 @table @samp
27894 @item executable
27895 normal executable (default), uses startup code @file{crt0.o}.
27897 @item xmdstub
27898 for use with Xilinx Microprocessor Debugger (XMD) based
27899 software intrusive debug agent called xmdstub. This uses startup file
27900 @file{crt1.o} and sets the start address of the program to 0x800.
27902 @item bootstrap
27903 for applications that are loaded using a bootloader.
27904 This model uses startup file @file{crt2.o} which does not contain a processor
27905 reset vector handler. This is suitable for transferring control on a
27906 processor reset to the bootloader rather than the application.
27908 @item novectors
27909 for applications that do not require any of the
27910 MicroBlaze vectors. This option may be useful for applications running
27911 within a monitoring application. This model uses @file{crt3.o} as a startup file.
27912 @end table
27914 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
27915 @option{-mxl-mode-@var{app-model}}.
27917 @opindex mpic-data-is-text-relative
27918 @item -mpic-data-is-text-relative
27919 Assume that the displacement between the text and data segments is fixed
27920 at static link time.  This allows data to be referenced by offset from start of
27921 text address instead of GOT since PC-relative addressing is not supported.
27923 @end table
27925 @node MIPS Options
27926 @subsection MIPS Options
27927 @cindex MIPS options
27929 @table @gcctabopt
27931 @opindex EB
27932 @item -EB
27933 Generate big-endian code.
27935 @opindex EL
27936 @item -EL
27937 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
27938 configurations.
27940 @opindex march
27941 @item -march=@var{arch}
27942 Generate code that runs on @var{arch}, which can be the name of a
27943 generic MIPS ISA, or the name of a particular processor.
27944 The ISA names are:
27945 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
27946 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
27947 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
27948 @samp{mips64r5} and @samp{mips64r6}.
27949 The processor names are:
27950 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
27951 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
27952 @samp{5kc}, @samp{5kf},
27953 @samp{20kc},
27954 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
27955 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
27956 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
27957 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
27958 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
27959 @samp{i6400}, @samp{i6500},
27960 @samp{interaptiv},
27961 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
27962 @samp{gs464e}, @samp{gs264e},
27963 @samp{m4k},
27964 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
27965 @samp{m5100}, @samp{m5101},
27966 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
27967 @samp{orion},
27968 @samp{p5600}, @samp{p6600},
27969 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
27970 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
27971 @samp{r6000}, @samp{r8000},
27972 @samp{rm7000}, @samp{rm9000},
27973 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
27974 @samp{sb1},
27975 @samp{sr71000},
27976 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
27977 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
27978 @samp{xlr} and @samp{xlp}.
27979 The special value @samp{from-abi} selects the
27980 most compatible architecture for the selected ABI (that is,
27981 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
27983 The native Linux/GNU toolchain also supports the value @samp{native},
27984 which selects the best architecture option for the host processor.
27985 @option{-march=native} has no effect if GCC does not recognize
27986 the processor.
27988 In processor names, a final @samp{000} can be abbreviated as @samp{k}
27989 (for example, @option{-march=r2k}).  Prefixes are optional, and
27990 @samp{vr} may be written @samp{r}.
27992 Names of the form @samp{@var{n}f2_1} refer to processors with
27993 FPUs clocked at half the rate of the core, names of the form
27994 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
27995 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
27996 processors with FPUs clocked a ratio of 3:2 with respect to the core.
27997 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
27998 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
27999 accepted as synonyms for @samp{@var{n}f1_1}.
28001 GCC defines two macros based on the value of this option.  The first
28002 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
28003 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
28004 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
28005 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
28006 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
28008 Note that the @code{_MIPS_ARCH} macro uses the processor names given
28009 above.  In other words, it has the full prefix and does not
28010 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
28011 the macro names the resolved architecture (either @code{"mips1"} or
28012 @code{"mips3"}).  It names the default architecture when no
28013 @option{-march} option is given.
28015 @opindex mtune
28016 @item -mtune=@var{arch}
28017 Optimize for @var{arch}.  Among other things, this option controls
28018 the way instructions are scheduled, and the perceived cost of arithmetic
28019 operations.  The list of @var{arch} values is the same as for
28020 @option{-march}.
28022 When this option is not used, GCC optimizes for the processor
28023 specified by @option{-march}.  By using @option{-march} and
28024 @option{-mtune} together, it is possible to generate code that
28025 runs on a family of processors, but optimize the code for one
28026 particular member of that family.
28028 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
28029 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
28030 @option{-march} ones described above.
28032 @opindex mips1
28033 @item -mips1
28034 Equivalent to @option{-march=mips1}.
28036 @opindex mips2
28037 @item -mips2
28038 Equivalent to @option{-march=mips2}.
28040 @opindex mips3
28041 @item -mips3
28042 Equivalent to @option{-march=mips3}.
28044 @opindex mips4
28045 @item -mips4
28046 Equivalent to @option{-march=mips4}.
28048 @opindex mips32
28049 @item -mips32
28050 Equivalent to @option{-march=mips32}.
28052 @opindex mips32r3
28053 @item -mips32r3
28054 Equivalent to @option{-march=mips32r3}.
28056 @opindex mips32r5
28057 @item -mips32r5
28058 Equivalent to @option{-march=mips32r5}.
28060 @opindex mips32r6
28061 @item -mips32r6
28062 Equivalent to @option{-march=mips32r6}.
28064 @opindex mips64
28065 @item -mips64
28066 Equivalent to @option{-march=mips64}.
28068 @opindex mips64r2
28069 @item -mips64r2
28070 Equivalent to @option{-march=mips64r2}.
28072 @opindex mips64r3
28073 @item -mips64r3
28074 Equivalent to @option{-march=mips64r3}.
28076 @opindex mips64r5
28077 @item -mips64r5
28078 Equivalent to @option{-march=mips64r5}.
28080 @opindex mips64r6
28081 @item -mips64r6
28082 Equivalent to @option{-march=mips64r6}.
28084 @opindex mips16
28085 @opindex mno-mips16
28086 @item -mips16
28087 @itemx -mno-mips16
28088 Generate (do not generate) MIPS16 code.  If GCC is targeting a
28089 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
28091 MIPS16 code generation can also be controlled on a per-function basis
28092 by means of @code{mips16} and @code{nomips16} attributes.
28093 @xref{Function Attributes}, for more information.
28095 @opindex mmips16e2
28096 @opindex mno-mips16e2
28097 @item -mmips16e2
28098 @itemx -mno-mips16e2
28099 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
28100 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
28102 @opindex mflip-mips16
28103 @item -mflip-mips16
28104 Generate MIPS16 code on alternating functions.  This option is provided
28105 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
28106 not intended for ordinary use in compiling user code.
28108 @opindex minterlink-compressed
28109 @opindex mno-interlink-compressed
28110 @item -minterlink-compressed
28111 @itemx -mno-interlink-compressed
28112 Require (do not require) that code using the standard (uncompressed) MIPS ISA
28113 be link-compatible with MIPS16 and microMIPS code, and vice versa.
28115 For example, code using the standard ISA encoding cannot jump directly
28116 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
28117 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
28118 knows that the target of the jump is not compressed.
28120 @opindex minterlink-mips16
28121 @opindex mno-interlink-mips16
28122 @item -minterlink-mips16
28123 @itemx -mno-interlink-mips16
28124 Aliases of @option{-minterlink-compressed} and
28125 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
28126 and are retained for backwards compatibility.
28128 @opindex mabi
28129 @item -mabi=32
28130 @itemx -mabi=o64
28131 @itemx -mabi=n32
28132 @itemx -mabi=64
28133 @itemx -mabi=eabi
28134 Generate code for the given ABI@.
28136 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
28137 generates 64-bit code when you select a 64-bit architecture, but you
28138 can use @option{-mgp32} to get 32-bit code instead.
28140 For information about the O64 ABI, see
28141 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
28143 GCC supports a variant of the o32 ABI in which floating-point registers
28144 are 64 rather than 32 bits wide.  You can select this combination with
28145 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
28146 and @code{mfhc1} instructions and is therefore only supported for
28147 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
28149 The register assignments for arguments and return values remain the
28150 same, but each scalar value is passed in a single 64-bit register
28151 rather than a pair of 32-bit registers.  For example, scalar
28152 floating-point values are returned in @samp{$f0} only, not a
28153 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
28154 remains the same in that the even-numbered double-precision registers
28155 are saved.
28157 Two additional variants of the o32 ABI are supported to enable
28158 a transition from 32-bit to 64-bit registers.  These are FPXX
28159 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
28160 The FPXX extension mandates that all code must execute correctly
28161 when run using 32-bit or 64-bit registers.  The code can be interlinked
28162 with either FP32 or FP64, but not both.
28163 The FP64A extension is similar to the FP64 extension but forbids the
28164 use of odd-numbered single-precision registers.  This can be used
28165 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
28166 processors and allows both FP32 and FP64A code to interlink and
28167 run in the same process without changing FPU modes.
28169 @opindex mabicalls
28170 @opindex mno-abicalls
28171 @item -mabicalls
28172 @itemx -mno-abicalls
28173 Generate (do not generate) code that is suitable for SVR4-style
28174 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
28175 systems.
28177 @item -mshared
28178 @itemx -mno-shared
28179 Generate (do not generate) code that is fully position-independent,
28180 and that can therefore be linked into shared libraries.  This option
28181 only affects @option{-mabicalls}.
28183 All @option{-mabicalls} code has traditionally been position-independent,
28184 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
28185 as an extension, the GNU toolchain allows executables to use absolute
28186 accesses for locally-binding symbols.  It can also use shorter GP
28187 initialization sequences and generate direct calls to locally-defined
28188 functions.  This mode is selected by @option{-mno-shared}.
28190 @option{-mno-shared} depends on binutils 2.16 or higher and generates
28191 objects that can only be linked by the GNU linker.  However, the option
28192 does not affect the ABI of the final executable; it only affects the ABI
28193 of relocatable objects.  Using @option{-mno-shared} generally makes
28194 executables both smaller and quicker.
28196 @option{-mshared} is the default.
28198 @opindex mplt
28199 @opindex mno-plt
28200 @item -mplt
28201 @itemx -mno-plt
28202 Assume (do not assume) that the static and dynamic linkers
28203 support PLTs and copy relocations.  This option only affects
28204 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
28205 has no effect without @option{-msym32}.
28207 You can make @option{-mplt} the default by configuring
28208 GCC with @option{--with-mips-plt}.  The default is
28209 @option{-mno-plt} otherwise.
28211 @opindex mxgot
28212 @opindex mno-xgot
28213 @item -mxgot
28214 @itemx -mno-xgot
28215 Lift (do not lift) the usual restrictions on the size of the global
28216 offset table.
28218 GCC normally uses a single instruction to load values from the GOT@.
28219 While this is relatively efficient, it only works if the GOT
28220 is smaller than about 64k.  Anything larger causes the linker
28221 to report an error such as:
28223 @cindex relocation truncated to fit (MIPS)
28224 @smallexample
28225 relocation truncated to fit: R_MIPS_GOT16 foobar
28226 @end smallexample
28228 If this happens, you should recompile your code with @option{-mxgot}.
28229 This works with very large GOTs, although the code is also
28230 less efficient, since it takes three instructions to fetch the
28231 value of a global symbol.
28233 Note that some linkers can create multiple GOTs.  If you have such a
28234 linker, you should only need to use @option{-mxgot} when a single object
28235 file accesses more than 64k's worth of GOT entries.  Very few do.
28237 These options have no effect unless GCC is generating position
28238 independent code.
28240 @opindex mgp32
28241 @item -mgp32
28242 Assume that general-purpose registers are 32 bits wide.
28244 @opindex mgp64
28245 @item -mgp64
28246 Assume that general-purpose registers are 64 bits wide.
28248 @opindex mfp32
28249 @item -mfp32
28250 Assume that floating-point registers are 32 bits wide.
28252 @opindex mfp64
28253 @item -mfp64
28254 Assume that floating-point registers are 64 bits wide.
28256 @opindex mfpxx
28257 @item -mfpxx
28258 Do not assume the width of floating-point registers.
28260 @opindex mhard-float
28261 @item -mhard-float
28262 Use floating-point coprocessor instructions.
28264 @opindex msoft-float
28265 @item -msoft-float
28266 Do not use floating-point coprocessor instructions.  Implement
28267 floating-point calculations using library calls instead.
28269 @opindex mno-float
28270 @item -mno-float
28271 Equivalent to @option{-msoft-float}, but additionally asserts that the
28272 program being compiled does not perform any floating-point operations.
28273 This option is presently supported only by some bare-metal MIPS
28274 configurations, where it may select a special set of libraries
28275 that lack all floating-point support (including, for example, the
28276 floating-point @code{printf} formats).  
28277 If code compiled with @option{-mno-float} accidentally contains
28278 floating-point operations, it is likely to suffer a link-time
28279 or run-time failure.
28281 @opindex msingle-float
28282 @item -msingle-float
28283 Assume that the floating-point coprocessor only supports single-precision
28284 operations.
28286 @opindex mdouble-float
28287 @item -mdouble-float
28288 Assume that the floating-point coprocessor supports double-precision
28289 operations.  This is the default.
28291 @opindex modd-spreg
28292 @opindex mno-odd-spreg
28293 @item -modd-spreg
28294 @itemx -mno-odd-spreg
28295 Enable the use of odd-numbered single-precision floating-point registers
28296 for the o32 ABI.  This is the default for processors that are known to
28297 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
28298 is set by default.
28300 @opindex mabs=2008
28301 @opindex mabs=legacy
28302 @item -mabs=2008
28303 @itemx -mabs=legacy
28304 These options control the treatment of the special not-a-number (NaN)
28305 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
28306 @code{neg.@i{fmt}} machine instructions.
28308 By default or when @option{-mabs=legacy} is used the legacy
28309 treatment is selected.  In this case these instructions are considered
28310 arithmetic and avoided where correct operation is required and the
28311 input operand might be a NaN.  A longer sequence of instructions that
28312 manipulate the sign bit of floating-point datum manually is used
28313 instead unless the @option{-ffinite-math-only} option has also been
28314 specified.
28316 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
28317 this case these instructions are considered non-arithmetic and therefore
28318 operating correctly in all cases, including in particular where the
28319 input operand is a NaN.  These instructions are therefore always used
28320 for the respective operations.
28322 @opindex mnan=2008
28323 @opindex mnan=legacy
28324 @item -mnan=2008
28325 @itemx -mnan=legacy
28326 These options control the encoding of the special not-a-number (NaN)
28327 IEEE 754 floating-point data.
28329 The @option{-mnan=legacy} option selects the legacy encoding.  In this
28330 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
28331 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
28332 by the first bit of their trailing significand field being 1.
28334 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
28335 this case qNaNs are denoted by the first bit of their trailing
28336 significand field being 1, whereas sNaNs are denoted by the first bit of
28337 their trailing significand field being 0.
28339 The default is @option{-mnan=legacy} unless GCC has been configured with
28340 @option{--with-nan=2008}.
28342 @opindex mllsc
28343 @opindex mno-llsc
28344 @item -mllsc
28345 @itemx -mno-llsc
28346 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
28347 implement atomic memory built-in functions.  When neither option is
28348 specified, GCC uses the instructions if the target architecture
28349 supports them.
28351 @option{-mllsc} is useful if the runtime environment can emulate the
28352 instructions and @option{-mno-llsc} can be useful when compiling for
28353 nonstandard ISAs.  You can make either option the default by
28354 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
28355 respectively.  @option{--with-llsc} is the default for some
28356 configurations; see the installation documentation for details.
28358 @opindex mdsp
28359 @opindex mno-dsp
28360 @item -mdsp
28361 @itemx -mno-dsp
28362 Use (do not use) revision 1 of the MIPS DSP ASE@.
28363 @xref{MIPS DSP Built-in Functions}.  This option defines the
28364 preprocessor macro @code{__mips_dsp}.  It also defines
28365 @code{__mips_dsp_rev} to 1.
28367 @opindex mdspr2
28368 @opindex mno-dspr2
28369 @item -mdspr2
28370 @itemx -mno-dspr2
28371 Use (do not use) revision 2 of the MIPS DSP ASE@.
28372 @xref{MIPS DSP Built-in Functions}.  This option defines the
28373 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
28374 It also defines @code{__mips_dsp_rev} to 2.
28376 @opindex msmartmips
28377 @opindex mno-smartmips
28378 @item -msmartmips
28379 @itemx -mno-smartmips
28380 Use (do not use) the MIPS SmartMIPS ASE.
28382 @opindex mpaired-single
28383 @opindex mno-paired-single
28384 @item -mpaired-single
28385 @itemx -mno-paired-single
28386 Use (do not use) paired-single floating-point instructions.
28387 @xref{MIPS Paired-Single Support}.  This option requires
28388 hardware floating-point support to be enabled.
28390 @opindex mdmx
28391 @opindex mno-mdmx
28392 @item -mdmx
28393 @itemx -mno-mdmx
28394 Use (do not use) MIPS Digital Media Extension instructions.
28395 This option can only be used when generating 64-bit code and requires
28396 hardware floating-point support to be enabled.
28398 @opindex mips3d
28399 @opindex mno-mips3d
28400 @item -mips3d
28401 @itemx -mno-mips3d
28402 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
28403 The option @option{-mips3d} implies @option{-mpaired-single}.
28405 @opindex mmicromips
28406 @opindex mno-mmicromips
28407 @item -mmicromips
28408 @itemx -mno-micromips
28409 Generate (do not generate) microMIPS code.
28411 MicroMIPS code generation can also be controlled on a per-function basis
28412 by means of @code{micromips} and @code{nomicromips} attributes.
28413 @xref{Function Attributes}, for more information.
28415 @opindex mmt
28416 @opindex mno-mt
28417 @item -mmt
28418 @itemx -mno-mt
28419 Use (do not use) MT Multithreading instructions.
28421 @opindex mmcu
28422 @opindex mno-mcu
28423 @item -mmcu
28424 @itemx -mno-mcu
28425 Use (do not use) the MIPS MCU ASE instructions.
28427 @opindex meva
28428 @opindex mno-eva
28429 @item -meva
28430 @itemx -mno-eva
28431 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
28433 @opindex mvirt
28434 @opindex mno-virt
28435 @item -mvirt
28436 @itemx -mno-virt
28437 Use (do not use) the MIPS Virtualization (VZ) instructions.
28439 @opindex mxpa
28440 @opindex mno-xpa
28441 @item -mxpa
28442 @itemx -mno-xpa
28443 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
28445 @opindex mcrc
28446 @opindex mno-crc
28447 @item -mcrc
28448 @itemx -mno-crc
28449 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
28451 @opindex mginv
28452 @opindex mno-ginv
28453 @item -mginv
28454 @itemx -mno-ginv
28455 Use (do not use) the MIPS Global INValidate (GINV) instructions.
28457 @opindex mloongson-mmi
28458 @opindex mno-loongson-mmi
28459 @item -mloongson-mmi
28460 @itemx -mno-loongson-mmi
28461 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
28463 @opindex mloongson-ext
28464 @opindex mno-loongson-ext
28465 @item -mloongson-ext
28466 @itemx -mno-loongson-ext
28467 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
28469 @opindex mloongson-ext2
28470 @opindex mno-loongson-ext2
28471 @item -mloongson-ext2
28472 @itemx -mno-loongson-ext2
28473 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
28475 @opindex mlong64
28476 @item -mlong64
28477 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
28478 an explanation of the default and the way that the pointer size is
28479 determined.
28481 @opindex mlong32
28482 @item -mlong32
28483 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
28485 The default size of @code{int}s, @code{long}s and pointers depends on
28486 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
28487 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
28488 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
28489 or the same size as integer registers, whichever is smaller.
28491 @opindex msym32
28492 @opindex mno-sym32
28493 @item -msym32
28494 @itemx -mno-sym32
28495 Assume (do not assume) that all symbols have 32-bit values, regardless
28496 of the selected ABI@.  This option is useful in combination with
28497 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
28498 to generate shorter and faster references to symbolic addresses.
28500 @opindex G
28501 @item -G @var{num}
28502 Put definitions of externally-visible data in a small data section
28503 if that data is no bigger than @var{num} bytes.  GCC can then generate
28504 more efficient accesses to the data; see @option{-mgpopt} for details.
28506 The default @option{-G} option depends on the configuration.
28508 @opindex mlocal-sdata
28509 @opindex mno-local-sdata
28510 @item -mlocal-sdata
28511 @itemx -mno-local-sdata
28512 Extend (do not extend) the @option{-G} behavior to local data too,
28513 such as to static variables in C@.  @option{-mlocal-sdata} is the
28514 default for all configurations.
28516 If the linker complains that an application is using too much small data,
28517 you might want to try rebuilding the less performance-critical parts with
28518 @option{-mno-local-sdata}.  You might also want to build large
28519 libraries with @option{-mno-local-sdata}, so that the libraries leave
28520 more room for the main program.
28522 @opindex mextern-sdata
28523 @opindex mno-extern-sdata
28524 @item -mextern-sdata
28525 @itemx -mno-extern-sdata
28526 Assume (do not assume) that externally-defined data is in
28527 a small data section if the size of that data is within the @option{-G} limit.
28528 @option{-mextern-sdata} is the default for all configurations.
28530 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
28531 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
28532 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
28533 is placed in a small data section.  If @var{Var} is defined by another
28534 module, you must either compile that module with a high-enough
28535 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
28536 definition.  If @var{Var} is common, you must link the application
28537 with a high-enough @option{-G} setting.
28539 The easiest way of satisfying these restrictions is to compile
28540 and link every module with the same @option{-G} option.  However,
28541 you may wish to build a library that supports several different
28542 small data limits.  You can do this by compiling the library with
28543 the highest supported @option{-G} setting and additionally using
28544 @option{-mno-extern-sdata} to stop the library from making assumptions
28545 about externally-defined data.
28547 @opindex mgpopt
28548 @opindex mno-gpopt
28549 @item -mgpopt
28550 @itemx -mno-gpopt
28551 Use (do not use) GP-relative accesses for symbols that are known to be
28552 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
28553 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
28554 configurations.
28556 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
28557 might not hold the value of @code{_gp}.  For example, if the code is
28558 part of a library that might be used in a boot monitor, programs that
28559 call boot monitor routines pass an unknown value in @code{$gp}.
28560 (In such situations, the boot monitor itself is usually compiled
28561 with @option{-G0}.)
28563 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
28564 @option{-mno-extern-sdata}.
28566 @opindex membedded-data
28567 @opindex mno-embedded-data
28568 @item -membedded-data
28569 @itemx -mno-embedded-data
28570 Allocate variables to the read-only data section first if possible, then
28571 next in the small data section if possible, otherwise in data.  This gives
28572 slightly slower code than the default, but reduces the amount of RAM required
28573 when executing, and thus may be preferred for some embedded systems.
28575 @opindex muninit-const-in-rodata
28576 @opindex mno-uninit-const-in-rodata
28577 @item -muninit-const-in-rodata
28578 @itemx -mno-uninit-const-in-rodata
28579 Put uninitialized @code{const} variables in the read-only data section.
28580 This option is only meaningful in conjunction with @option{-membedded-data}.
28582 @opindex mcode-readable
28583 @item -mcode-readable=@var{setting}
28584 Specify whether GCC may generate code that reads from executable sections.
28585 There are three possible settings:
28587 @table @gcctabopt
28588 @item -mcode-readable=yes
28589 Instructions may freely access executable sections.  This is the
28590 default setting.
28592 @item -mcode-readable=pcrel
28593 MIPS16 PC-relative load instructions can access executable sections,
28594 but other instructions must not do so.  This option is useful on 4KSc
28595 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
28596 It is also useful on processors that can be configured to have a dual
28597 instruction/data SRAM interface and that, like the M4K, automatically
28598 redirect PC-relative loads to the instruction RAM.
28600 @item -mcode-readable=no
28601 Instructions must not access executable sections.  This option can be
28602 useful on targets that are configured to have a dual instruction/data
28603 SRAM interface but that (unlike the M4K) do not automatically redirect
28604 PC-relative loads to the instruction RAM.
28605 @end table
28607 @opindex msplit-addresses
28608 @opindex mno-split-addresses
28609 @item -msplit-addresses
28610 @itemx -mno-split-addresses
28611 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
28612 relocation operators.  This option has been superseded by
28613 @option{-mexplicit-relocs} but is retained for backwards compatibility.
28615 @opindex mexplicit-relocs
28616 @opindex mno-explicit-relocs
28617 @item -mexplicit-relocs=none
28618 @itemx -mexplicit-relocs=base
28619 @itemx -mexplicit-relocs=pcrel
28620 @itemx -mexplicit-relocs
28621 @itemx -mno-explicit-relocs
28622 These options control whether explicit relocs (such as %gp_rel) are used.
28623 The default value depends on the version of GAS when GCC itself was built.
28625 The @code{base} explicit-relocs support introdunced into GAS in 2001.
28626 The @code{pcrel} explicit-relocs support introdunced into GAS in 2014,
28627 which supports @code{%pcrel_hi} and @code{%pcrel_lo}.
28629 @opindex mcheck-zero-division
28630 @opindex mno-check-zero-division
28631 @item -mcheck-zero-division
28632 @itemx -mno-check-zero-division
28633 Trap (do not trap) on integer division by zero.
28635 The default is @option{-mcheck-zero-division}.
28637 @opindex mdivide-traps
28638 @opindex mdivide-breaks
28639 @item -mdivide-traps
28640 @itemx -mdivide-breaks
28641 MIPS systems check for division by zero by generating either a
28642 conditional trap or a break instruction.  Using traps results in
28643 smaller code, but is only supported on MIPS II and later.  Also, some
28644 versions of the Linux kernel have a bug that prevents trap from
28645 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
28646 allow conditional traps on architectures that support them and
28647 @option{-mdivide-breaks} to force the use of breaks.
28649 The default is usually @option{-mdivide-traps}, but this can be
28650 overridden at configure time using @option{--with-divide=breaks}.
28651 Divide-by-zero checks can be completely disabled using
28652 @option{-mno-check-zero-division}.
28654 @opindex mload-store-pairs
28655 @opindex mno-load-store-pairs
28656 @item -mload-store-pairs
28657 @itemx -mno-load-store-pairs
28658 Enable (disable) an optimization that pairs consecutive load or store
28659 instructions to enable load/store bonding.  This option is enabled by
28660 default but only takes effect when the selected architecture is known
28661 to support bonding.
28663 @opindex mstrict-align
28664 @opindex mno-strict-align
28665 @opindex munaligned-access
28666 @opindex mno-unaligned-access
28667 @item -mstrict-align
28668 @itemx -mno-strict-align
28669 @itemx -munaligned-access
28670 @itemx -mno-unaligned-access
28671 Disable (enable) direct unaligned access for MIPS Release 6.
28672 MIPSr6 requires load/store unaligned-access support, by hardware or
28673 trap&emulate.  So @option{-mstrict-align} may be needed by kernel.  The
28674 options @option{-munaligned-access} and @option{-mno-unaligned-access}
28675 are obsoleted, and only for backward-compatible.
28677 @opindex mmemcpy
28678 @opindex mno-memcpy
28679 @item -mmemcpy
28680 @itemx -mno-memcpy
28681 Force (do not force) the use of @code{memcpy} for non-trivial block
28682 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
28683 most constant-sized copies.
28685 @opindex mlong-calls
28686 @opindex mno-long-calls
28687 @item -mlong-calls
28688 @itemx -mno-long-calls
28689 Disable (do not disable) use of the @code{jal} instruction.  Calling
28690 functions using @code{jal} is more efficient but requires the caller
28691 and callee to be in the same 256 megabyte segment.
28693 This option has no effect on abicalls code.  The default is
28694 @option{-mno-long-calls}.
28696 @opindex mmad
28697 @opindex mno-mad
28698 @item -mmad
28699 @itemx -mno-mad
28700 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
28701 instructions, as provided by the R4650 ISA@.
28703 @opindex mimadd
28704 @opindex mno-imadd
28705 @item -mimadd
28706 @itemx -mno-imadd
28707 Enable (disable) use of the @code{madd} and @code{msub} integer
28708 instructions.  The default is @option{-mimadd} on architectures
28709 that support @code{madd} and @code{msub} except for the 74k 
28710 architecture where it was found to generate slower code.
28712 @opindex mfused-madd
28713 @opindex mno-fused-madd
28714 @item -mfused-madd
28715 @itemx -mno-fused-madd
28716 Enable (disable) use of the floating-point multiply-accumulate
28717 instructions, when they are available.  The default is
28718 @option{-mfused-madd}.
28720 On the R8000 CPU when multiply-accumulate instructions are used,
28721 the intermediate product is calculated to infinite precision
28722 and is not subject to the FCSR Flush to Zero bit.  This may be
28723 undesirable in some circumstances.  On other processors the result
28724 is numerically identical to the equivalent computation using
28725 separate multiply, add, subtract and negate instructions.
28727 @opindex nocpp
28728 @item -nocpp
28729 Tell the MIPS assembler to not run its preprocessor over user
28730 assembler files (with a @samp{.s} suffix) when assembling them.
28732 @opindex mfix-24k
28733 @opindex mno-fix-24k
28734 @item -mfix-24k
28735 @itemx -mno-fix-24k
28736 Work around the 24K E48 (lost data on stores during refill) errata.
28737 The workarounds are implemented by the assembler rather than by GCC@.
28739 @opindex mfix-r4000
28740 @opindex mno-fix-r4000
28741 @item -mfix-r4000
28742 @itemx -mno-fix-r4000
28743 Work around certain R4000 CPU errata:
28744 @itemize @minus
28745 @item
28746 A double-word or a variable shift may give an incorrect result if executed
28747 immediately after starting an integer division.
28748 @item
28749 A double-word or a variable shift may give an incorrect result if executed
28750 while an integer multiplication is in progress.
28751 @item
28752 An integer division may give an incorrect result if started in a delay slot
28753 of a taken branch or a jump.
28754 @end itemize
28756 @opindex mfix-r4400
28757 @opindex mno-fix-r4400
28758 @item -mfix-r4400
28759 @itemx -mno-fix-r4400
28760 Work around certain R4400 CPU errata:
28761 @itemize @minus
28762 @item
28763 A double-word or a variable shift may give an incorrect result if executed
28764 immediately after starting an integer division.
28765 @end itemize
28767 @opindex mfix-r10000
28768 @opindex mno-fix-r10000
28769 @item -mfix-r10000
28770 @itemx -mno-fix-r10000
28771 Work around certain R10000 errata:
28772 @itemize @minus
28773 @item
28774 @code{ll}/@code{sc} sequences may not behave atomically on revisions
28775 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
28776 @end itemize
28778 This option can only be used if the target architecture supports
28779 branch-likely instructions.  @option{-mfix-r10000} is the default when
28780 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
28781 otherwise.
28783 @opindex mfix-r5900
28784 @item -mfix-r5900
28785 @itemx -mno-fix-r5900
28786 Do not attempt to schedule the preceding instruction into the delay slot
28787 of a branch instruction placed at the end of a short loop of six
28788 instructions or fewer and always schedule a @code{nop} instruction there
28789 instead.  The short loop bug under certain conditions causes loops to
28790 execute only once or twice, due to a hardware bug in the R5900 chip.  The
28791 workaround is implemented by the assembler rather than by GCC@.
28793 @opindex mfix-rm7000
28794 @item -mfix-rm7000
28795 @itemx -mno-fix-rm7000
28796 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
28797 workarounds are implemented by the assembler rather than by GCC@.
28799 @opindex mfix-vr4120
28800 @item -mfix-vr4120
28801 @itemx -mno-fix-vr4120
28802 Work around certain VR4120 errata:
28803 @itemize @minus
28804 @item
28805 @code{dmultu} does not always produce the correct result.
28806 @item
28807 @code{div} and @code{ddiv} do not always produce the correct result if one
28808 of the operands is negative.
28809 @end itemize
28810 The workarounds for the division errata rely on special functions in
28811 @file{libgcc.a}.  At present, these functions are only provided by
28812 the @code{mips64vr*-elf} configurations.
28814 Other VR4120 errata require a NOP to be inserted between certain pairs of
28815 instructions.  These errata are handled by the assembler, not by GCC itself.
28817 @opindex mfix-vr4130
28818 @item -mfix-vr4130
28819 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
28820 workarounds are implemented by the assembler rather than by GCC,
28821 although GCC avoids using @code{mflo} and @code{mfhi} if the
28822 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
28823 instructions are available instead.
28825 @opindex mfix-sb1
28826 @item -mfix-sb1
28827 @itemx -mno-fix-sb1
28828 Work around certain SB-1 CPU core errata.
28829 (This flag currently works around the SB-1 revision 2
28830 ``F1'' and ``F2'' floating-point errata.)
28832 @opindex mr10k-cache-barrier
28833 @item -mr10k-cache-barrier=@var{setting}
28834 Specify whether GCC should insert cache barriers to avoid the
28835 side effects of speculation on R10K processors.
28837 In common with many processors, the R10K tries to predict the outcome
28838 of a conditional branch and speculatively executes instructions from
28839 the ``taken'' branch.  It later aborts these instructions if the
28840 predicted outcome is wrong.  However, on the R10K, even aborted
28841 instructions can have side effects.
28843 This problem only affects kernel stores and, depending on the system,
28844 kernel loads.  As an example, a speculatively-executed store may load
28845 the target memory into cache and mark the cache line as dirty, even if
28846 the store itself is later aborted.  If a DMA operation writes to the
28847 same area of memory before the ``dirty'' line is flushed, the cached
28848 data overwrites the DMA-ed data.  See the R10K processor manual
28849 for a full description, including other potential problems.
28851 One workaround is to insert cache barrier instructions before every memory
28852 access that might be speculatively executed and that might have side
28853 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
28854 controls GCC's implementation of this workaround.  It assumes that
28855 aborted accesses to any byte in the following regions does not have
28856 side effects:
28858 @enumerate
28859 @item
28860 the memory occupied by the current function's stack frame;
28862 @item
28863 the memory occupied by an incoming stack argument;
28865 @item
28866 the memory occupied by an object with a link-time-constant address.
28867 @end enumerate
28869 It is the kernel's responsibility to ensure that speculative
28870 accesses to these regions are indeed safe.
28872 If the input program contains a function declaration such as:
28874 @smallexample
28875 void foo (void);
28876 @end smallexample
28878 then the implementation of @code{foo} must allow @code{j foo} and
28879 @code{jal foo} to be executed speculatively.  GCC honors this
28880 restriction for functions it compiles itself.  It expects non-GCC
28881 functions (such as hand-written assembly code) to do the same.
28883 The option has three forms:
28885 @table @gcctabopt
28886 @item -mr10k-cache-barrier=load-store
28887 Insert a cache barrier before a load or store that might be
28888 speculatively executed and that might have side effects even
28889 if aborted.
28891 @item -mr10k-cache-barrier=store
28892 Insert a cache barrier before a store that might be speculatively
28893 executed and that might have side effects even if aborted.
28895 @item -mr10k-cache-barrier=none
28896 Disable the insertion of cache barriers.  This is the default setting.
28897 @end table
28899 @opindex mflush-func
28900 @opindex mno-flush-func
28901 @item -mflush-func=@var{func}
28902 @itemx -mno-flush-func
28903 Specifies the function to call to flush the I and D caches, or to not
28904 call any such function.  If called, the function must take the same
28905 arguments as the common @code{_flush_func}, that is, the address of the
28906 memory range for which the cache is being flushed, the size of the
28907 memory range, and the number 3 (to flush both caches).  The default
28908 depends on the target GCC was configured for, but commonly is either
28909 @code{_flush_func} or @code{__cpu_flush}.
28911 @opindex mbranch-cost
28912 @item -mbranch-cost=@var{num}
28913 Set the cost of branches to roughly @var{num} ``simple'' instructions.
28914 This cost is only a heuristic and is not guaranteed to produce
28915 consistent results across releases.  A zero cost redundantly selects
28916 the default, which is based on the @option{-mtune} setting.
28918 @opindex mbranch-likely
28919 @opindex mno-branch-likely
28920 @item -mbranch-likely
28921 @itemx -mno-branch-likely
28922 Enable or disable use of Branch Likely instructions, regardless of the
28923 default for the selected architecture.  By default, Branch Likely
28924 instructions may be generated if they are supported by the selected
28925 architecture.  An exception is for the MIPS32 and MIPS64 architectures
28926 and processors that implement those architectures; for those, Branch
28927 Likely instructions are not be generated by default because the MIPS32
28928 and MIPS64 architectures specifically deprecate their use.
28930 @opindex mcompact-branches=never
28931 @opindex mcompact-branches=optimal
28932 @opindex mcompact-branches=always
28933 @item -mcompact-branches=never
28934 @itemx -mcompact-branches=optimal
28935 @itemx -mcompact-branches=always
28936 These options control which form of branches will be generated.  The
28937 default is @option{-mcompact-branches=optimal}.
28939 The @option{-mcompact-branches=never} option ensures that compact branch
28940 instructions will never be generated.
28942 The @option{-mcompact-branches=always} option ensures that a compact
28943 branch instruction will be generated if available for MIPS Release 6 onwards.
28944 If a compact branch instruction is not available (or pre-R6),
28945 a delay slot form of the branch will be used instead.
28947 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
28948 The behaviour for MIPS16/microMIPS may change in future,
28949 since they do have some compact branch instructions.
28951 The @option{-mcompact-branches=optimal} option will cause a delay slot
28952 branch to be used if one is available in the current ISA and the delay
28953 slot is successfully filled.  If the delay slot is not filled, a compact
28954 branch will be chosen if one is available.
28956 @opindex mfp-exceptions
28957 @item -mfp-exceptions
28958 @itemx -mno-fp-exceptions
28959 Specifies whether FP exceptions are enabled.  This affects how
28960 FP instructions are scheduled for some processors.
28961 The default is that FP exceptions are
28962 enabled.
28964 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
28965 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
28966 FP pipe.
28968 @opindex mvr4130-align
28969 @item -mvr4130-align
28970 @itemx -mno-vr4130-align
28971 The VR4130 pipeline is two-way superscalar, but can only issue two
28972 instructions together if the first one is 8-byte aligned.  When this
28973 option is enabled, GCC aligns pairs of instructions that it
28974 thinks should execute in parallel.
28976 This option only has an effect when optimizing for the VR4130.
28977 It normally makes code faster, but at the expense of making it bigger.
28978 It is enabled by default at optimization level @option{-O3}.
28980 @opindex msynci
28981 @item -msynci
28982 @itemx -mno-synci
28983 Enable (disable) generation of @code{synci} instructions on
28984 architectures that support it.  The @code{synci} instructions (if
28985 enabled) are generated when @code{__builtin___clear_cache} is
28986 compiled.
28988 This option defaults to @option{-mno-synci}, but the default can be
28989 overridden by configuring GCC with @option{--with-synci}.
28991 When compiling code for single processor systems, it is generally safe
28992 to use @code{synci}.  However, on many multi-core (SMP) systems, it
28993 does not invalidate the instruction caches on all cores and may lead
28994 to undefined behavior.
28996 @opindex mrelax-pic-calls
28997 @item -mrelax-pic-calls
28998 @itemx -mno-relax-pic-calls
28999 Try to turn PIC calls that are normally dispatched via register
29000 @code{$25} into direct calls.  This is only possible if the linker can
29001 resolve the destination at link time and if the destination is within
29002 range for a direct call.
29004 @option{-mrelax-pic-calls} is the default if GCC was configured to use
29005 an assembler and a linker that support the @code{.reloc} assembly
29006 directive and @option{-mexplicit-relocs} is in effect.  With
29007 @option{-mno-explicit-relocs}, this optimization can be performed by the
29008 assembler and the linker alone without help from the compiler.
29010 @opindex mmcount-ra-address
29011 @opindex mno-mcount-ra-address
29012 @item -mmcount-ra-address
29013 @itemx -mno-mcount-ra-address
29014 Emit (do not emit) code that allows @code{_mcount} to modify the
29015 calling function's return address.  When enabled, this option extends
29016 the usual @code{_mcount} interface with a new @var{ra-address}
29017 parameter, which has type @code{intptr_t *} and is passed in register
29018 @code{$12}.  @code{_mcount} can then modify the return address by
29019 doing both of the following:
29020 @itemize
29021 @item
29022 Returning the new address in register @code{$31}.
29023 @item
29024 Storing the new address in @code{*@var{ra-address}},
29025 if @var{ra-address} is nonnull.
29026 @end itemize
29028 The default is @option{-mno-mcount-ra-address}.
29030 @opindex mframe-header-opt
29031 @item -mframe-header-opt
29032 @itemx -mno-frame-header-opt
29033 Enable (disable) frame header optimization in the o32 ABI.  When using the
29034 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
29035 function to write out register arguments.  When enabled, this optimization
29036 will suppress the allocation of the frame header if it can be determined that
29037 it is unused.
29039 This optimization is off by default at all optimization levels.
29041 @opindex mlxc1-sxc1
29042 @item -mlxc1-sxc1
29043 @itemx -mno-lxc1-sxc1
29044 When applicable, enable (disable) the generation of @code{lwxc1},
29045 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
29047 @opindex mmadd4
29048 @item -mmadd4
29049 @itemx -mno-madd4
29050 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
29051 @code{madd.d} and related instructions.  Enabled by default.
29053 @end table
29055 @node MMIX Options
29056 @subsection MMIX Options
29057 @cindex MMIX Options
29059 These options are defined for the MMIX:
29061 @table @gcctabopt
29062 @opindex mlibfuncs
29063 @opindex mno-libfuncs
29064 @item -mlibfuncs
29065 @itemx -mno-libfuncs
29066 Specify that intrinsic library functions are being compiled, passing all
29067 values in registers, no matter the size.
29069 @opindex mepsilon
29070 @opindex mno-epsilon
29071 @item -mepsilon
29072 @itemx -mno-epsilon
29073 Generate floating-point comparison instructions that compare with respect
29074 to the @code{rE} epsilon register.
29076 @opindex mabi=mmixware
29077 @opindex mabi=gnu
29078 @item -mabi=mmixware
29079 @itemx -mabi=gnu
29080 Generate code that passes function parameters and return values that (in
29081 the called function) are seen as registers @code{$0} and up, as opposed to
29082 the GNU ABI which uses global registers @code{$231} and up.
29084 @opindex mzero-extend
29085 @opindex mno-zero-extend
29086 @item -mzero-extend
29087 @itemx -mno-zero-extend
29088 When reading data from memory in sizes shorter than 64 bits, use (do not
29089 use) zero-extending load instructions by default, rather than
29090 sign-extending ones.
29092 @opindex mknuthdiv
29093 @opindex mno-knuthdiv
29094 @item -mknuthdiv
29095 @itemx -mno-knuthdiv
29096 Make the result of a division yielding a remainder have the same sign as
29097 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
29098 remainder follows the sign of the dividend.  Both methods are
29099 arithmetically valid, the latter being almost exclusively used.
29101 @opindex mtoplevel-symbols
29102 @opindex mno-toplevel-symbols
29103 @item -mtoplevel-symbols
29104 @itemx -mno-toplevel-symbols
29105 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
29106 code can be used with the @code{PREFIX} assembly directive.
29108 @opindex melf
29109 @item -melf
29110 Generate an executable in the ELF format, rather than the default
29111 @samp{mmo} format used by the @command{mmix} simulator.
29113 @opindex mbranch-predict
29114 @opindex mno-branch-predict
29115 @item -mbranch-predict
29116 @itemx -mno-branch-predict
29117 Use (do not use) the probable-branch instructions, when static branch
29118 prediction indicates a probable branch.
29120 @opindex mbase-addresses
29121 @opindex mno-base-addresses
29122 @item -mbase-addresses
29123 @itemx -mno-base-addresses
29124 Generate (do not generate) code that uses @emph{base addresses}.  Using a
29125 base address automatically generates a request (handled by the assembler
29126 and the linker) for a constant to be set up in a global register.  The
29127 register is used for one or more base address requests within the range 0
29128 to 255 from the value held in the register.  The generally leads to short
29129 and fast code, but the number of different data items that can be
29130 addressed is limited.  This means that a program that uses lots of static
29131 data may require @option{-mno-base-addresses}.
29133 @opindex msingle-exit
29134 @opindex mno-single-exit
29135 @item -msingle-exit
29136 @itemx -mno-single-exit
29137 Force (do not force) generated code to have a single exit point in each
29138 function.
29139 @end table
29141 @node MN10300 Options
29142 @subsection MN10300 Options
29143 @cindex MN10300 options
29145 These @option{-m} options are defined for Matsushita MN10300 architectures:
29147 @table @gcctabopt
29148 @opindex mmult-bug
29149 @item -mmult-bug
29150 Generate code to avoid bugs in the multiply instructions for the MN10300
29151 processors.  This is the default.
29153 @opindex mno-mult-bug
29154 @item -mno-mult-bug
29155 Do not generate code to avoid bugs in the multiply instructions for the
29156 MN10300 processors.
29158 @opindex mam33
29159 @item -mam33
29160 Generate code using features specific to the AM33 processor.
29162 @opindex mno-am33
29163 @item -mno-am33
29164 Do not generate code using features specific to the AM33 processor.  This
29165 is the default.
29167 @opindex mam33-2
29168 @item -mam33-2
29169 Generate code using features specific to the AM33/2.0 processor.
29171 @opindex mam34
29172 @item -mam34
29173 Generate code using features specific to the AM34 processor.
29175 @opindex mtune
29176 @item -mtune=@var{cpu-type}
29177 Use the timing characteristics of the indicated CPU type when
29178 scheduling instructions.  This does not change the targeted processor
29179 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
29180 @samp{am33-2} or @samp{am34}.
29182 @opindex mreturn-pointer-on-d0
29183 @item -mreturn-pointer-on-d0
29184 When generating a function that returns a pointer, return the pointer
29185 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
29186 only in @code{a0}, and attempts to call such functions without a prototype
29187 result in errors.  Note that this option is on by default; use
29188 @option{-mno-return-pointer-on-d0} to disable it.
29190 @opindex mno-crt0
29191 @item -mno-crt0
29192 Do not link in the C run-time initialization object file.
29194 @opindex mrelax
29195 @item -mrelax
29196 Indicate to the linker that it should perform a relaxation optimization pass
29197 to shorten branches, calls and absolute memory addresses.  This option only
29198 has an effect when used on the command line for the final link step.
29200 This option makes symbolic debugging impossible.
29202 @opindex mliw
29203 @item -mliw
29204 Allow the compiler to generate @emph{Long Instruction Word}
29205 instructions if the target is the @samp{AM33} or later.  This is the
29206 default.  This option defines the preprocessor macro @code{__LIW__}.
29208 @opindex mno-liw
29209 @item -mno-liw
29210 Do not allow the compiler to generate @emph{Long Instruction Word}
29211 instructions.  This option defines the preprocessor macro
29212 @code{__NO_LIW__}.
29214 @opindex msetlb
29215 @item -msetlb
29216 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
29217 instructions if the target is the @samp{AM33} or later.  This is the
29218 default.  This option defines the preprocessor macro @code{__SETLB__}.
29220 @opindex mno-setlb
29221 @item -mno-setlb
29222 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
29223 instructions.  This option defines the preprocessor macro
29224 @code{__NO_SETLB__}.
29226 @end table
29228 @node Moxie Options
29229 @subsection Moxie Options
29230 @cindex Moxie Options
29232 @table @gcctabopt
29234 @opindex meb
29235 @item -meb
29236 Generate big-endian code.  This is the default for @samp{moxie-*-*}
29237 configurations.
29239 @opindex mel
29240 @item -mel
29241 Generate little-endian code.
29243 @opindex mmul.x
29244 @item -mmul.x
29245 Generate mul.x and umul.x instructions.  This is the default for
29246 @samp{moxiebox-*-*} configurations.
29248 @opindex mno-crt0
29249 @item -mno-crt0
29250 Do not link in the C run-time initialization object file.
29252 @end table
29254 @node MSP430 Options
29255 @subsection MSP430 Options
29256 @cindex MSP430 Options
29258 These options are defined for the MSP430:
29260 @table @gcctabopt
29262 @opindex masm-hex
29263 @item -masm-hex
29264 Force assembly output to always use hex constants.  Normally such
29265 constants are signed decimals, but this option is available for
29266 testsuite and/or aesthetic purposes.
29268 @opindex mmcu=
29269 @item -mmcu=
29270 Select the MCU to target.  This is used to create a C preprocessor
29271 symbol based upon the MCU name, converted to upper case and pre- and
29272 post-fixed with @samp{__}.  This in turn is used by the
29273 @file{msp430.h} header file to select an MCU-specific supplementary
29274 header file.
29276 The option also sets the ISA to use.  If the MCU name is one that is
29277 known to only support the 430 ISA then that is selected, otherwise the
29278 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
29279 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
29280 name selects the 430X ISA.
29282 In addition an MCU-specific linker script is added to the linker
29283 command line.  The script's name is the name of the MCU with
29284 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
29285 command line defines the C preprocessor symbol @code{__XXX__} and
29286 cause the linker to search for a script called @file{xxx.ld}.
29288 The ISA and hardware multiply supported for the different MCUs is hard-coded
29289 into GCC.  However, an external @samp{devices.csv} file can be used to
29290 extend device support beyond those that have been hard-coded.
29292 GCC searches for the @samp{devices.csv} file using the following methods in the
29293 given precedence order, where the first method takes precendence over the
29294 second which takes precedence over the third.
29296 @table @asis
29297 @item Include path specified with @code{-I} and @code{-L}
29298 @samp{devices.csv} will be searched for in each of the directories specified by
29299 include paths and linker library search paths.
29300 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
29301 Define the value of the global environment variable
29302 @samp{MSP430_GCC_INCLUDE_DIR}
29303 to the full path to the directory containing devices.csv, and GCC will search
29304 this directory for devices.csv.  If devices.csv is found, this directory will
29305 also be registered as an include path, and linker library path.  Header files
29306 and linker scripts in this directory can therefore be used without manually
29307 specifying @code{-I} and @code{-L} on the command line.
29308 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
29309 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
29310 toolchain root directory.  This directory does not exist in a default
29311 installation, but if the user has created it and copied @samp{devices.csv}
29312 there, then the MCU data will be read.  As above, this directory will
29313 also be registered as an include path, and linker library path.
29315 @end table
29316 If none of the above search methods find @samp{devices.csv}, then the
29317 hard-coded MCU data is used.
29320 @opindex mwarn-mcu
29321 @opindex mno-warn-mcu
29322 @item -mwarn-mcu
29323 @itemx -mno-warn-mcu
29324 This option enables or disables warnings about conflicts between the
29325 MCU name specified by the @option{-mmcu} option and the ISA set by the
29326 @option{-mcpu} option and/or the hardware multiply support set by the
29327 @option{-mhwmult} option.  It also toggles warnings about unrecognized
29328 MCU names.  This option is on by default.
29330 @opindex mcpu=
29331 @item -mcpu=
29332 Specifies the ISA to use.  Accepted values are @samp{msp430},
29333 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
29334 @option{-mmcu=} option should be used to select the ISA.
29336 @opindex msim
29337 @item -msim
29338 Link to the simulator runtime libraries and linker script.  Overrides
29339 any scripts that would be selected by the @option{-mmcu=} option.
29341 @opindex mlarge
29342 @item -mlarge
29343 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
29345 @opindex msmall
29346 @item -msmall
29347 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
29349 @opindex mrelax
29350 @item -mrelax
29351 This option is passed to the assembler and linker, and allows the
29352 linker to perform certain optimizations that cannot be done until
29353 the final link.
29355 @opindex mhwmult=
29356 @item mhwmult=
29357 Describes the type of hardware multiply supported by the target.
29358 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
29359 for the original 16-bit-only multiply supported by early MCUs.
29360 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
29361 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
29362 A value of @samp{auto} can also be given.  This tells GCC to deduce
29363 the hardware multiply support based upon the MCU name provided by the
29364 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
29365 the MCU name is not recognized then no hardware multiply support is
29366 assumed.  @code{auto} is the default setting.
29368 Hardware multiplies are normally performed by calling a library
29369 routine.  This saves space in the generated code.  When compiling at
29370 @option{-O3} or higher however the hardware multiplier is invoked
29371 inline.  This makes for bigger, but faster code.
29373 The hardware multiply routines disable interrupts whilst running and
29374 restore the previous interrupt state when they finish.  This makes
29375 them safe to use inside interrupt handlers as well as in normal code.
29377 @opindex minrt
29378 @item -minrt
29379 Enable the use of a minimum runtime environment - no static
29380 initializers or constructors.  This is intended for memory-constrained
29381 devices.  The compiler includes special symbols in some objects
29382 that tell the linker and runtime which code fragments are required.
29384 @opindex mtiny-printf
29385 @item -mtiny-printf
29386 Enable reduced code size @code{printf} and @code{puts} library functions.
29387 The @samp{tiny} implementations of these functions are not reentrant, so
29388 must be used with caution in multi-threaded applications.
29390 Support for streams has been removed and the string to be printed will
29391 always be sent to stdout via the @code{write} syscall.  The string is not
29392 buffered before it is sent to write.
29394 This option requires Newlib Nano IO, so GCC must be configured with
29395 @samp{--enable-newlib-nano-formatted-io}.
29397 @opindex mmax-inline-shift=
29398 @item -mmax-inline-shift=
29399 This option takes an integer between 0 and 64 inclusive, and sets
29400 the maximum number of inline shift instructions which should be emitted to
29401 perform a shift operation by a constant amount.  When this value needs to be
29402 exceeded, an mspabi helper function is used instead.  The default value is 4.
29404 This only affects cases where a shift by multiple positions cannot be
29405 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
29407 Shifts of a 32-bit value are at least twice as costly, so the value passed for
29408 this option is divided by 2 and the resulting value used instead.
29410 @opindex mcode-region
29411 @opindex mdata-region
29412 @item -mcode-region=
29413 @itemx -mdata-region=
29414 These options tell the compiler where to place functions and data that
29415 do not have one of the @code{lower}, @code{upper}, @code{either} or
29416 @code{section} attributes.  Possible values are @code{lower},
29417 @code{upper}, @code{either} or @code{any}.  The first three behave
29418 like the corresponding attribute.  The fourth possible value -
29419 @code{any} - is the default.  It leaves placement entirely up to the
29420 linker script and how it assigns the standard sections
29421 (@code{.text}, @code{.data}, etc) to the memory regions.
29423 @opindex msilicon-errata
29424 @item -msilicon-errata=
29425 This option passes on a request to assembler to enable the fixes for
29426 the named silicon errata.
29428 @opindex msilicon-errata-warn
29429 @item -msilicon-errata-warn=
29430 This option passes on a request to the assembler to enable warning
29431 messages when a silicon errata might need to be applied.
29433 @opindex mwarn-devices-csv
29434 @opindex mno-warn-devices-csv
29435 @item -mwarn-devices-csv
29436 @itemx -mno-warn-devices-csv
29437 Warn if @samp{devices.csv} is not found or there are problem parsing it
29438 (default: on).
29440 @end table
29442 @node NDS32 Options
29443 @subsection NDS32 Options
29444 @cindex NDS32 Options
29446 These options are defined for NDS32 implementations:
29448 @table @gcctabopt
29450 @opindex mbig-endian
29451 @item -mbig-endian
29452 Generate code in big-endian mode.
29454 @opindex mlittle-endian
29455 @item -mlittle-endian
29456 Generate code in little-endian mode.
29458 @opindex mreduced-regs
29459 @item -mreduced-regs
29460 Use reduced-set registers for register allocation.
29462 @opindex mfull-regs
29463 @item -mfull-regs
29464 Use full-set registers for register allocation.
29466 @opindex mcmov
29467 @item -mcmov
29468 Generate conditional move instructions.
29470 @opindex mno-cmov
29471 @item -mno-cmov
29472 Do not generate conditional move instructions.
29474 @opindex mext-perf
29475 @item -mext-perf
29476 Generate performance extension instructions.
29478 @opindex mno-ext-perf
29479 @item -mno-ext-perf
29480 Do not generate performance extension instructions.
29482 @opindex mext-perf2
29483 @item -mext-perf2
29484 Generate performance extension 2 instructions.
29486 @opindex mno-ext-perf2
29487 @item -mno-ext-perf2
29488 Do not generate performance extension 2 instructions.
29490 @opindex mext-string
29491 @item -mext-string
29492 Generate string extension instructions.
29494 @opindex mno-ext-string
29495 @item -mno-ext-string
29496 Do not generate string extension instructions.
29498 @opindex mv3push
29499 @item -mv3push
29500 Generate v3 push25/pop25 instructions.
29502 @opindex mno-v3push
29503 @item -mno-v3push
29504 Do not generate v3 push25/pop25 instructions.
29506 @opindex m16-bit
29507 @item -m16-bit
29508 Generate 16-bit instructions.
29510 @opindex mno-16-bit
29511 @item -mno-16-bit
29512 Do not generate 16-bit instructions.
29514 @opindex misr-vector-size
29515 @item -misr-vector-size=@var{num}
29516 Specify the size of each interrupt vector, which must be 4 or 16.
29518 @opindex mcache-block-size
29519 @item -mcache-block-size=@var{num}
29520 Specify the size of each cache block,
29521 which must be a power of 2 between 4 and 512.
29523 @opindex march
29524 @item -march=@var{arch}
29525 Specify the name of the target architecture.
29527 @opindex mcmodel
29528 @item -mcmodel=@var{code-model}
29529 Set the code model to one of
29530 @table @asis
29531 @item @samp{small}
29532 All the data and read-only data segments must be within 512KB addressing space.
29533 The text segment must be within 16MB addressing space.
29534 @item @samp{medium}
29535 The data segment must be within 512KB while the read-only data segment can be
29536 within 4GB addressing space.  The text segment should be still within 16MB
29537 addressing space.
29538 @item @samp{large}
29539 All the text and data segments can be within 4GB addressing space.
29540 @end table
29542 @opindex mctor-dtor
29543 @item -mctor-dtor
29544 Enable constructor/destructor feature.
29546 @opindex mrelax
29547 @item -mrelax
29548 Guide linker to relax instructions.
29550 @end table
29552 @node Nios II Options
29553 @subsection Nios II Options
29554 @cindex Nios II options
29555 @cindex Altera Nios II options
29557 These are the options defined for the Altera Nios II processor.
29559 @table @gcctabopt
29561 @opindex G
29562 @cindex smaller data references
29563 @item -G @var{num}
29564 Put global and static objects less than or equal to @var{num} bytes
29565 into the small data or BSS sections instead of the normal data or BSS
29566 sections.  The default value of @var{num} is 8.
29568 @opindex mgpopt
29569 @opindex mno-gpopt
29570 @item -mgpopt=@var{option}
29571 @itemx -mgpopt
29572 @itemx -mno-gpopt
29573 Generate (do not generate) GP-relative accesses.  The following 
29574 @var{option} names are recognized:
29576 @table @samp
29578 @item none
29579 Do not generate GP-relative accesses.
29581 @item local
29582 Generate GP-relative accesses for small data objects that are not 
29583 external, weak, or uninitialized common symbols.  
29584 Also use GP-relative addressing for objects that
29585 have been explicitly placed in a small data section via a @code{section}
29586 attribute.
29588 @item global
29589 As for @samp{local}, but also generate GP-relative accesses for
29590 small data objects that are external, weak, or common.  If you use this option,
29591 you must ensure that all parts of your program (including libraries) are
29592 compiled with the same @option{-G} setting.
29594 @item data
29595 Generate GP-relative accesses for all data objects in the program.  If you
29596 use this option, the entire data and BSS segments
29597 of your program must fit in 64K of memory and you must use an appropriate
29598 linker script to allocate them within the addressable range of the
29599 global pointer.
29601 @item all
29602 Generate GP-relative addresses for function pointers as well as data
29603 pointers.  If you use this option, the entire text, data, and BSS segments
29604 of your program must fit in 64K of memory and you must use an appropriate
29605 linker script to allocate them within the addressable range of the
29606 global pointer.
29608 @end table
29610 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
29611 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
29613 The default is @option{-mgpopt} except when @option{-fpic} or
29614 @option{-fPIC} is specified to generate position-independent code.
29615 Note that the Nios II ABI does not permit GP-relative accesses from
29616 shared libraries.
29618 You may need to specify @option{-mno-gpopt} explicitly when building
29619 programs that include large amounts of small data, including large
29620 GOT data sections.  In this case, the 16-bit offset for GP-relative
29621 addressing may not be large enough to allow access to the entire 
29622 small data section.
29624 @opindex mgprel-sec
29625 @item -mgprel-sec=@var{regexp}
29626 This option specifies additional section names that can be accessed via
29627 GP-relative addressing.  It is most useful in conjunction with 
29628 @code{section} attributes on variable declarations 
29629 (@pxref{Common Variable Attributes}) and a custom linker script.  
29630 The @var{regexp} is a POSIX Extended Regular Expression.
29632 This option does not affect the behavior of the @option{-G} option, and 
29633 the specified sections are in addition to the standard @code{.sdata}
29634 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
29636 @opindex mr0rel-sec
29637 @item -mr0rel-sec=@var{regexp}
29638 This option specifies names of sections that can be accessed via a 
29639 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
29640 of the 32-bit address space.  It is most useful in conjunction with 
29641 @code{section} attributes on variable declarations 
29642 (@pxref{Common Variable Attributes}) and a custom linker script.  
29643 The @var{regexp} is a POSIX Extended Regular Expression.
29645 In contrast to the use of GP-relative addressing for small data, 
29646 zero-based addressing is never generated by default and there are no 
29647 conventional section names used in standard linker scripts for sections
29648 in the low or high areas of memory.
29650 @opindex mel
29651 @opindex meb
29652 @item -mel
29653 @itemx -meb
29654 Generate little-endian (default) or big-endian (experimental) code,
29655 respectively.
29657 @opindex march
29658 @item -march=@var{arch}
29659 This specifies the name of the target Nios II architecture.  GCC uses this
29660 name to determine what kind of instructions it can emit when generating
29661 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
29663 The preprocessor macro @code{__nios2_arch__} is available to programs,
29664 with value 1 or 2, indicating the targeted ISA level.
29666 @opindex mno-bypass-cache
29667 @opindex mbypass-cache
29668 @item -mbypass-cache
29669 @itemx -mno-bypass-cache
29670 Force all load and store instructions to always bypass cache by 
29671 using I/O variants of the instructions. The default is not to
29672 bypass the cache.
29674 @opindex mcache-volatile 
29675 @opindex mno-cache-volatile
29676 @item -mno-cache-volatile 
29677 @itemx -mcache-volatile       
29678 Volatile memory access bypass the cache using the I/O variants of 
29679 the load and store instructions. The default is not to bypass the cache.
29681 @opindex mno-fast-sw-div
29682 @opindex mfast-sw-div
29683 @item -mno-fast-sw-div
29684 @itemx -mfast-sw-div
29685 Do not use table-based fast divide for small numbers. The default 
29686 is to use the fast divide at @option{-O3} and above.
29688 @opindex mno-hw-mul
29689 @opindex mhw-mul
29690 @opindex mno-hw-mulx
29691 @opindex mhw-mulx
29692 @opindex mno-hw-div
29693 @opindex mhw-div
29694 @item -mno-hw-mul
29695 @itemx -mhw-mul
29696 @itemx -mno-hw-mulx
29697 @itemx -mhw-mulx
29698 @itemx -mno-hw-div
29699 @itemx -mhw-div
29700 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
29701 instructions by the compiler. The default is to emit @code{mul}
29702 and not emit @code{div} and @code{mulx}.
29704 @item -mbmx
29705 @itemx -mno-bmx
29706 @itemx -mcdx
29707 @itemx -mno-cdx
29708 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
29709 CDX (code density) instructions.  Enabling these instructions also
29710 requires @option{-march=r2}.  Since these instructions are optional
29711 extensions to the R2 architecture, the default is not to emit them.
29713 @opindex mcustom-@var{insn}
29714 @opindex mno-custom-@var{insn}
29715 @item -mcustom-@var{insn}=@var{N}
29716 @itemx -mno-custom-@var{insn}
29717 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
29718 custom instruction with encoding @var{N} when generating code that uses 
29719 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
29720 instruction 253 for single-precision floating-point add operations instead
29721 of the default behavior of using a library call.
29723 The following values of @var{insn} are supported.  Except as otherwise
29724 noted, floating-point operations are expected to be implemented with
29725 normal IEEE 754 semantics and correspond directly to the C operators or the
29726 equivalent GCC built-in functions (@pxref{Other Builtins}).
29728 Single-precision floating point:
29729 @table @asis
29731 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
29732 Binary arithmetic operations.
29734 @item @samp{fnegs}
29735 Unary negation.
29737 @item @samp{fabss}
29738 Unary absolute value.
29740 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
29741 Comparison operations.
29743 @item @samp{fmins}, @samp{fmaxs}
29744 Floating-point minimum and maximum.  These instructions are only
29745 generated if @option{-ffinite-math-only} is specified.
29747 @item @samp{fsqrts}
29748 Unary square root operation.
29750 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
29751 Floating-point trigonometric and exponential functions.  These instructions
29752 are only generated if @option{-funsafe-math-optimizations} is also specified.
29754 @end table
29756 Double-precision floating point:
29757 @table @asis
29759 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
29760 Binary arithmetic operations.
29762 @item @samp{fnegd}
29763 Unary negation.
29765 @item @samp{fabsd}
29766 Unary absolute value.
29768 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
29769 Comparison operations.
29771 @item @samp{fmind}, @samp{fmaxd}
29772 Double-precision minimum and maximum.  These instructions are only
29773 generated if @option{-ffinite-math-only} is specified.
29775 @item @samp{fsqrtd}
29776 Unary square root operation.
29778 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
29779 Double-precision trigonometric and exponential functions.  These instructions
29780 are only generated if @option{-funsafe-math-optimizations} is also specified.
29782 @end table
29784 Conversions:
29785 @table @asis
29786 @item @samp{fextsd}
29787 Conversion from single precision to double precision.
29789 @item @samp{ftruncds}
29790 Conversion from double precision to single precision.
29792 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
29793 Conversion from floating point to signed or unsigned integer types, with
29794 truncation towards zero.
29796 @item @samp{round}
29797 Conversion from single-precision floating point to signed integer,
29798 rounding to the nearest integer and ties away from zero.
29799 This corresponds to the @code{__builtin_lroundf} function when
29800 @option{-fno-math-errno} is used.
29802 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
29803 Conversion from signed or unsigned integer types to floating-point types.
29805 @end table
29807 In addition, all of the following transfer instructions for internal
29808 registers X and Y must be provided to use any of the double-precision
29809 floating-point instructions.  Custom instructions taking two
29810 double-precision source operands expect the first operand in the
29811 64-bit register X.  The other operand (or only operand of a unary
29812 operation) is given to the custom arithmetic instruction with the
29813 least significant half in source register @var{src1} and the most
29814 significant half in @var{src2}.  A custom instruction that returns a
29815 double-precision result returns the most significant 32 bits in the
29816 destination register and the other half in 32-bit register Y.  
29817 GCC automatically generates the necessary code sequences to write
29818 register X and/or read register Y when double-precision floating-point
29819 instructions are used.
29821 @table @asis
29823 @item @samp{fwrx}
29824 Write @var{src1} into the least significant half of X and @var{src2} into
29825 the most significant half of X.
29827 @item @samp{fwry}
29828 Write @var{src1} into Y.
29830 @item @samp{frdxhi}, @samp{frdxlo}
29831 Read the most or least (respectively) significant half of X and store it in
29832 @var{dest}.
29834 @item @samp{frdy}
29835 Read the value of Y and store it into @var{dest}.
29836 @end table
29838 Note that you can gain more local control over generation of Nios II custom
29839 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
29840 and @code{target("no-custom-@var{insn}")} function attributes
29841 (@pxref{Function Attributes})
29842 or pragmas (@pxref{Function Specific Option Pragmas}).
29844 @opindex mcustom-fpu-cfg
29845 @item -mcustom-fpu-cfg=@var{name}
29847 This option enables a predefined, named set of custom instruction encodings
29848 (see @option{-mcustom-@var{insn}} above).  
29849 Currently, the following sets are defined:
29851 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
29852 @gccoptlist{-mcustom-fmuls=252
29853 -mcustom-fadds=253
29854 -mcustom-fsubs=254
29855 -fsingle-precision-constant}
29857 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
29858 @gccoptlist{-mcustom-fmuls=252
29859 -mcustom-fadds=253
29860 -mcustom-fsubs=254
29861 -mcustom-fdivs=255
29862 -fsingle-precision-constant}
29864 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
29865 @gccoptlist{-mcustom-floatus=243
29866 -mcustom-fixsi=244
29867 -mcustom-floatis=245
29868 -mcustom-fcmpgts=246
29869 -mcustom-fcmples=249
29870 -mcustom-fcmpeqs=250
29871 -mcustom-fcmpnes=251
29872 -mcustom-fmuls=252
29873 -mcustom-fadds=253
29874 -mcustom-fsubs=254
29875 -mcustom-fdivs=255
29876 -fsingle-precision-constant}
29878 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
29879 @gccoptlist{-mcustom-fabss=224
29880 -mcustom-fnegs=225
29881 -mcustom-fcmpnes=226
29882 -mcustom-fcmpeqs=227
29883 -mcustom-fcmpges=228
29884 -mcustom-fcmpgts=229
29885 -mcustom-fcmples=230
29886 -mcustom-fcmplts=231
29887 -mcustom-fmaxs=232
29888 -mcustom-fmins=233
29889 -mcustom-round=248
29890 -mcustom-fixsi=249
29891 -mcustom-floatis=250
29892 -mcustom-fsqrts=251
29893 -mcustom-fmuls=252
29894 -mcustom-fadds=253
29895 -mcustom-fsubs=254
29896 -mcustom-fdivs=255}
29898 Custom instruction assignments given by individual
29899 @option{-mcustom-@var{insn}=} options override those given by
29900 @option{-mcustom-fpu-cfg=}, regardless of the
29901 order of the options on the command line.
29903 Note that you can gain more local control over selection of a FPU
29904 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
29905 function attribute (@pxref{Function Attributes})
29906 or pragma (@pxref{Function Specific Option Pragmas}).
29908 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
29909 Hardware 2 Component}.  Please note that the custom instructions enabled by
29910 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
29911 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
29912 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
29913 specified.  In contrast to the other configurations,
29914 @option{-fsingle-precision-constant} is not set.
29916 @end table
29918 These additional @samp{-m} options are available for the Altera Nios II
29919 ELF (bare-metal) target:
29921 @table @gcctabopt
29923 @opindex mhal
29924 @item -mhal
29925 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
29926 startup and termination code, and is typically used in conjunction with
29927 @option{-msys-crt0=} to specify the location of the alternate startup code
29928 provided by the HAL BSP.
29930 @opindex msmallc
29931 @item -msmallc
29932 Link with a limited version of the C library, @option{-lsmallc}, rather than
29933 Newlib.
29935 @opindex msys-crt0
29936 @item -msys-crt0=@var{startfile}
29937 @var{startfile} is the file name of the startfile (crt0) to use 
29938 when linking.  This option is only useful in conjunction with @option{-mhal}.
29940 @opindex msys-lib
29941 @item -msys-lib=@var{systemlib}
29942 @var{systemlib} is the library name of the library that provides
29943 low-level system calls required by the C library,
29944 e.g.@: @code{read} and @code{write}.
29945 This option is typically used to link with a library provided by a HAL BSP.
29947 @end table
29949 @node Nvidia PTX Options
29950 @subsection Nvidia PTX Options
29951 @cindex Nvidia PTX options
29952 @cindex nvptx options
29954 These options are defined for Nvidia PTX:
29956 @table @gcctabopt
29958 @opindex m64
29959 @item -m64
29960 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
29961 supported.
29963 @opindex march
29964 @item -march=@var{architecture-string}
29965 Generate code for the specified PTX ISA target architecture
29966 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
29967 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
29968 @samp{sm_80}.
29969 The default depends on how the compiler has been configured, see
29970 @option{--with-arch}.
29972 This option sets the value of the preprocessor macro
29973 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
29974 @samp{350}.
29976 @opindex misa
29977 @item -misa=@var{architecture-string}
29978 Alias of @option{-march=}.
29980 @opindex march
29981 @item -march-map=@var{architecture-string}
29982 Select the closest available @option{-march=} value that is not more
29983 capable.  For instance, for @option{-march-map=sm_50} select
29984 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
29985 @option{-march=sm_53}.
29987 @opindex mptx
29988 @item -mptx=@var{version-string}
29989 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
29990 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
29991 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
29992 version is required for specified PTX ISA target architecture via
29993 option @option{-march=}.
29995 This option sets the values of the preprocessor macros
29996 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
29997 for instance, for @samp{3.1} the macros have the values @samp{3} and
29998 @samp{1}, respectively.
30000 @opindex mmainkernel
30001 @item -mmainkernel
30002 Link in code for a __main kernel.  This is for stand-alone instead of
30003 offloading execution.
30005 @opindex moptimize
30006 @item -moptimize
30007 Apply partitioned execution optimizations.  This is the default when any
30008 level of optimization is selected.
30010 @opindex msoft-stack
30011 @item -msoft-stack
30012 Generate code that does not use @code{.local} memory
30013 directly for stack storage. Instead, a per-warp stack pointer is
30014 maintained explicitly. This enables variable-length stack allocation (with
30015 variable-length arrays or @code{alloca}), and when global memory is used for
30016 underlying storage, makes it possible to access automatic variables from other
30017 threads, or with atomic instructions. This code generation variant is used
30018 for OpenMP offloading, but the option is exposed on its own for the purpose
30019 of testing the compiler; to generate code suitable for linking into programs
30020 using OpenMP offloading, use option @option{-mgomp}.
30022 @opindex muniform-simt
30023 @item -muniform-simt
30024 Switch to code generation variant that allows to execute all threads in each
30025 warp, while maintaining memory state and side effects as if only one thread
30026 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
30027 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
30028 current lane index equals the master lane index), and the register being
30029 assigned is copied via a shuffle instruction from the master lane.  Outside of
30030 SIMD regions lane 0 is the master; inside, each thread sees itself as the
30031 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
30032 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
30033 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
30034 with current lane index to compute the master lane index.
30036 @opindex mgomp
30037 @item -mgomp
30038 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
30039 @option{-muniform-simt} options, and selects corresponding multilib variant.
30041 @end table
30043 @node OpenRISC Options
30044 @subsection OpenRISC Options
30045 @cindex OpenRISC Options
30047 These options are defined for OpenRISC:
30049 @table @gcctabopt
30051 @opindex mboard
30052 @item -mboard=@var{name}
30053 Configure a board specific runtime.  This will be passed to the linker for
30054 newlib board library linking.  The default is @code{or1ksim}.
30056 @opindex mnewlib
30057 @item -mnewlib
30058 This option is ignored; it is for compatibility purposes only.  This used to
30059 select linker and preprocessor options for use with newlib.
30061 @opindex msoft-div
30062 @opindex mhard-div
30063 @item -msoft-div
30064 @itemx -mhard-div
30065 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
30066 This default is hardware divide.
30068 @opindex msoft-mul
30069 @opindex mhard-mul
30070 @item -msoft-mul
30071 @itemx -mhard-mul
30072 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
30073 This default is hardware multiply.
30075 @opindex msoft-float
30076 @opindex mhard-float
30077 @item -msoft-float
30078 @itemx -mhard-float
30079 Select software or hardware for floating point operations.
30080 The default is software.
30082 @opindex mdouble-float
30083 @item -mdouble-float
30084 When @option{-mhard-float} is selected, enables generation of double-precision
30085 floating point instructions.  By default functions from @file{libgcc} are used
30086 to perform double-precision floating point operations.
30088 @opindex munordered-float
30089 @item -munordered-float
30090 When @option{-mhard-float} is selected, enables generation of unordered
30091 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
30092 functions from @file{libgcc} are used to perform unordered floating point
30093 compare and set flag operations.
30095 @opindex mcmov
30096 @item -mcmov
30097 Enable generation of conditional move (@code{l.cmov}) instructions.  By
30098 default the equivalent will be generated using set and branch.
30100 @opindex mror
30101 @item -mror
30102 Enable generation of rotate right (@code{l.ror}) instructions.  By default
30103 functions from @file{libgcc} are used to perform rotate right operations.
30105 @opindex mrori
30106 @item -mrori
30107 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
30108 By default functions from @file{libgcc} are used to perform rotate right with
30109 immediate operations.
30111 @opindex msext
30112 @item -msext
30113 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
30114 memory loads are used to perform sign extension.
30116 @opindex msfimm
30117 @item -msfimm
30118 Enable generation of compare and set flag with immediate (@code{l.sf*i})
30119 instructions.  By default extra instructions will be generated to store the
30120 immediate to a register first.
30122 @opindex mshftimm
30123 @item -mshftimm
30124 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
30125 @code{l.slli}) instructions.  By default extra instructions will be generated
30126 to store the immediate to a register first.
30128 @opindex mcmodel=small
30129 @item -mcmodel=small
30130 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
30131 the default model.
30133 @opindex mcmodel=large
30134 @item -mcmodel=large
30135 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
30138 @end table
30140 @node PDP-11 Options
30141 @subsection PDP-11 Options
30142 @cindex PDP-11 Options
30144 These options are defined for the PDP-11:
30146 @table @gcctabopt
30147 @opindex mfpu
30148 @item -mfpu
30149 Use hardware FPP floating point.  This is the default.  (FIS floating
30150 point on the PDP-11/40 is not supported.)  Implies -m45.
30152 @opindex msoft-float
30153 @item -msoft-float
30154 Do not use hardware floating point.
30156 @opindex mac0
30157 @item -mac0
30158 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
30160 @opindex mno-ac0
30161 @item -mno-ac0
30162 Return floating-point results in memory.  This is the default.
30164 @opindex m40
30165 @item -m40
30166 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
30168 @opindex m45
30169 @item -m45
30170 Generate code for a PDP-11/45.  This is the default.
30172 @opindex m10
30173 @item -m10
30174 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
30176 @opindex mint16
30177 @opindex mno-int32
30178 @item -mint16
30179 @itemx -mno-int32
30180 Use 16-bit @code{int}.  This is the default.
30182 @opindex mint32
30183 @opindex mno-int16
30184 @item -mint32
30185 @itemx -mno-int16
30186 Use 32-bit @code{int}.
30188 @opindex msplit
30189 @item -msplit
30190 Target has split instruction and data space.  Implies -m45.
30192 @opindex munix-asm
30193 @item -munix-asm
30194 Use Unix assembler syntax.
30196 @opindex mdec-asm
30197 @item -mdec-asm
30198 Use DEC assembler syntax.
30200 @opindex mgnu-asm
30201 @item -mgnu-asm
30202 Use GNU assembler syntax.  This is the default.
30204 @opindex mlra
30205 @item -mlra
30206 Use the new LRA register allocator.  By default, the old ``reload''
30207 allocator is used.
30208 @end table
30210 @node PowerPC Options
30211 @subsection PowerPC Options
30212 @cindex PowerPC options
30214 These are listed under @xref{RS/6000 and PowerPC Options}.
30216 @node PRU Options
30217 @subsection PRU Options
30218 @cindex PRU Options
30220 These command-line options are defined for PRU target:
30222 @table @gcctabopt
30223 @opindex minrt
30224 @item -minrt
30225 Link with a minimum runtime environment.  This can significantly reduce
30226 the size of the final ELF binary, but some standard C runtime features
30227 are removed.
30229 This option disables support for static initializers and constructors.
30230 Beware that the compiler could still generate code with static initializers
30231 and constructors.  It is up to the programmer to ensure that the source
30232 program will not use those features.
30234 The minimal startup code would not pass @code{argc} and @code{argv} arguments
30235 to @code{main}, so the latter must be declared as @code{int main (void)}.
30236 This is already the norm for most firmware projects.
30238 @opindex mmcu
30239 @item -mmcu=@var{mcu}
30240 Specify the PRU hardware variant to use.  A correspondingly named
30241 spec file would be loaded, passing the memory region sizes to
30242 the linker and defining hardware-specific C macros.
30244 Newlib provides only the @code{sim} spec, intended for running
30245 regression tests using a simulator.  Specs for real hardware can be
30246 obtained by installing the
30247 @w{@uref{https://github.com/dinuxbg/gnuprumcu/,GnuPruMcu}} package.
30249 @opindex mno-relax
30250 @item -mno-relax
30251 Make GCC pass the @option{--no-relax} command-line option to the linker
30252 instead of the @option{--relax} option.
30254 @opindex mloop
30255 @item -mloop
30256 Allow (or do not allow) GCC to use the LOOP instruction.
30258 @opindex mabi
30259 @item -mabi=@var{variant}
30260 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
30261 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
30262 more naturally with certain GCC assumptions.  These are the differences:
30264 @table @samp
30265 @item Function Pointer Size
30266 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
30267 supports only 32-bit data and code pointers.
30269 @item Optional Return Value Pointer
30270 Function return values larger than 64 bits are passed by using a hidden
30271 pointer as the first argument of the function.  TI ABI, though, mandates that
30272 the pointer can be NULL in case the caller is not using the returned value.
30273 GNU always passes and expects a valid return value pointer.
30275 @end table
30277 The current @option{-mabi=ti} implementation simply raises a compile error
30278 when any of the above code constructs is detected.  As a consequence
30279 the standard C library cannot be built and it is omitted when linking with
30280 @option{-mabi=ti}.
30282 Relaxation is a GNU feature and for safety reasons is disabled when using
30283 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
30284 instructions, so the GNU linker cannot adjust them when shortening adjacent
30285 LDI32 pseudo instructions.
30287 @end table
30289 @node RISC-V Options
30290 @subsection RISC-V Options
30291 @cindex RISC-V Options
30293 These command-line options are defined for RISC-V targets:
30295 @table @gcctabopt
30296 @opindex mbranch-cost
30297 @item -mbranch-cost=@var{n}
30298 Set the cost of branches to roughly @var{n} instructions.
30300 @opindex plt
30301 @item -mplt
30302 @itemx -mno-plt
30303 When generating PIC code, do or don't allow the use of PLTs. Ignored for
30304 non-PIC.  The default is @option{-mplt}.
30306 @opindex mabi
30307 @item -mabi=@var{ABI-string}
30308 Specify integer and floating-point calling convention.  @var{ABI-string}
30309 contains two parts: the size of integer types and the registers used for
30310 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
30311 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
30312 32-bit), and that floating-point values up to 64 bits wide are passed in F
30313 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
30314 allows the compiler to generate code that uses the F and D extensions but only
30315 allows floating-point values up to 32 bits long to be passed in registers; or
30316 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
30317 passed in registers.
30319 The default for this argument is system dependent, users who want a specific
30320 calling convention should specify one explicitly.  The valid calling
30321 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
30322 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
30323 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
30324 invalid because the ABI requires 64-bit values be passed in F registers, but F
30325 registers are only 32 bits wide.  There are also the @samp{ilp32e} ABI that can
30326 only be used with the @samp{rv32e} architecture and the @samp{lp64e} ABI that
30327 can only be used with the @samp{rv64e}.  Those ABIs are not well specified at
30328 present, and are subject to change.
30330 @opindex mfdiv
30331 @item -mfdiv
30332 @itemx -mno-fdiv
30333 Do or don't use hardware floating-point divide and square root instructions.
30334 This requires the F or D extensions for floating-point registers.  The default
30335 is to use them if the specified architecture has these instructions.
30337 @opindex mdiv
30338 @item -mdiv
30339 @itemx -mno-div
30340 Do or don't use hardware instructions for integer division.  This requires the
30341 M extension.  The default is to use them if the specified architecture has
30342 these instructions.
30344 @opindex misa-spec
30345 @item -misa-spec=@var{ISA-spec-string}
30346 Specify the version of the RISC-V Unprivileged (formerly User-Level)
30347 ISA specification to produce code conforming to.  The possibilities
30348 for @var{ISA-spec-string} are:
30349 @table @code
30350 @item 2.2
30351 Produce code conforming to version 2.2.
30352 @item 20190608
30353 Produce code conforming to version 20190608.
30354 @item 20191213
30355 Produce code conforming to version 20191213.
30356 @end table
30357 The default is @option{-misa-spec=20191213} unless GCC has been configured
30358 with @option{--with-isa-spec=} specifying a different default version.
30360 @opindex march
30361 @item -march=@var{ISA-string}
30362 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
30363 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
30364 @samp{rv32imaf}. Additionally, a special value @option{help}
30365 (@option{-march=help}) is accepted to list all supported extensions.
30367 The syntax of the ISA string is defined as follows:
30369 @table @code
30370 @item The string must start with @samp{rv32} or @samp{rv64}, followed by
30371 @samp{i}, @samp{e}, or @samp{g}, referred to as the base ISA.
30372 @item The subsequent part of the string is a list of extension names. Extension
30373 names can be categorized as multi-letter (e.g.@: @samp{zba}) and single-letter
30374 (e.g.@: @samp{v}). Single-letter extensions can appear consecutively,
30375 but multi-letter extensions must be separated by underscores.
30376 @item An underscore can appear anywhere after the base ISA. It has no specific
30377 effect but is used to improve readability and can act as a separator.
30378 @item Extension names may include an optional version number, following the
30379 syntax @samp{<major>p<minor>} or @samp{<major>}, (e.g.@: @samp{m2p1} or
30380 @samp{m2}).
30381 @end table
30383 Supported extension are listed below:
30384 @multitable @columnfractions .10 .10 .80
30385 @headitem Extension Name @tab Supported Version @tab Description
30386 @item i
30387 @tab 2.0, 2.1
30388 @tab Base integer extension.
30390 @item e
30391 @tab 2.0
30392 @tab Reduced base integer extension.
30394 @item g
30395 @tab -
30396 @tab General-purpose computing base extension, @samp{g} will expand to
30397 @samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and
30398 @samp{zifencei}.
30400 @item m
30401 @tab 2.0
30402 @tab Integer multiplication and division extension.
30404 @item a
30405 @tab 2.0, 2.1
30406 @tab Atomic extension.
30408 @item f
30409 @tab 2.0, 2.2
30410 @tab Single-precision floating-point extension.
30412 @item d
30413 @tab 2.0, 2.2
30414 @tab Double-precision floating-point extension.
30416 @item c
30417 @tab 2.0
30418 @tab Compressed extension.
30420 @item h
30421 @tab 1.0
30422 @tab Hypervisor extension.
30424 @item v
30425 @tab 1.0
30426 @tab Vector extension.
30428 @item zicsr
30429 @tab 2.0
30430 @tab Control and status register access extension.
30432 @item zifencei
30433 @tab 2.0
30434 @tab Instruction-fetch fence extension.
30436 @item zicond
30437 @tab 1.0
30438 @tab Integer conditional operations extension.
30440 @item za64rs
30441 @tab 1.0
30442 @tab Reservation set size of 64 bytes.
30444 @item za128rs
30445 @tab 1.0
30446 @tab Reservation set size of 128 bytes.
30448 @item zawrs
30449 @tab 1.0
30450 @tab Wait-on-reservation-set extension.
30452 @item zba
30453 @tab 1.0
30454 @tab Address calculation extension.
30456 @item zbb
30457 @tab 1.0
30458 @tab Basic bit manipulation extension.
30460 @item zbc
30461 @tab 1.0
30462 @tab Carry-less multiplication extension.
30464 @item zbs
30465 @tab 1.0
30466 @tab Single-bit operation extension.
30468 @item zfinx
30469 @tab 1.0
30470 @tab Single-precision floating-point in integer registers extension.
30472 @item zdinx
30473 @tab 1.0
30474 @tab Double-precision floating-point in integer registers extension.
30476 @item zhinx
30477 @tab 1.0
30478 @tab Half-precision floating-point in integer registers extension.
30480 @item zhinxmin
30481 @tab 1.0
30482 @tab Minimal half-precision floating-point in integer registers extension.
30484 @item zbkb
30485 @tab 1.0
30486 @tab Cryptography bit-manipulation extension.
30488 @item zbkc
30489 @tab 1.0
30490 @tab Cryptography carry-less multiply extension.
30492 @item zbkx
30493 @tab 1.0
30494 @tab Cryptography crossbar permutation extension.
30496 @item zkne
30497 @tab 1.0
30498 @tab AES Encryption extension.
30500 @item zknd
30501 @tab 1.0
30502 @tab AES Decryption extension.
30504 @item zknh
30505 @tab 1.0
30506 @tab Hash function extension.
30508 @item zkr
30509 @tab 1.0
30510 @tab Entropy source extension.
30512 @item zksed
30513 @tab 1.0
30514 @tab SM4 block cipher extension.
30516 @item zksh
30517 @tab 1.0
30518 @tab SM3 hash function extension.
30520 @item zkt
30521 @tab 1.0
30522 @tab Data independent execution latency extension.
30524 @item zk
30525 @tab 1.0
30526 @tab Standard scalar cryptography extension.
30528 @item zkn
30529 @tab 1.0
30530 @tab NIST algorithm suite extension.
30532 @item zks
30533 @tab 1.0
30534 @tab ShangMi algorithm suite extension.
30536 @item zihintntl
30537 @tab 1.0
30538 @tab Non-temporal locality hints extension.
30540 @item zihintpause
30541 @tab 1.0
30542 @tab Pause hint extension.
30544 @item zicboz
30545 @tab 1.0
30546 @tab Cache-block zero extension.
30548 @item zicbom
30549 @tab 1.0
30550 @tab Cache-block management extension.
30552 @item zicbop
30553 @tab 1.0
30554 @tab Cache-block prefetch extension.
30556 @item zic64b
30557 @tab 1.0
30558 @tab Cache block size isf 64 bytes.
30560 @item ziccamoa
30561 @tab 1.0
30562 @tab Main memory supports all atomics in A.
30564 @item ziccif
30565 @tab 1.0
30566 @tab Main memory supports instruction fetch with atomicity requirement.
30568 @item zicclsm
30569 @tab 1.0
30570 @tab Main memory supports misaligned loads/stores.
30572 @item ziccrse
30573 @tab 1.0
30574 @tab Main memory supports forward progress on LR/SC sequences.
30576 @item zicntr
30577 @tab 2.0
30578 @tab Standard extension for base counters and timers.
30580 @item zihpm
30581 @tab 2.0
30582 @tab Standard extension for hardware performance counters.
30584 @item ztso
30585 @tab 1.0
30586 @tab Total store ordering extension.
30588 @item zve32x
30589 @tab 1.0
30590 @tab Vector extensions for embedded processors.
30592 @item zve32f
30593 @tab 1.0
30594 @tab Vector extensions for embedded processors.
30596 @item zve64x
30597 @tab 1.0
30598 @tab Vector extensions for embedded processors.
30600 @item zve64f
30601 @tab 1.0
30602 @tab Vector extensions for embedded processors.
30604 @item zve64d
30605 @tab 1.0
30606 @tab Vector extensions for embedded processors.
30608 @item zvl32b
30609 @tab 1.0
30610 @tab Minimum vector length standard extensions
30612 @item zvl64b
30613 @tab 1.0
30614 @tab Minimum vector length standard extensions
30616 @item zvl128b
30617 @tab 1.0
30618 @tab Minimum vector length standard extensions
30620 @item zvl256b
30621 @tab 1.0
30622 @tab Minimum vector length standard extensions
30624 @item zvl512b
30625 @tab 1.0
30626 @tab Minimum vector length standard extensions
30628 @item zvl1024b
30629 @tab 1.0
30630 @tab Minimum vector length standard extensions
30632 @item zvl2048b
30633 @tab 1.0
30634 @tab Minimum vector length standard extensions
30636 @item zvl4096b
30637 @tab 1.0
30638 @tab Minimum vector length standard extensions
30640 @item zvbb
30641 @tab 1.0
30642 @tab Vector basic bit-manipulation extension.
30644 @item zvbc
30645 @tab 1.0
30646 @tab Vector carryless multiplication extension.
30648 @item zvkb
30649 @tab 1.0
30650 @tab Vector cryptography bit-manipulation extension.
30652 @item zvkg
30653 @tab 1.0
30654 @tab Vector GCM/GMAC extension.
30656 @item zvkned
30657 @tab 1.0
30658 @tab Vector AES block cipher extension.
30660 @item zvknha
30661 @tab 1.0
30662 @tab Vector SHA-2 secure hash extension.
30664 @item zvknhb
30665 @tab 1.0
30666 @tab Vector SHA-2 secure hash extension.
30668 @item zvksed
30669 @tab 1.0
30670 @tab Vector SM4 Block Cipher extension.
30672 @item zvksh
30673 @tab 1.0
30674 @tab Vector SM3 Secure Hash extension.
30676 @item zvkn
30677 @tab 1.0
30678 @tab Vector NIST Algorithm Suite extension, @samp{zvkn} will expand to
30679 @samp{zvkned}, @samp{zvknhb}, @samp{zvkb} and @samp{zvkt}.
30681 @item zvknc
30682 @tab 1.0
30683 @tab Vector NIST Algorithm Suite with carryless multiply extension, @samp{zvknc}
30684 will expand to @samp{zvkn} and @samp{zvbc}.
30686 @item zvkng
30687 @tab 1.0
30688 @tab Vector NIST Algorithm Suite with GCM extension, @samp{zvkng} will expand
30689 to @samp{zvkn} and @samp{zvkg}.
30691 @item zvks
30692 @tab 1.0
30693 @tab Vector ShangMi algorithm suite extension, @samp{zvks} will expand
30694 to @samp{zvksed}, @samp{zvksh}, @samp{zvkb} and @samp{zvkt}.
30696 @item zvksc
30697 @tab 1.0
30698 @tab Vector ShangMi algorithm suite with carryless multiplication extension,
30699 @samp{zvksc} will expand to @samp{zvks} and @samp{zvbc}.
30701 @item zvksg
30702 @tab 1.0
30703 @tab Vector ShangMi algorithm suite with GCM extension, @samp{zvksg} will expand
30704 to @samp{zvks} and @samp{zvkg}.
30706 @item zvkt
30707 @tab 1.0
30708 @tab Vector data independent execution latency extension.
30710 @item zfh
30711 @tab 1.0
30712 @tab Half-precision floating-point extension.
30714 @item zfhmin
30715 @tab 1.0
30716 @tab Minimal half-precision floating-point extension.
30718 @item zvfh
30719 @tab 1.0
30720 @tab Vector half-precision floating-point extension.
30722 @item zvfhmin
30723 @tab 1.0
30724 @tab Vector minimal half-precision floating-point extension.
30726 @item zvfbfmin
30727 @tab 1.0
30728 @tab Vector BF16 converts extension.
30730 @item zfa
30731 @tab 1.0
30732 @tab Additional floating-point extension.
30734 @item zmmul
30735 @tab 1.0
30736 @tab Integer multiplication extension.
30738 @item zca
30739 @tab 1.0
30740 @tab Integer compressed instruction extension.
30742 @item zcf
30743 @tab 1.0
30744 @tab Compressed single-precision floating point loads and stores extension.
30746 @item zcd
30747 @tab 1.0
30748 @tab Compressed double-precision floating point loads and stores extension.
30750 @item zcb
30751 @tab 1.0
30752 @tab Simple compressed instruction extension.
30754 @item zce
30755 @tab 1.0
30756 @tab Compressed instruction extensions for embedded processors.
30758 @item zcmp
30759 @tab 1.0
30760 @tab Compressed push pop extension.
30762 @item zcmt
30763 @tab 1.0
30764 @tab Table jump instruction extension.
30766 @item smaia
30767 @tab 1.0
30768 @tab Advanced interrupt architecture extension.
30770 @item smepmp
30771 @tab 1.0
30772 @tab PMP Enhancements for memory access and execution prevention on Machine mode.
30774 @item smstateen
30775 @tab 1.0
30776 @tab State enable extension.
30778 @item ssaia
30779 @tab 1.0
30780 @tab Advanced interrupt architecture extension for supervisor-mode.
30782 @item sscofpmf
30783 @tab 1.0
30784 @tab Count overflow & filtering extension.
30786 @item ssstateen
30787 @tab 1.0
30788 @tab State-enable extension for supervisor-mode.
30790 @item sstc
30791 @tab 1.0
30792 @tab Supervisor-mode timer interrupts extension.
30794 @item svinval
30795 @tab 1.0
30796 @tab Fine-grained address-translation cache invalidation extension.
30798 @item svnapot
30799 @tab 1.0
30800 @tab NAPOT translation contiguity extension.
30802 @item svpbmt
30803 @tab 1.0
30804 @tab Page-based memory types extension.
30806 @item xcvmac
30807 @tab 1.0
30808 @tab Core-V multiply-accumulate extension.
30810 @item xcvalu
30811 @tab 1.0
30812 @tab Core-V miscellaneous ALU extension.
30814 @item xcvelw
30815 @tab 1.0
30816 @tab Core-V event load word extension.
30818 @item xtheadba
30819 @tab 1.0
30820 @tab T-head address calculation extension.
30822 @item xtheadbb
30823 @tab 1.0
30824 @tab T-head basic bit-manipulation extension.
30826 @item xtheadbs
30827 @tab 1.0
30828 @tab T-head single-bit instructions extension.
30830 @item xtheadcmo
30831 @tab 1.0
30832 @tab T-head cache management operations extension.
30834 @item xtheadcondmov
30835 @tab 1.0
30836 @tab T-head conditional move extension.
30838 @item xtheadfmemidx
30839 @tab 1.0
30840 @tab T-head indexed memory operations for floating-point registers extension.
30842 @item xtheadfmv
30843 @tab 1.0
30844 @tab T-head double floating-point high-bit data transmission extension.
30846 @item xtheadint
30847 @tab 1.0
30848 @tab T-head acceleration interruption extension.
30850 @item xtheadmac
30851 @tab 1.0
30852 @tab T-head multiply-accumulate extension.
30854 @item xtheadmemidx
30855 @tab 1.0
30856 @tab T-head indexed memory operation extension.
30858 @item xtheadmempair
30859 @tab 1.0
30860 @tab T-head two-GPR memory operation extension.
30862 @item xtheadsync
30863 @tab 1.0
30864 @tab T-head multi-core synchronization extension.
30866 @item xventanacondops
30867 @tab 1.0
30868 @tab Ventana integer conditional operations extension.
30870 @end multitable
30872 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
30874 If both @option{-march} and @option{-mcpu=} are not specified, the default for
30875 this argument is system dependent, users who want a specific architecture
30876 extensions should specify one explicitly.
30878 @opindex mcpu
30879 @item -mcpu=@var{processor-string}
30880 Use architecture of and optimize the output for the given processor, specified
30881 by particular CPU name.
30882 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
30883 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
30884 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
30885 @samp{sifive-u54}, @samp{sifive-u74}, @samp{sifive-x280}, @samp{sifive-xp450},
30886 @samp{sifive-x670}.
30888 Note that @option{-mcpu} does not override @option{-march} or @option{-mtune}.
30890 @opindex mtune
30891 @item -mtune=@var{processor-string}
30892 Optimize the output for the given processor, specified by microarchitecture or
30893 particular CPU name.  Permissible values for this option are: @samp{rocket},
30894 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
30895 @samp{thead-c906}, @samp{size}, @samp{sifive-p400-series},
30896 @samp{sifive-p600-series}, and all valid options for @option{-mcpu=}.
30898 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
30899 the default is @samp{rocket} if both are not specified.
30901 The @samp{size} choice is not intended for use by end-users.  This is used
30902 when @option{-Os} is specified.  It overrides the instruction cost info
30903 provided by @option{-mtune=}, but does not override the pipeline info.  This
30904 helps reduce code size while still giving good performance.
30906 @opindex mpreferred-stack-boundary
30907 @item -mpreferred-stack-boundary=@var{num}
30908 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
30909 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
30910 the default is 4 (16 bytes or 128-bits).
30912 @strong{Warning:} If you use this switch, then you must build all modules with
30913 the same value, including any libraries.  This includes the system libraries
30914 and startup modules.
30916 @opindex msmall-data-limit
30917 @item -msmall-data-limit=@var{n}
30918 Put global and static data smaller than @var{n} bytes into a special section
30919 (on some targets).
30921 @opindex msave-restore
30922 @item -msave-restore
30923 @itemx -mno-save-restore
30924 Do or don't use smaller but slower prologue and epilogue code that uses
30925 library function calls.  The default is to use fast inline prologues and
30926 epilogues.
30928 @opindex mmovcc
30929 @item -mmovcc
30930 @itemx -mno-movcc
30931 Do or don't produce branchless conditional-move code sequences even with
30932 targets that do not have specific instructions for conditional operations.
30933 If enabled, sequences of ALU operations are produced using base integer
30934 ISA instructions where profitable.
30936 @opindex minline-atomics
30937 @item -minline-atomics
30938 @itemx -mno-inline-atomics
30939 Do or don't use smaller but slower subword atomic emulation code that uses
30940 libatomic function calls.  The default is to use fast inline subword atomics
30941 that do not require libatomic.
30943 @opindex minline-strlen
30944 @item -minline-strlen
30945 @itemx -mno-inline-strlen
30946 Do or do not attempt to inline strlen calls if possible.
30947 Inlining will only be done if the string is properly aligned
30948 and instructions for accelerated processing are available.
30949 The default is to not inline strlen calls.
30951 @opindex minline-strcmp
30952 @item -minline-strcmp
30953 @itemx -mno-inline-strcmp
30954 Do or do not attempt to inline strcmp calls if possible.
30955 Inlining will only be done if the strings are properly aligned
30956 and instructions for accelerated processing are available.
30957 The default is to not inline strcmp calls.
30959 The @option{--param riscv-strcmp-inline-limit=@var{n}} parameter controls
30960 the maximum number of bytes compared by the inlined code.
30961 The default value is 64.
30963 @opindex minline-strncmp
30964 @item -minline-strncmp
30965 @itemx -mno-inline-strncmp
30966 Do or do not attempt to inline strncmp calls if possible.
30967 Inlining will only be done if the strings are properly aligned
30968 and instructions for accelerated processing are available.
30969 The default is to not inline strncmp calls.
30971 The @option{--param riscv-strcmp-inline-limit=@var{n}} parameter controls
30972 the maximum number of bytes compared by the inlined code.
30973 The default value is 64.
30975 @opindex mshorten-memrefs
30976 @item -mshorten-memrefs
30977 @itemx -mno-shorten-memrefs
30978 Do or do not attempt to make more use of compressed load/store instructions by
30979 replacing a load/store of 'base register + large offset' with a new load/store
30980 of 'new base + small offset'.  If the new base gets stored in a compressed
30981 register, then the new load/store can be compressed.  Currently targets 32-bit
30982 integer load/stores only.
30984 @opindex mstrict-align
30985 @item -mstrict-align
30986 @itemx -mno-strict-align
30987 Do not or do generate unaligned memory accesses.  The default is set depending
30988 on whether the processor we are optimizing for supports fast unaligned access
30989 or not.
30991 @opindex mcmodel=medlow
30992 @item -mcmodel=medlow
30993 Generate code for the medium-low code model. The program and its statically
30994 defined symbols must lie within a single 2 GiB address range and must lie
30995 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
30996 statically or dynamically linked. This is the default code model.
30998 @opindex mcmodel=medany
30999 @item -mcmodel=medany
31000 Generate code for the medium-any code model. The program and its statically
31001 defined symbols must be within any single 2 GiB address range. Programs can be
31002 statically or dynamically linked.
31004 The code generated by the medium-any code model is position-independent, but is
31005 not guaranteed to function correctly when linked into position-independent
31006 executables or libraries.
31008 @item -mexplicit-relocs
31009 @itemx -mno-exlicit-relocs
31010 Use or do not use assembler relocation operators when dealing with symbolic
31011 addresses.  The alternative is to use assembler macros instead, which may
31012 limit optimization.
31014 @opindex mrelax
31015 @item -mrelax
31016 @itemx -mno-relax
31017 Take advantage of linker relaxations to reduce the number of instructions
31018 required to materialize symbol addresses. The default is to take advantage of
31019 linker relaxations.
31021 @opindex mriscv-attribute
31022 @item -mriscv-attribute
31023 @itemx -mno-riscv-attribute
31024 Emit (do not emit) RISC-V attribute to record extra information into ELF
31025 objects.  This feature requires at least binutils 2.32.
31027 @opindex mcsr-check
31028 @item -mcsr-check
31029 @itemx -mno-csr-check
31030 Enables or disables the CSR checking.
31032 @opindex malign-data
31033 @item -malign-data=@var{type}
31034 Control how GCC aligns variables and constants of array, structure, or union
31035 types.  Supported values for @var{type} are @samp{xlen} which uses x register
31036 width as the alignment value, and @samp{natural} which uses natural alignment.
31037 @samp{xlen} is the default.
31039 @opindex mbig-endian
31040 @item -mbig-endian
31041 Generate big-endian code.  This is the default when GCC is configured for a
31042 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
31044 @opindex mlittle-endian
31045 @item -mlittle-endian
31046 Generate little-endian code.  This is the default when GCC is configured for a
31047 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
31048 @samp{riscv32be-*-*} target.
31050 @opindex mstack-protector-guard
31051 @opindex mstack-protector-guard-reg
31052 @opindex mstack-protector-guard-offset
31053 @item -mstack-protector-guard=@var{guard}
31054 @itemx -mstack-protector-guard-reg=@var{reg}
31055 @itemx -mstack-protector-guard-offset=@var{offset}
31056 Generate stack protection code using canary at @var{guard}.  Supported
31057 locations are @samp{global} for a global canary or @samp{tls} for per-thread
31058 canary in the TLS block.
31060 With the latter choice the options
31061 @option{-mstack-protector-guard-reg=@var{reg}} and
31062 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
31063 which register to use as base register for reading the canary,
31064 and from what offset from that base register. There is no default
31065 register or offset as this is entirely for use within the Linux
31066 kernel.
31068 @opindex mtls-dialect=desc
31069 @item -mtls-dialect=desc
31070 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
31071 of TLS variables.
31073 @opindex mtls-dialect=trad
31074 @item -mtls-dialect=trad
31075 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
31076 of TLS variables.  This is the default.
31077 @end table
31079 @node RL78 Options
31080 @subsection RL78 Options
31081 @cindex RL78 Options
31083 @table @gcctabopt
31085 @opindex msim
31086 @item -msim
31087 Links in additional target libraries to support operation within a
31088 simulator.
31090 @opindex mmul
31091 @item -mmul=none
31092 @itemx -mmul=g10
31093 @itemx -mmul=g13
31094 @itemx -mmul=g14
31095 @itemx -mmul=rl78
31096 Specifies the type of hardware multiplication and division support to
31097 be used.  The simplest is @code{none}, which uses software for both
31098 multiplication and division.  This is the default.  The @code{g13}
31099 value is for the hardware multiply/divide peripheral found on the
31100 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
31101 the multiplication and division instructions supported by the RL78/G14
31102 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
31103 the value @code{mg10} is an alias for @code{none}.
31105 In addition a C preprocessor macro is defined, based upon the setting
31106 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
31107 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
31109 @opindex mcpu
31110 @item -mcpu=g10
31111 @itemx -mcpu=g13
31112 @itemx -mcpu=g14
31113 @itemx -mcpu=rl78
31114 Specifies the RL78 core to target.  The default is the G14 core, also
31115 known as an S3 core or just RL78.  The G13 or S2 core does not have
31116 multiply or divide instructions, instead it uses a hardware peripheral
31117 for these operations.  The G10 or S1 core does not have register
31118 banks, so it uses a different calling convention.
31120 If this option is set it also selects the type of hardware multiply
31121 support to use, unless this is overridden by an explicit
31122 @option{-mmul=none} option on the command line.  Thus specifying
31123 @option{-mcpu=g13} enables the use of the G13 hardware multiply
31124 peripheral and specifying @option{-mcpu=g10} disables the use of
31125 hardware multiplications altogether.
31127 Note, although the RL78/G14 core is the default target, specifying
31128 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
31129 change the behavior of the toolchain since it also enables G14
31130 hardware multiply support.  If these options are not specified on the
31131 command line then software multiplication routines will be used even
31132 though the code targets the RL78 core.  This is for backwards
31133 compatibility with older toolchains which did not have hardware
31134 multiply and divide support.
31136 In addition a C preprocessor macro is defined, based upon the setting
31137 of this option.  Possible values are: @code{__RL78_G10__},
31138 @code{__RL78_G13__} or @code{__RL78_G14__}.
31140 @opindex mg10
31141 @opindex mg13
31142 @opindex mg14
31143 @opindex mrl78
31144 @item -mg10
31145 @itemx -mg13
31146 @itemx -mg14
31147 @itemx -mrl78
31148 These are aliases for the corresponding @option{-mcpu=} option.  They
31149 are provided for backwards compatibility.
31151 @opindex mallregs
31152 @item -mallregs
31153 Allow the compiler to use all of the available registers.  By default
31154 registers @code{r24..r31} are reserved for use in interrupt handlers.
31155 With this option enabled these registers can be used in ordinary
31156 functions as well.
31158 @opindex m64bit-doubles
31159 @opindex m32bit-doubles
31160 @item -m64bit-doubles
31161 @itemx -m32bit-doubles
31162 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
31163 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
31164 @option{-m32bit-doubles}.
31166 @opindex msave-mduc-in-interrupts
31167 @opindex mno-save-mduc-in-interrupts
31168 @item -msave-mduc-in-interrupts
31169 @itemx -mno-save-mduc-in-interrupts
31170 Specifies that interrupt handler functions should preserve the
31171 MDUC registers.  This is only necessary if normal code might use
31172 the MDUC registers, for example because it performs multiplication
31173 and division operations.  The default is to ignore the MDUC registers
31174 as this makes the interrupt handlers faster.  The target option -mg13
31175 needs to be passed for this to work as this feature is only available
31176 on the G13 target (S2 core).  The MDUC registers will only be saved
31177 if the interrupt handler performs a multiplication or division
31178 operation or it calls another function.
31180 @end table
31182 @node RS/6000 and PowerPC Options
31183 @subsection IBM RS/6000 and PowerPC Options
31184 @cindex RS/6000 and PowerPC Options
31185 @cindex IBM RS/6000 and PowerPC Options
31187 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
31188 @table @gcctabopt
31189 @item -mpowerpc-gpopt
31190 @itemx -mno-powerpc-gpopt
31191 @itemx -mpowerpc-gfxopt
31192 @itemx -mno-powerpc-gfxopt
31193 @need 800
31194 @itemx -mpowerpc64
31195 @itemx -mno-powerpc64
31196 @itemx -mmfcrf
31197 @itemx -mno-mfcrf
31198 @itemx -mpopcntb
31199 @itemx -mno-popcntb
31200 @itemx -mpopcntd
31201 @itemx -mno-popcntd
31202 @itemx -mfprnd
31203 @itemx -mno-fprnd
31204 @need 800
31205 @opindex mpowerpc-gpopt
31206 @opindex mno-powerpc-gpopt
31207 @opindex mpowerpc-gfxopt
31208 @opindex mno-powerpc-gfxopt
31209 @opindex mpowerpc64
31210 @opindex mno-powerpc64
31211 @opindex mmfcrf
31212 @opindex mno-mfcrf
31213 @opindex mpopcntb
31214 @opindex mno-popcntb
31215 @opindex mpopcntd
31216 @opindex mno-popcntd
31217 @opindex mfprnd
31218 @opindex mno-fprnd
31219 @opindex mcmpb
31220 @opindex mno-cmpb
31221 @opindex mhard-dfp
31222 @opindex mno-hard-dfp
31223 @itemx -mcmpb
31224 @itemx -mno-cmpb
31225 @itemx -mhard-dfp
31226 @itemx -mno-hard-dfp
31227 You use these options to specify which instructions are available on the
31228 processor you are using.  The default value of these options is
31229 determined when configuring GCC@.  Specifying the
31230 @option{-mcpu=@var{cpu_type}} overrides the specification of these
31231 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
31232 rather than the options listed above.
31234 Specifying @option{-mpowerpc-gpopt} allows
31235 GCC to use the optional PowerPC architecture instructions in the
31236 General Purpose group, including floating-point square root.  Specifying
31237 @option{-mpowerpc-gfxopt} allows GCC to
31238 use the optional PowerPC architecture instructions in the Graphics
31239 group, including floating-point select.
31241 The @option{-mmfcrf} option allows GCC to generate the move from
31242 condition register field instruction implemented on the POWER4
31243 processor and other processors that support the PowerPC V2.01
31244 architecture.
31245 The @option{-mpopcntb} option allows GCC to generate the popcount and
31246 double-precision FP reciprocal estimate instruction implemented on the
31247 POWER5 processor and other processors that support the PowerPC V2.02
31248 architecture.
31249 The @option{-mpopcntd} option allows GCC to generate the popcount
31250 instruction implemented on the POWER7 processor and other processors
31251 that support the PowerPC V2.06 architecture.
31252 The @option{-mfprnd} option allows GCC to generate the FP round to
31253 integer instructions implemented on the POWER5+ processor and other
31254 processors that support the PowerPC V2.03 architecture.
31255 The @option{-mcmpb} option allows GCC to generate the compare bytes
31256 instruction implemented on the POWER6 processor and other processors
31257 that support the PowerPC V2.05 architecture.
31258 The @option{-mhard-dfp} option allows GCC to generate the decimal
31259 floating-point instructions implemented on some POWER processors.
31261 The @option{-mpowerpc64} option allows GCC to generate the additional
31262 64-bit instructions that are found in the full PowerPC64 architecture
31263 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
31264 @option{-mno-powerpc64}.
31266 @opindex mcpu
31267 @item -mcpu=@var{cpu_type}
31268 Set architecture type, register usage, and
31269 instruction scheduling parameters for machine type @var{cpu_type}.
31270 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
31271 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
31272 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
31273 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
31274 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
31275 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
31276 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
31277 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
31278 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
31279 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
31280 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
31281 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
31283 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
31284 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
31285 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
31286 architecture machine types, with an appropriate, generic processor
31287 model assumed for scheduling purposes.
31289 Specifying @samp{native} as cpu type detects and selects the
31290 architecture option that corresponds to the host processor of the
31291 system performing the compilation.
31292 @option{-mcpu=native} has no effect if GCC does not recognize the
31293 processor.
31295 The other options specify a specific processor.  Code generated under
31296 those options runs best on that processor, and may not run at all on
31297 others.
31299 The @option{-mcpu} options automatically enable or disable the
31300 following options:
31302 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
31303 -mpopcntb  -mpopcntd  -mpowerpc64
31304 -mpowerpc-gpopt  -mpowerpc-gfxopt
31305 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
31306 -mcrypto  -mhtm  -mpower8-fusion
31307 -mquad-memory  -mquad-memory-atomic  -mfloat128
31308 -mfloat128-hardware -mprefixed -mpcrel -mmma
31309 -mrop-protect}
31311 The particular options set for any particular CPU varies between
31312 compiler versions, depending on what setting seems to produce optimal
31313 code for that CPU; it doesn't necessarily reflect the actual hardware's
31314 capabilities.  If you wish to set an individual option to a particular
31315 value, you may specify it after the @option{-mcpu} option, like
31316 @option{-mcpu=970 -mno-altivec}.
31318 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
31319 not enabled or disabled by the @option{-mcpu} option at present because
31320 AIX does not have full support for these options.  You may still
31321 enable or disable them individually if you're sure it'll work in your
31322 environment.
31324 @opindex mtune
31325 @item -mtune=@var{cpu_type}
31326 Set the instruction scheduling parameters for machine type
31327 @var{cpu_type}, but do not set the architecture type or register usage,
31328 as @option{-mcpu=@var{cpu_type}} does.  The same
31329 values for @var{cpu_type} are used for @option{-mtune} as for
31330 @option{-mcpu}.  If both are specified, the code generated uses the
31331 architecture and registers set by @option{-mcpu}, but the
31332 scheduling parameters set by @option{-mtune}.
31334 @opindex mcmodel=small
31335 @item -mcmodel=small
31336 Generate PowerPC64 code for the small model: The TOC is limited to
31337 64k.
31339 @opindex mcmodel=medium
31340 @item -mcmodel=medium
31341 Generate PowerPC64 code for the medium model: The TOC and other static
31342 data may be up to a total of 4G in size.  This is the default for 64-bit
31343 Linux.
31345 @opindex mcmodel=large
31346 @item -mcmodel=large
31347 Generate PowerPC64 code for the large model: The TOC may be up to 4G
31348 in size.  Other data and code is only limited by the 64-bit address
31349 space.
31351 @opindex maltivec
31352 @opindex mno-altivec
31353 @item -maltivec
31354 @itemx -mno-altivec
31355 Generate code that uses (does not use) AltiVec instructions, and also
31356 enable the use of built-in functions that allow more direct access to
31357 the AltiVec instruction set.  You may also need to set
31358 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
31359 enhancements.
31361 When @option{-maltivec} is used, the element order for AltiVec intrinsics
31362 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
31363 match array element order corresponding to the endianness of the
31364 target.  That is, element zero identifies the leftmost element in a
31365 vector register when targeting a big-endian platform, and identifies
31366 the rightmost element in a vector register when targeting a
31367 little-endian platform.
31369 @opindex mvrsave
31370 @opindex mno-vrsave
31371 @item -mvrsave
31372 @itemx -mno-vrsave
31373 Generate VRSAVE instructions when generating AltiVec code.
31375 @opindex msecure-plt
31376 @item -msecure-plt
31377 Generate code that allows @command{ld} and @command{ld.so}
31378 to build executables and shared
31379 libraries with non-executable @code{.plt} and @code{.got} sections.
31380 This is a PowerPC
31381 32-bit SYSV ABI option.
31383 @opindex mbss-plt
31384 @item -mbss-plt
31385 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
31386 fills in, and
31387 requires @code{.plt} and @code{.got}
31388 sections that are both writable and executable.
31389 This is a PowerPC 32-bit SYSV ABI option.
31391 @opindex misel
31392 @opindex mno-isel
31393 @item -misel
31394 @itemx -mno-isel
31395 This switch enables or disables the generation of ISEL instructions.
31397 @opindex mvsx
31398 @opindex mno-vsx
31399 @item -mvsx
31400 @itemx -mno-vsx
31401 Generate code that uses (does not use) vector/scalar (VSX)
31402 instructions, and also enable the use of built-in functions that allow
31403 more direct access to the VSX instruction set.
31405 @opindex mcrypto
31406 @opindex mno-crypto
31407 @item -mcrypto
31408 @itemx -mno-crypto
31409 Enable the use (disable) of the built-in functions that allow direct
31410 access to the cryptographic instructions that were added in version
31411 2.07 of the PowerPC ISA.
31413 @opindex mhtm
31414 @opindex mno-htm
31415 @item -mhtm
31416 @itemx -mno-htm
31417 Enable (disable) the use of the built-in functions that allow direct
31418 access to the Hardware Transactional Memory (HTM) instructions that
31419 were added in version 2.07 of the PowerPC ISA.
31421 @opindex mpower8-fusion
31422 @opindex mno-power8-fusion
31423 @item -mpower8-fusion
31424 @itemx -mno-power8-fusion
31425 Generate code that keeps (does not keeps) some integer operations
31426 adjacent so that the instructions can be fused together on power8 and
31427 later processors.
31429 @opindex mquad-memory
31430 @opindex mno-quad-memory
31431 @item -mquad-memory
31432 @itemx -mno-quad-memory
31433 Generate code that uses (does not use) the non-atomic quad word memory
31434 instructions.  The @option{-mquad-memory} option requires use of
31435 64-bit mode.
31437 @opindex mquad-memory-atomic
31438 @opindex mno-quad-memory-atomic
31439 @item -mquad-memory-atomic
31440 @itemx -mno-quad-memory-atomic
31441 Generate code that uses (does not use) the atomic quad word memory
31442 instructions.  The @option{-mquad-memory-atomic} option requires use of
31443 64-bit mode.
31445 @opindex mfloat128
31446 @opindex mno-float128
31447 @item -mfloat128
31448 @itemx -mno-float128
31449 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
31450 and use either software emulation for IEEE 128-bit floating point or
31451 hardware instructions.
31453 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
31454 128-bit floating point support.  The IEEE 128-bit floating point is only
31455 supported on Linux.
31457 The default for @option{-mfloat128} is enabled on PowerPC Linux
31458 systems using the VSX instruction set, and disabled on other systems.
31460 If you use the ISA 3.0 instruction set (@option{-mcpu=power9}) on a
31461 64-bit system, the IEEE 128-bit floating point support will also enable
31462 the generation of ISA 3.0 IEEE 128-bit floating point instructions.
31463 Otherwise, if you do not specify to generate ISA 3.0 instructions or you
31464 are targeting a 32-bit big endian system, IEEE 128-bit floating point
31465 will be done with software emulation.
31467 @opindex mfloat128-hardware
31468 @opindex mno-float128-hardware
31469 @item -mfloat128-hardware
31470 @itemx -mno-float128-hardware
31471 Enable/disable using ISA 3.0 hardware instructions to support the
31472 @var{__float128} data type.
31474 The default for @option{-mfloat128-hardware} is enabled on PowerPC
31475 Linux systems using the ISA 3.0 instruction set, and disabled on other
31476 systems.
31478 @opindex m32
31479 @opindex m64
31480 @item -m32
31481 @itemx -m64
31482 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
31483 targets (including GNU/Linux).  The 32-bit environment sets int, long
31484 and pointer to 32 bits and generates code that runs on any PowerPC
31485 variant.  The 64-bit environment sets int to 32 bits and long and
31486 pointer to 64 bits, and generates code for PowerPC64, as for
31487 @option{-mpowerpc64}.
31489 @opindex mfull-toc
31490 @opindex mno-fp-in-toc
31491 @opindex mno-sum-in-toc
31492 @opindex mminimal-toc
31493 @item -mfull-toc
31494 @itemx -mno-fp-in-toc
31495 @itemx -mno-sum-in-toc
31496 @itemx -mminimal-toc
31497 Modify generation of the TOC (Table Of Contents), which is created for
31498 every executable file.  The @option{-mfull-toc} option is selected by
31499 default.  In that case, GCC allocates at least one TOC entry for
31500 each unique non-automatic variable reference in your program.  GCC
31501 also places floating-point constants in the TOC@.  However, only
31502 16,384 entries are available in the TOC@.
31504 If you receive a linker error message that saying you have overflowed
31505 the available TOC space, you can reduce the amount of TOC space used
31506 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
31507 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
31508 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
31509 generate code to calculate the sum of an address and a constant at
31510 run time instead of putting that sum into the TOC@.  You may specify one
31511 or both of these options.  Each causes GCC to produce very slightly
31512 slower and larger code at the expense of conserving TOC space.
31514 If you still run out of space in the TOC even when you specify both of
31515 these options, specify @option{-mminimal-toc} instead.  This option causes
31516 GCC to make only one TOC entry for every file.  When you specify this
31517 option, GCC produces code that is slower and larger but which
31518 uses extremely little TOC space.  You may wish to use this option
31519 only on files that contain less frequently-executed code.
31521 @opindex maix64
31522 @opindex maix32
31523 @item -maix64
31524 @itemx -maix32
31525 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
31526 @code{long} type, and the infrastructure needed to support them.
31527 Specifying @option{-maix64} implies @option{-mpowerpc64},
31528 while @option{-maix32} disables the 64-bit ABI and
31529 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
31531 @opindex mxl-compat
31532 @opindex mno-xl-compat
31533 @item -mxl-compat
31534 @itemx -mno-xl-compat
31535 Produce code that conforms more closely to IBM XL compiler semantics
31536 when using AIX-compatible ABI@.  Pass floating-point arguments to
31537 prototyped functions beyond the register save area (RSA) on the stack
31538 in addition to argument FPRs.  Do not assume that most significant
31539 double in 128-bit long double value is properly rounded when comparing
31540 values and converting to double.  Use XL symbol names for long double
31541 support routines.
31543 The AIX calling convention was extended but not initially documented to
31544 handle an obscure K&R C case of calling a function that takes the
31545 address of its arguments with fewer arguments than declared.  IBM XL
31546 compilers access floating-point arguments that do not fit in the
31547 RSA from the stack when a subroutine is compiled without
31548 optimization.  Because always storing floating-point arguments on the
31549 stack is inefficient and rarely needed, this option is not enabled by
31550 default and only is necessary when calling subroutines compiled by IBM
31551 XL compilers without optimization.
31553 @opindex mpe
31554 @item -mpe
31555 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
31556 application written to use message passing with special startup code to
31557 enable the application to run.  The system must have PE installed in the
31558 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
31559 must be overridden with the @option{-specs=} option to specify the
31560 appropriate directory location.  The Parallel Environment does not
31561 support threads, so the @option{-mpe} option and the @option{-pthread}
31562 option are incompatible.
31564 @opindex malign-natural
31565 @opindex malign-power
31566 @item -malign-natural
31567 @itemx -malign-power
31568 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
31569 @option{-malign-natural} overrides the ABI-defined alignment of larger
31570 types, such as floating-point doubles, on their natural size-based boundary.
31571 The option @option{-malign-power} instructs GCC to follow the ABI-specified
31572 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
31574 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
31575 is not supported.
31577 @opindex msoft-float
31578 @opindex mhard-float
31579 @item -msoft-float
31580 @itemx -mhard-float
31581 Generate code that does not use (uses) the floating-point register set.
31582 Software floating-point emulation is provided if you use the
31583 @option{-msoft-float} option, and pass the option to GCC when linking.
31585 @opindex mmultiple
31586 @opindex mno-multiple
31587 @item -mmultiple
31588 @itemx -mno-multiple
31589 Generate code that uses (does not use) the load multiple word
31590 instructions and the store multiple word instructions.  These
31591 instructions are generated by default on POWER systems, and not
31592 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
31593 PowerPC systems, since those instructions do not work when the
31594 processor is in little-endian mode.  The exceptions are PPC740 and
31595 PPC750 which permit these instructions in little-endian mode.
31597 @opindex mupdate
31598 @opindex mno-update
31599 @item -mupdate
31600 @itemx -mno-update
31601 Generate code that uses (does not use) the load or store instructions
31602 that update the base register to the address of the calculated memory
31603 location.  These instructions are generated by default.  If you use
31604 @option{-mno-update}, there is a small window between the time that the
31605 stack pointer is updated and the address of the previous frame is
31606 stored, which means code that walks the stack frame across interrupts or
31607 signals may get corrupted data.
31609 @opindex mavoid-indexed-addresses
31610 @opindex mno-avoid-indexed-addresses
31611 @item -mavoid-indexed-addresses
31612 @itemx -mno-avoid-indexed-addresses
31613 Generate code that tries to avoid (not avoid) the use of indexed load
31614 or store instructions. These instructions can incur a performance
31615 penalty on Power6 processors in certain situations, such as when
31616 stepping through large arrays that cross a 16M boundary.  This option
31617 is enabled by default when targeting Power6 and disabled otherwise.
31619 @opindex mfused-madd
31620 @opindex mno-fused-madd
31621 @item -mfused-madd
31622 @itemx -mno-fused-madd
31623 Generate code that uses (does not use) the floating-point multiply and
31624 accumulate instructions.  These instructions are generated by default
31625 if hardware floating point is used.  The machine-dependent
31626 @option{-mfused-madd} option is now mapped to the machine-independent
31627 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31628 mapped to @option{-ffp-contract=off}.
31630 @opindex mmulhw
31631 @opindex mno-mulhw
31632 @item -mmulhw
31633 @itemx -mno-mulhw
31634 Generate code that uses (does not use) the half-word multiply and
31635 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
31636 These instructions are generated by default when targeting those
31637 processors.
31639 @opindex mdlmzb
31640 @opindex mno-dlmzb
31641 @item -mdlmzb
31642 @itemx -mno-dlmzb
31643 Generate code that uses (does not use) the string-search @samp{dlmzb}
31644 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
31645 generated by default when targeting those processors.
31647 @opindex mno-bit-align
31648 @opindex mbit-align
31649 @item -mno-bit-align
31650 @itemx -mbit-align
31651 On System V.4 and embedded PowerPC systems do not (do) force structures
31652 and unions that contain bit-fields to be aligned to the base type of the
31653 bit-field.
31655 For example, by default a structure containing nothing but 8
31656 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
31657 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
31658 the structure is aligned to a 1-byte boundary and is 1 byte in
31659 size.
31661 @opindex mno-strict-align
31662 @opindex mstrict-align
31663 @item -mno-strict-align
31664 @itemx -mstrict-align
31665 On System V.4 and embedded PowerPC systems do not (do) assume that
31666 unaligned memory references are handled by the system.
31668 @opindex mrelocatable
31669 @opindex mno-relocatable
31670 @item -mrelocatable
31671 @itemx -mno-relocatable
31672 Generate code that allows (does not allow) a static executable to be
31673 relocated to a different address at run time.  A simple embedded
31674 PowerPC system loader should relocate the entire contents of
31675 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
31676 a table of 32-bit addresses generated by this option.  For this to
31677 work, all objects linked together must be compiled with
31678 @option{-mrelocatable} or @option{-mrelocatable-lib}.
31679 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
31681 @opindex mrelocatable-lib
31682 @opindex mno-relocatable-lib
31683 @item -mrelocatable-lib
31684 @itemx -mno-relocatable-lib
31685 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
31686 @code{.fixup} section to allow static executables to be relocated at
31687 run time, but @option{-mrelocatable-lib} does not use the smaller stack
31688 alignment of @option{-mrelocatable}.  Objects compiled with
31689 @option{-mrelocatable-lib} may be linked with objects compiled with
31690 any combination of the @option{-mrelocatable} options.
31692 @opindex mno-toc
31693 @opindex mtoc
31694 @item -mno-toc
31695 @itemx -mtoc
31696 On System V.4 and embedded PowerPC systems do not (do) assume that
31697 register 2 contains a pointer to a global area pointing to the addresses
31698 used in the program.
31700 @opindex mlittle
31701 @opindex mlittle-endian
31702 @item -mlittle
31703 @itemx -mlittle-endian
31704 On System V.4 and embedded PowerPC systems compile code for the
31705 processor in little-endian mode.  The @option{-mlittle-endian} option is
31706 the same as @option{-mlittle}.
31708 @opindex mbig
31709 @opindex mbig-endian
31710 @item -mbig
31711 @itemx -mbig-endian
31712 On System V.4 and embedded PowerPC systems compile code for the
31713 processor in big-endian mode.  The @option{-mbig-endian} option is
31714 the same as @option{-mbig}.
31716 @opindex mdynamic-no-pic
31717 @item -mdynamic-no-pic
31718 On Darwin / macOS systems, compile code so that it is not
31719 relocatable, but that its external references are relocatable.  The
31720 resulting code is suitable for applications, but not shared
31721 libraries.
31723 @opindex msingle-pic-base
31724 @item -msingle-pic-base
31725 Treat the register used for PIC addressing as read-only, rather than
31726 loading it in the prologue for each function.  The runtime system is
31727 responsible for initializing this register with an appropriate value
31728 before execution begins.
31730 @opindex mprioritize-restricted-insns
31731 @item -mprioritize-restricted-insns=@var{priority}
31732 This option controls the priority that is assigned to
31733 dispatch-slot restricted instructions during the second scheduling
31734 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
31735 or @samp{2} to assign no, highest, or second-highest (respectively) 
31736 priority to dispatch-slot restricted
31737 instructions.
31739 @opindex msched-costly-dep
31740 @item -msched-costly-dep=@var{dependence_type}
31741 This option controls which dependences are considered costly
31742 by the target during instruction scheduling.  The argument
31743 @var{dependence_type} takes one of the following values:
31745 @table @asis
31746 @item @samp{no}
31747 No dependence is costly.
31749 @item @samp{all}
31750 All dependences are costly.
31752 @item @samp{true_store_to_load}
31753 A true dependence from store to load is costly.
31755 @item @samp{store_to_load}
31756 Any dependence from store to load is costly.
31758 @item @var{number}
31759 Any dependence for which the latency is greater than or equal to 
31760 @var{number} is costly.
31761 @end table
31763 @opindex minsert-sched-nops
31764 @item -minsert-sched-nops=@var{scheme}
31765 This option controls which NOP insertion scheme is used during
31766 the second scheduling pass.  The argument @var{scheme} takes one of the
31767 following values:
31769 @table @asis
31770 @item @samp{no}
31771 Don't insert NOPs.
31773 @item @samp{pad}
31774 Pad with NOPs any dispatch group that has vacant issue slots,
31775 according to the scheduler's grouping.
31777 @item @samp{regroup_exact}
31778 Insert NOPs to force costly dependent insns into
31779 separate groups.  Insert exactly as many NOPs as needed to force an insn
31780 to a new group, according to the estimated processor grouping.
31782 @item @var{number}
31783 Insert NOPs to force costly dependent insns into
31784 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
31785 @end table
31787 @opindex mcall-sysv
31788 @item -mcall-sysv
31789 On System V.4 and embedded PowerPC systems compile code using calling
31790 conventions that adhere to the March 1995 draft of the System V
31791 Application Binary Interface, PowerPC processor supplement.  This is the
31792 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
31794 @opindex mcall-sysv-eabi
31795 @opindex mcall-eabi
31796 @item -mcall-sysv-eabi
31797 @itemx -mcall-eabi
31798 Specify both @option{-mcall-sysv} and @option{-meabi} options.
31800 @opindex mcall-sysv-noeabi
31801 @item -mcall-sysv-noeabi
31802 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
31804 @opindex mcall-aixdesc
31805 @item -mcall-aixdesc
31806 On System V.4 and embedded PowerPC systems compile code for the AIX
31807 operating system.
31809 @opindex mcall-linux
31810 @item -mcall-linux
31811 On System V.4 and embedded PowerPC systems compile code for the
31812 Linux-based GNU system.
31814 @opindex mcall-freebsd
31815 @item -mcall-freebsd
31816 On System V.4 and embedded PowerPC systems compile code for the
31817 FreeBSD operating system.
31819 @opindex mcall-netbsd
31820 @item -mcall-netbsd
31821 On System V.4 and embedded PowerPC systems compile code for the
31822 NetBSD operating system.
31824 @opindex mcall-openbsd
31825 @item -mcall-openbsd
31826 On System V.4 and embedded PowerPC systems compile code for the
31827 OpenBSD operating system.
31829 @opindex mtraceback
31830 @item -mtraceback=@var{traceback_type}
31831 Select the type of traceback table. Valid values for @var{traceback_type}
31832 are @samp{full}, @samp{part}, and @samp{no}.
31834 @opindex maix-struct-return
31835 @item -maix-struct-return
31836 Return all structures in memory (as specified by the AIX ABI)@.
31838 @opindex msvr4-struct-return
31839 @item -msvr4-struct-return
31840 Return structures smaller than 8 bytes in registers (as specified by the
31841 SVR4 ABI)@.
31843 @opindex mabi
31844 @item -mabi=@var{abi-type}
31845 Extend the current ABI with a particular extension, or remove such extension.
31846 Valid values are: @samp{altivec}, @samp{no-altivec},
31847 @samp{ibmlongdouble}, @samp{ieeelongdouble},
31848 @samp{elfv1}, @samp{elfv2},
31849 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
31851 @opindex mabi=ibmlongdouble
31852 @item -mabi=ibmlongdouble
31853 Change the current ABI to use IBM extended-precision long double.
31854 This is not likely to work if your system defaults to using IEEE
31855 extended-precision long double.  If you change the long double type
31856 from IEEE extended-precision, the compiler will issue a warning unless
31857 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
31858 to be enabled.
31860 @opindex mabi=ieeelongdouble
31861 @item -mabi=ieeelongdouble
31862 Change the current ABI to use IEEE extended-precision long double.
31863 This is not likely to work if your system defaults to using IBM
31864 extended-precision long double.  If you change the long double type
31865 from IBM extended-precision, the compiler will issue a warning unless
31866 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
31867 to be enabled.
31869 @opindex mabi=elfv1
31870 @item -mabi=elfv1
31871 Change the current ABI to use the ELFv1 ABI.
31872 This is the default ABI for big-endian PowerPC 64-bit Linux.
31873 Overriding the default ABI requires special system support and is
31874 likely to fail in spectacular ways.
31876 @opindex mabi=elfv2
31877 @item -mabi=elfv2
31878 Change the current ABI to use the ELFv2 ABI.
31879 This is the default ABI for little-endian PowerPC 64-bit Linux.
31880 Overriding the default ABI requires special system support and is
31881 likely to fail in spectacular ways.
31883 @opindex mgnu-attribute
31884 @opindex mno-gnu-attribute
31885 @item -mgnu-attribute
31886 @itemx -mno-gnu-attribute
31887 Emit .gnu_attribute assembly directives to set tag/value pairs in a
31888 .gnu.attributes section that specify ABI variations in function
31889 parameters or return values.
31891 @opindex mprototype
31892 @opindex mno-prototype
31893 @item -mprototype
31894 @itemx -mno-prototype
31895 On System V.4 and embedded PowerPC systems assume that all calls to
31896 variable argument functions are properly prototyped.  Otherwise, the
31897 compiler must insert an instruction before every non-prototyped call to
31898 set or clear bit 6 of the condition code register (@code{CR}) to
31899 indicate whether floating-point values are passed in the floating-point
31900 registers in case the function takes variable arguments.  With
31901 @option{-mprototype}, only calls to prototyped variable argument functions
31902 set or clear the bit.
31904 @opindex msim
31905 @item -msim
31906 On embedded PowerPC systems, assume that the startup module is called
31907 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
31908 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
31909 configurations.
31911 @opindex mmvme
31912 @item -mmvme
31913 On embedded PowerPC systems, assume that the startup module is called
31914 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
31915 @file{libc.a}.
31917 @opindex mads
31918 @item -mads
31919 On embedded PowerPC systems, assume that the startup module is called
31920 @file{crt0.o} and the standard C libraries are @file{libads.a} and
31921 @file{libc.a}.
31923 @opindex myellowknife
31924 @item -myellowknife
31925 On embedded PowerPC systems, assume that the startup module is called
31926 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
31927 @file{libc.a}.
31929 @opindex mvxworks
31930 @item -mvxworks
31931 On System V.4 and embedded PowerPC systems, specify that you are
31932 compiling for a VxWorks system.
31934 @opindex memb
31935 @item -memb
31936 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
31937 header to indicate that @samp{eabi} extended relocations are used.
31939 @opindex meabi
31940 @opindex mno-eabi
31941 @item -meabi
31942 @itemx -mno-eabi
31943 On System V.4 and embedded PowerPC systems do (do not) adhere to the
31944 Embedded Applications Binary Interface (EABI), which is a set of
31945 modifications to the System V.4 specifications.  Selecting @option{-meabi}
31946 means that the stack is aligned to an 8-byte boundary, a function
31947 @code{__eabi} is called from @code{main} to set up the EABI
31948 environment, and the @option{-msdata} option can use both @code{r2} and
31949 @code{r13} to point to two separate small data areas.  Selecting
31950 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
31951 no EABI initialization function is called from @code{main}, and the
31952 @option{-msdata} option only uses @code{r13} to point to a single
31953 small data area.  The @option{-meabi} option is on by default if you
31954 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
31956 @opindex msdata=eabi
31957 @item -msdata=eabi
31958 On System V.4 and embedded PowerPC systems, put small initialized
31959 @code{const} global and static data in the @code{.sdata2} section, which
31960 is pointed to by register @code{r2}.  Put small initialized
31961 non-@code{const} global and static data in the @code{.sdata} section,
31962 which is pointed to by register @code{r13}.  Put small uninitialized
31963 global and static data in the @code{.sbss} section, which is adjacent to
31964 the @code{.sdata} section.  The @option{-msdata=eabi} option is
31965 incompatible with the @option{-mrelocatable} option.  The
31966 @option{-msdata=eabi} option also sets the @option{-memb} option.
31968 @opindex msdata=sysv
31969 @item -msdata=sysv
31970 On System V.4 and embedded PowerPC systems, put small global and static
31971 data in the @code{.sdata} section, which is pointed to by register
31972 @code{r13}.  Put small uninitialized global and static data in the
31973 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
31974 The @option{-msdata=sysv} option is incompatible with the
31975 @option{-mrelocatable} option.
31977 @opindex msdata=default
31978 @opindex msdata
31979 @item -msdata=default
31980 @itemx -msdata
31981 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
31982 compile code the same as @option{-msdata=eabi}, otherwise compile code the
31983 same as @option{-msdata=sysv}.
31985 @opindex msdata=data
31986 @item -msdata=data
31987 On System V.4 and embedded PowerPC systems, put small global
31988 data in the @code{.sdata} section.  Put small uninitialized global
31989 data in the @code{.sbss} section.  Do not use register @code{r13}
31990 to address small data however.  This is the default behavior unless
31991 other @option{-msdata} options are used.
31993 @opindex msdata=none
31994 @opindex mno-sdata
31995 @item -msdata=none
31996 @itemx -mno-sdata
31997 On embedded PowerPC systems, put all initialized global and static data
31998 in the @code{.data} section, and all uninitialized data in the
31999 @code{.bss} section.
32001 @opindex mreadonly-in-sdata
32002 @opindex mno-readonly-in-sdata
32003 @item -mreadonly-in-sdata
32004 Put read-only objects in the @code{.sdata} section as well.  This is the
32005 default.
32007 @opindex mblock-move-inline-limit
32008 @item -mblock-move-inline-limit=@var{num}
32009 Inline all block moves (such as calls to @code{memcpy} or structure
32010 copies) less than or equal to @var{num} bytes.  The minimum value for
32011 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
32012 targets.  The default value is target-specific.
32014 @opindex mblock-compare-inline-limit
32015 @item -mblock-compare-inline-limit=@var{num}
32016 Generate non-looping inline code for all block compares (such as calls
32017 to @code{memcmp} or structure compares) less than or equal to @var{num}
32018 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
32019 block compare is disabled. The default value is target-specific.
32021 @opindex mblock-compare-inline-loop-limit
32022 @item -mblock-compare-inline-loop-limit=@var{num}
32023 Generate an inline expansion using loop code for all block compares that
32024 are less than or equal to @var{num} bytes, but greater than the limit
32025 for non-loop inline block compare expansion. If the block length is not
32026 constant, at most @var{num} bytes will be compared before @code{memcmp}
32027 is called to compare the remainder of the block. The default value is
32028 target-specific.
32030 @opindex mstring-compare-inline-limit
32031 @item -mstring-compare-inline-limit=@var{num}
32032 Compare at most @var{num} string bytes with inline code.
32033 If the difference or end of string is not found at the
32034 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
32035 take care of the rest of the comparison. The default is 64 bytes.
32037 @opindex G
32038 @cindex smaller data references (PowerPC)
32039 @cindex .sdata/.sdata2 references (PowerPC)
32040 @item -G @var{num}
32041 On embedded PowerPC systems, put global and static items less than or
32042 equal to @var{num} bytes into the small data or BSS sections instead of
32043 the normal data or BSS section.  By default, @var{num} is 8.  The
32044 @option{-G @var{num}} switch is also passed to the linker.
32045 All modules should be compiled with the same @option{-G @var{num}} value.
32047 @opindex mregnames
32048 @opindex mno-regnames
32049 @item -mregnames
32050 @itemx -mno-regnames
32051 On System V.4 and embedded PowerPC systems do (do not) emit register
32052 names in the assembly language output using symbolic forms.
32054 @opindex mlongcall
32055 @opindex mno-longcall
32056 @item -mlongcall
32057 @itemx -mno-longcall
32058 By default assume that all calls are far away so that a longer and more
32059 expensive calling sequence is required.  This is required for calls
32060 farther than 32 megabytes (33,554,432 bytes) from the current location.
32061 A short call is generated if the compiler knows
32062 the call cannot be that far away.  This setting can be overridden by
32063 the @code{shortcall} function attribute, or by @code{#pragma
32064 longcall(0)}.
32066 Some linkers are capable of detecting out-of-range calls and generating
32067 glue code on the fly.  On these systems, long calls are unnecessary and
32068 generate slower code.  As of this writing, the AIX linker can do this,
32069 as can the GNU linker for PowerPC/64.  It is planned to add this feature
32070 to the GNU linker for 32-bit PowerPC systems as well.
32072 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
32073 GCC can generate long calls using an inline PLT call sequence (see
32074 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
32075 ELFv1 (big-endian) do not support inline PLT calls.
32077 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
32078 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
32079 addresses represent the callee and the branch island.  The
32080 Darwin/PPC linker prefers the first address and generates a @code{bl
32081 callee} if the PPC @code{bl} instruction reaches the callee directly;
32082 otherwise, the linker generates @code{bl L42} to call the branch
32083 island.  The branch island is appended to the body of the
32084 calling function; it computes the full 32-bit address of the callee
32085 and jumps to it.
32087 On Mach-O (Darwin) systems, this option directs the compiler emit to
32088 the glue for every direct call, and the Darwin linker decides whether
32089 to use or discard it.
32091 In the future, GCC may ignore all longcall specifications
32092 when the linker is known to generate glue.
32094 @opindex mpltseq
32095 @opindex mno-pltseq
32096 @item -mpltseq
32097 @itemx -mno-pltseq
32098 Implement (do not implement) -fno-plt and long calls using an inline
32099 PLT call sequence that supports lazy linking and long calls to
32100 functions in dlopen'd shared libraries.  Inline PLT calls are only
32101 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
32102 linkers, and are enabled by default if the support is detected when
32103 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
32104 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
32105 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
32106 linked together.
32108 @opindex mtls-markers
32109 @opindex mno-tls-markers
32110 @item -mtls-markers
32111 @itemx -mno-tls-markers
32112 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
32113 specifying the function argument.  The relocation allows the linker to
32114 reliably associate function call with argument setup instructions for
32115 TLS optimization, which in turn allows GCC to better schedule the
32116 sequence.
32118 @opindex mrecip
32119 @item -mrecip
32120 @itemx -mno-recip
32121 This option enables use of the reciprocal estimate and
32122 reciprocal square root estimate instructions with additional
32123 Newton-Raphson steps to increase precision instead of doing a divide or
32124 square root and divide for floating-point arguments.  You should use
32125 the @option{-ffast-math} option when using @option{-mrecip} (or at
32126 least @option{-funsafe-math-optimizations},
32127 @option{-ffinite-math-only}, @option{-freciprocal-math} and
32128 @option{-fno-trapping-math}).  Note that while the throughput of the
32129 sequence is generally higher than the throughput of the non-reciprocal
32130 instruction, the precision of the sequence can be decreased by up to 2
32131 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
32132 roots.
32134 @opindex mrecip=opt
32135 @item -mrecip=@var{opt}
32136 This option controls which reciprocal estimate instructions
32137 may be used.  @var{opt} is a comma-separated list of options, which may
32138 be preceded by a @code{!} to invert the option:
32140 @table @samp
32142 @item all
32143 Enable all estimate instructions.
32145 @item default 
32146 Enable the default instructions, equivalent to @option{-mrecip}.
32148 @item none 
32149 Disable all estimate instructions, equivalent to @option{-mno-recip}.
32151 @item div 
32152 Enable the reciprocal approximation instructions for both 
32153 single and double precision.
32155 @item divf 
32156 Enable the single-precision reciprocal approximation instructions.
32158 @item divd 
32159 Enable the double-precision reciprocal approximation instructions.
32161 @item rsqrt 
32162 Enable the reciprocal square root approximation instructions for both
32163 single and double precision.
32165 @item rsqrtf 
32166 Enable the single-precision reciprocal square root approximation instructions.
32168 @item rsqrtd 
32169 Enable the double-precision reciprocal square root approximation instructions.
32171 @end table
32173 So, for example, @option{-mrecip=all,!rsqrtd} enables
32174 all of the reciprocal estimate instructions, except for the
32175 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
32176 which handle the double-precision reciprocal square root calculations.
32178 @opindex mrecip-precision
32179 @item -mrecip-precision
32180 @itemx -mno-recip-precision
32181 Assume (do not assume) that the reciprocal estimate instructions
32182 provide higher-precision estimates than is mandated by the PowerPC
32183 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
32184 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
32185 The double-precision square root estimate instructions are not generated by
32186 default on low-precision machines, since they do not provide an
32187 estimate that converges after three steps.
32189 @opindex mveclibabi
32190 @item -mveclibabi=@var{type}
32191 Specifies the ABI type to use for vectorizing intrinsics using an
32192 external library.  The only type supported at present is @samp{mass},
32193 which specifies to use IBM's Mathematical Acceleration Subsystem
32194 (MASS) libraries for vectorizing intrinsics using external libraries.
32195 GCC currently emits calls to @code{acosd2}, @code{acosf4},
32196 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
32197 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
32198 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
32199 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
32200 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
32201 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
32202 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
32203 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
32204 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
32205 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
32206 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
32207 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
32208 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
32209 for power7.  Both @option{-ftree-vectorize} and
32210 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
32211 libraries must be specified at link time.
32213 @opindex mfriz
32214 @item -mfriz
32215 @itemx -mno-friz
32216 Generate (do not generate) the @code{friz} instruction when the
32217 @option{-funsafe-math-optimizations} option is used to optimize
32218 rounding of floating-point values to 64-bit integer and back to floating
32219 point.  The @code{friz} instruction does not return the same value if
32220 the floating-point number is too large to fit in an integer.
32222 @opindex mpointers-to-nested-functions
32223 @item -mpointers-to-nested-functions
32224 @itemx -mno-pointers-to-nested-functions
32225 Generate (do not generate) code to load up the static chain register
32226 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
32227 systems where a function pointer points to a 3-word descriptor giving
32228 the function address, TOC value to be loaded in register @code{r2}, and
32229 static chain value to be loaded in register @code{r11}.  The
32230 @option{-mpointers-to-nested-functions} is on by default.  You cannot
32231 call through pointers to nested functions or pointers
32232 to functions compiled in other languages that use the static chain if
32233 you use @option{-mno-pointers-to-nested-functions}.
32235 @opindex msave-toc-indirect
32236 @item -msave-toc-indirect
32237 @itemx -mno-save-toc-indirect
32238 Generate (do not generate) code to save the TOC value in the reserved
32239 stack location in the function prologue if the function calls through
32240 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
32241 saved in the prologue, it is saved just before the call through the
32242 pointer.  The @option{-mno-save-toc-indirect} option is the default.
32244 @opindex mcompat-align-parm
32245 @item -mcompat-align-parm
32246 @itemx -mno-compat-align-parm
32247 Generate (do not generate) code to pass structure parameters with a
32248 maximum alignment of 64 bits, for compatibility with older versions
32249 of GCC.
32251 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
32252 structure parameter on a 128-bit boundary when that structure contained
32253 a member requiring 128-bit alignment.  This is corrected in more
32254 recent versions of GCC.  This option may be used to generate code
32255 that is compatible with functions compiled with older versions of
32256 GCC.
32258 The @option{-mno-compat-align-parm} option is the default.
32260 @opindex mstack-protector-guard
32261 @opindex mstack-protector-guard-reg
32262 @opindex mstack-protector-guard-offset
32263 @opindex mstack-protector-guard-symbol
32264 @item -mstack-protector-guard=@var{guard}
32265 @itemx -mstack-protector-guard-reg=@var{reg}
32266 @itemx -mstack-protector-guard-offset=@var{offset}
32267 @itemx -mstack-protector-guard-symbol=@var{symbol}
32268 Generate stack protection code using canary at @var{guard}.  Supported
32269 locations are @samp{global} for global canary or @samp{tls} for per-thread
32270 canary in the TLS block (the default with GNU libc version 2.4 or later).
32272 With the latter choice the options
32273 @option{-mstack-protector-guard-reg=@var{reg}} and
32274 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
32275 which register to use as base register for reading the canary, and from what
32276 offset from that base register. The default for those is as specified in the
32277 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
32278 the offset with a symbol reference to a canary in the TLS block.
32280 @opindex mpcrel
32281 @opindex mno-pcrel
32282 @item -mpcrel
32283 @itemx -mno-pcrel
32284 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
32285 option requires that the medium code model (@option{-mcmodel=medium})
32286 and prefixed addressing (@option{-mprefixed}) options are enabled.
32288 @opindex mprefixed
32289 @opindex mno-prefixed
32290 @item -mprefixed
32291 @itemx -mno-prefixed
32292 Generate (do not generate) addressing modes using prefixed load and
32293 store instructions.  The @option{-mprefixed} option requires that
32294 the option @option{-mcpu=power10} (or later) is enabled.
32296 @opindex mmma
32297 @opindex mno-mma
32298 @item -mmma
32299 @itemx -mno-mma
32300 Generate (do not generate) the MMA instructions.  The @option{-mma}
32301 option requires that the option @option{-mcpu=power10} (or later)
32302 is enabled.
32304 @opindex mrop-protect
32305 @opindex mno-rop-protect
32306 @item -mrop-protect
32307 @itemx -mno-rop-protect
32308 Generate (do not generate) ROP protection instructions when the target
32309 processor supports them.  Currently this option disables the shrink-wrap
32310 optimization (@option{-fshrink-wrap}).
32312 @opindex mprivileged
32313 @opindex mno-privileged
32314 @item -mprivileged
32315 @itemx -mno-privileged
32316 Generate (do not generate) code that will run in privileged state.
32318 @opindex block-ops-unaligned-vsx
32319 @opindex no-block-ops-unaligned-vsx
32320 @item -mblock-ops-unaligned-vsx
32321 @itemx -mno-block-ops-unaligned-vsx
32322 Generate (do not generate) unaligned vsx loads and stores for
32323 inline expansion of @code{memcpy} and @code{memmove}.
32325 @item --param rs6000-vect-unroll-limit=
32326 The vectorizer will check with target information to determine whether it
32327 would be beneficial to unroll the main vectorized loop and by how much.  This
32328 parameter sets the upper bound of how much the vectorizer will unroll the main
32329 loop.  The default value is four.
32331 @end table
32333 @node RX Options
32334 @subsection RX Options
32335 @cindex RX Options
32337 These command-line options are defined for RX targets:
32339 @table @gcctabopt
32340 @opindex m64bit-doubles
32341 @opindex m32bit-doubles
32342 @item -m64bit-doubles
32343 @itemx -m32bit-doubles
32344 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
32345 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
32346 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
32347 works on 32-bit values, which is why the default is
32348 @option{-m32bit-doubles}.
32350 @opindex fpu
32351 @opindex nofpu
32352 @item -fpu
32353 @itemx -nofpu
32354 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
32355 floating-point hardware.  The default is enabled for the RX600
32356 series and disabled for the RX200 series.
32358 Floating-point instructions are only generated for 32-bit floating-point 
32359 values, however, so the FPU hardware is not used for doubles if the
32360 @option{-m64bit-doubles} option is used.
32362 @emph{Note} If the @option{-fpu} option is enabled then
32363 @option{-funsafe-math-optimizations} is also enabled automatically.
32364 This is because the RX FPU instructions are themselves unsafe.
32366 @opindex mcpu
32367 @item -mcpu=@var{name}
32368 Selects the type of RX CPU to be targeted.  Currently three types are
32369 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
32370 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
32372 The only difference between @samp{RX600} and @samp{RX610} is that the
32373 @samp{RX610} does not support the @code{MVTIPL} instruction.
32375 The @samp{RX200} series does not have a hardware floating-point unit
32376 and so @option{-nofpu} is enabled by default when this type is
32377 selected.
32379 @opindex mbig-endian-data
32380 @opindex mlittle-endian-data
32381 @item -mbig-endian-data
32382 @itemx -mlittle-endian-data
32383 Store data (but not code) in the big-endian format.  The default is
32384 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
32385 format.
32387 @opindex msmall-data-limit
32388 @item -msmall-data-limit=@var{N}
32389 Specifies the maximum size in bytes of global and static variables
32390 which can be placed into the small data area.  Using the small data
32391 area can lead to smaller and faster code, but the size of area is
32392 limited and it is up to the programmer to ensure that the area does
32393 not overflow.  Also when the small data area is used one of the RX's
32394 registers (usually @code{r13}) is reserved for use pointing to this
32395 area, so it is no longer available for use by the compiler.  This
32396 could result in slower and/or larger code if variables are pushed onto
32397 the stack instead of being held in this register.
32399 Note, common variables (variables that have not been initialized) and
32400 constants are not placed into the small data area as they are assigned
32401 to other sections in the output executable.
32403 The default value is zero, which disables this feature.  Note, this
32404 feature is not enabled by default with higher optimization levels
32405 (@option{-O2} etc) because of the potentially detrimental effects of
32406 reserving a register.  It is up to the programmer to experiment and
32407 discover whether this feature is of benefit to their program.  See the
32408 description of the @option{-mpid} option for a description of how the
32409 actual register to hold the small data area pointer is chosen.
32411 @opindex msim
32412 @opindex mno-sim
32413 @item -msim
32414 @itemx -mno-sim
32415 Use the simulator runtime.  The default is to use the libgloss
32416 board-specific runtime.
32418 @opindex mas100-syntax
32419 @opindex mno-as100-syntax
32420 @item -mas100-syntax
32421 @itemx -mno-as100-syntax
32422 When generating assembler output use a syntax that is compatible with
32423 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
32424 assembler, but it has some restrictions so it is not generated by default.
32426 @opindex mmax-constant-size
32427 @item -mmax-constant-size=@var{N}
32428 Specifies the maximum size, in bytes, of a constant that can be used as
32429 an operand in a RX instruction.  Although the RX instruction set does
32430 allow constants of up to 4 bytes in length to be used in instructions,
32431 a longer value equates to a longer instruction.  Thus in some
32432 circumstances it can be beneficial to restrict the size of constants
32433 that are used in instructions.  Constants that are too big are instead
32434 placed into a constant pool and referenced via register indirection.
32436 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
32437 or 4 means that constants of any size are allowed.
32439 @opindex mrelax
32440 @item -mrelax
32441 Enable linker relaxation.  Linker relaxation is a process whereby the
32442 linker attempts to reduce the size of a program by finding shorter
32443 versions of various instructions.  Disabled by default.
32445 @opindex mint-register
32446 @item -mint-register=@var{N}
32447 Specify the number of registers to reserve for fast interrupt handler
32448 functions.  The value @var{N} can be between 0 and 4.  A value of 1
32449 means that register @code{r13} is reserved for the exclusive use
32450 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
32451 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
32452 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
32453 A value of 0, the default, does not reserve any registers.
32455 @opindex msave-acc-in-interrupts
32456 @item -msave-acc-in-interrupts
32457 Specifies that interrupt handler functions should preserve the
32458 accumulator register.  This is only necessary if normal code might use
32459 the accumulator register, for example because it performs 64-bit
32460 multiplications.  The default is to ignore the accumulator as this
32461 makes the interrupt handlers faster.
32463 @opindex mpid
32464 @opindex mno-pid
32465 @item -mpid
32466 @itemx -mno-pid
32467 Enables the generation of position independent data.  When enabled any
32468 access to constant data is done via an offset from a base address
32469 held in a register.  This allows the location of constant data to be
32470 determined at run time without requiring the executable to be
32471 relocated, which is a benefit to embedded applications with tight
32472 memory constraints.  Data that can be modified is not affected by this
32473 option.
32475 Note, using this feature reserves a register, usually @code{r13}, for
32476 the constant data base address.  This can result in slower and/or
32477 larger code, especially in complicated functions.
32479 The actual register chosen to hold the constant data base address
32480 depends upon whether the @option{-msmall-data-limit} and/or the
32481 @option{-mint-register} command-line options are enabled.  Starting
32482 with register @code{r13} and proceeding downwards, registers are
32483 allocated first to satisfy the requirements of @option{-mint-register},
32484 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
32485 is possible for the small data area register to be @code{r8} if both
32486 @option{-mint-register=4} and @option{-mpid} are specified on the
32487 command line.
32489 By default this feature is not enabled.  The default can be restored
32490 via the @option{-mno-pid} command-line option.
32492 @opindex mno-warn-multiple-fast-interrupts
32493 @opindex mwarn-multiple-fast-interrupts
32494 @item -mno-warn-multiple-fast-interrupts
32495 @itemx -mwarn-multiple-fast-interrupts
32496 Prevents GCC from issuing a warning message if it finds more than one
32497 fast interrupt handler when it is compiling a file.  The default is to
32498 issue a warning for each extra fast interrupt handler found, as the RX
32499 only supports one such interrupt.
32501 @opindex mallow-string-insns
32502 @opindex mno-allow-string-insns
32503 @item -mallow-string-insns
32504 @itemx -mno-allow-string-insns
32505 Enables or disables the use of the string manipulation instructions
32506 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
32507 @code{SWHILE} and also the @code{RMPA} instruction.  These
32508 instructions may prefetch data, which is not safe to do if accessing
32509 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
32510 for more information).
32512 The default is to allow these instructions, but it is not possible for
32513 GCC to reliably detect all circumstances where a string instruction
32514 might be used to access an I/O register, so their use cannot be
32515 disabled automatically.  Instead it is reliant upon the programmer to
32516 use the @option{-mno-allow-string-insns} option if their program
32517 accesses I/O space.
32519 When the instructions are enabled GCC defines the C preprocessor
32520 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
32521 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
32523 @opindex mjsr
32524 @opindex mno-jsr
32525 @item -mjsr
32526 @itemx -mno-jsr
32527 Use only (or not only) @code{JSR} instructions to access functions.
32528 This option can be used when code size exceeds the range of @code{BSR}
32529 instructions.  Note that @option{-mno-jsr} does not mean to not use
32530 @code{JSR} but instead means that any type of branch may be used.
32531 @end table
32533 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
32534 has special significance to the RX port when used with the
32535 @code{interrupt} function attribute.  This attribute indicates a
32536 function intended to process fast interrupts.  GCC ensures
32537 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
32538 and/or @code{r13} and only provided that the normal use of the
32539 corresponding registers have been restricted via the
32540 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
32541 options.
32543 @node S/390 and zSeries Options
32544 @subsection S/390 and zSeries Options
32545 @cindex S/390 and zSeries Options
32547 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
32549 @table @gcctabopt
32550 @opindex mhard-float
32551 @opindex msoft-float
32552 @item -mhard-float
32553 @itemx -msoft-float
32554 Use (do not use) the hardware floating-point instructions and registers
32555 for floating-point operations.  When @option{-msoft-float} is specified,
32556 functions in @file{libgcc.a} are used to perform floating-point
32557 operations.  When @option{-mhard-float} is specified, the compiler
32558 generates IEEE floating-point instructions.  This is the default.
32560 @opindex mhard-dfp
32561 @opindex mno-hard-dfp
32562 @item -mhard-dfp
32563 @itemx -mno-hard-dfp
32564 Use (do not use) the hardware decimal-floating-point instructions for
32565 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
32566 specified, functions in @file{libgcc.a} are used to perform
32567 decimal-floating-point operations.  When @option{-mhard-dfp} is
32568 specified, the compiler generates decimal-floating-point hardware
32569 instructions.  This is the default for @option{-march=z9-ec} or higher.
32571 @opindex mlong-double-64
32572 @opindex mlong-double-128
32573 @item -mlong-double-64
32574 @itemx -mlong-double-128
32575 These switches control the size of @code{long double} type. A size
32576 of 64 bits makes the @code{long double} type equivalent to the @code{double}
32577 type. This is the default.
32579 @opindex mbackchain
32580 @opindex mno-backchain
32581 @item -mbackchain
32582 @itemx -mno-backchain
32583 Store (do not store) the address of the caller's frame as backchain pointer
32584 into the callee's stack frame.
32585 A backchain may be needed to allow debugging using tools that do not understand
32586 DWARF call frame information.
32587 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
32588 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
32589 the backchain is placed into the topmost word of the 96/160 byte register
32590 save area.
32592 In general, code compiled with @option{-mbackchain} is call-compatible with
32593 code compiled with @option{-mno-backchain}; however, use of the backchain
32594 for debugging purposes usually requires that the whole binary is built with
32595 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
32596 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
32597 to build a linux kernel use @option{-msoft-float}.
32599 The default is to not maintain the backchain.
32601 @opindex mpacked-stack
32602 @opindex mno-packed-stack
32603 @item -mpacked-stack
32604 @itemx -mno-packed-stack
32605 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
32606 specified, the compiler uses the all fields of the 96/160 byte register save
32607 area only for their default purpose; unused fields still take up stack space.
32608 When @option{-mpacked-stack} is specified, register save slots are densely
32609 packed at the top of the register save area; unused space is reused for other
32610 purposes, allowing for more efficient use of the available stack space.
32611 However, when @option{-mbackchain} is also in effect, the topmost word of
32612 the save area is always used to store the backchain, and the return address
32613 register is always saved two words below the backchain.
32615 As long as the stack frame backchain is not used, code generated with
32616 @option{-mpacked-stack} is call-compatible with code generated with
32617 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
32618 S/390 or zSeries generated code that uses the stack frame backchain at run
32619 time, not just for debugging purposes.  Such code is not call-compatible
32620 with code compiled with @option{-mpacked-stack}.  Also, note that the
32621 combination of @option{-mbackchain},
32622 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
32623 to build a linux kernel use @option{-msoft-float}.
32625 The default is to not use the packed stack layout.
32627 @opindex msmall-exec
32628 @opindex mno-small-exec
32629 @item -msmall-exec
32630 @itemx -mno-small-exec
32631 Generate (or do not generate) code using the @code{bras} instruction
32632 to do subroutine calls.
32633 This only works reliably if the total executable size does not
32634 exceed 64k.  The default is to use the @code{basr} instruction instead,
32635 which does not have this limitation.
32637 @opindex m64
32638 @opindex m31
32639 @item -m64
32640 @itemx -m31
32641 When @option{-m31} is specified, generate code compliant to the
32642 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
32643 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
32644 particular to generate 64-bit instructions.  For the @samp{s390}
32645 targets, the default is @option{-m31}, while the @samp{s390x}
32646 targets default to @option{-m64}.
32648 @opindex mzarch
32649 @opindex mesa
32650 @item -mzarch
32651 @itemx -mesa
32652 When @option{-mzarch} is specified, generate code using the
32653 instructions available on z/Architecture.
32654 When @option{-mesa} is specified, generate code using the
32655 instructions available on ESA/390.  Note that @option{-mesa} is
32656 not possible with @option{-m64}.
32657 When generating code compliant to the GNU/Linux for S/390 ABI,
32658 the default is @option{-mesa}.  When generating code compliant
32659 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
32661 @opindex mhtm
32662 @opindex mno-htm
32663 @item -mhtm
32664 @itemx -mno-htm
32665 The @option{-mhtm} option enables a set of builtins making use of
32666 instructions available with the transactional execution facility
32667 introduced with the IBM zEnterprise EC12 machine generation
32668 @ref{S/390 System z Built-in Functions}.
32669 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
32671 @opindex mvx
32672 @opindex mno-vx
32673 @item -mvx
32674 @itemx -mno-vx
32675 When @option{-mvx} is specified, generate code using the instructions
32676 available with the vector extension facility introduced with the IBM
32677 z13 machine generation.
32678 This option changes the ABI for some vector type values with regard to
32679 alignment and calling conventions.  In case vector type values are
32680 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
32681 command will be added to mark the resulting binary with the ABI used.
32682 @option{-mvx} is enabled by default when using @option{-march=z13}.
32684 @opindex mzvector
32685 @opindex mno-zvector
32686 @item -mzvector
32687 @itemx -mno-zvector
32688 The @option{-mzvector} option enables vector language extensions and
32689 builtins using instructions available with the vector extension
32690 facility introduced with the IBM z13 machine generation.
32691 This option adds support for @samp{vector} to be used as a keyword to
32692 define vector type variables and arguments.  @samp{vector} is only
32693 available when GNU extensions are enabled.  It will not be expanded
32694 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
32695 In addition to the GCC low-level builtins @option{-mzvector} enables
32696 a set of builtins added for compatibility with AltiVec-style
32697 implementations like Power and Cell.  In order to make use of these
32698 builtins the header file @file{vecintrin.h} needs to be included.
32699 @option{-mzvector} is disabled by default.
32701 @opindex mmvcle
32702 @opindex mno-mvcle
32703 @item -mmvcle
32704 @itemx -mno-mvcle
32705 Generate (or do not generate) code using the @code{mvcle} instruction
32706 to perform block moves.  When @option{-mno-mvcle} is specified,
32707 use a @code{mvc} loop instead.  This is the default unless optimizing for
32708 size.
32710 @opindex mdebug
32711 @opindex mno-debug
32712 @item -mdebug
32713 @itemx -mno-debug
32714 Print (or do not print) additional debug information when compiling.
32715 The default is to not print debug information.
32717 @opindex march
32718 @item -march=@var{cpu-type}
32719 Generate code that runs on @var{cpu-type}, which is the name of a
32720 system representing a certain processor type.  Possible values for
32721 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
32722 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
32723 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
32724 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
32725 @samp{z16}/@samp{arch14}, and @samp{native}.
32727 The default is @option{-march=z900}.
32729 Specifying @samp{native} as cpu type can be used to select the best
32730 architecture option for the host processor.
32731 @option{-march=native} has no effect if GCC does not recognize the
32732 processor.
32734 @opindex mtune
32735 @item -mtune=@var{cpu-type}
32736 Tune to @var{cpu-type} everything applicable about the generated code,
32737 except for the ABI and the set of available instructions.
32738 The list of @var{cpu-type} values is the same as for @option{-march}.
32739 The default is the value used for @option{-march}.
32741 @opindex mtpf-trace
32742 @opindex mno-tpf-trace
32743 @item -mtpf-trace
32744 @itemx -mno-tpf-trace
32745 Generate code that adds (does not add) in TPF OS specific branches to trace
32746 routines in the operating system.  This option is off by default, even
32747 when compiling for the TPF OS@.
32749 @opindex mtpf-trace-skip
32750 @opindex mno-tpf-trace-skip
32751 @item -mtpf-trace-skip
32752 @itemx -mno-tpf-trace-skip
32753 Generate code that changes (does not change) the default branch
32754 targets enabled by @option{-mtpf-trace} to point to specialized trace
32755 routines providing the ability of selectively skipping function trace
32756 entries for the TPF OS.  This option is off by default, even when
32757 compiling for the TPF OS and specifying @option{-mtpf-trace}.
32759 @opindex mfused-madd
32760 @opindex mno-fused-madd
32761 @item -mfused-madd
32762 @itemx -mno-fused-madd
32763 Generate code that uses (does not use) the floating-point multiply and
32764 accumulate instructions.  These instructions are generated by default if
32765 hardware floating point is used.
32767 @opindex mwarn-framesize
32768 @item -mwarn-framesize=@var{framesize}
32769 Emit a warning if the current function exceeds the given frame size.  Because
32770 this is a compile-time check it doesn't need to be a real problem when the program
32771 runs.  It is intended to identify functions that most probably cause
32772 a stack overflow.  It is useful to be used in an environment with limited stack
32773 size e.g.@: the linux kernel.
32775 @opindex mwarn-dynamicstack
32776 @item -mwarn-dynamicstack
32777 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
32778 arrays.  This is generally a bad idea with a limited stack size.
32780 @opindex mstack-guard
32781 @opindex mstack-size
32782 @item -mstack-guard=@var{stack-guard}
32783 @itemx -mstack-size=@var{stack-size}
32784 If these options are provided the S/390 back end emits additional instructions in
32785 the function prologue that trigger a trap if the stack size is @var{stack-guard}
32786 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
32787 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
32788 the frame size of the compiled function is chosen.
32789 These options are intended to be used to help debugging stack overflow problems.
32790 The additionally emitted code causes only little overhead and hence can also be
32791 used in production-like systems without greater performance degradation.  The given
32792 values have to be exact powers of 2 and @var{stack-size} has to be greater than
32793 @var{stack-guard} without exceeding 64k.
32794 In order to be efficient the extra code makes the assumption that the stack starts
32795 at an address aligned to the value given by @var{stack-size}.
32796 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
32798 @opindex mhotpatch
32799 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
32800 If the hotpatch option is enabled, a ``hot-patching'' function
32801 prologue is generated for all functions in the compilation unit.
32802 The funtion label is prepended with the given number of two-byte
32803 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
32804 the label, 2 * @var{post-halfwords} bytes are appended, using the
32805 largest NOP like instructions the architecture allows (maximum
32806 1000000).
32808 If both arguments are zero, hotpatching is disabled.
32810 This option can be overridden for individual functions with the
32811 @code{hotpatch} attribute.
32812 @end table
32814 @node SH Options
32815 @subsection SH Options
32817 These @samp{-m} options are defined for the SH implementations:
32819 @table @gcctabopt
32820 @opindex m1
32821 @item -m1
32822 Generate code for the SH1.
32824 @opindex m2
32825 @item -m2
32826 Generate code for the SH2.
32828 @item -m2e
32829 Generate code for the SH2e.
32831 @opindex m2a-nofpu
32832 @item -m2a-nofpu
32833 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
32834 that the floating-point unit is not used.
32836 @opindex m2a-single-only
32837 @item -m2a-single-only
32838 Generate code for the SH2a-FPU, in such a way that no double-precision
32839 floating-point operations are used.
32841 @opindex m2a-single
32842 @item -m2a-single
32843 Generate code for the SH2a-FPU assuming the floating-point unit is in
32844 single-precision mode by default.
32846 @opindex m2a
32847 @item -m2a
32848 Generate code for the SH2a-FPU assuming the floating-point unit is in
32849 double-precision mode by default.
32851 @opindex m3
32852 @item -m3
32853 Generate code for the SH3.
32855 @opindex m3e
32856 @item -m3e
32857 Generate code for the SH3e.
32859 @opindex m4-nofpu
32860 @item -m4-nofpu
32861 Generate code for the SH4 without a floating-point unit.
32863 @opindex m4-single-only
32864 @item -m4-single-only
32865 Generate code for the SH4 with a floating-point unit that only
32866 supports single-precision arithmetic.
32868 @opindex m4-single
32869 @item -m4-single
32870 Generate code for the SH4 assuming the floating-point unit is in
32871 single-precision mode by default.
32873 @opindex m4
32874 @item -m4
32875 Generate code for the SH4.
32877 @opindex m4-100
32878 @item -m4-100
32879 Generate code for SH4-100.
32881 @opindex m4-100-nofpu
32882 @item -m4-100-nofpu
32883 Generate code for SH4-100 in such a way that the
32884 floating-point unit is not used.
32886 @opindex m4-100-single
32887 @item -m4-100-single
32888 Generate code for SH4-100 assuming the floating-point unit is in
32889 single-precision mode by default.
32891 @opindex m4-100-single-only
32892 @item -m4-100-single-only
32893 Generate code for SH4-100 in such a way that no double-precision
32894 floating-point operations are used.
32896 @opindex m4-200
32897 @item -m4-200
32898 Generate code for SH4-200.
32900 @opindex m4-200-nofpu
32901 @item -m4-200-nofpu
32902 Generate code for SH4-200 without in such a way that the
32903 floating-point unit is not used.
32905 @opindex m4-200-single
32906 @item -m4-200-single
32907 Generate code for SH4-200 assuming the floating-point unit is in
32908 single-precision mode by default.
32910 @opindex m4-200-single-only
32911 @item -m4-200-single-only
32912 Generate code for SH4-200 in such a way that no double-precision
32913 floating-point operations are used.
32915 @opindex m4-300
32916 @item -m4-300
32917 Generate code for SH4-300.
32919 @opindex m4-300-nofpu
32920 @item -m4-300-nofpu
32921 Generate code for SH4-300 without in such a way that the
32922 floating-point unit is not used.
32924 @opindex m4-300-single
32925 @item -m4-300-single
32926 Generate code for SH4-300 in such a way that no double-precision
32927 floating-point operations are used.
32929 @opindex m4-300-single-only
32930 @item -m4-300-single-only
32931 Generate code for SH4-300 in such a way that no double-precision
32932 floating-point operations are used.
32934 @opindex m4-340
32935 @item -m4-340
32936 Generate code for SH4-340 (no MMU, no FPU).
32938 @opindex m4-500
32939 @item -m4-500
32940 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
32941 assembler.
32943 @opindex m4a-nofpu
32944 @item -m4a-nofpu
32945 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
32946 floating-point unit is not used.
32948 @opindex m4a-single-only
32949 @item -m4a-single-only
32950 Generate code for the SH4a, in such a way that no double-precision
32951 floating-point operations are used.
32953 @opindex m4a-single
32954 @item -m4a-single
32955 Generate code for the SH4a assuming the floating-point unit is in
32956 single-precision mode by default.
32958 @opindex m4a
32959 @item -m4a
32960 Generate code for the SH4a.
32962 @opindex m4al
32963 @item -m4al
32964 Same as @option{-m4a-nofpu}, except that it implicitly passes
32965 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
32966 instructions at the moment.
32968 @opindex mb
32969 @item -mb
32970 Compile code for the processor in big-endian mode.
32972 @opindex ml
32973 @item -ml
32974 Compile code for the processor in little-endian mode.
32976 @opindex mdalign
32977 @item -mdalign
32978 Align doubles at 64-bit boundaries.  Note that this changes the calling
32979 conventions, and thus some functions from the standard C library do
32980 not work unless you recompile it first with @option{-mdalign}.
32982 @opindex mrelax
32983 @item -mrelax
32984 Shorten some address references at link time, when possible; uses the
32985 linker option @option{-relax}.
32987 @opindex mbigtable
32988 @item -mbigtable
32989 Use 32-bit offsets in @code{switch} tables.  The default is to use
32990 16-bit offsets.
32992 @opindex mbitops
32993 @item -mbitops
32994 Enable the use of bit manipulation instructions on SH2A.
32996 @opindex mfmovd
32997 @item -mfmovd
32998 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
32999 alignment constraints.
33001 @opindex mrenesas
33002 @item -mrenesas
33003 Comply with the calling conventions defined by Renesas.
33005 @opindex mno-renesas
33006 @item -mno-renesas
33007 Comply with the calling conventions defined for GCC before the Renesas
33008 conventions were available.  This option is the default for all
33009 targets of the SH toolchain.
33011 @opindex mnomacsave
33012 @item -mnomacsave
33013 Mark the @code{MAC} register as call-clobbered, even if
33014 @option{-mrenesas} is given.
33016 @opindex mieee
33017 @opindex mno-ieee
33018 @item -mieee
33019 @itemx -mno-ieee
33020 Control the IEEE compliance of floating-point comparisons, which affects the
33021 handling of cases where the result of a comparison is unordered.  By default
33022 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
33023 enabled @option{-mno-ieee} is implicitly set, which results in faster
33024 floating-point greater-equal and less-equal comparisons.  The implicit settings
33025 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
33027 @opindex minline-ic_invalidate
33028 @item -minline-ic_invalidate
33029 Inline code to invalidate instruction cache entries after setting up
33030 nested function trampolines.
33031 This option has no effect if @option{-musermode} is in effect and the selected
33032 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
33033 instruction.
33034 If the selected code generation option does not allow the use of the @code{icbi}
33035 instruction, and @option{-musermode} is not in effect, the inlined code
33036 manipulates the instruction cache address array directly with an associative
33037 write.  This not only requires privileged mode at run time, but it also
33038 fails if the cache line had been mapped via the TLB and has become unmapped.
33040 @opindex misize
33041 @item -misize
33042 Dump instruction size and location in the assembly code.
33044 @opindex mpadstruct
33045 @item -mpadstruct
33046 This option is deprecated.  It pads structures to multiple of 4 bytes,
33047 which is incompatible with the SH ABI@.
33049 @opindex matomic-model=@var{model}
33050 @item -matomic-model=@var{model}
33051 Sets the model of atomic operations and additional parameters as a comma
33052 separated list.  For details on the atomic built-in functions see
33053 @ref{__atomic Builtins}.  The following models and parameters are supported:
33055 @table @samp
33057 @item none
33058 Disable compiler generated atomic sequences and emit library calls for atomic
33059 operations.  This is the default if the target is not @code{sh*-*-linux*}.
33061 @item soft-gusa
33062 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
33063 built-in functions.  The generated atomic sequences require additional support
33064 from the interrupt/exception handling code of the system and are only suitable
33065 for SH3* and SH4* single-core systems.  This option is enabled by default when
33066 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
33067 this option also partially utilizes the hardware atomic instructions
33068 @code{movli.l} and @code{movco.l} to create more efficient code, unless
33069 @samp{strict} is specified.  
33071 @item soft-tcb
33072 Generate software atomic sequences that use a variable in the thread control
33073 block.  This is a variation of the gUSA sequences which can also be used on
33074 SH1* and SH2* targets.  The generated atomic sequences require additional
33075 support from the interrupt/exception handling code of the system and are only
33076 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
33077 parameter has to be specified as well.
33079 @item soft-imask
33080 Generate software atomic sequences that temporarily disable interrupts by
33081 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
33082 in privileged mode and is only suitable for single-core systems.  Additional
33083 support from the interrupt/exception handling code of the system is not
33084 required.  This model is enabled by default when the target is
33085 @code{sh*-*-linux*} and SH1* or SH2*.
33087 @item hard-llcs
33088 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
33089 instructions only.  This is only available on SH4A and is suitable for
33090 multi-core systems.  Since the hardware instructions support only 32 bit atomic
33091 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
33092 Code compiled with this option is also compatible with other software
33093 atomic model interrupt/exception handling systems if executed on an SH4A
33094 system.  Additional support from the interrupt/exception handling code of the
33095 system is not required for this model.
33097 @item gbr-offset=
33098 This parameter specifies the offset in bytes of the variable in the thread
33099 control block structure that should be used by the generated atomic sequences
33100 when the @samp{soft-tcb} model has been selected.  For other models this
33101 parameter is ignored.  The specified value must be an integer multiple of four
33102 and in the range 0-1020.
33104 @item strict
33105 This parameter prevents mixed usage of multiple atomic models, even if they
33106 are compatible, and makes the compiler generate atomic sequences of the
33107 specified model only.
33109 @end table
33111 @opindex mtas
33112 @item -mtas
33113 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
33114 Notice that depending on the particular hardware and software configuration
33115 this can degrade overall performance due to the operand cache line flushes
33116 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
33117 processors the @code{tas.b} instruction must be used with caution since it
33118 can result in data corruption for certain cache configurations.
33120 @opindex mprefergot
33121 @item -mprefergot
33122 When generating position-independent code, emit function calls using
33123 the Global Offset Table instead of the Procedure Linkage Table.
33125 @opindex musermode
33126 @opindex mno-usermode
33127 @item -musermode
33128 @itemx -mno-usermode
33129 Don't allow (allow) the compiler generating privileged mode code.  Specifying
33130 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
33131 inlined code would not work in user mode.  @option{-musermode} is the default
33132 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
33133 @option{-musermode} has no effect, since there is no user mode.
33135 @opindex multcost=@var{number}
33136 @item -multcost=@var{number}
33137 Set the cost to assume for a multiply insn.
33139 @opindex mdiv=@var{strategy}
33140 @item -mdiv=@var{strategy}
33141 Set the division strategy to be used for integer division operations.
33142 @var{strategy} can be one of: 
33144 @table @samp
33146 @item call-div1
33147 Calls a library function that uses the single-step division instruction
33148 @code{div1} to perform the operation.  Division by zero calculates an
33149 unspecified result and does not trap.  This is the default except for SH4,
33150 SH2A and SHcompact.
33152 @item call-fp
33153 Calls a library function that performs the operation in double precision
33154 floating point.  Division by zero causes a floating-point exception.  This is
33155 the default for SHcompact with FPU.  Specifying this for targets that do not
33156 have a double precision FPU defaults to @code{call-div1}.
33158 @item call-table
33159 Calls a library function that uses a lookup table for small divisors and
33160 the @code{div1} instruction with case distinction for larger divisors.  Division
33161 by zero calculates an unspecified result and does not trap.  This is the default
33162 for SH4.  Specifying this for targets that do not have dynamic shift
33163 instructions defaults to @code{call-div1}.
33165 @end table
33167 When a division strategy has not been specified the default strategy is
33168 selected based on the current target.  For SH2A the default strategy is to
33169 use the @code{divs} and @code{divu} instructions instead of library function
33170 calls.
33172 @opindex maccumulate-outgoing-args
33173 @item -maccumulate-outgoing-args
33174 Reserve space once for outgoing arguments in the function prologue rather
33175 than around each call.  Generally beneficial for performance and size.  Also
33176 needed for unwinding to avoid changing the stack frame around conditional code.
33178 @opindex mdivsi3_libfunc=@var{name}
33179 @item -mdivsi3_libfunc=@var{name}
33180 Set the name of the library function used for 32-bit signed division to
33181 @var{name}.
33182 This only affects the name used in the @samp{call} division strategies, and
33183 the compiler still expects the same sets of input/output/clobbered registers as
33184 if this option were not present.
33186 @opindex mfixed-range
33187 @item -mfixed-range=@var{register-range}
33188 Generate code treating the given register range as fixed registers.
33189 A fixed register is one that the register allocator cannot use.  This is
33190 useful when compiling kernel code.  A register range is specified as
33191 two registers separated by a dash.  Multiple register ranges can be
33192 specified separated by a comma.
33194 @opindex mbranch-cost=@var{num}
33195 @item -mbranch-cost=@var{num}
33196 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
33197 make the compiler try to generate more branch-free code if possible.  
33198 If not specified the value is selected depending on the processor type that
33199 is being compiled for.
33201 @opindex mzdcbranch
33202 @opindex mno-zdcbranch
33203 @item -mzdcbranch
33204 @itemx -mno-zdcbranch
33205 Assume (do not assume) that zero displacement conditional branch instructions
33206 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
33207 compiler prefers zero displacement branch code sequences.  This is
33208 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
33209 disabled by specifying @option{-mno-zdcbranch}.
33211 @opindex mcbranch-force-delay-slot
33212 @item -mcbranch-force-delay-slot
33213 Force the usage of delay slots for conditional branches, which stuffs the delay
33214 slot with a @code{nop} if a suitable instruction cannot be found.  By default
33215 this option is disabled.  It can be enabled to work around hardware bugs as
33216 found in the original SH7055.
33218 @opindex mfused-madd
33219 @opindex mno-fused-madd
33220 @item -mfused-madd
33221 @itemx -mno-fused-madd
33222 Generate code that uses (does not use) the floating-point multiply and
33223 accumulate instructions.  These instructions are generated by default
33224 if hardware floating point is used.  The machine-dependent
33225 @option{-mfused-madd} option is now mapped to the machine-independent
33226 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
33227 mapped to @option{-ffp-contract=off}.
33229 @opindex mfsca
33230 @opindex mno-fsca
33231 @item -mfsca
33232 @itemx -mno-fsca
33233 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
33234 and cosine approximations.  The option @option{-mfsca} must be used in
33235 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
33236 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
33237 approximations even if @option{-funsafe-math-optimizations} is in effect.
33239 @opindex mfsrra
33240 @opindex mno-fsrra
33241 @item -mfsrra
33242 @itemx -mno-fsrra
33243 Allow or disallow the compiler to emit the @code{fsrra} instruction for
33244 reciprocal square root approximations.  The option @option{-mfsrra} must be used
33245 in combination with @option{-funsafe-math-optimizations} and
33246 @option{-ffinite-math-only}.  It is enabled by default when generating code for
33247 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
33248 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
33249 in effect.
33251 @opindex mpretend-cmove
33252 @item -mpretend-cmove
33253 Prefer zero-displacement conditional branches for conditional move instruction
33254 patterns.  This can result in faster code on the SH4 processor.
33256 @opindex fdpic
33257 @item -mfdpic
33258 Generate code using the FDPIC ABI.
33260 @end table
33262 @node Solaris 2 Options
33263 @subsection Solaris 2 Options
33264 @cindex Solaris 2 options
33266 These @samp{-m} options are supported on Solaris 2:
33268 @table @gcctabopt
33269 @opindex mclear-hwcap
33270 @item -mclear-hwcap
33271 @option{-mclear-hwcap} tells the compiler to remove the hardware
33272 capabilities generated by the Solaris assembler.  This is only necessary
33273 when object files use ISA extensions not supported by the current
33274 machine, but check at runtime whether or not to use them.
33276 @opindex mimpure-text
33277 @item -mimpure-text
33278 @option{-mimpure-text}, used in addition to @option{-shared}, tells
33279 the compiler to not pass @option{-z text} to the linker when linking a
33280 shared object.  Using this option, you can link position-dependent
33281 code into a shared object.
33283 @option{-mimpure-text} suppresses the ``relocations remain against
33284 allocatable but non-writable sections'' linker error message.
33285 However, the necessary relocations trigger copy-on-write, and the
33286 shared object is not actually shared across processes.  Instead of
33287 using @option{-mimpure-text}, you should compile all source code with
33288 @option{-fpic} or @option{-fPIC}.
33290 @end table
33292 These switches are supported in addition to the above on Solaris 2:
33294 @table @gcctabopt
33295 @opindex pthreads
33296 @item -pthreads
33297 This is a synonym for @option{-pthread}.
33298 @end table
33300 @node SPARC Options
33301 @subsection SPARC Options
33302 @cindex SPARC options
33304 These @samp{-m} options are supported on the SPARC:
33306 @table @gcctabopt
33307 @opindex mno-app-regs
33308 @opindex mapp-regs
33309 @item -mno-app-regs
33310 @itemx -mapp-regs
33311 Specify @option{-mapp-regs} to generate output using the global registers
33312 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
33313 global register 1, each global register 2 through 4 is then treated as an
33314 allocable register that is clobbered by function calls.  This is the default.
33316 To be fully SVR4 ABI-compliant at the cost of some performance loss,
33317 specify @option{-mno-app-regs}.  You should compile libraries and system
33318 software with this option.
33320 @opindex mflat
33321 @opindex mno-flat
33322 @item -mflat
33323 @itemx -mno-flat
33324 With @option{-mflat}, the compiler does not generate save/restore instructions
33325 and uses a ``flat'' or single register window model.  This model is compatible
33326 with the regular register window model.  The local registers and the input
33327 registers (0--5) are still treated as ``call-saved'' registers and are
33328 saved on the stack as needed.
33330 With @option{-mno-flat} (the default), the compiler generates save/restore
33331 instructions (except for leaf functions).  This is the normal operating mode.
33333 @opindex mfpu
33334 @opindex mhard-float
33335 @item -mfpu
33336 @itemx -mhard-float
33337 Generate output containing floating-point instructions.  This is the
33338 default.
33340 @opindex mno-fpu
33341 @opindex msoft-float
33342 @item -mno-fpu
33343 @itemx -msoft-float
33344 Generate output containing library calls for floating point.
33345 @strong{Warning:} the requisite libraries are not available for all SPARC
33346 targets.  Normally the facilities of the machine's usual C compiler are
33347 used, but this cannot be done directly in cross-compilation.  You must make
33348 your own arrangements to provide suitable library functions for
33349 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
33350 @samp{sparclite-*-*} do provide software floating-point support.
33352 @option{-msoft-float} changes the calling convention in the output file;
33353 therefore, it is only useful if you compile @emph{all} of a program with
33354 this option.  In particular, you need to compile @file{libgcc.a}, the
33355 library that comes with GCC, with @option{-msoft-float} in order for
33356 this to work.
33358 @opindex mhard-quad-float
33359 @item -mhard-quad-float
33360 Generate output containing quad-word (long double) floating-point
33361 instructions.
33363 @opindex msoft-quad-float
33364 @item -msoft-quad-float
33365 Generate output containing library calls for quad-word (long double)
33366 floating-point instructions.  The functions called are those specified
33367 in the SPARC ABI@.  This is the default.
33369 As of this writing, there are no SPARC implementations that have hardware
33370 support for the quad-word floating-point instructions.  They all invoke
33371 a trap handler for one of these instructions, and then the trap handler
33372 emulates the effect of the instruction.  Because of the trap handler overhead,
33373 this is much slower than calling the ABI library routines.  Thus the
33374 @option{-msoft-quad-float} option is the default.
33376 @opindex mno-unaligned-doubles
33377 @opindex munaligned-doubles
33378 @item -mno-unaligned-doubles
33379 @itemx -munaligned-doubles
33380 Assume that doubles have 8-byte alignment.  This is the default.
33382 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
33383 alignment only if they are contained in another type, or if they have an
33384 absolute address.  Otherwise, it assumes they have 4-byte alignment.
33385 Specifying this option avoids some rare compatibility problems with code
33386 generated by other compilers.  It is not the default because it results
33387 in a performance loss, especially for floating-point code.
33389 @opindex muser-mode
33390 @opindex mno-user-mode
33391 @item -muser-mode
33392 @itemx -mno-user-mode
33393 Do not generate code that can only run in supervisor mode.  This is relevant
33394 only for the @code{casa} instruction emitted for the LEON3 processor.  This
33395 is the default.
33397 @opindex mfaster-structs
33398 @opindex mno-faster-structs
33399 @item -mfaster-structs
33400 @itemx -mno-faster-structs
33401 With @option{-mfaster-structs}, the compiler assumes that structures
33402 should have 8-byte alignment.  This enables the use of pairs of
33403 @code{ldd} and @code{std} instructions for copies in structure
33404 assignment, in place of twice as many @code{ld} and @code{st} pairs.
33405 However, the use of this changed alignment directly violates the SPARC
33406 ABI@.  Thus, it's intended only for use on targets where the developer
33407 acknowledges that their resulting code is not directly in line with
33408 the rules of the ABI@.
33410 @opindex mstd-struct-return
33411 @opindex mno-std-struct-return
33412 @item -mstd-struct-return
33413 @itemx -mno-std-struct-return
33414 With @option{-mstd-struct-return}, the compiler generates checking code
33415 in functions returning structures or unions to detect size mismatches
33416 between the two sides of function calls, as per the 32-bit ABI@.
33418 The default is @option{-mno-std-struct-return}.  This option has no effect
33419 in 64-bit mode.
33421 @opindex mlra
33422 @opindex mno-lra
33423 @item -mlra
33424 @itemx -mno-lra
33425 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
33426 so @option{-mno-lra} needs to be passed to get old Reload.
33428 @opindex mcpu
33429 @item -mcpu=@var{cpu_type}
33430 Set the instruction set, register set, and instruction scheduling parameters
33431 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
33432 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
33433 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
33434 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
33435 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
33436 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
33437 @samp{m8}.
33439 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
33440 which selects the best architecture option for the host processor.
33441 @option{-mcpu=native} has no effect if GCC does not recognize
33442 the processor.
33444 Default instruction scheduling parameters are used for values that select
33445 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
33446 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
33448 Here is a list of each supported architecture and their supported
33449 implementations.
33451 @table @asis
33452 @item v7
33453 cypress, leon3v7
33455 @item v8
33456 supersparc, hypersparc, leon, leon3, leon5
33458 @item sparclite
33459 f930, f934, sparclite86x
33461 @item sparclet
33462 tsc701
33464 @item v9
33465 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
33466 niagara7, m8
33467 @end table
33469 By default (unless configured otherwise), GCC generates code for the V7
33470 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
33471 additionally optimizes it for the Cypress CY7C602 chip, as used in the
33472 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
33473 SPARCStation 1, 2, IPX etc.
33475 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
33476 architecture.  The only difference from V7 code is that the compiler emits
33477 the integer multiply and integer divide instructions which exist in SPARC-V8
33478 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
33479 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
33480 2000 series.
33482 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
33483 the SPARC architecture.  This adds the integer multiply, integer divide step
33484 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
33485 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
33486 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
33487 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
33488 MB86934 chip, which is the more recent SPARClite with FPU@.
33490 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
33491 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
33492 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
33493 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
33494 optimizes it for the TEMIC SPARClet chip.
33496 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
33497 architecture.  This adds 64-bit integer and floating-point move instructions,
33498 3 additional floating-point condition code registers and conditional move
33499 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
33500 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
33501 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
33502 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
33503 @option{-mcpu=niagara}, the compiler additionally optimizes it for
33504 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
33505 additionally optimizes it for Sun UltraSPARC T2 chips. With
33506 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
33507 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
33508 additionally optimizes it for Sun UltraSPARC T4 chips.  With
33509 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
33510 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
33511 additionally optimizes it for Oracle M8 chips.
33513 @opindex mtune
33514 @item -mtune=@var{cpu_type}
33515 Set the instruction scheduling parameters for machine type
33516 @var{cpu_type}, but do not set the instruction set or register set that the
33517 option @option{-mcpu=@var{cpu_type}} does.
33519 The same values for @option{-mcpu=@var{cpu_type}} can be used for
33520 @option{-mtune=@var{cpu_type}}, but the only useful values are those
33521 that select a particular CPU implementation.  Those are
33522 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
33523 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
33524 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
33525 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
33526 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
33527 and GNU/Linux toolchains, @samp{native} can also be used.
33529 @opindex mv8plus
33530 @opindex mno-v8plus
33531 @item -mv8plus
33532 @itemx -mno-v8plus
33533 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
33534 difference from the V8 ABI is that the global and out registers are
33535 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
33536 mode for all SPARC-V9 processors.
33538 @opindex mvis
33539 @opindex mno-vis
33540 @item -mvis
33541 @itemx -mno-vis
33542 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
33543 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
33545 @opindex mvis2
33546 @opindex mno-vis2
33547 @item -mvis2
33548 @itemx -mno-vis2
33549 With @option{-mvis2}, GCC generates code that takes advantage of
33550 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
33551 default is @option{-mvis2} when targeting a cpu that supports such
33552 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
33553 also sets @option{-mvis}.
33555 @opindex mvis3
33556 @opindex mno-vis3
33557 @item -mvis3
33558 @itemx -mno-vis3
33559 With @option{-mvis3}, GCC generates code that takes advantage of
33560 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
33561 default is @option{-mvis3} when targeting a cpu that supports such
33562 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
33563 also sets @option{-mvis2} and @option{-mvis}.
33565 @opindex mvis4
33566 @opindex mno-vis4
33567 @item -mvis4
33568 @itemx -mno-vis4
33569 With @option{-mvis4}, GCC generates code that takes advantage of
33570 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
33571 default is @option{-mvis4} when targeting a cpu that supports such
33572 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
33573 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
33575 @opindex mvis4b
33576 @opindex mno-vis4b
33577 @item -mvis4b
33578 @itemx -mno-vis4b
33579 With @option{-mvis4b}, GCC generates code that takes advantage of
33580 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
33581 the additional VIS instructions introduced in the Oracle SPARC
33582 Architecture 2017.  The default is @option{-mvis4b} when targeting a
33583 cpu that supports such instructions, such as m8 and later.  Setting
33584 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
33585 @option{-mvis2} and @option{-mvis}.
33587 @opindex mcbcond
33588 @opindex mno-cbcond
33589 @item -mcbcond
33590 @itemx -mno-cbcond
33591 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
33592 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
33593 when targeting a CPU that supports such instructions, such as Niagara-4 and
33594 later.
33596 @opindex mfmaf
33597 @opindex mno-fmaf
33598 @item -mfmaf
33599 @itemx -mno-fmaf
33600 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
33601 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
33602 when targeting a CPU that supports such instructions, such as Niagara-3 and
33603 later.
33605 @opindex mfsmuld
33606 @opindex mno-fsmuld
33607 @item -mfsmuld
33608 @itemx -mno-fsmuld
33609 With @option{-mfsmuld}, GCC generates code that takes advantage of the
33610 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
33611 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
33612 or V9 with FPU except @option{-mcpu=leon}.
33614 @opindex mpopc
33615 @opindex mno-popc
33616 @item -mpopc
33617 @itemx -mno-popc
33618 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
33619 Population Count instruction.  The default is @option{-mpopc}
33620 when targeting a CPU that supports such an instruction, such as Niagara-2 and
33621 later.
33623 @opindex msubxc
33624 @opindex mno-subxc
33625 @item -msubxc
33626 @itemx -mno-subxc
33627 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
33628 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
33629 when targeting a CPU that supports such an instruction, such as Niagara-7 and
33630 later.
33632 @opindex mfix-at697f
33633 @item -mfix-at697f
33634 Enable the documented workaround for the single erratum of the Atmel AT697F
33635 processor (which corresponds to erratum #13 of the AT697E processor).
33637 @opindex mfix-ut699
33638 @item -mfix-ut699
33639 Enable the documented workarounds for the floating-point errata and the data
33640 cache nullify errata of the UT699 processor.
33642 @opindex mfix-ut700
33643 @item -mfix-ut700
33644 Enable the documented workaround for the back-to-back store errata of
33645 the UT699E/UT700 processor.
33647 @opindex mfix-gr712rc
33648 @item -mfix-gr712rc
33649 Enable the documented workaround for the back-to-back store errata of
33650 the GR712RC processor.
33651 @end table
33653 These @samp{-m} options are supported in addition to the above
33654 on SPARC-V9 processors in 64-bit environments:
33656 @table @gcctabopt
33657 @opindex m32
33658 @opindex m64
33659 @item -m32
33660 @itemx -m64
33661 Generate code for a 32-bit or 64-bit environment.
33662 The 32-bit environment sets int, long and pointer to 32 bits.
33663 The 64-bit environment sets int to 32 bits and long and pointer
33664 to 64 bits.
33666 @opindex mcmodel
33667 @item -mcmodel=@var{which}
33668 Set the code model to one of
33670 @table @samp
33671 @item medlow
33672 The Medium/Low code model: 64-bit addresses, programs
33673 must be linked in the low 32 bits of memory.  Programs can be statically
33674 or dynamically linked.
33676 @item medmid
33677 The Medium/Middle code model: 64-bit addresses, programs
33678 must be linked in the low 44 bits of memory, the text and data segments must
33679 be less than 2GB in size and the data segment must be located within 2GB of
33680 the text segment.
33682 @item medany
33683 The Medium/Anywhere code model: 64-bit addresses, programs
33684 may be linked anywhere in memory, the text and data segments must be less
33685 than 2GB in size and the data segment must be located within 2GB of the
33686 text segment.
33688 @item embmedany
33689 The Medium/Anywhere code model for embedded systems:
33690 64-bit addresses, the text and data segments must be less than 2GB in
33691 size, both starting anywhere in memory (determined at link time).  The
33692 global register %g4 points to the base of the data segment.  Programs
33693 are statically linked and PIC is not supported.
33694 @end table
33696 @opindex mmemory-model
33697 @item -mmemory-model=@var{mem-model}
33698 Set the memory model in force on the processor to one of
33700 @table @samp
33701 @item default
33702 The default memory model for the processor and operating system.
33704 @item rmo
33705 Relaxed Memory Order
33707 @item pso
33708 Partial Store Order
33710 @item tso
33711 Total Store Order
33713 @item sc
33714 Sequential Consistency
33715 @end table
33717 These memory models are formally defined in Appendix D of the SPARC-V9
33718 architecture manual, as set in the processor's @code{PSTATE.MM} field.
33720 @opindex mstack-bias
33721 @opindex mno-stack-bias
33722 @item -mstack-bias
33723 @itemx -mno-stack-bias
33724 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
33725 frame pointer if present, are offset by @minus{}2047 which must be added back
33726 when making stack frame references.  This is the default in 64-bit mode.
33727 Otherwise, assume no such offset is present.
33728 @end table
33730 @node System V Options
33731 @subsection Options for System V
33733 These additional options are available on System V Release 4 for
33734 compatibility with other compilers on those systems:
33736 @table @gcctabopt
33737 @opindex G
33738 @item -G
33739 Create a shared object.
33740 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
33742 @opindex Qy
33743 @item -Qy
33744 Identify the versions of each tool used by the compiler, in a
33745 @code{.ident} assembler directive in the output.
33747 @opindex Qn
33748 @item -Qn
33749 Refrain from adding @code{.ident} directives to the output file (this is
33750 the default).
33752 @opindex YP
33753 @item -YP,@var{dirs}
33754 Search the directories @var{dirs}, and no others, for libraries
33755 specified with @option{-l}.
33757 @opindex Ym
33758 @item -Ym,@var{dir}
33759 Look in the directory @var{dir} to find the M4 preprocessor.
33760 The assembler uses this option.
33761 @c This is supposed to go with a -Yd for predefined M4 macro files, but
33762 @c the generic assembler that comes with Solaris takes just -Ym.
33763 @end table
33765 @node V850 Options
33766 @subsection V850 Options
33767 @cindex V850 Options
33769 These @samp{-m} options are defined for V850 implementations:
33771 @table @gcctabopt
33772 @opindex mlong-calls
33773 @opindex mno-long-calls
33774 @item -mlong-calls
33775 @itemx -mno-long-calls
33776 Treat all calls as being far away (near).  If calls are assumed to be
33777 far away, the compiler always loads the function's address into a
33778 register, and calls indirect through the pointer.
33780 @opindex mno-ep
33781 @opindex mep
33782 @item -mno-ep
33783 @itemx -mep
33784 Do not optimize (do optimize) basic blocks that use the same index
33785 pointer 4 or more times to copy pointer into the @code{ep} register, and
33786 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
33787 option is on by default if you optimize.
33789 @opindex mno-prolog-function
33790 @opindex mprolog-function
33791 @item -mno-prolog-function
33792 @itemx -mprolog-function
33793 Do not use (do use) external functions to save and restore registers
33794 at the prologue and epilogue of a function.  The external functions
33795 are slower, but use less code space if more than one function saves
33796 the same number of registers.  The @option{-mprolog-function} option
33797 is on by default if you optimize.
33799 @opindex mspace
33800 @item -mspace
33801 Try to make the code as small as possible.  At present, this just turns
33802 on the @option{-mep} and @option{-mprolog-function} options.
33804 @opindex mtda
33805 @item -mtda=@var{n}
33806 Put static or global variables whose size is @var{n} bytes or less into
33807 the tiny data area that register @code{ep} points to.  The tiny data
33808 area can hold up to 256 bytes in total (128 bytes for byte references).
33810 @opindex msda
33811 @item -msda=@var{n}
33812 Put static or global variables whose size is @var{n} bytes or less into
33813 the small data area that register @code{gp} points to.  The small data
33814 area can hold up to 64 kilobytes.
33816 @opindex mzda
33817 @item -mzda=@var{n}
33818 Put static or global variables whose size is @var{n} bytes or less into
33819 the first 32 kilobytes of memory.
33821 @opindex mv850
33822 @item -mv850
33823 Specify that the target processor is the V850.
33825 @opindex mv850e3v5
33826 @item -mv850e3v5
33827 Specify that the target processor is the V850E3V5.  The preprocessor
33828 constant @code{__v850e3v5__} is defined if this option is used.
33830 @opindex mv850e2v4
33831 @item -mv850e2v4
33832 Specify that the target processor is the V850E3V5.  This is an alias for
33833 the @option{-mv850e3v5} option.
33835 @opindex mv850e2v3
33836 @item -mv850e2v3
33837 Specify that the target processor is the V850E2V3.  The preprocessor
33838 constant @code{__v850e2v3__} is defined if this option is used.
33840 @opindex mv850e2
33841 @item -mv850e2
33842 Specify that the target processor is the V850E2.  The preprocessor
33843 constant @code{__v850e2__} is defined if this option is used.
33845 @opindex mv850e1
33846 @item -mv850e1
33847 Specify that the target processor is the V850E1.  The preprocessor
33848 constants @code{__v850e1__} and @code{__v850e__} are defined if
33849 this option is used.
33851 @opindex mv850es
33852 @item -mv850es
33853 Specify that the target processor is the V850ES.  This is an alias for
33854 the @option{-mv850e1} option.
33856 @opindex mv850e
33857 @item -mv850e
33858 Specify that the target processor is the V850E@.  The preprocessor
33859 constant @code{__v850e__} is defined if this option is used.
33861 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
33862 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
33863 are defined then a default target processor is chosen and the
33864 relevant @samp{__v850*__} preprocessor constant is defined.
33866 The preprocessor constants @code{__v850} and @code{__v851__} are always
33867 defined, regardless of which processor variant is the target.
33869 @opindex mdisable-callt
33870 @opindex mno-disable-callt
33871 @item -mdisable-callt
33872 @itemx -mno-disable-callt
33873 This option suppresses generation of the @code{CALLT} instruction for the
33874 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
33875 architecture.
33877 This option is enabled by default when the RH850 ABI is
33878 in use (see @option{-mrh850-abi}), and disabled by default when the
33879 GCC ABI is in use.  If @code{CALLT} instructions are being generated
33880 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
33882 @opindex mrelax
33883 @opindex mno-relax
33884 @item -mrelax
33885 @itemx -mno-relax
33886 Pass on (or do not pass on) the @option{-mrelax} command-line option
33887 to the assembler.
33889 @opindex mlong-jumps
33890 @opindex mno-long-jumps
33891 @item -mlong-jumps
33892 @itemx -mno-long-jumps
33893 Disable (or re-enable) the generation of PC-relative jump instructions.
33895 @opindex msoft-float
33896 @opindex mhard-float
33897 @item -msoft-float
33898 @itemx -mhard-float
33899 Disable (or re-enable) the generation of hardware floating point
33900 instructions.  This option is only significant when the target
33901 architecture is @samp{V850E2V3} or higher.  If hardware floating point
33902 instructions are being generated then the C preprocessor symbol
33903 @code{__FPU_OK__} is defined, otherwise the symbol
33904 @code{__NO_FPU__} is defined.
33906 @opindex mloop
33907 @item -mloop
33908 Enables the use of the e3v5 LOOP instruction.  The use of this
33909 instruction is not enabled by default when the e3v5 architecture is
33910 selected because its use is still experimental.
33912 @opindex mrh850-abi
33913 @opindex mghs
33914 @item -mrh850-abi
33915 @itemx -mghs
33916 Enables support for the RH850 version of the V850 ABI.  This is the
33917 default.  With this version of the ABI the following rules apply:
33919 @itemize
33920 @item
33921 Integer sized structures and unions are returned via a memory pointer
33922 rather than a register.
33924 @item
33925 Large structures and unions (more than 8 bytes in size) are passed by
33926 value.
33928 @item
33929 Functions are aligned to 16-bit boundaries.
33931 @item
33932 The @option{-m8byte-align} command-line option is supported.
33934 @item
33935 The @option{-mdisable-callt} command-line option is enabled by
33936 default.  The @option{-mno-disable-callt} command-line option is not
33937 supported.
33938 @end itemize
33940 When this version of the ABI is enabled the C preprocessor symbol
33941 @code{__V850_RH850_ABI__} is defined.
33943 @opindex mgcc-abi
33944 @item -mgcc-abi
33945 Enables support for the old GCC version of the V850 ABI.  With this
33946 version of the ABI the following rules apply:
33948 @itemize
33949 @item
33950 Integer sized structures and unions are returned in register @code{r10}.
33952 @item
33953 Large structures and unions (more than 8 bytes in size) are passed by
33954 reference.
33956 @item
33957 Functions are aligned to 32-bit boundaries, unless optimizing for
33958 size.
33960 @item
33961 The @option{-m8byte-align} command-line option is not supported.
33963 @item
33964 The @option{-mdisable-callt} command-line option is supported but not
33965 enabled by default.
33966 @end itemize
33968 When this version of the ABI is enabled the C preprocessor symbol
33969 @code{__V850_GCC_ABI__} is defined.
33971 @opindex m8byte-align
33972 @opindex mno-8byte-align
33973 @item -m8byte-align
33974 @itemx -mno-8byte-align
33975 Enables support for @code{double} and @code{long long} types to be
33976 aligned on 8-byte boundaries.  The default is to restrict the
33977 alignment of all objects to at most 4-bytes.  When
33978 @option{-m8byte-align} is in effect the C preprocessor symbol
33979 @code{__V850_8BYTE_ALIGN__} is defined.
33981 @opindex mbig-switch
33982 @item -mbig-switch
33983 Generate code suitable for big switch tables.  Use this option only if
33984 the assembler/linker complain about out of range branches within a switch
33985 table.
33987 @opindex mapp-regs
33988 @item -mapp-regs
33989 This option causes r2 and r5 to be used in the code generated by
33990 the compiler.  This setting is the default.
33992 @opindex mno-app-regs
33993 @item -mno-app-regs
33994 This option causes r2 and r5 to be treated as fixed registers.
33996 @end table
33998 @node VAX Options
33999 @subsection VAX Options
34000 @cindex VAX options
34002 These @samp{-m} options are defined for the VAX:
34004 @table @gcctabopt
34005 @opindex munix
34006 @item -munix
34007 Do not output certain jump instructions (@code{aobleq} and so on)
34008 that the Unix assembler for the VAX cannot handle across long
34009 ranges.
34011 @opindex mgnu
34012 @item -mgnu
34013 Do output those jump instructions, on the assumption that the
34014 GNU assembler is being used.
34016 @opindex mg
34017 @item -mg
34018 Output code for G-format floating-point numbers instead of D-format.
34020 @opindex mlra
34021 @opindex mno-lra
34022 @item -mlra
34023 @itemx -mno-lra
34024 Enable Local Register Allocation.  This is still experimental for the VAX,
34025 so by default the compiler uses standard reload.
34026 @end table
34028 @node Visium Options
34029 @subsection Visium Options
34030 @cindex Visium options
34032 @table @gcctabopt
34034 @opindex mdebug
34035 @item -mdebug
34036 A program which performs file I/O and is destined to run on an MCM target
34037 should be linked with this option.  It causes the libraries libc.a and
34038 libdebug.a to be linked.  The program should be run on the target under
34039 the control of the GDB remote debugging stub.
34041 @opindex msim
34042 @item -msim
34043 A program which performs file I/O and is destined to run on the simulator
34044 should be linked with option.  This causes libraries libc.a and libsim.a to
34045 be linked.
34047 @opindex mfpu
34048 @opindex mhard-float
34049 @item -mfpu
34050 @itemx -mhard-float
34051 Generate code containing floating-point instructions.  This is the
34052 default.
34054 @opindex mno-fpu
34055 @opindex msoft-float
34056 @item -mno-fpu
34057 @itemx -msoft-float
34058 Generate code containing library calls for floating-point.
34060 @option{-msoft-float} changes the calling convention in the output file;
34061 therefore, it is only useful if you compile @emph{all} of a program with
34062 this option.  In particular, you need to compile @file{libgcc.a}, the
34063 library that comes with GCC, with @option{-msoft-float} in order for
34064 this to work.
34066 @opindex mcpu
34067 @item -mcpu=@var{cpu_type}
34068 Set the instruction set, register set, and instruction scheduling parameters
34069 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
34070 @samp{mcm}, @samp{gr5} and @samp{gr6}.
34072 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
34074 By default (unless configured otherwise), GCC generates code for the GR5
34075 variant of the Visium architecture.  
34077 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
34078 architecture.  The only difference from GR5 code is that the compiler will
34079 generate block move instructions.
34081 @opindex mtune
34082 @item -mtune=@var{cpu_type}
34083 Set the instruction scheduling parameters for machine type @var{cpu_type},
34084 but do not set the instruction set or register set that the option
34085 @option{-mcpu=@var{cpu_type}} would.
34087 @opindex msv-mode
34088 @item -msv-mode
34089 Generate code for the supervisor mode, where there are no restrictions on
34090 the access to general registers.  This is the default.
34092 @opindex muser-mode
34093 @item -muser-mode
34094 Generate code for the user mode, where the access to some general registers
34095 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
34096 mode; on the GR6, only registers r29 to r31 are affected.
34097 @end table
34099 @node VMS Options
34100 @subsection VMS Options
34102 These @samp{-m} options are defined for the VMS implementations:
34104 @table @gcctabopt
34105 @opindex mvms-return-codes
34106 @item -mvms-return-codes
34107 Return VMS condition codes from @code{main}. The default is to return POSIX-style
34108 condition (e.g.@: error) codes.
34110 @opindex mdebug-main=@var{prefix}
34111 @item -mdebug-main=@var{prefix}
34112 Flag the first routine whose name starts with @var{prefix} as the main
34113 routine for the debugger.
34115 @opindex mmalloc64
34116 @item -mmalloc64
34117 Default to 64-bit memory allocation routines.
34119 @opindex mpointer-size=@var{size}
34120 @item -mpointer-size=@var{size}
34121 Set the default size of pointers. Possible options for @var{size} are
34122 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
34123 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
34124 The later option disables @code{pragma pointer_size}.
34125 @end table
34127 @node VxWorks Options
34128 @subsection VxWorks Options
34129 @cindex VxWorks Options
34131 The options in this section are defined for all VxWorks targets.
34132 Options specific to the target hardware are listed with the other
34133 options for that target.
34135 @table @gcctabopt
34136 @opindex mrtp
34137 @item -mrtp
34138 GCC can generate code for both VxWorks kernels and real time processes
34139 (RTPs).  This option switches from the former to the latter.  It also
34140 defines the preprocessor macro @code{__RTP__}.
34142 @opindex msmp
34143 @item -msmp
34144 Select SMP runtimes for linking.  Not available on architectures other
34145 than PowerPC, nor on VxWorks version 7 or later, in which the selection
34146 is part of the VxWorks build configuration and the library paths are the
34147 same for either choice.
34149 @opindex non-static
34150 @item -non-static
34151 Link an RTP executable against shared libraries rather than static
34152 libraries.  The options @option{-static} and @option{-shared} can
34153 also be used for RTPs (@pxref{Link Options}); @option{-static}
34154 is the default.
34156 @opindex Bstatic
34157 @opindex Bdynamic
34158 @item -Bstatic
34159 @itemx -Bdynamic
34160 These options are passed down to the linker.  They are defined for
34161 compatibility with Diab.
34163 @opindex Xbind-lazy
34164 @item -Xbind-lazy
34165 Enable lazy binding of function calls.  This option is equivalent to
34166 @option{-Wl,-z,now} and is defined for compatibility with Diab.
34168 @opindex Xbind-now
34169 @item -Xbind-now
34170 Disable lazy binding of function calls.  This option is the default and
34171 is defined for compatibility with Diab.
34172 @end table
34174 @node x86 Options
34175 @subsection x86 Options
34176 @cindex x86 Options
34178 These @samp{-m} options are defined for the x86 family of computers.
34180 @table @gcctabopt
34182 @opindex march
34183 @item -march=@var{cpu-type}
34184 Generate instructions for the machine type @var{cpu-type}.  In contrast to
34185 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
34186 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
34187 to generate code that may not run at all on processors other than the one
34188 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
34189 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
34191 The choices for @var{cpu-type} are:
34193 @table @samp
34194 @item native
34195 This selects the CPU to generate code for at compilation time by determining
34196 the processor type of the compiling machine.  Using @option{-march=native}
34197 enables all instruction subsets supported by the local machine (hence
34198 the result might not run on different machines).  Using @option{-mtune=native}
34199 produces code optimized for the local machine under the constraints
34200 of the selected instruction set.  
34202 @item x86-64
34203 A generic CPU with 64-bit extensions.
34205 @item x86-64-v2
34206 @itemx x86-64-v3
34207 @itemx x86-64-v4
34208 These choices for @var{cpu-type} select the corresponding
34209 micro-architecture level from the x86-64 psABI.  On ABIs other than
34210 the x86-64 psABI they select the same CPU features as the x86-64 psABI
34211 documents for the particular micro-architecture level.
34213 Since these @var{cpu-type} values do not have a corresponding
34214 @option{-mtune} setting, using @option{-march} with these values enables
34215 generic tuning.  Specific tuning can be enabled using the
34216 @option{-mtune=@var{other-cpu-type}} option with an appropriate
34217 @var{other-cpu-type} value.
34219 @item i386
34220 Original Intel i386 CPU@.
34222 @item i486
34223 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
34225 @item i586
34226 @itemx pentium
34227 Intel Pentium CPU with no MMX support.
34229 @item lakemont
34230 Intel Lakemont MCU, based on Intel Pentium CPU.
34232 @item pentium-mmx
34233 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
34235 @item pentiumpro
34236 Intel Pentium Pro CPU@.
34238 @item i686
34239 When used with @option{-march}, the Pentium Pro
34240 instruction set is used, so the code runs on all i686 family chips.
34241 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
34243 @item pentium2
34244 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
34245 set support.
34247 @item pentium3
34248 @itemx pentium3m
34249 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
34250 instruction set support.
34252 @item pentium-m
34253 Intel Pentium M; low-power version of Intel Pentium III CPU
34254 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
34255 notebooks.
34257 @item pentium4
34258 @itemx pentium4m
34259 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
34261 @item prescott
34262 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
34263 instruction set support.
34265 @item nocona
34266 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
34267 SSE2, SSE3 and FXSR instruction set support.
34269 @item core2
34270 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
34271 SAHF and FXSR instruction set support.
34273 @item nehalem
34274 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34275 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
34277 @item westmere
34278 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34279 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
34281 @item sandybridge
34282 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34283 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
34284 support.
34286 @item ivybridge
34287 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
34288 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
34289 and F16C instruction set support.
34291 @item haswell
34292 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34293 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34294 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
34296 @item broadwell
34297 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34298 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34299 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
34300 instruction set support.
34302 @item skylake
34303 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34304 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34305 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34306 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
34308 @item bonnell
34309 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
34310 instruction set support.
34312 @item silvermont
34313 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34314 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
34315 instruction set support.
34317 @item goldmont
34318 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34319 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
34320 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
34321 set support.
34323 @item goldmont-plus
34324 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34325 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
34326 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
34327 RDPID and SGX instruction set support.
34329 @item tremont
34330 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34331 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
34332 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
34333 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
34334 support.
34336 @item sierraforest
34337 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34338 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34339 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34340 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34341 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34342 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
34343 support.
34345 @item grandridge
34346 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34347 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34348 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34349 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34350 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34351 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
34352 support.
34354 @item clearwaterforest
34355 Intel Clearwater Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
34356 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE,
34357 XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
34358 MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
34359 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34360 ENQCMD, UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16,
34361 SHA512, SM3, SM4, USER_MSR and PREFETCHI instruction set support.
34363 @item knl
34364 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34365 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34366 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34367 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
34369 @item knm
34370 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34371 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34372 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34373 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
34374 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
34376 @item skylake-avx512
34377 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34378 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34379 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34380 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
34381 AVX512DQ and AVX512CD instruction set support.
34383 @item cannonlake
34384 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
34385 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
34386 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
34387 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
34388 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
34389 support.
34391 @item icelake-client
34392 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34393 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34394 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34395 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34396 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
34397 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
34399 @item icelake-server
34400 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34401 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34402 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34403 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34404 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
34405 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
34406 instruction set support.
34408 @item cascadelake
34409 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34410 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34411 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34412 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
34413 AVX512CD and AVX512VNNI instruction set support.
34415 @item cooperlake
34416 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34417 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34418 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34419 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
34420 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
34422 @item tigerlake
34423 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34424 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34425 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34426 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
34427 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34428 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
34429 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
34431 @item sapphirerapids
34432 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34433 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34434 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34435 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34436 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34437 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34438 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34439 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
34440 instruction set support.
34442 @item alderlake
34443 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
34444 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
34445 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
34446 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
34447 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
34448 support.
34450 @item rocketlake
34451 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
34452 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
34453 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
34454 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
34455 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34456 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
34458 @item graniterapids
34459 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34460 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34461 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34462 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34463 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34464 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34465 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34466 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
34467 and PREFETCHI instruction set support.
34469 @item graniterapids-d
34470 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34471 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
34472 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
34473 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
34474 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
34475 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
34476 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
34477 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
34478 PREFETCHI and AMX-COMPLEX instruction set support.
34480 @item arrowlake
34481 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34482 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34483 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34484 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34485 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34486 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set
34487 support.
34489 @item arrowlake-s
34490 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34491 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34492 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34493 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34494 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34495 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
34496 SM3 and SM4 instruction set support.
34498 @item pantherlake
34499 Intel Panther Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
34500 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
34501 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
34502 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
34503 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
34504 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
34505 SM3, SM4 and PREFETCHI instruction set support.
34507 @item k6
34508 AMD K6 CPU with MMX instruction set support.
34510 @item k6-2
34511 @itemx k6-3
34512 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
34514 @item athlon
34515 @itemx athlon-tbird
34516 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
34517 support.
34519 @item athlon-4
34520 @itemx athlon-xp
34521 @itemx athlon-mp
34522 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
34523 instruction set support.
34525 @item k8
34526 @itemx opteron
34527 @itemx athlon64
34528 @itemx athlon-fx
34529 Processors based on the AMD K8 core with x86-64 instruction set support,
34530 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
34531 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
34532 instruction set extensions.)
34534 @item k8-sse3
34535 @itemx opteron-sse3
34536 @itemx athlon64-sse3
34537 Improved versions of AMD K8 cores with SSE3 instruction set support.
34539 @item amdfam10
34540 @itemx barcelona
34541 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
34542 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
34543 instruction set extensions.)
34545 @item bdver1
34546 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
34547 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
34548 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
34550 @item bdver2
34551 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34552 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
34553 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
34554 extensions.)
34556 @item bdver3
34557 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34558 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
34559 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
34560 64-bit instruction set extensions.)
34562 @item bdver4
34563 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
34564 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
34565 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
34566 SSE4.2, ABM and 64-bit instruction set extensions.)
34568 @item znver1
34569 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
34570 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
34571 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
34572 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
34573 instruction set extensions.)
34575 @item znver2
34576 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
34577 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34578 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34579 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34580 WBNOINVD, and 64-bit instruction set extensions.)
34582 @item znver3
34583 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
34584 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34585 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34586 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34587 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
34589 @item znver4
34590 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
34591 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34592 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34593 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34594 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
34595 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
34596 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
34598 @item znver5
34599 AMD Family 1ah core based CPUs with x86-64 instruction set support. (This
34600 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
34601 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
34602 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
34603 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
34604 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
34605 AVX512BITALG, AVX512VPOPCNTDQ, GFNI, AVXVNNI, MOVDIRI, MOVDIR64B,
34606 AVX512VP2INTERSECT, PREFETCHI and 64-bit instruction set extensions.)
34608 @item btver1
34609 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
34610 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
34611 instruction set extensions.)
34613 @item btver2
34614 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
34615 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
34616 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
34618 @item winchip-c6
34619 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
34620 set support.
34622 @item winchip2
34623 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
34624 instruction set support.
34626 @item c3
34627 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
34628 (No scheduling is implemented for this chip.)
34630 @item c3-2
34631 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
34632 (No scheduling is implemented for this chip.)
34634 @item c7
34635 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
34636 (No scheduling is implemented for this chip.)
34638 @item samuel-2
34639 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
34640 (No scheduling is implemented for this chip.)
34642 @item nehemiah
34643 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
34644 (No scheduling is implemented for this chip.)
34646 @item esther
34647 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
34648 (No scheduling is implemented for this chip.)
34650 @item eden-x2
34651 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
34652 (No scheduling is implemented for this chip.)
34654 @item eden-x4
34655 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
34656 AVX and AVX2 instruction set support.
34657 (No scheduling is implemented for this chip.)
34659 @item nano
34660 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34661 instruction set support.
34662 (No scheduling is implemented for this chip.)
34664 @item nano-1000
34665 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34666 instruction set support.
34667 (No scheduling is implemented for this chip.)
34669 @item nano-2000
34670 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
34671 instruction set support.
34672 (No scheduling is implemented for this chip.)
34674 @item nano-3000
34675 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34676 instruction set support.
34677 (No scheduling is implemented for this chip.)
34679 @item nano-x2
34680 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34681 instruction set support.
34682 (No scheduling is implemented for this chip.)
34684 @item nano-x4
34685 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
34686 instruction set support.
34687 (No scheduling is implemented for this chip.)
34689 @item lujiazui
34690 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
34691 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
34692 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
34694 @item yongfeng
34695 ZHAOXIN yongfeng CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
34696 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
34697 ABM, BMI, BMI2, F16C, FXSR, RDSEED, AVX2, FMA, SHA, LZCNT
34698 instruction set support.
34700 @item geode
34701 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
34702 @end table
34704 @opindex mtune
34705 @item -mtune=@var{cpu-type}
34706 Tune to @var{cpu-type} everything applicable about the generated code, except
34707 for the ABI and the set of available instructions.  
34708 While picking a specific @var{cpu-type} schedules things appropriately
34709 for that particular chip, the compiler does not generate any code that
34710 cannot run on the default machine type unless you use a
34711 @option{-march=@var{cpu-type}} option.
34712 For example, if GCC is configured for i686-pc-linux-gnu
34713 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
34714 but still runs on i686 machines.
34716 The choices for @var{cpu-type} are the same as for @option{-march}.
34717 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
34719 @table @samp
34720 @item generic
34721 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
34722 If you know the CPU on which your code will run, then you should use
34723 the corresponding @option{-mtune} or @option{-march} option instead of
34724 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
34725 of your application will have, then you should use this option.
34727 As new processors are deployed in the marketplace, the behavior of this
34728 option will change.  Therefore, if you upgrade to a newer version of
34729 GCC, code generation controlled by this option will change to reflect
34730 the processors
34731 that are most common at the time that version of GCC is released.
34733 There is no @option{-march=generic} option because @option{-march}
34734 indicates the instruction set the compiler can use, and there is no
34735 generic instruction set applicable to all processors.  In contrast,
34736 @option{-mtune} indicates the processor (or, in this case, collection of
34737 processors) for which the code is optimized.
34739 @item intel
34740 Produce code optimized for the most current Intel processors, which are
34741 Haswell and Silvermont for this version of GCC.  If you know the CPU
34742 on which your code will run, then you should use the corresponding
34743 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
34744 But, if you want your application performs better on both Haswell and
34745 Silvermont, then you should use this option.
34747 As new Intel processors are deployed in the marketplace, the behavior of
34748 this option will change.  Therefore, if you upgrade to a newer version of
34749 GCC, code generation controlled by this option will change to reflect
34750 the most current Intel processors at the time that version of GCC is
34751 released.
34753 There is no @option{-march=intel} option because @option{-march} indicates
34754 the instruction set the compiler can use, and there is no common
34755 instruction set applicable to all processors.  In contrast,
34756 @option{-mtune} indicates the processor (or, in this case, collection of
34757 processors) for which the code is optimized.
34758 @end table
34760 @opindex mcpu
34761 @item -mcpu=@var{cpu-type}
34762 A deprecated synonym for @option{-mtune}.
34764 @opindex mfpmath
34765 @item -mfpmath=@var{unit}
34766 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
34767 for @var{unit} are:
34769 @table @samp
34770 @item 387
34771 Use the standard 387 floating-point coprocessor present on the majority of chips and
34772 emulated otherwise.  Code compiled with this option runs almost everywhere.
34773 The temporary results are computed in 80-bit precision instead of the precision
34774 specified by the type, resulting in slightly different results compared to most
34775 of other chips.  See @option{-ffloat-store} for more detailed description.
34777 This is the default choice for non-Darwin x86-32 targets.
34779 @item sse
34780 Use scalar floating-point instructions present in the SSE instruction set.
34781 This instruction set is supported by Pentium III and newer chips,
34782 and in the AMD line
34783 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
34784 instruction set supports only single-precision arithmetic, thus the double and
34785 extended-precision arithmetic are still done using 387.  A later version, present
34786 only in Pentium 4 and AMD x86-64 chips, supports double-precision
34787 arithmetic too.
34789 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
34790 or @option{-msse2} switches to enable SSE extensions and make this option
34791 effective.  For the x86-64 compiler, these extensions are enabled by default.
34793 The resulting code should be considerably faster in the majority of cases and avoid
34794 the numerical instability problems of 387 code, but may break some existing
34795 code that expects temporaries to be 80 bits.
34797 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
34798 and the default choice for x86-32 targets with the SSE2 instruction set
34799 when @option{-ffast-math} is enabled.
34801 @item sse,387
34802 @itemx sse+387
34803 @itemx both
34804 Attempt to utilize both instruction sets at once.  This effectively doubles the
34805 amount of available registers, and on chips with separate execution units for
34806 387 and SSE the execution resources too.  Use this option with care, as it is
34807 still experimental, because the GCC register allocator does not model separate
34808 functional units well, resulting in unstable performance.
34809 @end table
34811 @opindex masm=@var{dialect}
34812 @item -masm=@var{dialect}
34813 Output assembly instructions using selected @var{dialect}.  Also affects
34814 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
34815 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
34816 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
34817 not support @samp{intel}.
34819 @opindex mieee-fp
34820 @opindex mno-ieee-fp
34821 @item -mieee-fp
34822 @itemx -mno-ieee-fp
34823 Control whether or not the compiler uses IEEE floating-point
34824 comparisons.  These correctly handle the case where the result of a
34825 comparison is unordered.
34827 @opindex m80387
34828 @opindex mhard-float
34829 @item -m80387
34830 @itemx -mhard-float
34831 Generate output containing 80387 instructions for floating point.
34833 @opindex no-80387
34834 @opindex msoft-float
34835 @item -mno-80387
34836 @itemx -msoft-float
34837 Generate output containing library calls for floating point.
34839 @strong{Warning:} the requisite libraries are not part of GCC@.
34840 Normally the facilities of the machine's usual C compiler are used, but
34841 this cannot be done directly in cross-compilation.  You must make your
34842 own arrangements to provide suitable library functions for
34843 cross-compilation.
34845 On machines where a function returns floating-point results in the 80387
34846 register stack, some floating-point opcodes may be emitted even if
34847 @option{-msoft-float} is used.
34849 @opindex mno-fp-ret-in-387
34850 @opindex mfp-ret-in-387
34851 @item -mno-fp-ret-in-387
34852 Do not use the FPU registers for return values of functions.
34854 The usual calling convention has functions return values of types
34855 @code{float} and @code{double} in an FPU register, even if there
34856 is no FPU@.  The idea is that the operating system should emulate
34857 an FPU@.
34859 The option @option{-mno-fp-ret-in-387} causes such values to be returned
34860 in ordinary CPU registers instead.
34862 @opindex mno-fancy-math-387
34863 @opindex mfancy-math-387
34864 @item -mno-fancy-math-387
34865 Some 387 emulators do not support the @code{sin}, @code{cos} and
34866 @code{sqrt} instructions for the 387.  Specify this option to avoid
34867 generating those instructions.
34868 This option is overridden when @option{-march}
34869 indicates that the target CPU always has an FPU and so the
34870 instruction does not need emulation.  These
34871 instructions are not generated unless you also use the
34872 @option{-funsafe-math-optimizations} switch.
34874 @opindex malign-double
34875 @opindex mno-align-double
34876 @item -malign-double
34877 @itemx -mno-align-double
34878 Control whether GCC aligns @code{double}, @code{long double}, and
34879 @code{long long} variables on a two-word boundary or a one-word
34880 boundary.  Aligning @code{double} variables on a two-word boundary
34881 produces code that runs somewhat faster on a Pentium at the
34882 expense of more memory.
34884 On x86-64, @option{-malign-double} is enabled by default.
34886 @strong{Warning:} if you use the @option{-malign-double} switch,
34887 structures containing the above types are aligned differently than
34888 the published application binary interface specifications for the x86-32
34889 and are not binary compatible with structures in code compiled
34890 without that switch.
34892 @opindex m96bit-long-double
34893 @opindex m128bit-long-double
34894 @item -m96bit-long-double
34895 @itemx -m128bit-long-double
34896 These switches control the size of @code{long double} type.  The x86-32
34897 application binary interface specifies the size to be 96 bits,
34898 so @option{-m96bit-long-double} is the default in 32-bit mode.
34900 Modern architectures (Pentium and newer) prefer @code{long double}
34901 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
34902 conforming to the ABI, this is not possible.  So specifying
34903 @option{-m128bit-long-double} aligns @code{long double}
34904 to a 16-byte boundary by padding the @code{long double} with an additional
34905 32-bit zero.
34907 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
34908 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
34910 Notice that neither of these options enable any extra precision over the x87
34911 standard of 80 bits for a @code{long double}.
34913 @strong{Warning:} if you override the default value for your target ABI, this
34914 changes the size of 
34915 structures and arrays containing @code{long double} variables,
34916 as well as modifying the function calling convention for functions taking
34917 @code{long double}.  Hence they are not binary-compatible
34918 with code compiled without that switch.
34920 @opindex mlong-double-64
34921 @opindex mlong-double-80
34922 @opindex mlong-double-128
34923 @item -mlong-double-64
34924 @itemx -mlong-double-80
34925 @itemx -mlong-double-128
34926 These switches control the size of @code{long double} type. A size
34927 of 64 bits makes the @code{long double} type equivalent to the @code{double}
34928 type. This is the default for 32-bit Bionic C library.  A size
34929 of 128 bits makes the @code{long double} type equivalent to the
34930 @code{__float128} type. This is the default for 64-bit Bionic C library.
34932 @strong{Warning:} if you override the default value for your target ABI, this
34933 changes the size of
34934 structures and arrays containing @code{long double} variables,
34935 as well as modifying the function calling convention for functions taking
34936 @code{long double}.  Hence they are not binary-compatible
34937 with code compiled without that switch.
34939 @opindex malign-data
34940 @item -malign-data=@var{type}
34941 Control how GCC aligns variables.  Supported values for @var{type} are
34942 @samp{compat} uses increased alignment value compatible uses GCC 4.8
34943 and earlier, @samp{abi} uses alignment value as specified by the
34944 psABI, and @samp{cacheline} uses increased alignment value to match
34945 the cache line size.  @samp{compat} is the default.
34947 @opindex mlarge-data-threshold
34948 @item -mlarge-data-threshold=@var{threshold}
34949 When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
34950 objects larger than @var{threshold} are placed in large data sections.  The
34951 default is 65535.
34953 @opindex mrtd
34954 @item -mrtd
34955 Use a different function-calling convention, in which functions that
34956 take a fixed number of arguments return with the @code{ret @var{num}}
34957 instruction, which pops their arguments while returning.  This saves one
34958 instruction in the caller since there is no need to pop the arguments
34959 there.
34961 You can specify that an individual function is called with this calling
34962 sequence with the function attribute @code{stdcall}.  You can also
34963 override the @option{-mrtd} option by using the function attribute
34964 @code{cdecl}.  @xref{Function Attributes}.
34966 @strong{Warning:} this calling convention is incompatible with the one
34967 normally used on Unix, so you cannot use it if you need to call
34968 libraries compiled with the Unix compiler.
34970 Also, you must provide function prototypes for all functions that
34971 take variable numbers of arguments (including @code{printf});
34972 otherwise incorrect code is generated for calls to those
34973 functions.
34975 In addition, seriously incorrect code results if you call a
34976 function with too many arguments.  (Normally, extra arguments are
34977 harmlessly ignored.)
34979 @opindex mregparm
34980 @item -mregparm=@var{num}
34981 Control how many registers are used to pass integer arguments.  By
34982 default, no registers are used to pass arguments, and at most 3
34983 registers can be used.  You can control this behavior for a specific
34984 function by using the function attribute @code{regparm}.
34985 @xref{Function Attributes}.
34987 @strong{Warning:} if you use this switch, and
34988 @var{num} is nonzero, then you must build all modules with the same
34989 value, including any libraries.  This includes the system libraries and
34990 startup modules.
34992 @opindex msseregparm
34993 @item -msseregparm
34994 Use SSE register passing conventions for float and double arguments
34995 and return values.  You can control this behavior for a specific
34996 function by using the function attribute @code{sseregparm}.
34997 @xref{Function Attributes}.
34999 @strong{Warning:} if you use this switch then you must build all
35000 modules with the same value, including any libraries.  This includes
35001 the system libraries and startup modules.
35003 @opindex mvect8-ret-in-mem
35004 @item -mvect8-ret-in-mem
35005 Return 8-byte vectors in memory instead of MMX registers.  This is the
35006 default on VxWorks to match the ABI of the Sun Studio compilers until
35007 version 12.  @emph{Only} use this option if you need to remain
35008 compatible with existing code produced by those previous compiler
35009 versions or older versions of GCC@.
35011 @opindex mpc32
35012 @opindex mpc64
35013 @opindex mpc80
35014 @item -mpc32
35015 @itemx -mpc64
35016 @itemx -mpc80
35018 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
35019 is specified, the significands of results of floating-point operations are
35020 rounded to 24 bits (single precision); @option{-mpc64} rounds the
35021 significands of results of floating-point operations to 53 bits (double
35022 precision) and @option{-mpc80} rounds the significands of results of
35023 floating-point operations to 64 bits (extended double precision), which is
35024 the default.  When this option is used, floating-point operations in higher
35025 precisions are not available to the programmer without setting the FPU
35026 control word explicitly.
35028 Setting the rounding of floating-point operations to less than the default
35029 80 bits can speed some programs by 2% or more.  Note that some mathematical
35030 libraries assume that extended-precision (80-bit) floating-point operations
35031 are enabled by default; routines in such libraries could suffer significant
35032 loss of accuracy, typically through so-called ``catastrophic cancellation'',
35033 when this option is used to set the precision to less than extended precision.
35035 @opindex mdaz-ftz
35036 @item -mdaz-ftz
35038 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
35039 are used to control floating-point calculations.SSE and AVX instructions
35040 including scalar and vector instructions could benefit from enabling the FTZ
35041 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
35042 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
35043 will set FTZ/DAZ flags even with @option{-shared}.
35045 @opindex mstackrealign
35046 @item -mstackrealign
35047 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
35048 option generates an alternate prologue and epilogue that realigns the
35049 run-time stack if necessary.  This supports mixing legacy codes that keep
35050 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
35051 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
35052 applicable to individual functions.
35054 @opindex mpreferred-stack-boundary
35055 @item -mpreferred-stack-boundary=@var{num}
35056 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
35057 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
35058 the default is 4 (16 bytes or 128 bits).
35060 @strong{Warning:} When generating code for the x86-64 architecture with
35061 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
35062 used to keep the stack boundary aligned to 8 byte boundary.  Since
35063 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
35064 intended to be used in controlled environment where stack space is
35065 important limitation.  This option leads to wrong code when functions
35066 compiled with 16 byte stack alignment (such as functions from a standard
35067 library) are called with misaligned stack.  In this case, SSE
35068 instructions may lead to misaligned memory access traps.  In addition,
35069 variable arguments are handled incorrectly for 16 byte aligned
35070 objects (including x87 long double and __int128), leading to wrong
35071 results.  You must build all modules with
35072 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
35073 includes the system libraries and startup modules.
35075 @opindex mincoming-stack-boundary
35076 @item -mincoming-stack-boundary=@var{num}
35077 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
35078 boundary.  If @option{-mincoming-stack-boundary} is not specified,
35079 the one specified by @option{-mpreferred-stack-boundary} is used.
35081 On Pentium and Pentium Pro, @code{double} and @code{long double} values
35082 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
35083 suffer significant run time performance penalties.  On Pentium III, the
35084 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
35085 properly if it is not 16-byte aligned.
35087 To ensure proper alignment of this values on the stack, the stack boundary
35088 must be as aligned as that required by any value stored on the stack.
35089 Further, every function must be generated such that it keeps the stack
35090 aligned.  Thus calling a function compiled with a higher preferred
35091 stack boundary from a function compiled with a lower preferred stack
35092 boundary most likely misaligns the stack.  It is recommended that
35093 libraries that use callbacks always use the default setting.
35095 This extra alignment does consume extra stack space, and generally
35096 increases code size.  Code that is sensitive to stack space usage, such
35097 as embedded systems and operating system kernels, may want to reduce the
35098 preferred alignment to @option{-mpreferred-stack-boundary=2}.
35100 @need 200
35101 @opindex mmmx
35102 @item -mmmx
35103 @need 200
35104 @opindex msse
35105 @itemx -msse
35106 @need 200
35107 @opindex msse2
35108 @itemx -msse2
35109 @need 200
35110 @opindex msse3
35111 @itemx -msse3
35112 @need 200
35113 @opindex mssse3
35114 @itemx -mssse3
35115 @need 200
35116 @opindex msse4
35117 @itemx -msse4
35118 @need 200
35119 @opindex msse4a
35120 @itemx -msse4a
35121 @need 200
35122 @opindex msse4.1
35123 @itemx -msse4.1
35124 @need 200
35125 @opindex msse4.2
35126 @itemx -msse4.2
35127 @need 200
35128 @opindex mavx
35129 @itemx -mavx
35130 @need 200
35131 @opindex mavx2
35132 @itemx -mavx2
35133 @need 200
35134 @opindex mavx512f
35135 @itemx -mavx512f
35136 @need 200
35137 @opindex mavx512pf
35138 @itemx -mavx512pf
35139 @need 200
35140 @opindex mavx512er
35141 @itemx -mavx512er
35142 @need 200
35143 @opindex mavx512cd
35144 @itemx -mavx512cd
35145 @need 200
35146 @opindex mavx512vl
35147 @itemx -mavx512vl
35148 @need 200
35149 @opindex mavx512bw
35150 @itemx -mavx512bw
35151 @need 200
35152 @opindex mavx512dq
35153 @itemx -mavx512dq
35154 @need 200
35155 @opindex mavx512ifma
35156 @itemx -mavx512ifma
35157 @need 200
35158 @opindex mavx512vbmi
35159 @itemx -mavx512vbmi
35160 @need 200
35161 @opindex msha
35162 @itemx -msha
35163 @need 200
35164 @opindex maes
35165 @itemx -maes
35166 @need 200
35167 @opindex mpclmul
35168 @itemx -mpclmul
35169 @need 200
35170 @opindex mclflushopt
35171 @itemx -mclflushopt
35172 @need 200
35173 @opindex mclwb
35174 @itemx -mclwb
35175 @need 200
35176 @opindex mfsgsbase
35177 @itemx -mfsgsbase
35178 @need 200
35179 @opindex mptwrite
35180 @itemx -mptwrite
35181 @need 200
35182 @opindex mrdrnd
35183 @itemx -mrdrnd
35184 @need 200
35185 @opindex mf16c
35186 @itemx -mf16c
35187 @need 200
35188 @opindex mfma
35189 @itemx -mfma
35190 @need 200
35191 @opindex mpconfig
35192 @itemx -mpconfig
35193 @need 200
35194 @opindex mwbnoinvd
35195 @itemx -mwbnoinvd
35196 @need 200
35197 @opindex mfma4
35198 @itemx -mfma4
35199 @need 200
35200 @opindex mprfchw
35201 @itemx -mprfchw
35202 @need 200
35203 @opindex mrdpid
35204 @itemx -mrdpid
35205 @need 200
35206 @opindex mprefetchwt1
35207 @itemx -mprefetchwt1
35208 @need 200
35209 @opindex mrdseed
35210 @itemx -mrdseed
35211 @need 200
35212 @opindex msgx
35213 @itemx -msgx
35214 @need 200
35215 @opindex mxop
35216 @itemx -mxop
35217 @need 200
35218 @opindex mlwp
35219 @itemx -mlwp
35220 @need 200
35221 @opindex m3dnow
35222 @itemx -m3dnow
35223 @need 200
35224 @opindex m3dnowa
35225 @itemx -m3dnowa
35226 @need 200
35227 @opindex mpopcnt
35228 @itemx -mpopcnt
35229 @need 200
35230 @opindex mabm
35231 @itemx -mabm
35232 @need 200
35233 @opindex madx
35234 @itemx -madx
35235 @need 200
35236 @opindex mbmi
35237 @itemx -mbmi
35238 @need 200
35239 @opindex mbmi2
35240 @itemx -mbmi2
35241 @need 200
35242 @opindex mlzcnt
35243 @itemx -mlzcnt
35244 @need 200
35245 @opindex mfxsr
35246 @itemx -mfxsr
35247 @need 200
35248 @opindex mxsave
35249 @itemx -mxsave
35250 @need 200
35251 @opindex mxsaveopt
35252 @itemx -mxsaveopt
35253 @need 200
35254 @opindex mxsavec
35255 @itemx -mxsavec
35256 @need 200
35257 @opindex mxsaves
35258 @itemx -mxsaves
35259 @need 200
35260 @opindex mrtm
35261 @itemx -mrtm
35262 @need 200
35263 @opindex mhle
35264 @itemx -mhle
35265 @need 200
35266 @opindex mtbm
35267 @itemx -mtbm
35268 @need 200
35269 @opindex mmwaitx
35270 @itemx -mmwaitx
35271 @need 200
35272 @opindex mclzero
35273 @itemx -mclzero
35274 @need 200
35275 @opindex mpku
35276 @itemx -mpku
35277 @need 200
35278 @opindex mavx512vbmi2
35279 @itemx -mavx512vbmi2
35280 @need 200
35281 @opindex mavx512bf16
35282 @itemx -mavx512bf16
35283 @need 200
35284 @opindex mavx512fp16
35285 @itemx -mavx512fp16
35286 @need 200
35287 @opindex mgfni
35288 @itemx -mgfni
35289 @need 200
35290 @opindex mvaes
35291 @itemx -mvaes
35292 @need 200
35293 @opindex mwaitpkg
35294 @itemx -mwaitpkg
35295 @need 200
35296 @opindex mvpclmulqdq
35297 @itemx -mvpclmulqdq
35298 @need 200
35299 @opindex mavx512bitalg
35300 @itemx -mavx512bitalg
35301 @need 200
35302 @opindex mmovdiri
35303 @itemx -mmovdiri
35304 @need 200
35305 @opindex mmovdir64b
35306 @itemx -mmovdir64b
35307 @need 200
35308 @opindex menqcmd
35309 @opindex muintr
35310 @itemx -menqcmd
35311 @itemx -muintr
35312 @need 200
35313 @opindex mtsxldtrk
35314 @itemx -mtsxldtrk
35315 @need 200
35316 @opindex mavx512vpopcntdq
35317 @itemx -mavx512vpopcntdq
35318 @need 200
35319 @opindex mavx512vp2intersect
35320 @itemx -mavx512vp2intersect
35321 @need 200
35322 @opindex mavx5124fmaps
35323 @itemx -mavx5124fmaps
35324 @need 200
35325 @opindex mavx512vnni
35326 @itemx -mavx512vnni
35327 @need 200
35328 @opindex mavxvnni
35329 @itemx -mavxvnni
35330 @need 200
35331 @opindex mavx5124vnniw
35332 @itemx -mavx5124vnniw
35333 @need 200
35334 @opindex mcldemote
35335 @itemx -mcldemote
35336 @need 200
35337 @opindex mserialize
35338 @itemx -mserialize
35339 @need 200
35340 @opindex mamx-tile
35341 @itemx -mamx-tile
35342 @need 200
35343 @opindex mamx-int8
35344 @itemx -mamx-int8
35345 @need 200
35346 @opindex mamx-bf16
35347 @itemx -mamx-bf16
35348 @need 200
35349 @opindex mhreset
35350 @opindex mkl
35351 @itemx -mhreset
35352 @itemx -mkl
35353 @need 200
35354 @opindex mwidekl
35355 @itemx -mwidekl
35356 @need 200
35357 @opindex mavxifma
35358 @itemx -mavxifma
35359 @need 200
35360 @opindex mavxvnniint8
35361 @itemx -mavxvnniint8
35362 @need 200
35363 @opindex mavxneconvert
35364 @itemx -mavxneconvert
35365 @need 200
35366 @opindex mcmpccxadd
35367 @itemx -mcmpccxadd
35368 @need 200
35369 @opindex mamx-fp16
35370 @itemx -mamx-fp16
35371 @need 200
35372 @opindex mprefetchi
35373 @itemx -mprefetchi
35374 @need 200
35375 @opindex mraoint
35376 @itemx -mraoint
35377 @need 200
35378 @opindex mamx-complex
35379 @itemx -mamx-complex
35380 @need 200
35381 @opindex mavxvnniint16
35382 @itemx -mavxvnniint16
35383 @need 200
35384 @opindex msm3
35385 @itemx -msm3
35386 @need 200
35387 @opindex msha512
35388 @itemx -msha512
35389 @need 200
35390 @opindex msm4
35391 @itemx -msm4
35392 @need 200
35393 @opindex mapxf
35394 @itemx -mapxf
35395 @need 200
35396 @opindex musermsr
35397 @itemx -musermsr
35398 @need 200
35399 @opindex mavx10.1
35400 @itemx -mavx10.1
35401 @need 200
35402 @opindex mavx10.1-256
35403 @itemx -mavx10.1-256
35404 @need 200
35405 @opindex mavx10.1-512
35406 @itemx -mavx10.1-512
35407 These switches enable the use of instructions in the MMX, SSE,
35408 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
35409 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
35410 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
35411 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
35412 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
35413 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
35414 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
35415 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
35416 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
35417 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4, APX_F, USER_MSR, AVX10.1 or
35418 CLDEMOTE extended instruction sets.  Each has a corresponding @option{-mno-}
35419 option to disable use of these instructions.
35421 These extensions are also available as built-in functions: see
35422 @ref{x86 Built-in Functions}, for details of the functions enabled and
35423 disabled by these switches.
35425 To generate SSE/SSE2 instructions automatically from floating-point
35426 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
35428 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
35429 generates new AVX instructions or AVX equivalence for all SSEx instructions
35430 when needed.
35432 These options enable GCC to use these extended instructions in
35433 generated code, even without @option{-mfpmath=sse}.  Applications that
35434 perform run-time CPU detection must compile separate files for each
35435 supported architecture, using the appropriate flags.  In particular,
35436 the file containing the CPU detection code should be compiled without
35437 these options.
35439 @opindex mdump-tune-features
35440 @item -mdump-tune-features
35441 This option instructs GCC to dump the names of the x86 performance 
35442 tuning features and default settings. The names can be used in 
35443 @option{-mtune-ctrl=@var{feature-list}}.
35445 @opindex mtune-ctrl=@var{feature-list}
35446 @item -mtune-ctrl=@var{feature-list}
35447 This option is used to do fine grain control of x86 code generation features.
35448 @var{feature-list} is a comma separated list of @var{feature} names. See also
35449 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
35450 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
35451 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
35452 developers. Using it may lead to code paths not covered by testing and can
35453 potentially result in compiler ICEs or runtime errors.
35455 @opindex mno-default
35456 @item -mno-default
35457 This option instructs GCC to turn off all tunable features. See also 
35458 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
35460 @opindex mcld
35461 @item -mcld
35462 This option instructs GCC to emit a @code{cld} instruction in the prologue
35463 of functions that use string instructions.  String instructions depend on
35464 the DF flag to select between autoincrement or autodecrement mode.  While the
35465 ABI specifies the DF flag to be cleared on function entry, some operating
35466 systems violate this specification by not clearing the DF flag in their
35467 exception dispatchers.  The exception handler can be invoked with the DF flag
35468 set, which leads to wrong direction mode when string instructions are used.
35469 This option can be enabled by default on 32-bit x86 targets by configuring
35470 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
35471 instructions can be suppressed with the @option{-mno-cld} compiler option
35472 in this case.
35474 @opindex mvzeroupper
35475 @item -mvzeroupper
35476 This option instructs GCC to emit a @code{vzeroupper} instruction
35477 before a transfer of control flow out of the function to minimize
35478 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
35479 intrinsics.
35481 @opindex mprefer-avx128
35482 @item -mprefer-avx128
35483 This option instructs GCC to use 128-bit AVX instructions instead of
35484 256-bit AVX instructions in the auto-vectorizer.
35486 @opindex mprefer-vector-width
35487 @item -mprefer-vector-width=@var{opt}
35488 This option instructs GCC to use @var{opt}-bit vector width in instructions
35489 instead of default on the selected platform.
35491 @opindex mpartial-vector-fp-math
35492 @item -mpartial-vector-fp-math
35493 This option enables GCC to generate floating-point operations that might
35494 affect the set of floating-point status flags on partial vectors, where
35495 vector elements reside in the low part of the 128-bit SSE register.  Unless
35496 @option{-fno-trapping-math} is specified, the compiler guarantees correct
35497 behavior by sanitizing all input operands to have zeroes in the unused
35498 upper part of the vector register.  Note that by using built-in functions
35499 or inline assembly with partial vector arguments, NaNs, denormal or invalid
35500 values can leak into the upper part of the vector, causing possible
35501 performance issues when @option{-fno-trapping-math} is in effect.  These
35502 issues can be mitigated by manually sanitizing the upper part of the partial
35503 vector argument register or by using @option{-mdaz-ftz} to set
35504 denormals-are-zero (DAZ) flag in the MXCSR register.
35506 This option is enabled by default.
35508 @opindex mmove-max
35509 @item -mmove-max=@var{bits}
35510 This option instructs GCC to set the maximum number of bits can be
35511 moved from memory to memory efficiently to @var{bits}.  The valid
35512 @var{bits} are 128, 256 and 512.
35514 @opindex mstore-max
35515 @item -mstore-max=@var{bits}
35516 This option instructs GCC to set the maximum number of bits can be
35517 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
35518 128, 256 and 512.
35520 @table @samp
35521 @item none
35522 No extra limitations applied to GCC other than defined by the selected platform.
35524 @item 128
35525 Prefer 128-bit vector width for instructions.
35527 @item 256
35528 Prefer 256-bit vector width for instructions.
35530 @item 512
35531 Prefer 512-bit vector width for instructions.
35532 @end table
35534 @opindex mnoreturn-no-callee-saved-registers
35535 @item -mnoreturn-no-callee-saved-registers
35536 This option optimizes functions with @code{noreturn} attribute or
35537 @code{_Noreturn} specifier by not saving in the function prologue callee-saved
35538 registers which are used in the function (except for the @code{BP}
35539 register).  This option can interfere with debugging of the caller of the
35540 @code{noreturn} function or any function further up in the call stack, so it
35541 is not enabled by default.
35543 @opindex mcx16
35544 @item -mcx16
35545 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
35546 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
35547 objects.  This is useful for atomic updates of data structures exceeding one
35548 machine word in size.  The compiler uses this instruction to implement
35549 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
35550 128-bit integers, a library call is always used.
35552 @opindex msahf
35553 @item -msahf
35554 This option enables generation of @code{SAHF} instructions in 64-bit code.
35555 Early Intel Pentium 4 CPUs with Intel 64 support,
35556 prior to the introduction of Pentium 4 G1 step in December 2005,
35557 lacked the @code{LAHF} and @code{SAHF} instructions
35558 which are supported by AMD64.
35559 These are load and store instructions, respectively, for certain status flags.
35560 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
35561 @code{drem}, and @code{remainder} built-in functions;
35562 see @ref{Other Builtins} for details.
35564 @opindex mmovbe
35565 @item -mmovbe
35566 This option enables use of the @code{movbe} instruction to optimize
35567 byte swapping of four and eight byte entities.
35569 @opindex mshstk
35570 @item -mshstk
35571 The @option{-mshstk} option enables shadow stack built-in functions
35572 from x86 Control-flow Enforcement Technology (CET).
35574 @opindex mcrc32
35575 @item -mcrc32
35576 This option enables built-in functions @code{__builtin_ia32_crc32qi},
35577 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
35578 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
35580 @opindex mmwait
35581 @item -mmwait
35582 This option enables built-in functions @code{__builtin_ia32_monitor},
35583 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
35584 @code{mwait} machine instructions.
35586 @opindex mrecip
35587 @item -mrecip
35588 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
35589 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
35590 with an additional Newton-Raphson step
35591 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
35592 (and their vectorized
35593 variants) for single-precision floating-point arguments.  These instructions
35594 are generated only when @option{-funsafe-math-optimizations} is enabled
35595 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
35596 Note that while the throughput of the sequence is higher than the throughput
35597 of the non-reciprocal instruction, the precision of the sequence can be
35598 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
35600 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
35601 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
35602 combination), and doesn't need @option{-mrecip}.
35604 Also note that GCC emits the above sequence with additional Newton-Raphson step
35605 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
35606 already with @option{-ffast-math} (or the above option combination), and
35607 doesn't need @option{-mrecip}.
35609 @opindex mrecip=opt
35610 @item -mrecip=@var{opt}
35611 This option controls which reciprocal estimate instructions
35612 may be used.  @var{opt} is a comma-separated list of options, which may
35613 be preceded by a @samp{!} to invert the option:
35615 @table @samp
35616 @item all
35617 Enable all estimate instructions.
35619 @item default
35620 Enable the default instructions, equivalent to @option{-mrecip}.
35622 @item none
35623 Disable all estimate instructions, equivalent to @option{-mno-recip}.
35625 @item div
35626 Enable the approximation for scalar division.
35628 @item vec-div
35629 Enable the approximation for vectorized division.
35631 @item sqrt
35632 Enable the approximation for scalar square root.
35634 @item vec-sqrt
35635 Enable the approximation for vectorized square root.
35636 @end table
35638 So, for example, @option{-mrecip=all,!sqrt} enables
35639 all of the reciprocal approximations, except for square root.
35641 @opindex mveclibabi
35642 @item -mveclibabi=@var{type}
35643 Specifies the ABI type to use for vectorizing intrinsics using an
35644 external library.  Supported values for @var{type} are @samp{svml} 
35645 for the Intel short
35646 vector math library and @samp{acml} for the AMD math core library.
35647 To use this option, both @option{-ftree-vectorize} and
35648 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
35649 ABI-compatible library must be specified at link time.
35651 GCC currently emits calls to @code{vmldExp2},
35652 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
35653 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
35654 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
35655 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
35656 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
35657 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
35658 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
35659 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
35660 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
35661 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
35662 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
35663 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
35664 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
35665 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
35666 when @option{-mveclibabi=acml} is used.  
35668 @opindex mabi
35669 @item -mabi=@var{name}
35670 Generate code for the specified calling convention.  Permissible values
35671 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
35672 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
35673 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
35674 You can control this behavior for specific functions by
35675 using the function attributes @code{ms_abi} and @code{sysv_abi}.
35676 @xref{Function Attributes}.
35678 @opindex mforce-indirect-call
35679 @item -mforce-indirect-call
35680 Force all calls to functions to be indirect. This is useful
35681 when using Intel Processor Trace where it generates more precise timing
35682 information for function calls.
35684 @opindex mmanual-endbr
35685 @item -mmanual-endbr
35686 Insert ENDBR instruction at function entry only via the @code{cf_check}
35687 function attribute. This is useful when used with the option
35688 @option{-fcf-protection=branch} to control ENDBR insertion at the
35689 function entry.
35691 @opindex mcet-switch
35692 @item -mcet-switch
35693 By default, CET instrumentation is turned off on switch statements that
35694 use a jump table and indirect branch track is disabled.  Since jump
35695 tables are stored in read-only memory, this does not result in a direct
35696 loss of hardening.  But if the jump table index is attacker-controlled,
35697 the indirect jump may not be constrained by CET.  This option turns on
35698 CET instrumentation to enable indirect branch track for switch statements
35699 with jump tables which leads to the jump targets reachable via any indirect
35700 jumps.
35702 @opindex mcall-ms2sysv-xlogues
35703 @opindex mno-call-ms2sysv-xlogues
35704 @item -mcall-ms2sysv-xlogues
35705 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
35706 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
35707 default, the code for saving and restoring these registers is emitted inline,
35708 resulting in fairly lengthy prologues and epilogues.  Using
35709 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
35710 use stubs in the static portion of libgcc to perform these saves and restores,
35711 thus reducing function size at the cost of a few extra instructions.
35713 @opindex mtls-dialect
35714 @item -mtls-dialect=@var{type}
35715 Generate code to access thread-local storage using the @samp{gnu} or
35716 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
35717 @samp{gnu2} is more efficient, but it may add compile- and run-time
35718 requirements that cannot be satisfied on all systems.
35720 @opindex mpush-args
35721 @opindex mno-push-args
35722 @item -mpush-args
35723 @itemx -mno-push-args
35724 Use PUSH operations to store outgoing parameters.  This method is shorter
35725 and usually equally fast as method using SUB/MOV operations and is enabled
35726 by default.  In some cases disabling it may improve performance because of
35727 improved scheduling and reduced dependencies.
35729 @opindex maccumulate-outgoing-args
35730 @item -maccumulate-outgoing-args
35731 If enabled, the maximum amount of space required for outgoing arguments is
35732 computed in the function prologue.  This is faster on most modern CPUs
35733 because of reduced dependencies, improved scheduling and reduced stack usage
35734 when the preferred stack boundary is not equal to 2.  The drawback is a notable
35735 increase in code size.  This switch implies @option{-mno-push-args}.
35737 @opindex mthreads
35738 @item -mthreads
35739 Support thread-safe exception handling on MinGW.  Programs that rely
35740 on thread-safe exception handling must compile and link all code with the
35741 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
35742 @option{-D_MT}; when linking, it links in a special thread helper library
35743 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
35745 @opindex mms-bitfields
35746 @opindex mno-ms-bitfields
35747 @item -mms-bitfields
35748 @itemx -mno-ms-bitfields
35750 Enable/disable bit-field layout compatible with the native Microsoft
35751 Windows compiler.  
35753 If @code{packed} is used on a structure, or if bit-fields are used,
35754 it may be that the Microsoft ABI lays out the structure differently
35755 than the way GCC normally does.  Particularly when moving packed
35756 data between functions compiled with GCC and the native Microsoft compiler
35757 (either via function call or as data in a file), it may be necessary to access
35758 either format.
35760 This option is enabled by default for Microsoft Windows
35761 targets.  This behavior can also be controlled locally by use of variable
35762 or type attributes.  For more information, see @ref{x86 Variable Attributes}
35763 and @ref{x86 Type Attributes}.
35765 The Microsoft structure layout algorithm is fairly simple with the exception
35766 of the bit-field packing.  
35767 The padding and alignment of members of structures and whether a bit-field 
35768 can straddle a storage-unit boundary are determine by these rules:
35770 @enumerate
35771 @item Structure members are stored sequentially in the order in which they are
35772 declared: the first member has the lowest memory address and the last member
35773 the highest.
35775 @item Every data object has an alignment requirement.  The alignment requirement
35776 for all data except structures, unions, and arrays is either the size of the
35777 object or the current packing size (specified with either the
35778 @code{aligned} attribute or the @code{pack} pragma),
35779 whichever is less.  For structures, unions, and arrays,
35780 the alignment requirement is the largest alignment requirement of its members.
35781 Every object is allocated an offset so that:
35783 @smallexample
35784 offset % alignment_requirement == 0
35785 @end smallexample
35787 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
35788 unit if the integral types are the same size and if the next bit-field fits
35789 into the current allocation unit without crossing the boundary imposed by the
35790 common alignment requirements of the bit-fields.
35791 @end enumerate
35793 MSVC interprets zero-length bit-fields in the following ways:
35795 @enumerate
35796 @item If a zero-length bit-field is inserted between two bit-fields that
35797 are normally coalesced, the bit-fields are not coalesced.
35799 For example:
35801 @smallexample
35802 struct
35803  @{
35804    unsigned long bf_1 : 12;
35805    unsigned long : 0;
35806    unsigned long bf_2 : 12;
35807  @} t1;
35808 @end smallexample
35810 @noindent
35811 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
35812 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
35814 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
35815 alignment of the zero-length bit-field is greater than the member that follows it,
35816 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
35818 For example:
35820 @smallexample
35821 struct
35822  @{
35823    char foo : 4;
35824    short : 0;
35825    char bar;
35826  @} t2;
35828 struct
35829  @{
35830    char foo : 4;
35831    short : 0;
35832    double bar;
35833  @} t3;
35834 @end smallexample
35836 @noindent
35837 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
35838 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
35839 bit-field does not affect the alignment of @code{bar} or, as a result, the size
35840 of the structure.
35842 Taking this into account, it is important to note the following:
35844 @enumerate
35845 @item If a zero-length bit-field follows a normal bit-field, the type of the
35846 zero-length bit-field may affect the alignment of the structure as whole. For
35847 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
35848 normal bit-field, and is of type short.
35850 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
35851 still affect the alignment of the structure:
35853 @smallexample
35854 struct
35855  @{
35856    char foo : 6;
35857    long : 0;
35858  @} t4;
35859 @end smallexample
35861 @noindent
35862 Here, @code{t4} takes up 4 bytes.
35863 @end enumerate
35865 @item Zero-length bit-fields following non-bit-field members are ignored:
35867 @smallexample
35868 struct
35869  @{
35870    char foo;
35871    long : 0;
35872    char bar;
35873  @} t5;
35874 @end smallexample
35876 @noindent
35877 Here, @code{t5} takes up 2 bytes.
35878 @end enumerate
35881 @opindex mno-align-stringops
35882 @opindex malign-stringops
35883 @item -mno-align-stringops
35884 Do not align the destination of inlined string operations.  This switch reduces
35885 code size and improves performance in case the destination is already aligned,
35886 but GCC doesn't know about it.
35888 @opindex minline-all-stringops
35889 @item -minline-all-stringops
35890 By default GCC inlines string operations only when the destination is 
35891 known to be aligned to least a 4-byte boundary.  
35892 This enables more inlining and increases code
35893 size, but may improve performance of code that depends on fast
35894 @code{memcpy} and @code{memset} for short lengths.
35895 The option enables inline expansion of @code{strlen} for all
35896 pointer alignments.
35898 @opindex minline-stringops-dynamically
35899 @item -minline-stringops-dynamically
35900 For string operations of unknown size, use run-time checks with
35901 inline code for small blocks and a library call for large blocks.
35903 @opindex mstringop-strategy=@var{alg}
35904 @item -mstringop-strategy=@var{alg}
35905 Override the internal decision heuristic for the particular algorithm to use
35906 for inlining string operations.  The allowed values for @var{alg} are:
35908 @table @samp
35909 @item rep_byte
35910 @itemx rep_4byte
35911 @itemx rep_8byte
35912 Expand using i386 @code{rep} prefix of the specified size.
35914 @item byte_loop
35915 @itemx loop
35916 @itemx unrolled_loop
35917 Expand into an inline loop.
35919 @item libcall
35920 Always use a library call.
35921 @end table
35923 @opindex mmemcpy-strategy=@var{strategy}
35924 @item -mmemcpy-strategy=@var{strategy}
35925 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
35926 should be inlined and what inline algorithm to use when the expected size
35927 of the copy operation is known. @var{strategy} 
35928 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
35929 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
35930 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
35931 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
35932 in the list must be specified in increasing order.  The minimal byte size for 
35933 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
35934 preceding range.
35936 @opindex mmemset-strategy=@var{strategy}
35937 @item -mmemset-strategy=@var{strategy}
35938 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
35939 @code{__builtin_memset} expansion.
35941 @opindex momit-leaf-frame-pointer
35942 @item -momit-leaf-frame-pointer
35943 Don't keep the frame pointer in a register for leaf functions.  This
35944 avoids the instructions to save, set up, and restore frame pointers and
35945 makes an extra register available in leaf functions.  The option
35946 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
35947 which might make debugging harder.
35949 @opindex mtls-direct-seg-refs
35950 @item -mtls-direct-seg-refs
35951 @itemx -mno-tls-direct-seg-refs
35952 Controls whether TLS variables may be accessed with offsets from the
35953 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
35954 or whether the thread base pointer must be added.  Whether or not this
35955 is valid depends on the operating system, and whether it maps the
35956 segment to cover the entire TLS area.
35958 For systems that use the GNU C Library, the default is on.
35960 @opindex msse2avx
35961 @item -msse2avx
35962 @itemx -mno-sse2avx
35963 Specify that the assembler should encode SSE instructions with VEX
35964 prefix.  The option @option{-mavx} turns this on by default.
35966 @opindex mfentry
35967 @item -mfentry
35968 @itemx -mno-fentry
35969 If profiling is active (@option{-pg}), put the profiling
35970 counter call before the prologue.
35971 Note: On x86 architectures the attribute @code{ms_hook_prologue}
35972 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
35974 @opindex mrecord-mcount
35975 @item -mrecord-mcount
35976 @itemx -mno-record-mcount
35977 If profiling is active (@option{-pg}), generate a __mcount_loc section
35978 that contains pointers to each profiling call. This is useful for
35979 automatically patching and out calls.
35981 @opindex mnop-mcount
35982 @item -mnop-mcount
35983 @itemx -mno-nop-mcount
35984 If profiling is active (@option{-pg}), generate the calls to
35985 the profiling functions as NOPs. This is useful when they
35986 should be patched in later dynamically. This is likely only
35987 useful together with @option{-mrecord-mcount}.
35989 @opindex minstrument-return
35990 @item -minstrument-return=@var{type}
35991 Instrument function exit in -pg -mfentry instrumented functions with
35992 call to specified function. This only instruments true returns ending
35993 with ret, but not sibling calls ending with jump. Valid types
35994 are @var{none} to not instrument, @var{call} to generate a call to __return__,
35995 or @var{nop5} to generate a 5 byte nop.
35997 @opindex mrecord-return
35998 @item -mrecord-return
35999 @itemx -mno-record-return
36000 Generate a __return_loc section pointing to all return instrumentation code.
36002 @opindex mfentry-name
36003 @item -mfentry-name=@var{name}
36004 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
36006 @opindex mfentry-section
36007 @item -mfentry-section=@var{name}
36008 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
36010 @opindex mskip-rax-setup
36011 @item -mskip-rax-setup
36012 @itemx -mno-skip-rax-setup
36013 When generating code for the x86-64 architecture with SSE extensions
36014 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
36015 register when there are no variable arguments passed in vector registers.
36017 @strong{Warning:} Since RAX register is used to avoid unnecessarily
36018 saving vector registers on stack when passing variable arguments, the
36019 impacts of this option are callees may waste some stack space,
36020 misbehave or jump to a random location.  GCC 4.4 or newer don't have
36021 those issues, regardless the RAX register value.
36023 @opindex m8bit-idiv
36024 @item -m8bit-idiv
36025 @itemx -mno-8bit-idiv
36026 On some processors, like Intel Atom, 8-bit unsigned integer divide is
36027 much faster than 32-bit/64-bit integer divide.  This option generates a
36028 run-time check.  If both dividend and divisor are within range of 0
36029 to 255, 8-bit unsigned integer divide is used instead of
36030 32-bit/64-bit integer divide.
36032 @opindex mavx256-split-unaligned-load
36033 @opindex mavx256-split-unaligned-store
36034 @item -mavx256-split-unaligned-load
36035 @itemx -mavx256-split-unaligned-store
36036 Split 32-byte AVX unaligned load and store.
36038 @opindex mstack-protector-guard
36039 @opindex mstack-protector-guard-reg
36040 @opindex mstack-protector-guard-offset
36041 @item -mstack-protector-guard=@var{guard}
36042 @itemx -mstack-protector-guard-reg=@var{reg}
36043 @itemx -mstack-protector-guard-offset=@var{offset}
36044 Generate stack protection code using canary at @var{guard}.  Supported
36045 locations are @samp{global} for global canary or @samp{tls} for per-thread
36046 canary in the TLS block (the default).  This option has effect only when
36047 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
36049 With the latter choice the options
36050 @option{-mstack-protector-guard-reg=@var{reg}} and
36051 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
36052 which segment register (@code{%fs} or @code{%gs}) to use as base register
36053 for reading the canary, and from what offset from that base register.
36054 The default for those is as specified in the relevant ABI.
36056 @opindex mgeneral-regs-only
36057 @item -mgeneral-regs-only
36058 Generate code that uses only the general-purpose registers.  This
36059 prevents the compiler from using floating-point, vector, mask and bound
36060 registers.
36062 @opindex mrelax-cmpxchg-loop
36063 @item -mrelax-cmpxchg-loop
36064 When emitting a compare-and-swap loop for @ref{__sync Builtins}
36065 and @ref{__atomic Builtins} lacking a native instruction, optimize
36066 for the highly contended case by issuing an atomic load before the
36067 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
36068 to save CPU power when restarting the loop.
36070 @opindex mindirect-branch
36071 @item -mindirect-branch=@var{choice}
36072 Convert indirect call and jump with @var{choice}.  The default is
36073 @samp{keep}, which keeps indirect call and jump unmodified.
36074 @samp{thunk} converts indirect call and jump to call and return thunk.
36075 @samp{thunk-inline} converts indirect call and jump to inlined call
36076 and return thunk.  @samp{thunk-extern} converts indirect call and jump
36077 to external call and return thunk provided in a separate object file.
36078 You can control this behavior for a specific function by using the
36079 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
36081 Note that @option{-mcmodel=large} is incompatible with
36082 @option{-mindirect-branch=thunk} and
36083 @option{-mindirect-branch=thunk-extern} since the thunk function may
36084 not be reachable in the large code model.
36086 Note that @option{-mindirect-branch=thunk-extern} is compatible with
36087 @option{-fcf-protection=branch} since the external thunk can be made
36088 to enable control-flow check.
36090 @opindex mfunction-return
36091 @item -mfunction-return=@var{choice}
36092 Convert function return with @var{choice}.  The default is @samp{keep},
36093 which keeps function return unmodified.  @samp{thunk} converts function
36094 return to call and return thunk.  @samp{thunk-inline} converts function
36095 return to inlined call and return thunk.  @samp{thunk-extern} converts
36096 function return to external call and return thunk provided in a separate
36097 object file.  You can control this behavior for a specific function by
36098 using the function attribute @code{function_return}.
36099 @xref{Function Attributes}.
36101 Note that @option{-mindirect-return=thunk-extern} is compatible with
36102 @option{-fcf-protection=branch} since the external thunk can be made
36103 to enable control-flow check.
36105 Note that @option{-mcmodel=large} is incompatible with
36106 @option{-mfunction-return=thunk} and
36107 @option{-mfunction-return=thunk-extern} since the thunk function may
36108 not be reachable in the large code model.
36111 @opindex mindirect-branch-register
36112 @item -mindirect-branch-register
36113 Force indirect call and jump via register.
36115 @opindex mharden-sls
36116 @item -mharden-sls=@var{choice}
36117 Generate code to mitigate against straight line speculation (SLS) with
36118 @var{choice}.  The default is @samp{none} which disables all SLS
36119 hardening.  @samp{return} enables SLS hardening for function returns.
36120 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
36121 @samp{all} enables all SLS hardening.
36123 @opindex mindirect-branch-cs-prefix
36124 @item -mindirect-branch-cs-prefix
36125 Add CS prefix to call and jmp to indirect thunk with branch target in
36126 r8-r15 registers so that the call and jmp instruction length is 6 bytes
36127 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
36128 @samp{lfence; jmp *%r8-r15} at run-time.
36130 @opindex mapx-inline-asm-use-gpr32
36131 @item -mapx-inline-asm-use-gpr32
36132 For inline asm support with APX, by default the EGPR feature was
36133 disabled to prevent potential illegal instruction with EGPR occurs.
36134 To invoke egpr usage in inline asm, use new compiler option
36135 -mapx-inline-asm-use-gpr32 and user should ensure the instruction
36136 supports EGPR.
36138 @opindex mevex512
36139 @item -mevex512
36140 @itemx -mno-evex512
36141 Enables/disables 512-bit vector. It will be default on if AVX512F is enabled.
36143 @end table
36145 These @samp{-m} switches are supported in addition to the above
36146 on x86-64 processors in 64-bit environments.
36148 @table @gcctabopt
36149 @opindex m32
36150 @opindex m64
36151 @opindex mx32
36152 @opindex m16
36153 @opindex miamcu
36154 @item -m32
36155 @itemx -m64
36156 @itemx -mx32
36157 @itemx -m16
36158 @itemx -miamcu
36159 Generate code for a 16-bit, 32-bit or 64-bit environment.
36160 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
36161 to 32 bits, and
36162 generates code that runs in 32-bit mode.
36164 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
36165 types to 64 bits, and generates code for the x86-64 architecture.
36166 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
36167 and @option{-mdynamic-no-pic} options.
36169 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
36170 to 32 bits, and
36171 generates code for the x86-64 architecture.
36173 The @option{-m16} option is the same as @option{-m32}, except for that
36174 it outputs the @code{.code16gcc} assembly directive at the beginning of
36175 the assembly output so that the binary can run in 16-bit mode.
36177 The @option{-miamcu} option generates code which conforms to Intel MCU
36178 psABI.  It requires the @option{-m32} option to be turned on.
36180 @opindex mno-red-zone
36181 @opindex mred-zone
36182 @item -mno-red-zone
36183 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
36184 by the x86-64 ABI; it is a 128-byte area beyond the location of the
36185 stack pointer that is not modified by signal or interrupt handlers
36186 and therefore can be used for temporary data without adjusting the stack
36187 pointer.  The flag @option{-mno-red-zone} disables this red zone.
36189 @opindex mcmodel=small
36190 @item -mcmodel=small
36191 Generate code for the small code model: the program and its symbols must
36192 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
36193 Programs can be statically or dynamically linked.  This is the default
36194 code model.
36196 @opindex mcmodel=kernel
36197 @item -mcmodel=kernel
36198 Generate code for the kernel code model.  The kernel runs in the
36199 negative 2 GB of the address space.
36200 This model has to be used for Linux kernel code.
36202 @opindex mcmodel=medium
36203 @item -mcmodel=medium
36204 Generate code for the medium model: the program is linked in the lower 2
36205 GB of the address space.  Small symbols are also placed there.  Symbols
36206 with sizes larger than @option{-mlarge-data-threshold} are put into
36207 large data or BSS sections and can be located above 2GB.  Programs can
36208 be statically or dynamically linked.
36210 @opindex mcmodel=large
36211 @item -mcmodel=large
36212 Generate code for the large model.  This model makes no assumptions
36213 about addresses and sizes of sections.
36215 @opindex maddress-mode=long
36216 @item -maddress-mode=long
36217 Generate code for long address mode.  This is only supported for 64-bit
36218 and x32 environments.  It is the default address mode for 64-bit
36219 environments.
36221 @opindex maddress-mode=short
36222 @item -maddress-mode=short
36223 Generate code for short address mode.  This is only supported for 32-bit
36224 and x32 environments.  It is the default address mode for 32-bit and
36225 x32 environments.
36227 @opindex mneeded
36228 @item -mneeded
36229 @itemx -mno-needed
36230 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
36231 indicate the micro-architecture ISA level required to execute the binary.
36233 @opindex mno-direct-extern-access
36234 @opindex mdirect-extern-access
36235 @item -mno-direct-extern-access
36236 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
36237 to access external symbols.  With @option{-fpic} or @option{-fPIC},
36238 treat access to protected symbols as local symbols.  The default is
36239 @option{-mdirect-extern-access}.
36241 @strong{Warning:} shared libraries compiled with
36242 @option{-mno-direct-extern-access} and executable compiled with
36243 @option{-mdirect-extern-access} may not be binary compatible if
36244 protected symbols are used in shared libraries and executable.
36246 @opindex munroll-only-small-loops
36247 @opindex mno-unroll-only-small-loops
36248 @item -munroll-only-small-loops
36249 Controls conservative small loop unrolling. It is default enabled by
36250 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
36251 -f[no-]unroll-[all-]loops would disable this flag to avoid any
36252 unintended unrolling behavior that user does not want.
36254 @opindex mlam
36255 @item -mlam=@var{choice}
36256 LAM(linear-address masking) allows special bits in the pointer to be used
36257 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
36258 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
36259 positions 62:57 can be used for metadata.
36260 @end table
36262 @node x86 Windows Options
36263 @subsection x86 Windows Options
36264 @cindex x86 Windows Options
36265 @cindex Windows Options for x86
36267 These additional options are available for Microsoft Windows targets:
36269 @table @gcctabopt
36270 @opindex mconsole
36271 @item -mconsole
36272 This option
36273 specifies that a console application is to be generated, by
36274 instructing the linker to set the PE header subsystem type
36275 required for console applications.
36276 This option is available for Cygwin and MinGW targets and is
36277 enabled by default on those targets.
36279 @opindex mcrtdll
36280 @item -mcrtdll=@var{library}
36281 Preprocess, compile or link with specified C RunTime DLL @var{library}.
36282 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
36283 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
36284 start file for CRT @var{library} and link with CRT @var{library}.
36285 Recognized CRT library names for proprocessor are:
36286 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
36287 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
36288 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
36289 If this options is not specified then the default MinGW import library
36290 @code{msvcrt} is used for linking and no other adjustment for
36291 preprocessor is done. MinGW import library @code{msvcrt} is just a
36292 symlink to (or a copy of) another MinGW CRT import library
36293 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
36294 is for Windows system CRT DLL library @code{msvcrt.dll} and
36295 in most cases is the default MinGW import library.
36296 Generally speaking, changing the CRT DLL requires recompiling
36297 the entire MinGW CRT. This option is for experimental and testing
36298 purposes only.
36299 This option is available for MinGW targets.
36301 @opindex mdll
36302 @item -mdll
36303 This option is available for Cygwin and MinGW targets.  It
36304 specifies that a DLL---a dynamic link library---is to be
36305 generated, enabling the selection of the required runtime
36306 startup object and entry point.
36308 @opindex mnop-fun-dllimport
36309 @item -mnop-fun-dllimport
36310 This option is available for Cygwin and MinGW targets.  It
36311 specifies that the @code{dllimport} attribute should be ignored.
36313 @opindex mthreads
36314 @item -mthreads
36315 This option is available for MinGW targets. It specifies
36316 that MinGW-specific thread support is to be used.
36318 @opindex municode
36319 @item -municode
36320 This option is available for MinGW-w64 targets.  It causes
36321 the @code{UNICODE} preprocessor macro to be predefined, and
36322 chooses Unicode-capable runtime startup code.
36324 @opindex mwin32
36325 @item -mwin32
36326 This option is available for Cygwin and MinGW targets.  It
36327 specifies that the typical Microsoft Windows predefined macros are to
36328 be set in the pre-processor, but does not influence the choice
36329 of runtime library/startup code.
36331 @opindex mwindows
36332 @item -mwindows
36333 This option is available for Cygwin and MinGW targets.  It
36334 specifies that a GUI application is to be generated by
36335 instructing the linker to set the PE header subsystem type
36336 appropriately.
36338 @opindex fno-set-stack-executable
36339 @opindex fset-stack-executable
36340 @item -fno-set-stack-executable
36341 This option is available for MinGW targets. It specifies that
36342 the executable flag for the stack used by nested functions isn't
36343 set. This is necessary for binaries running in kernel mode of
36344 Microsoft Windows, as there the User32 API, which is used to set executable
36345 privileges, isn't available.
36347 @opindex fno-writable-relocated-rdata
36348 @opindex fwritable-relocated-rdata
36349 @item -fwritable-relocated-rdata
36350 This option is available for MinGW and Cygwin targets.  It specifies
36351 that relocated-data in read-only section is put into the @code{.data}
36352 section.  This is a necessary for older runtimes not supporting
36353 modification of @code{.rdata} sections for pseudo-relocation.
36355 @opindex mpe-aligned-commons
36356 @item -mpe-aligned-commons
36357 This option is available for Cygwin and MinGW targets.  It
36358 specifies that the GNU extension to the PE file format that
36359 permits the correct alignment of COMMON variables should be
36360 used when generating code.  It is enabled by default if
36361 GCC detects that the target assembler found during configuration
36362 supports the feature.
36363 @end table
36365 See also under @ref{x86 Options} for standard options.
36367 @node Xstormy16 Options
36368 @subsection Xstormy16 Options
36369 @cindex Xstormy16 Options
36371 These options are defined for Xstormy16:
36373 @table @gcctabopt
36374 @opindex msim
36375 @item -msim
36376 Choose startup files and linker script suitable for the simulator.
36377 @end table
36379 @node Xtensa Options
36380 @subsection Xtensa Options
36381 @cindex Xtensa Options
36383 These options are supported for Xtensa targets:
36385 @table @gcctabopt
36386 @opindex mconst16
36387 @opindex mno-const16
36388 @item -mconst16
36389 @itemx -mno-const16
36390 Enable or disable use of @code{CONST16} instructions for loading
36391 constant values.  The @code{CONST16} instruction is currently not a
36392 standard option from Tensilica.  When enabled, @code{CONST16}
36393 instructions are always used in place of the standard @code{L32R}
36394 instructions.  The use of @code{CONST16} is enabled by default only if
36395 the @code{L32R} instruction is not available.
36397 @opindex mfused-madd
36398 @opindex mno-fused-madd
36399 @item -mfused-madd
36400 @itemx -mno-fused-madd
36401 Enable or disable use of fused multiply/add and multiply/subtract
36402 instructions in the floating-point option.  This has no effect if the
36403 floating-point option is not also enabled.  Disabling fused multiply/add
36404 and multiply/subtract instructions forces the compiler to use separate
36405 instructions for the multiply and add/subtract operations.  This may be
36406 desirable in some cases where strict IEEE 754-compliant results are
36407 required: the fused multiply add/subtract instructions do not round the
36408 intermediate result, thereby producing results with @emph{more} bits of
36409 precision than specified by the IEEE standard.  Disabling fused multiply
36410 add/subtract instructions also ensures that the program output is not
36411 sensitive to the compiler's ability to combine multiply and add/subtract
36412 operations.
36414 @opindex mserialize-volatile
36415 @opindex mno-serialize-volatile
36416 @item -mserialize-volatile
36417 @itemx -mno-serialize-volatile
36418 When this option is enabled, GCC inserts @code{MEMW} instructions before
36419 @code{volatile} memory references to guarantee sequential consistency.
36420 The default is @option{-mserialize-volatile}.  Use
36421 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
36423 @opindex mforce-no-pic
36424 @item -mforce-no-pic
36425 For targets, like GNU/Linux, where all user-mode Xtensa code must be
36426 position-independent code (PIC), this option disables PIC for compiling
36427 kernel code.
36429 @opindex mtext-section-literals
36430 @opindex mno-text-section-literals
36431 @item -mtext-section-literals
36432 @itemx -mno-text-section-literals
36433 These options control the treatment of literal pools.  The default is
36434 @option{-mno-text-section-literals}, which places literals in a separate
36435 section in the output file.  This allows the literal pool to be placed
36436 in a data RAM/ROM, and it also allows the linker to combine literal
36437 pools from separate object files to remove redundant literals and
36438 improve code size.  With @option{-mtext-section-literals}, the literals
36439 are interspersed in the text section in order to keep them as close as
36440 possible to their references.  This may be necessary for large assembly
36441 files.  Literals for each function are placed right before that function.
36443 @opindex mauto-litpools
36444 @opindex mno-auto-litpools
36445 @item -mauto-litpools
36446 @itemx -mno-auto-litpools
36447 These options control the treatment of literal pools.  The default is
36448 @option{-mno-auto-litpools}, which places literals in a separate
36449 section in the output file unless @option{-mtext-section-literals} is
36450 used.  With @option{-mauto-litpools} the literals are interspersed in
36451 the text section by the assembler.  Compiler does not produce explicit
36452 @code{.literal} directives and loads literals into registers with
36453 @code{MOVI} instructions instead of @code{L32R} to let the assembler
36454 do relaxation and place literals as necessary.  This option allows
36455 assembler to create several literal pools per function and assemble
36456 very big functions, which may not be possible with
36457 @option{-mtext-section-literals}.
36459 @opindex mtarget-align
36460 @opindex mno-target-align
36461 @item -mtarget-align
36462 @itemx -mno-target-align
36463 When this option is enabled, GCC instructs the assembler to
36464 automatically align instructions to reduce branch penalties at the
36465 expense of some code density.  The assembler attempts to widen density
36466 instructions to align branch targets and the instructions following call
36467 instructions.  If there are not enough preceding safe density
36468 instructions to align a target, no widening is performed.  The
36469 default is @option{-mtarget-align}.  These options do not affect the
36470 treatment of auto-aligned instructions like @code{LOOP}, which the
36471 assembler always aligns, either by widening density instructions or
36472 by inserting NOP instructions.
36474 @opindex mlongcalls
36475 @opindex mno-longcalls
36476 @item -mlongcalls
36477 @itemx -mno-longcalls
36478 When this option is enabled, GCC instructs the assembler to translate
36479 direct calls to indirect calls unless it can determine that the target
36480 of a direct call is in the range allowed by the call instruction.  This
36481 translation typically occurs for calls to functions in other source
36482 files.  Specifically, the assembler translates a direct @code{CALL}
36483 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
36484 The default is @option{-mno-longcalls}.  This option should be used in
36485 programs where the call target can potentially be out of range.  This
36486 option is implemented in the assembler, not the compiler, so the
36487 assembly code generated by GCC still shows direct call
36488 instructions---look at the disassembled object code to see the actual
36489 instructions.  Note that the assembler uses an indirect call for
36490 every cross-file call, not just those that really are out of range.
36492 @opindex mabi
36493 @item -mabi=@var{name}
36494 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
36495 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
36497 @opindex mabi=call0
36498 @item -mabi=call0
36499 When this option is enabled function parameters are passed in registers
36500 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
36501 caller-saved, and register @code{a15} may be used as a frame pointer.
36502 When this version of the ABI is enabled the C preprocessor symbol
36503 @code{__XTENSA_CALL0_ABI__} is defined.
36505 @opindex mabi=windowed
36506 @item -mabi=windowed
36507 When this option is enabled function parameters are passed in registers
36508 @code{a10} through @code{a15}, and called function rotates register window
36509 by 8 registers on entry so that its arguments are found in registers
36510 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
36511 pointer.  Register window is rotated 8 registers back upon return.
36512 When this version of the ABI is enabled the C preprocessor symbol
36513 @code{__XTENSA_WINDOWED_ABI__} is defined.
36515 @opindex mextra-l32r-costs
36516 @item -mextra-l32r-costs=@var{n}
36517 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
36518 instructions, in clock cycles.  This affects, when optimizing for speed,
36519 whether loading a constant from literal pool using @code{L32R} or
36520 synthesizing the constant from a small one with a couple of arithmetic
36521 instructions.  The default value is 0.
36523 @opindex mstrict-align
36524 @opindex mno-strict-align
36525 @item -mstrict-align
36526 @itemx -mno-strict-align
36527 Avoid or allow generating memory accesses that may not be aligned on a natural
36528 object boundary as described in the architecture specification.
36529 The default is @option{-mno-strict-align} for cores that support both
36530 unaligned loads and stores in hardware and @option{-mstrict-align} for all
36531 other cores.
36533 @end table
36535 @node zSeries Options
36536 @subsection zSeries Options
36537 @cindex zSeries options
36539 These are listed under @xref{S/390 and zSeries Options}.
36542 @c man end
36544 @node Spec Files
36545 @section Specifying Subprocesses and the Switches to Pass to Them
36546 @cindex Spec Files
36548 @command{gcc} is a driver program.  It performs its job by invoking a
36549 sequence of other programs to do the work of compiling, assembling and
36550 linking.  GCC interprets its command-line parameters and uses these to
36551 deduce which programs it should invoke, and which command-line options
36552 it ought to place on their command lines.  This behavior is controlled
36553 by @dfn{spec strings}.  In most cases there is one spec string for each
36554 program that GCC can invoke, but a few programs have multiple spec
36555 strings to control their behavior.  The spec strings built into GCC can
36556 be overridden by using the @option{-specs=} command-line switch to specify
36557 a spec file.
36559 @dfn{Spec files} are plain-text files that are used to construct spec
36560 strings.  They consist of a sequence of directives separated by blank
36561 lines.  The type of directive is determined by the first non-whitespace
36562 character on the line, which can be one of the following:
36564 @table @code
36565 @item %@var{command}
36566 Issues a @var{command} to the spec file processor.  The commands that can
36567 appear here are:
36569 @table @code
36570 @cindex @code{%include}
36571 @item %include <@var{file}>
36572 Search for @var{file} and insert its text at the current point in the
36573 specs file.
36575 @cindex @code{%include_noerr}
36576 @item %include_noerr <@var{file}>
36577 Just like @samp{%include}, but do not generate an error message if the include
36578 file cannot be found.
36580 @cindex @code{%rename}
36581 @item %rename @var{old_name} @var{new_name}
36582 Rename the spec string @var{old_name} to @var{new_name}.
36584 @end table
36586 @item *[@var{spec_name}]:
36587 This tells the compiler to create, override or delete the named spec
36588 string.  All lines after this directive up to the next directive or
36589 blank line are considered to be the text for the spec string.  If this
36590 results in an empty string then the spec is deleted.  (Or, if the
36591 spec did not exist, then nothing happens.)  Otherwise, if the spec
36592 does not currently exist a new spec is created.  If the spec does
36593 exist then its contents are overridden by the text of this
36594 directive, unless the first character of that text is the @samp{+}
36595 character, in which case the text is appended to the spec.
36597 @item [@var{suffix}]:
36598 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
36599 and up to the next directive or blank line are considered to make up the
36600 spec string for the indicated suffix.  When the compiler encounters an
36601 input file with the named suffix, it processes the spec string in
36602 order to work out how to compile that file.  For example:
36604 @smallexample
36605 .ZZ:
36606 z-compile -input %i
36607 @end smallexample
36609 This says that any input file whose name ends in @samp{.ZZ} should be
36610 passed to the program @samp{z-compile}, which should be invoked with the
36611 command-line switch @option{-input} and with the result of performing the
36612 @samp{%i} substitution.  (See below.)
36614 As an alternative to providing a spec string, the text following a
36615 suffix directive can be one of the following:
36617 @table @code
36618 @item @@@var{language}
36619 This says that the suffix is an alias for a known @var{language}.  This is
36620 similar to using the @option{-x} command-line switch to GCC to specify a
36621 language explicitly.  For example:
36623 @smallexample
36624 .ZZ:
36625 @@c++
36626 @end smallexample
36628 Says that .ZZ files are, in fact, C++ source files.
36630 @item #@var{name}
36631 This causes an error messages saying:
36633 @smallexample
36634 @var{name} compiler not installed on this system.
36635 @end smallexample
36636 @end table
36638 GCC already has an extensive list of suffixes built into it.
36639 This directive adds an entry to the end of the list of suffixes, but
36640 since the list is searched from the end backwards, it is effectively
36641 possible to override earlier entries using this technique.
36643 @end table
36645 GCC has the following spec strings built into it.  Spec files can
36646 override these strings or create their own.  Note that individual
36647 targets can also add their own spec strings to this list.
36649 @smallexample
36650 asm          Options to pass to the assembler
36651 asm_final    Options to pass to the assembler post-processor
36652 cpp          Options to pass to the C preprocessor
36653 cc1          Options to pass to the C compiler
36654 cc1plus      Options to pass to the C++ compiler
36655 endfile      Object files to include at the end of the link
36656 link         Options to pass to the linker
36657 lib          Libraries to include on the command line to the linker
36658 libgcc       Decides which GCC support library to pass to the linker
36659 linker       Sets the name of the linker
36660 predefines   Defines to be passed to the C preprocessor
36661 signed_char  Defines to pass to CPP to say whether @code{char} is signed
36662              by default
36663 startfile    Object files to include at the start of the link
36664 @end smallexample
36666 Here is a small example of a spec file:
36668 @smallexample
36669 %rename lib                 old_lib
36671 *lib:
36672 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
36673 @end smallexample
36675 This example renames the spec called @samp{lib} to @samp{old_lib} and
36676 then overrides the previous definition of @samp{lib} with a new one.
36677 The new definition adds in some extra command-line options before
36678 including the text of the old definition.
36680 @dfn{Spec strings} are a list of command-line options to be passed to their
36681 corresponding program.  In addition, the spec strings can contain
36682 @samp{%}-prefixed sequences to substitute variable text or to
36683 conditionally insert text into the command line.  Using these constructs
36684 it is possible to generate quite complex command lines.
36686 Here is a table of all defined @samp{%}-sequences for spec
36687 strings.  Note that spaces are not generated automatically around the
36688 results of expanding these sequences.  Therefore you can concatenate them
36689 together or combine them with constant text in a single argument.
36691 @table @code
36692 @item %%
36693 Substitute one @samp{%} into the program name or argument.
36695 @item %"
36696 Substitute an empty argument.
36698 @item %i
36699 Substitute the name of the input file being processed.
36701 @item %b
36702 Substitute the basename for outputs related with the input file being
36703 processed.  This is often the substring up to (and not including) the
36704 last period and not including the directory but, unless %w is active, it
36705 expands to the basename for auxiliary outputs, which may be influenced
36706 by an explicit output name, and by various other options that control
36707 how auxiliary outputs are named.
36709 @item %B
36710 This is the same as @samp{%b}, but include the file suffix (text after
36711 the last period).  Without %w, it expands to the basename for dump
36712 outputs.
36714 @item %d
36715 Marks the argument containing or following the @samp{%d} as a
36716 temporary file name, so that that file is deleted if GCC exits
36717 successfully.  Unlike @samp{%g}, this contributes no text to the
36718 argument.
36720 @item %g@var{suffix}
36721 Substitute a file name that has suffix @var{suffix} and is chosen
36722 once per compilation, and mark the argument in the same way as
36723 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
36724 name is now chosen in a way that is hard to predict even when previously
36725 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
36726 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
36727 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
36728 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
36729 was simply substituted with a file name chosen once per compilation,
36730 without regard to any appended suffix (which was therefore treated
36731 just like ordinary text), making such attacks more likely to succeed.
36733 @item %u@var{suffix}
36734 Like @samp{%g}, but generates a new temporary file name
36735 each time it appears instead of once per compilation.
36737 @item %U@var{suffix}
36738 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
36739 new one if there is no such last file name.  In the absence of any
36740 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
36741 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
36742 involves the generation of two distinct file names, one
36743 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
36744 simply substituted with a file name chosen for the previous @samp{%u},
36745 without regard to any appended suffix.
36747 @item %j@var{suffix}
36748 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
36749 writable, and if @option{-save-temps} is not used; 
36750 otherwise, substitute the name
36751 of a temporary file, just like @samp{%u}.  This temporary file is not
36752 meant for communication between processes, but rather as a junk
36753 disposal mechanism.
36755 @item %|@var{suffix}
36756 @itemx %m@var{suffix}
36757 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
36758 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
36759 all.  These are the two most common ways to instruct a program that it
36760 should read from standard input or write to standard output.  If you
36761 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
36762 construct: see for example @file{gcc/fortran/lang-specs.h}.
36764 @item %.@var{SUFFIX}
36765 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
36766 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
36767 terminated by the next space or %.
36769 @item %w
36770 Marks the argument containing or following the @samp{%w} as the
36771 designated output file of this compilation.  This puts the argument
36772 into the sequence of arguments that @samp{%o} substitutes.
36774 @item %V
36775 Indicates that this compilation produces no output file.
36777 @item %o
36778 Substitutes the names of all the output files, with spaces
36779 automatically placed around them.  You should write spaces
36780 around the @samp{%o} as well or the results are undefined.
36781 @samp{%o} is for use in the specs for running the linker.
36782 Input files whose names have no recognized suffix are not compiled
36783 at all, but they are included among the output files, so they are
36784 linked.
36786 @item %O
36787 Substitutes the suffix for object files.  Note that this is
36788 handled specially when it immediately follows @samp{%g, %u, or %U},
36789 because of the need for those to form complete file names.  The
36790 handling is such that @samp{%O} is treated exactly as if it had already
36791 been substituted, except that @samp{%g, %u, and %U} do not currently
36792 support additional @var{suffix} characters following @samp{%O} as they do
36793 following, for example, @samp{.o}.
36795 @item %I
36796 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
36797 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
36798 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
36799 and @option{-imultilib} as necessary.
36801 @item %s
36802 Current argument is the name of a library or startup file of some sort.
36803 Search for that file in a standard list of directories and substitute
36804 the full name found.  The current working directory is included in the
36805 list of directories scanned.
36807 @item %T
36808 Current argument is the name of a linker script.  Search for that file
36809 in the current list of directories to scan for libraries. If the file
36810 is located insert a @option{--script} option into the command line
36811 followed by the full path name found.  If the file is not found then
36812 generate an error message.  Note: the current working directory is not
36813 searched.
36815 @item %e@var{str}
36816 Print @var{str} as an error message.  @var{str} is terminated by a newline.
36817 Use this when inconsistent options are detected.
36819 @item %n@var{str}
36820 Print @var{str} as a notice.  @var{str} is terminated by a newline.
36822 @item %(@var{name})
36823 Substitute the contents of spec string @var{name} at this point.
36825 @item %x@{@var{option}@}
36826 Accumulate an option for @samp{%X}.
36828 @item %X
36829 Output the accumulated linker options specified by a @samp{%x} spec string.
36831 @item %Y
36832 Output the accumulated assembler options specified by @option{-Wa}.
36834 @item %Z
36835 Output the accumulated preprocessor options specified by @option{-Wp}.
36837 @item %M
36838 Output @code{multilib_os_dir}.
36840 @item %R
36841 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
36843 @item %a
36844 Process the @code{asm} spec.  This is used to compute the
36845 switches to be passed to the assembler.
36847 @item %A
36848 Process the @code{asm_final} spec.  This is a spec string for
36849 passing switches to an assembler post-processor, if such a program is
36850 needed.
36852 @item %l
36853 Process the @code{link} spec.  This is the spec for computing the
36854 command line passed to the linker.  Typically it makes use of the
36855 @samp{%L %G %S %D and %E} sequences.
36857 @item %D
36858 Dump out a @option{-L} option for each directory that GCC believes might
36859 contain startup files.  If the target supports multilibs then the
36860 current multilib directory is prepended to each of these paths.
36862 @item %L
36863 Process the @code{lib} spec.  This is a spec string for deciding which
36864 libraries are included on the command line to the linker.
36866 @item %G
36867 Process the @code{libgcc} spec.  This is a spec string for deciding
36868 which GCC support library is included on the command line to the linker.
36870 @item %S
36871 Process the @code{startfile} spec.  This is a spec for deciding which
36872 object files are the first ones passed to the linker.  Typically
36873 this might be a file named @file{crt0.o}.
36875 @item %E
36876 Process the @code{endfile} spec.  This is a spec string that specifies
36877 the last object files that are passed to the linker.
36879 @item %C
36880 Process the @code{cpp} spec.  This is used to construct the arguments
36881 to be passed to the C preprocessor.
36883 @item %1
36884 Process the @code{cc1} spec.  This is used to construct the options to be
36885 passed to the actual C compiler (@command{cc1}).
36887 @item %2
36888 Process the @code{cc1plus} spec.  This is used to construct the options to be
36889 passed to the actual C++ compiler (@command{cc1plus}).
36891 @item %*
36892 Substitute the variable part of a matched option.  See below.
36893 Note that each comma in the substituted string is replaced by
36894 a single space.
36896 @item %<@var{S}
36897 Remove all occurrences of @code{-@var{S}} from the command line.  Note---this
36898 command is position dependent.  @samp{%} commands in the spec string
36899 before this one see @code{-@var{S}}, @samp{%} commands in the spec string
36900 after this one do not.
36902 @item %<@var{S}*
36903 Similar to @samp{%<@var{S}}, but match all switches beginning with @code{-@var{S}}.
36905 @item %>@var{S}
36906 Similar to @samp{%<@var{S}}, but keep @code{-@var{S}} in the GCC command line.
36908 @item %:@var{function}(@var{args})
36909 Call the named function @var{function}, passing it @var{args}.
36910 @var{args} is first processed as a nested spec string, then split
36911 into an argument vector in the usual fashion.  The function returns
36912 a string which is processed as if it had appeared literally as part
36913 of the current spec.
36915 The following built-in spec functions are provided:
36917 @table @code
36918 @item @code{getenv}
36919 The @code{getenv} spec function takes two arguments: an environment
36920 variable name and a string.  If the environment variable is not
36921 defined, a fatal error is issued.  Otherwise, the return value is the
36922 value of the environment variable concatenated with the string.  For
36923 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
36925 @smallexample
36926 %:getenv(TOPDIR /include)
36927 @end smallexample
36929 expands to @file{/path/to/top/include}.
36931 @item @code{if-exists}
36932 The @code{if-exists} spec function takes one argument, an absolute
36933 pathname to a file.  If the file exists, @code{if-exists} returns the
36934 pathname.  Here is a small example of its usage:
36936 @smallexample
36937 *startfile:
36938 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
36939 @end smallexample
36941 @item @code{if-exists-else}
36942 The @code{if-exists-else} spec function is similar to the @code{if-exists}
36943 spec function, except that it takes two arguments.  The first argument is
36944 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
36945 returns the pathname.  If it does not exist, it returns the second argument.
36946 This way, @code{if-exists-else} can be used to select one file or another,
36947 based on the existence of the first.  Here is a small example of its usage:
36949 @smallexample
36950 *startfile:
36951 crt0%O%s %:if-exists(crti%O%s) \
36952 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
36953 @end smallexample
36955 @item @code{if-exists-then-else}
36956 The @code{if-exists-then-else} spec function takes at least two arguments
36957 and an optional third one. The first argument is an absolute pathname to a
36958 file.  If the file exists, the function returns the second argument.
36959 If the file does not exist, the function returns the third argument if there
36960 is one, or NULL otherwise. This can be used to expand one text, or optionally
36961 another, based on the existence of a file.  Here is a small example of its
36962 usage:
36964 @smallexample
36965 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
36966 @end smallexample
36968 @item @code{sanitize}
36969 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
36970 any address, thread or undefined behavior sanitizers are active.
36972 @smallexample
36973 %@{%:sanitize(address):-funwind-tables@}
36974 @end smallexample
36976 @item @code{replace-outfile}
36977 The @code{replace-outfile} spec function takes two arguments.  It looks for the
36978 first argument in the outfiles array and replaces it with the second argument.  Here
36979 is a small example of its usage:
36981 @smallexample
36982 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
36983 @end smallexample
36985 @item @code{remove-outfile}
36986 The @code{remove-outfile} spec function takes one argument.  It looks for the
36987 first argument in the outfiles array and removes it.  Here is a small example
36988 its usage:
36990 @smallexample
36991 %:remove-outfile(-lm)
36992 @end smallexample
36994 @item @code{version-compare}
36995 The @code{version-compare} spec function takes four or five arguments of the following
36996 form:
36998 @smallexample
36999 <comparison-op> <arg1> [<arg2>] <switch> <result>
37000 @end smallexample
37002 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
37003 The supported @code{comparison-op} values are:
37005 @table @code
37006 @item >=
37007 True if @code{switch} is a later (or same) version than @code{arg1}
37009 @item !>
37010 Opposite of @code{>=}
37012 @item <
37013 True if @code{switch} is an earlier version than @code{arg1}
37015 @item !<
37016 Opposite of @code{<}
37018 @item ><
37019 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
37021 @item <>
37022 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
37023 @end table
37025 If the @code{switch} is not present at all, the condition is false unless the first character
37026 of the @code{comparison-op} is @code{!}.
37028 @smallexample
37029 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
37030 @end smallexample
37032 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
37033 passed.
37035 @item @code{include}
37036 The @code{include} spec function behaves much like @code{%include}, with the advantage
37037 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
37038 the filename, and looks for it in the startfile path.  It always returns NULL.
37040 @smallexample
37041 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
37042 @end smallexample
37044 @item @code{pass-through-libs}
37045 The @code{pass-through-libs} spec function takes any number of arguments.  It
37046 finds any @option{-l} options and any non-options ending in @file{.a} (which it
37047 assumes are the names of linker input library archive files) and returns a
37048 result containing all the found arguments each prepended by
37049 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
37050 intended to be passed to the LTO linker plugin.
37052 @smallexample
37053 %:pass-through-libs(%G %L %G)
37054 @end smallexample
37056 @item @code{print-asm-header}
37057 The @code{print-asm-header} function takes no arguments and simply
37058 prints a banner like:
37060 @smallexample
37061 Assembler options
37062 =================
37064 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
37065 @end smallexample
37067 It is used to separate compiler options from assembler options
37068 in the @option{--target-help} output.
37070 @item @code{gt}
37071 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
37072 empty string) if the second-to-last argument is greater than the last argument, and NULL
37073 otherwise.  The following example inserts the @code{link_gomp} spec if the last
37074 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
37076 @smallexample
37077 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
37078 @end smallexample
37080 @item @code{debug-level-gt}
37081 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
37082 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
37083 otherwise.
37085 @smallexample
37086 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
37087 @end smallexample
37088 @end table
37090 @item %@{@var{S}@}
37091 Substitutes the @code{-@var{S}} switch, if that switch is given to GCC@.
37092 If that switch is not specified, this substitutes nothing.  Note that
37093 the leading dash is omitted when specifying this option, and it is
37094 automatically inserted if the substitution is performed.  Thus the spec
37095 string @samp{%@{foo@}} matches the command-line option @option{-foo}
37096 and outputs the command-line option @option{-foo}.
37098 @item %W@{@var{S}@}
37099 Like %@{@code{@var{S}}@} but mark last argument supplied within as a file to be
37100 deleted on failure.
37102 @item %@@@{@var{S}@}
37103 Like %@{@code{@var{S}}@} but puts the result into a @code{FILE} and substitutes
37104 @code{@@FILE} if an @code{@@file} argument has been supplied.
37106 @item %@{@var{S}*@}
37107 Substitutes all the switches specified to GCC whose names start
37108 with @code{-@var{S}}, but which also take an argument.  This is used for
37109 switches like @option{-o}, @option{-D}, @option{-I}, etc.
37110 GCC considers @option{-o foo} as being
37111 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
37112 text, including the space.  Thus two arguments are generated.
37114 @item %@{@var{S}*&@var{T}*@}
37115 Like %@{@code{@var{S}}*@}, but preserve order of @code{@var{S}} and @code{@var{T}} options
37116 (the order of @code{@var{S}} and @code{@var{T}} in the spec is not significant).
37117 There can be any number of ampersand-separated variables; for each the
37118 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
37120 @item %@{@var{S}:@var{X}@}
37121 Substitutes @code{@var{X}}, if the @option{-@var{S}} switch is given to GCC@.
37123 @item %@{!@var{S}:@var{X}@}
37124 Substitutes @code{@var{X}}, if the @option{-@var{S}} switch is @emph{not} given to GCC@.
37126 @item %@{@var{S}*:@var{X}@}
37127 Substitutes @code{@var{X}} if one or more switches whose names start with
37128 @code{-@var{S}} are specified to GCC@.  Normally @code{@var{X}} is substituted only
37129 once, no matter how many such switches appeared.  However, if @code{%*}
37130 appears somewhere in @code{@var{X}}, then @code{@var{X}} is substituted once
37131 for each matching switch, with the @code{%*} replaced by the part of
37132 that switch matching the @code{*}.
37134 If @code{%*} appears as the last part of a spec sequence then a space
37135 is added after the end of the last substitution.  If there is more
37136 text in the sequence, however, then a space is not generated.  This
37137 allows the @code{%*} substitution to be used as part of a larger
37138 string.  For example, a spec string like this:
37140 @smallexample
37141 %@{mcu=*:--script=%*/memory.ld@}
37142 @end smallexample
37144 @noindent
37145 when matching an option like @option{-mcu=newchip} produces:
37147 @smallexample
37148 --script=newchip/memory.ld
37149 @end smallexample
37151 @item %@{.@var{S}:@var{X}@}
37152 Substitutes @code{@var{X}}, if processing a file with suffix @code{@var{S}}.
37154 @item %@{!.@var{S}:@var{X}@}
37155 Substitutes @code{@var{X}}, if @emph{not} processing a file with suffix @code{@var{S}}.
37157 @item %@{,@var{S}:@var{X}@}
37158 Substitutes @code{@var{X}}, if processing a file for language @code{@var{S}}.
37160 @item %@{!,@var{S}:@var{X}@}
37161 Substitutes @code{@var{X}}, if not processing a file for language @code{@var{S}}.
37163 @item %@{@var{S}|@var{P}:@var{X}@}
37164 Substitutes @code{@var{X}} if either @code{-@var{S}} or @code{-@var{P}} is given to
37165 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
37166 @code{*} sequences as well, although they have a stronger binding than
37167 the @samp{|}.  If @code{%*} appears in @code{@var{X}}, all of the
37168 alternatives must be starred, and only the first matching alternative
37169 is substituted.
37171 For example, a spec string like this:
37173 @smallexample
37174 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
37175 @end smallexample
37177 @noindent
37178 outputs the following command-line options from the following input
37179 command-line options:
37181 @smallexample
37182 fred.c        -foo -baz
37183 jim.d         -bar -boggle
37184 -d fred.c     -foo -baz -boggle
37185 -d jim.d      -bar -baz -boggle
37186 @end smallexample
37188 @item %@{%:@var{function}(@var{args}):@var{X}@}
37190 Call function named @var{function} with args @var{args}.  If the
37191 function returns non-NULL, then @code{@var{X}} is substituted, if it returns
37192 NULL, it isn't substituted.
37194 @item %@{@var{S}:@var{X}; @var{T}:@var{Y}; :@var{D}@}
37196 If @code{@var{S}} is given to GCC, substitutes @code{@var{X}}; else if @code{@var{T}} is
37197 given to GCC, substitutes @code{@var{Y}}; else substitutes @code{@var{D}}.  There can
37198 be as many clauses as you need.  This may be combined with @code{.},
37199 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
37202 @end table
37204 The switch matching text @code{@var{S}} in a @samp{%@{@var{S}@}}, @samp{%@{@var{S}:@var{X}@}}
37205 or similar construct can use a backslash to ignore the special meaning
37206 of the character following it, thus allowing literal matching of a
37207 character that is otherwise specially treated.  For example,
37208 @samp{%@{std=iso9899\:1999:@var{X}@}} substitutes @code{@var{X}} if the
37209 @option{-std=iso9899:1999} option is given.
37211 The conditional text @code{@var{X}} in a @samp{%@{@var{S}:@var{X}@}} or similar
37212 construct may contain other nested @samp{%} constructs or spaces, or
37213 even newlines.  They are processed as usual, as described above.
37214 Trailing white space in @code{@var{X}} is ignored.  White space may also
37215 appear anywhere on the left side of the colon in these constructs,
37216 except between @code{.} or @code{*} and the corresponding word.
37218 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
37219 handled specifically in these constructs.  If another value of
37220 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
37221 @option{-W} switch is found later in the command line, the earlier
37222 switch value is ignored, except with @{@code{@var{S}}*@} where @code{@var{S}} is
37223 just one letter, which passes all matching options.
37225 The character @samp{|} at the beginning of the predicate text is used to
37226 indicate that a command should be piped to the following command, but
37227 only if @option{-pipe} is specified.
37229 It is built into GCC which switches take arguments and which do not.
37230 (You might think it would be useful to generalize this to allow each
37231 compiler's spec to say which switches take arguments.  But this cannot
37232 be done in a consistent fashion.  GCC cannot even decide which input
37233 files have been specified without knowing which switches take arguments,
37234 and it must know which input files to compile in order to tell which
37235 compilers to run).
37237 GCC also knows implicitly that arguments starting in @option{-l} are to be
37238 treated as compiler output files, and passed to the linker in their
37239 proper position among the other output files.
37241 @node Environment Variables
37242 @section Environment Variables Affecting GCC
37243 @cindex environment variables
37245 @c man begin ENVIRONMENT
37246 This section describes several environment variables that affect how GCC
37247 operates.  Some of them work by specifying directories or prefixes to use
37248 when searching for various kinds of files.  Some are used to specify other
37249 aspects of the compilation environment.
37251 Note that you can also specify places to search using options such as
37252 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
37253 take precedence over places specified using environment variables, which
37254 in turn take precedence over those specified by the configuration of GCC@.
37255 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
37256 GNU Compiler Collection (GCC) Internals}.
37258 @table @env
37259 @vindex LANG
37260 @vindex LC_CTYPE
37261 @c @vindex LC_COLLATE
37262 @vindex LC_MESSAGES
37263 @c @vindex LC_MONETARY
37264 @c @vindex LC_NUMERIC
37265 @c @vindex LC_TIME
37266 @vindex LC_ALL
37267 @cindex locale
37268 @item LANG
37269 @itemx LC_CTYPE
37270 @c @itemx LC_COLLATE
37271 @itemx LC_MESSAGES
37272 @c @itemx LC_MONETARY
37273 @c @itemx LC_NUMERIC
37274 @c @itemx LC_TIME
37275 @itemx LC_ALL
37276 These environment variables control the way that GCC uses
37277 localization information which allows GCC to work with different
37278 national conventions.  GCC inspects the locale categories
37279 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
37280 so.  These locale categories can be set to any value supported by your
37281 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
37282 Kingdom encoded in UTF-8.
37284 The @env{LC_CTYPE} environment variable specifies character
37285 classification.  GCC uses it to determine the character boundaries in
37286 a string; this is needed for some multibyte encodings that contain quote
37287 and escape characters that are otherwise interpreted as a string
37288 end or escape.
37290 The @env{LC_MESSAGES} environment variable specifies the language to
37291 use in diagnostic messages.
37293 If the @env{LC_ALL} environment variable is set, it overrides the value
37294 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
37295 and @env{LC_MESSAGES} default to the value of the @env{LANG}
37296 environment variable.  If none of these variables are set, GCC
37297 defaults to traditional C English behavior.
37299 @vindex TMPDIR
37300 @item TMPDIR
37301 If @env{TMPDIR} is set, it specifies the directory to use for temporary
37302 files.  GCC uses temporary files to hold the output of one stage of
37303 compilation which is to be used as input to the next stage: for example,
37304 the output of the preprocessor, which is the input to the compiler
37305 proper.
37307 @vindex GCC_COMPARE_DEBUG
37308 @item GCC_COMPARE_DEBUG
37309 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
37310 @option{-fcompare-debug} to the compiler driver.  See the documentation
37311 of this option for more details.
37313 @vindex GCC_EXEC_PREFIX
37314 @item GCC_EXEC_PREFIX
37315 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
37316 names of the subprograms executed by the compiler.  No slash is added
37317 when this prefix is combined with the name of a subprogram, but you can
37318 specify a prefix that ends with a slash if you wish.
37320 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
37321 an appropriate prefix to use based on the pathname it is invoked with.
37323 If GCC cannot find the subprogram using the specified prefix, it
37324 tries looking in the usual places for the subprogram.
37326 The default value of @env{GCC_EXEC_PREFIX} is
37327 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
37328 the installed compiler. In many cases @var{prefix} is the value
37329 of @code{prefix} when you ran the @file{configure} script.
37331 Other prefixes specified with @option{-B} take precedence over this prefix.
37333 This prefix is also used for finding files such as @file{crt0.o} that are
37334 used for linking.
37336 In addition, the prefix is used in an unusual way in finding the
37337 directories to search for header files.  For each of the standard
37338 directories whose name normally begins with @samp{/usr/local/lib/gcc}
37339 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
37340 replacing that beginning with the specified prefix to produce an
37341 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
37342 @file{foo/bar} just before it searches the standard directory 
37343 @file{/usr/local/lib/bar}.
37344 If a standard directory begins with the configured
37345 @var{prefix} then the value of @var{prefix} is replaced by
37346 @env{GCC_EXEC_PREFIX} when looking for header files.
37348 @vindex COMPILER_PATH
37349 @item COMPILER_PATH
37350 The value of @env{COMPILER_PATH} is a colon-separated list of
37351 directories, much like @env{PATH}.  GCC tries the directories thus
37352 specified when searching for subprograms, if it cannot find the
37353 subprograms using @env{GCC_EXEC_PREFIX}.
37355 @vindex LIBRARY_PATH
37356 @item LIBRARY_PATH
37357 The value of @env{LIBRARY_PATH} is a colon-separated list of
37358 directories, much like @env{PATH}.  When configured as a native compiler,
37359 GCC tries the directories thus specified when searching for special
37360 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
37361 using GCC also uses these directories when searching for ordinary
37362 libraries for the @option{-l} option (but directories specified with
37363 @option{-L} come first).
37365 @vindex LANG
37366 @cindex locale definition
37367 @item LANG
37368 This variable is used to pass locale information to the compiler.  One way in
37369 which this information is used is to determine the character set to be used
37370 when character literals, string literals and comments are parsed in C and C++.
37371 When the compiler is configured to allow multibyte characters,
37372 the following values for @env{LANG} are recognized:
37374 @table @samp
37375 @item C-JIS
37376 Recognize JIS characters.
37377 @item C-SJIS
37378 Recognize SJIS characters.
37379 @item C-EUCJP
37380 Recognize EUCJP characters.
37381 @end table
37383 If @env{LANG} is not defined, or if it has some other value, then the
37384 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
37385 recognize and translate multibyte characters.
37387 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
37388 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
37389 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
37390 then additional text will be emitted to stderr when fix-it hints are
37391 emitted.  @option{-fdiagnostics-parseable-fixits} and
37392 @option{-fno-diagnostics-parseable-fixits} take precedence over this
37393 environment variable.
37395 @table @samp
37396 @item fixits-v1
37397 Emit parseable fix-it hints, equivalent to
37398 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
37399 expressed as a count of bytes, starting at byte 1 for the initial column.
37401 @item fixits-v2
37402 As @code{fixits-v1}, but columns are expressed as display columns,
37403 as per @option{-fdiagnostics-column-unit=display}.
37404 @end table
37406 @end table
37408 @noindent
37409 Some additional environment variables affect the behavior of the
37410 preprocessor.
37412 @include cppenv.texi
37414 @c man end
37416 @node Precompiled Headers
37417 @section Using Precompiled Headers
37418 @cindex precompiled headers
37419 @cindex speed of compilation
37421 Often large projects have many header files that are included in every
37422 source file.  The time the compiler takes to process these header files
37423 over and over again can account for nearly all of the time required to
37424 build the project.  To make builds faster, GCC allows you to
37425 @dfn{precompile} a header file.
37427 To create a precompiled header file, simply compile it as you would any
37428 other file, if necessary using the @option{-x} option to make the driver
37429 treat it as a C or C++ header file.  You may want to use a
37430 tool like @command{make} to keep the precompiled header up-to-date when
37431 the headers it contains change.
37433 A precompiled header file is searched for when @code{#include} is
37434 seen in the compilation.  As it searches for the included file
37435 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
37436 compiler looks for a precompiled header in each directory just before it
37437 looks for the include file in that directory.  The name searched for is
37438 the name specified in the @code{#include} with @samp{.gch} appended.  If
37439 the precompiled header file cannot be used, it is ignored.
37441 For instance, if you have @code{#include "all.h"}, and you have
37442 @file{all.h.gch} in the same directory as @file{all.h}, then the
37443 precompiled header file is used if possible, and the original
37444 header is used otherwise.
37446 Alternatively, you might decide to put the precompiled header file in a
37447 directory and use @option{-I} to ensure that directory is searched
37448 before (or instead of) the directory containing the original header.
37449 Then, if you want to check that the precompiled header file is always
37450 used, you can put a file of the same name as the original header in this
37451 directory containing an @code{#error} command.
37453 This also works with @option{-include}.  So yet another way to use
37454 precompiled headers, good for projects not designed with precompiled
37455 header files in mind, is to simply take most of the header files used by
37456 a project, include them from another header file, precompile that header
37457 file, and @option{-include} the precompiled header.  If the header files
37458 have guards against multiple inclusion, they are skipped because
37459 they've already been included (in the precompiled header).
37461 If you need to precompile the same header file for different
37462 languages, targets, or compiler options, you can instead make a
37463 @emph{directory} named like @file{all.h.gch}, and put each precompiled
37464 header in the directory, perhaps using @option{-o}.  It doesn't matter
37465 what you call the files in the directory; every precompiled header in
37466 the directory is considered.  The first precompiled header
37467 encountered in the directory that is valid for this compilation is
37468 used; they're searched in no particular order.
37470 There are many other possibilities, limited only by your imagination,
37471 good sense, and the constraints of your build system.
37473 A precompiled header file can be used only when these conditions apply:
37475 @itemize
37476 @item
37477 Only one precompiled header can be used in a particular compilation.
37479 @item
37480 A precompiled header cannot be used once the first C token is seen.  You
37481 can have preprocessor directives before a precompiled header; you cannot
37482 include a precompiled header from inside another header.
37484 @item
37485 The precompiled header file must be produced for the same language as
37486 the current compilation.  You cannot use a C precompiled header for a C++
37487 compilation.
37489 @item
37490 The precompiled header file must have been produced by the same compiler
37491 binary as the current compilation is using.
37493 @item
37494 Any macros defined before the precompiled header is included must
37495 either be defined in the same way as when the precompiled header was
37496 generated, or must not affect the precompiled header, which usually
37497 means that they don't appear in the precompiled header at all.
37499 The @option{-D} option is one way to define a macro before a
37500 precompiled header is included; using a @code{#define} can also do it.
37501 There are also some options that define macros implicitly, like
37502 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
37503 defined this way.
37505 @item If debugging information is output when using the precompiled
37506 header, using @option{-g} or similar, the same kind of debugging information
37507 must have been output when building the precompiled header.  However,
37508 a precompiled header built using @option{-g} can be used in a compilation
37509 when no debugging information is being output.
37511 @item The same @option{-m} options must generally be used when building
37512 and using the precompiled header.  @xref{Submodel Options},
37513 for any cases where this rule is relaxed.
37515 @item Each of the following options must be the same when building and using
37516 the precompiled header:
37518 @gccoptlist{-fexceptions}
37520 @item
37521 Some other command-line options starting with @option{-f},
37522 @option{-p}, or @option{-O} must be defined in the same way as when
37523 the precompiled header was generated.  At present, it's not clear
37524 which options are safe to change and which are not; the safest choice
37525 is to use exactly the same options when generating and using the
37526 precompiled header.  The following are known to be safe:
37528 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
37529 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
37530 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
37531 -pedantic-errors}
37533 @item Address space layout randomization (ASLR) can lead to not binary identical
37534 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
37535 PCH files.
37537 @end itemize
37539 For all of these except the last, the compiler automatically
37540 ignores the precompiled header if the conditions aren't met.  If you
37541 find an option combination that doesn't work and doesn't cause the
37542 precompiled header to be ignored, please consider filing a bug report,
37543 see @ref{Bugs}.
37545 If you do use differing options when generating and using the
37546 precompiled header, the actual behavior is a mixture of the
37547 behavior for the options.  For instance, if you use @option{-g} to
37548 generate the precompiled header but not when using it, you may or may
37549 not get debugging information for routines in the precompiled header.
37551 @node C++ Modules
37552 @section C++ Modules
37553 @cindex speed of compilation
37555 Modules are a C++20 language feature.  As the name suggests, they
37556 provides a modular compilation system, intending to provide both
37557 faster builds and better library isolation.  The ``Merging Modules''
37558 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
37559 of changes to the standard, although it does not capture later
37560 changes.
37562 @emph{G++'s modules support is not complete.}  Other than bugs, the
37563 known missing pieces are:
37565 @table @emph
37567 @item Private Module Fragment
37568 The Private Module Fragment is recognized, but an error is emitted.
37570 @item Partition definition visibility rules
37571 Entities may be defined in implementation partitions, and those
37572 definitions are not available outside of the module.  This is not
37573 implemented, and the definitions are available to extra-module use.
37575 @item Textual merging of reachable GM entities
37576 Entities may be multiply defined across different header-units.
37577 These must be de-duplicated, and this is implemented across imports,
37578 or when an import redefines a textually-defined entity.  However the
37579 reverse is not implemented---textually redefining an entity that has
37580 been defined in an imported header-unit.  A redefinition error is
37581 emitted.
37583 @item Translation-Unit local referencing rules
37584 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
37585 (@uref{https://wg21.link/p2003}) add limitations on which entities an
37586 exported region may reference (for instance, the entities an exported
37587 template definition may reference).  These are not fully implemented.
37589 @item Standard Library Header Units
37590 The Standard Library is not provided as importable header units.  If
37591 you want to import such units, you must explicitly build them first.
37592 If you do not do this with care, you may have multiple declarations,
37593 which the module machinery must merge---compiler resource usage can be
37594 affected by how you partition header files into header units.
37596 @end table
37598 Modular compilation is @emph{not} enabled with just the
37599 @option{-std=c++20} option.  You must explicitly enable it with the
37600 @option{-fmodules-ts} option.  It is independent of the language
37601 version selected, although in pre-C++20 versions, it is of course an
37602 extension.
37604 No new source file suffixes are required or supported.  If you wish to
37605 use a non-standard suffix (@pxref{Overall Options}), you also need
37606 to provide a @option{-x c++} option too.@footnote{Some users like to
37607 distinguish module interface files with a new suffix, such as naming
37608 the source @code{module.cppm}, which involves
37609 teaching all tools about the new suffix.  A different scheme, such as
37610 naming @code{module-m.cpp} would be less invasive.}
37612 Compiling a module interface unit produces an additional output (to
37613 the assembly or object file), called a Compiled Module Interface
37614 (CMI).  This encodes the exported declarations of the module.
37615 Importing a module reads in the CMI.  The import graph is a Directed
37616 Acyclic Graph (DAG).  You must build imports before the importer.
37618 Header files may themselves be compiled to header units, which are a
37619 transitional ability aiming at faster compilation.  The
37620 @option{-fmodule-header} option is used to enable this, and implies
37621 the @option{-fmodules-ts} option.  These CMIs are named by the fully
37622 resolved underlying header file, and thus may be a complete pathname
37623 containing subdirectories.  If the header file is found at an absolute
37624 pathname, the CMI location is still relative to a CMI root directory.
37626 As header files often have no suffix, you commonly have to specify a
37627 @option{-x} option to tell the compiler the source is a header file.
37628 You may use @option{-x c++-header}, @option{-x c++-user-header} or
37629 @option{-x c++-system-header}.  When used in conjunction with
37630 @option{-fmodules-ts}, these all imply an appropriate
37631 @option{-fmodule-header} option.  The latter two variants use the
37632 user or system include path to search for the file specified.  This
37633 allows you to, for instance, compile standard library header files as
37634 header units, without needing to know exactly where they are
37635 installed.  Specifying the language as one of these variants also
37636 inhibits output of the object file, as header files have no associated
37637 object file.
37639 The @option{-fmodule-only} option disables generation of the
37640 associated object file for compiling a module interface.  Only the CMI
37641 is generated.  This option is implied when using the
37642 @option{-fmodule-header} option.
37644 The @option{-flang-info-include-translate} and
37645 @option{-flang-info-include-translate-not} options notes whether
37646 include translation occurs or not.  With no argument, the first will
37647 note all include translation.  The second will note all
37648 non-translations of include files not known to intentionally be
37649 textual.  With an argument, queries about include translation of a
37650 header files with that particular trailing pathname are noted.  You
37651 may repeat this form to cover several different header files.  This
37652 option may be helpful in determining whether include translation is
37653 happening---if it is working correctly, it behaves as if it isn't
37654 there at all.
37656 The @option{-flang-info-module-cmi} option can be used to determine
37657 where the compiler is reading a CMI from.  Without the option, the
37658 compiler is silent when such a read is successful.  This option has an
37659 optional argument, which will restrict the notification to just the
37660 set of named modules or header units specified.
37662 The @option{-Winvalid-imported-macros} option causes all imported macros
37663 to be resolved at the end of compilation.  Without this, imported
37664 macros are only resolved when expanded or (re)defined.  This option
37665 detects conflicting import definitions for all macros.
37667 For details of the @option{-fmodule-mapper} family of options,
37668 @pxref{C++ Module Mapper}.
37670 @menu
37671 * C++ Module Mapper::       Module Mapper
37672 * C++ Module Preprocessing::  Module Preprocessing
37673 * C++ Compiled Module Interface:: Compiled Module Interface
37674 @end menu
37676 @node C++ Module Mapper
37677 @subsection Module Mapper
37678 @cindex C++ Module Mapper
37680 A module mapper provides a server or file that the compiler queries to
37681 determine the mapping between module names and CMI files.  It is also
37682 used to build CMIs on demand.  @emph{Mapper functionality is in its
37683 infancy and is intended for experimentation with build system
37684 interactions.}
37686 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
37687 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
37688 have one of the following forms:
37690 @table @gcctabopt
37692 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
37693 An optional hostname and a numeric port number to connect to.  If the
37694 hostname is omitted, the loopback address is used.  If the hostname
37695 corresponds to multiple IPV6 addresses, these are tried in turn, until
37696 one is successful.  If your host lacks IPv6, this form is
37697 non-functional.  If you must use IPv4 use
37698 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
37700 @item =@var{socket}@r{[}?@var{ident}@r{]}
37701 A local domain socket.  If your host lacks local domain sockets, this
37702 form is non-functional.
37704 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
37705 A program to spawn, and communicate with on its stdin/stdout streams.
37706 Your @var{PATH} environment variable is searched for the program.
37707 Arguments are separated by space characters, (it is not possible for
37708 one of the arguments delivered to the program to contain a space).  An
37709 exception is if @var{program} begins with @@.  In that case
37710 @var{program} (sans @@) is looked for in the compiler's internal
37711 binary directory.  Thus the sample mapper-server can be specified
37712 with @code{@@g++-mapper-server}.
37714 @item <>@r{[}?@var{ident}@r{]}
37715 @item <>@var{inout}@r{[}?@var{ident}@r{]}
37716 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
37717 Named pipes or file descriptors to communicate over.  The first form,
37718 @option{<>}, communicates over stdin and stdout.  The other forms
37719 allow you to specify a file descriptor or name a pipe.  A numeric value
37720 is interpreted as a file descriptor, otherwise named pipe is opened.
37721 The second form specifies a bidirectional pipe and the last form
37722 allows specifying two independent pipes.  Using file descriptors
37723 directly in this manner is fragile in general, as it can require the
37724 cooperation of intermediate processes.  In particular using stdin &
37725 stdout is fraught with danger as other compiler options might also
37726 cause the compiler to read stdin or write stdout, and it can have
37727 unfortunate interactions with signal delivery from the terminal.
37729 @item @var{file}@r{[}?@var{ident}@r{]}
37730 A mapping file consisting of space-separated module-name, filename
37731 pairs, one per line.  Only the mappings for the direct imports and any
37732 module export name need be provided.  If other mappings are provided,
37733 they override those stored in any imported CMI files.  A repository
37734 root may be specified in the mapping file by using @samp{$root} as the
37735 module name in the first active line.  Use of this option will disable
37736 any default module->CMI name mapping.
37738 @end table
37740 As shown, an optional @var{ident} may suffix the first word of the
37741 option, indicated by a @samp{?} prefix.  The value is used in the
37742 initial handshake with the module server, or to specify a prefix on
37743 mapping file lines.  In the server case, the main source file name is
37744 used if no @var{ident} is specified.  In the file case, all non-blank
37745 lines are significant, unless a value is specified, in which case only
37746 lines beginning with @var{ident} are significant.  The @var{ident}
37747 must be separated by whitespace from the module name.  Be aware that
37748 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
37749 significant to the shell, and therefore may need quoting.
37751 The mapper is connected to or loaded lazily, when the first module
37752 mapping is required.  The networking protocols are only supported on
37753 hosts that provide networking.  If no mapper is specified a default is
37754 provided.
37756 A project-specific mapper is expected to be provided by the build
37757 system that invokes the compiler.  It is not expected that a
37758 general-purpose server is provided for all compilations.  As such, the
37759 server will know the build configuration, the compiler it invoked, and
37760 the environment (such as working directory) in which that is
37761 operating.  As it may parallelize builds, several compilations may
37762 connect to the same socket.
37764 The default mapper generates CMI files in a @samp{gcm.cache}
37765 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
37766 is used directly to provide the basename.  Header units construct a
37767 relative path using the underlying header file name.  If the path is
37768 already relative, a @samp{,} directory is prepended.  Internal
37769 @samp{..} components are translated to @samp{,,}.  No attempt is made
37770 to canonicalize these filenames beyond that done by the preprocessor's
37771 include search algorithm, as in general it is ambiguous when symbolic
37772 links are present.
37774 The mapper protocol was published as ``A Module Mapper''
37775 @uref{https://wg21.link/p1184}.  The implementation is provided by
37776 @command{libcody}, @uref{https://github.com/urnathan/libcody},
37777 which specifies the canonical protocol definition.  A proof of concept
37778 server implementation embedded in @command{make} was described in
37779 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
37781 @node C++ Module Preprocessing
37782 @subsection Module Preprocessing
37783 @cindex C++ Module Preprocessing
37785 Modules affect preprocessing because of header units and include
37786 translation.  Some uses of the preprocessor as a separate step either
37787 do not produce a correct output, or require CMIs to be available.
37789 Header units import macros.  These macros can affect later conditional
37790 inclusion, which therefore can cascade to differing import sets.  When
37791 preprocessing, it is necessary to load the CMI.  If a header unit is
37792 unavailable, the preprocessor issues a warning and continue (when
37793 not just preprocessing, an error is emitted).  Detecting such imports
37794 requires preprocessor tokenization of the input stream to phase 4
37795 (macro expansion).
37797 Include translation converts @code{#include}, @code{#include_next} and
37798 @code{#import} directives to internal @code{import} declarations.
37799 Whether a particular directive is translated is controlled by the
37800 module mapper.  Header unit names are canonicalized during
37801 preprocessing.
37803 Dependency information can be emitted for macro import, extending the
37804 functionality of @option{-MD} and @option{-MMD} options.  Detection of
37805 import declarations also requires phase 4 preprocessing, and thus
37806 requires full preprocessing (or compilation).
37808 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
37809 preprocessing before phase 4.
37811 The @option{-save-temps} option uses @option{-fdirectives-only} for
37812 preprocessing, and preserve the macro definitions in the preprocessed
37813 output.  Usually you also want to use this option when explicitly
37814 preprocessing a header-unit, or consuming such preprocessed output:
37816 @smallexample
37817 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
37818 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
37819 @end smallexample
37821 @node C++ Compiled Module Interface
37822 @subsection Compiled Module Interface
37823 @cindex C++ Compiled Module Interface
37825 CMIs are an additional artifact when compiling named module
37826 interfaces, partitions or header units.  These are read when
37827 importing.  CMI contents are implementation-specific, and in GCC's
37828 case tied to the compiler version.  Consider them a rebuildable cache
37829 artifact, not a distributable object.
37831 When creating an output CMI, any missing directory components are
37832 created in a manner that is safe for concurrent builds creating
37833 multiple, different, CMIs within a common subdirectory tree.
37835 CMI contents are written to a temporary file, which is then atomically
37836 renamed.  Observers either see old contents (if there is an
37837 existing file), or complete new contents.  They do not observe the
37838 CMI during its creation.  This is unlike object file writing, which
37839 may be observed by an external process.
37841 CMIs are read in lazily, if the host OS provides @code{mmap}
37842 functionality.  Generally blocks are read when name lookup or template
37843 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
37844 option may be used.
37846 The @option{--param lazy-modules=@var{n}} parameter controls the limit
37847 on the number of concurrently open module files during lazy loading.
37848 Should more modules be imported, an LRU algorithm is used to determine
37849 which files to close---until that file is needed again.  This limit
37850 may be exceeded with deep module dependency hierarchies.  With large
37851 code bases there may be more imports than the process limit of file
37852 descriptors.  By default, the limit is a few less than the per-process
37853 file descriptor hard limit, if that is determinable.@footnote{Where
37854 applicable the soft limit is incremented as needed towards the hard limit.}
37856 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
37857 You may use @command{readelf} to inspect them, although section
37858 contents are largely undecipherable.  There is a section named
37859 @code{.gnu.c++.README}, which contains human-readable text.  Other
37860 than the first line, each line consists of @code{@var{tag}: @code{value}}
37861 tuples.
37863 @smallexample
37864 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
37866 String dump of section '.gnu.c++.README':
37867   [     0]  GNU C++ primary module interface
37868   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
37869   [    6f]  version: 2020/11/16-04:54
37870   [    89]  module: foo
37871   [    95]  source: c_b.ii
37872   [    a4]  dialect: C++20/coroutines
37873   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
37874   [    ee]  repository: gcm.cache
37875   [   104]  buildtime: 2020/11/16 15:03:21 UTC
37876   [   127]  localtime: 2020/11/16 07:03:21 PST
37877   [   14a]  export: foo:part1 foo-part1.gcm
37878 @end smallexample
37880 Amongst other things, this lists the source that was built, C++
37881 dialect used and imports of the module.@footnote{The precise contents
37882 of this output may change.} The timestamp is the same value as that
37883 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
37884 explicitly specified with the environment variable
37885 @code{SOURCE_DATE_EPOCH}.  For further details
37886 @pxref{Environment Variables}.
37888 A set of related CMIs may be copied, provided the relative pathnames
37889 are preserved.
37891 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
37892 it may be removed or altered.  The section numbering of the sections
37893 whose names do not begin with @code{.gnu.c++.}, or are not the string
37894 section is significant and must not be altered.