gcov: Improve -fprofile-update=atomic
[official-gcc.git] / gcc / doc / invoke.texi
blob557d613a1e63a3ac45eed1a3a1d54923c78ae375
1 @c Copyright (C) 1988-2023 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-2023 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-implicit-templates
223 -fno-implicit-inline-templates
224 -fno-implement-inlines
225 -fmodule-header@r{[}=@var{kind}@r{]} -fmodule-only -fmodules-ts
226 -fmodule-implicit-inline
227 -fno-module-lazy
228 -fmodule-mapper=@var{specification}
229 -fmodule-version-ignore
230 -fms-extensions
231 -fnew-inheriting-ctors
232 -fnew-ttp-matching
233 -fno-nonansi-builtins  -fnothrow-opt  -fno-operator-names
234 -fno-optional-diags
235 -fno-pretty-templates
236 -fno-rtti  -fsized-deallocation
237 -ftemplate-backtrace-limit=@var{n}
238 -ftemplate-depth=@var{n}
239 -fno-threadsafe-statics  -fuse-cxa-atexit
240 -fno-weak  -nostdinc++
241 -fvisibility-inlines-hidden
242 -fvisibility-ms-compat
243 -fext-numeric-literals
244 -flang-info-include-translate@r{[}=@var{header}@r{]}
245 -flang-info-include-translate-not
246 -flang-info-module-cmi@r{[}=@var{module}@r{]}
247 -stdlib=@var{libstdc++,libc++}
248 -Wabi-tag  -Wcatch-value  -Wcatch-value=@var{n}
249 -Wno-class-conversion  -Wclass-memaccess
250 -Wcomma-subscript  -Wconditionally-supported
251 -Wno-conversion-null  -Wctad-maybe-unsupported
252 -Wctor-dtor-privacy  -Wdangling-reference
253 -Wno-delete-incomplete
254 -Wdelete-non-virtual-dtor  -Wno-deprecated-array-compare
255 -Wdeprecated-copy -Wdeprecated-copy-dtor
256 -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion
257 -Weffc++ -Wno-elaborated-enum-base
258 -Wno-exceptions -Wextra-semi  -Wno-inaccessible-base
259 -Wno-inherited-variadic-ctor  -Wno-init-list-lifetime
260 -Winvalid-constexpr -Winvalid-imported-macros
261 -Wno-invalid-offsetof  -Wno-literal-suffix
262 -Wmismatched-new-delete -Wmismatched-tags
263 -Wmultiple-inheritance  -Wnamespaces  -Wnarrowing
264 -Wnoexcept  -Wnoexcept-type  -Wnon-virtual-dtor
265 -Wpessimizing-move  -Wno-placement-new  -Wplacement-new=@var{n}
266 -Wrange-loop-construct -Wredundant-move -Wredundant-tags
267 -Wreorder  -Wregister
268 -Wstrict-null-sentinel  -Wno-subobject-linkage  -Wtemplates
269 -Wno-non-template-friend  -Wold-style-cast
270 -Woverloaded-virtual  -Wno-pmf-conversions -Wself-move -Wsign-promo
271 -Wsized-deallocation  -Wsuggest-final-methods
272 -Wsuggest-final-types  -Wsuggest-override
273 -Wno-terminate  -Wuseless-cast  -Wno-vexing-parse
274 -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-show-option  -fno-diagnostics-show-caret
309 -fno-diagnostics-show-labels  -fno-diagnostics-show-line-numbers
310 -fno-diagnostics-show-cwe
311 -fno-diagnostics-show-rule
312 -fdiagnostics-minimum-margin-width=@var{width}
313 -fdiagnostics-parseable-fixits  -fdiagnostics-generate-patch
314 -fdiagnostics-show-template-tree  -fno-elide-type
315 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]}
316 -fdiagnostics-show-path-depths
317 -fno-show-column
318 -fdiagnostics-column-unit=@r{[}display@r{|}byte@r{]}
319 -fdiagnostics-column-origin=@var{origin}
320 -fdiagnostics-escape-format=@r{[}unicode@r{|}bytes@r{]}
321 -fdiagnostics-text-art-charset=@r{[}none@r{|}ascii@r{|}unicode@r{|}emoji@r{]}}
323 @item Warning Options
324 @xref{Warning Options,,Options to Request or Suppress Warnings}.
325 @gccoptlist{-fsyntax-only  -fmax-errors=@var{n}  -Wpedantic
326 -pedantic-errors -fpermissive
327 -w  -Wextra  -Wall  -Wabi=@var{n}
328 -Waddress  -Wno-address-of-packed-member  -Waggregate-return
329 -Walloc-size-larger-than=@var{byte-size}  -Walloc-zero
330 -Walloca  -Walloca-larger-than=@var{byte-size}
331 -Wno-aggressive-loop-optimizations
332 -Warith-conversion
333 -Warray-bounds  -Warray-bounds=@var{n}  -Warray-compare
334 -Wno-attributes  -Wattribute-alias=@var{n} -Wno-attribute-alias
335 -Wno-attribute-warning
336 -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
337 -Wbool-compare  -Wbool-operation
338 -Wno-builtin-declaration-mismatch
339 -Wno-builtin-macro-redefined  -Wc90-c99-compat  -Wc99-c11-compat
340 -Wc11-c23-compat
341 -Wc++-compat  -Wc++11-compat  -Wc++14-compat  -Wc++17-compat
342 -Wc++20-compat
343 -Wno-c++11-extensions  -Wno-c++14-extensions -Wno-c++17-extensions
344 -Wno-c++20-extensions  -Wno-c++23-extensions
345 -Wcast-align  -Wcast-align=strict  -Wcast-function-type  -Wcast-qual
346 -Wchar-subscripts
347 -Wclobbered  -Wcomment
348 -Wcompare-distinct-pointer-types
349 -Wno-complain-wrong-lang
350 -Wconversion  -Wno-coverage-mismatch  -Wno-cpp
351 -Wdangling-else  -Wdangling-pointer  -Wdangling-pointer=@var{n}
352 -Wdate-time
353 -Wno-deprecated  -Wno-deprecated-declarations  -Wno-designated-init
354 -Wdisabled-optimization
355 -Wno-discarded-array-qualifiers  -Wno-discarded-qualifiers
356 -Wno-div-by-zero  -Wdouble-promotion
357 -Wduplicated-branches  -Wduplicated-cond
358 -Wempty-body  -Wno-endif-labels  -Wenum-compare  -Wenum-conversion
359 -Wenum-int-mismatch
360 -Werror  -Werror=*  -Wexpansion-to-defined  -Wfatal-errors
361 -Wflex-array-member-not-at-end
362 -Wfloat-conversion  -Wfloat-equal  -Wformat  -Wformat=2
363 -Wno-format-contains-nul  -Wno-format-extra-args
364 -Wformat-nonliteral  -Wformat-overflow=@var{n}
365 -Wformat-security  -Wformat-signedness  -Wformat-truncation=@var{n}
366 -Wformat-y2k  -Wframe-address
367 -Wframe-larger-than=@var{byte-size}  -Wno-free-nonheap-object
368 -Wno-if-not-aligned  -Wno-ignored-attributes
369 -Wignored-qualifiers  -Wno-incompatible-pointer-types
370 -Wimplicit  -Wimplicit-fallthrough  -Wimplicit-fallthrough=@var{n}
371 -Wno-implicit-function-declaration  -Wno-implicit-int
372 -Winfinite-recursion
373 -Winit-self  -Winline  -Wno-int-conversion  -Wint-in-bool-context
374 -Wno-int-to-pointer-cast  -Wno-invalid-memory-model
375 -Winvalid-pch  -Winvalid-utf8  -Wno-unicode  -Wjump-misses-init
376 -Wlarger-than=@var{byte-size}  -Wlogical-not-parentheses  -Wlogical-op
377 -Wlong-long  -Wno-lto-type-mismatch -Wmain  -Wmaybe-uninitialized
378 -Wmemset-elt-size  -Wmemset-transposed-args
379 -Wmisleading-indentation  -Wmissing-attributes  -Wmissing-braces
380 -Wmissing-field-initializers  -Wmissing-format-attribute
381 -Wmissing-include-dirs  -Wmissing-noreturn  -Wno-missing-profile
382 -Wno-multichar  -Wmultistatement-macros  -Wnonnull  -Wnonnull-compare
383 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
384 -Wnull-dereference  -Wno-odr
385 -Wopenacc-parallelism
386 -Wopenmp-simd
387 -Wno-overflow  -Woverlength-strings  -Wno-override-init-side-effects
388 -Wpacked  -Wno-packed-bitfield-compat  -Wpacked-not-aligned  -Wpadded
389 -Wparentheses  -Wno-pedantic-ms-format
390 -Wpointer-arith  -Wno-pointer-compare  -Wno-pointer-to-int-cast
391 -Wno-pragmas  -Wno-prio-ctor-dtor  -Wredundant-decls
392 -Wrestrict  -Wno-return-local-addr  -Wreturn-type
393 -Wno-scalar-storage-order  -Wsequence-point
394 -Wshadow  -Wshadow=global  -Wshadow=local  -Wshadow=compatible-local
395 -Wno-shadow-ivar
396 -Wno-shift-count-negative  -Wno-shift-count-overflow  -Wshift-negative-value
397 -Wno-shift-overflow  -Wshift-overflow=@var{n}
398 -Wsign-compare  -Wsign-conversion
399 -Wno-sizeof-array-argument
400 -Wsizeof-array-div
401 -Wsizeof-pointer-div  -Wsizeof-pointer-memaccess
402 -Wstack-protector  -Wstack-usage=@var{byte-size}  -Wstrict-aliasing
403 -Wstrict-aliasing=n  -Wstrict-overflow  -Wstrict-overflow=@var{n}
404 -Wstring-compare
405 -Wno-stringop-overflow -Wno-stringop-overread
406 -Wno-stringop-truncation -Wstrict-flex-arrays
407 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]}
408 -Wswitch  -Wno-switch-bool  -Wswitch-default  -Wswitch-enum
409 -Wno-switch-outside-range  -Wno-switch-unreachable  -Wsync-nand
410 -Wsystem-headers  -Wtautological-compare  -Wtrampolines  -Wtrigraphs
411 -Wtrivial-auto-var-init -Wtsan -Wtype-limits  -Wundef
412 -Wuninitialized  -Wunknown-pragmas
413 -Wunsuffixed-float-constants  -Wunused
414 -Wunused-but-set-parameter  -Wunused-but-set-variable
415 -Wunused-const-variable  -Wunused-const-variable=@var{n}
416 -Wunused-function  -Wunused-label  -Wunused-local-typedefs
417 -Wunused-macros
418 -Wunused-parameter  -Wno-unused-result
419 -Wunused-value  -Wunused-variable
420 -Wno-varargs  -Wvariadic-macros
421 -Wvector-operation-performance
422 -Wvla  -Wvla-larger-than=@var{byte-size}  -Wno-vla-larger-than
423 -Wvolatile-register-var  -Wwrite-strings
424 -Wxor-used-as-pow
425 -Wzero-length-bounds}
427 @item Static Analyzer Options
428 @gccoptlist{
429 -fanalyzer
430 -fanalyzer-call-summaries
431 -fanalyzer-checker=@var{name}
432 -fno-analyzer-feasibility
433 -fanalyzer-fine-grained
434 -fanalyzer-show-events-in-system-headers
435 -fno-analyzer-state-merge
436 -fno-analyzer-state-purge
437 -fno-analyzer-suppress-followups
438 -fanalyzer-transitivity
439 -fno-analyzer-undo-inlining
440 -fanalyzer-verbose-edges
441 -fanalyzer-verbose-state-changes
442 -fanalyzer-verbosity=@var{level}
443 -fdump-analyzer
444 -fdump-analyzer-callgraph
445 -fdump-analyzer-exploded-graph
446 -fdump-analyzer-exploded-nodes
447 -fdump-analyzer-exploded-nodes-2
448 -fdump-analyzer-exploded-nodes-3
449 -fdump-analyzer-exploded-paths
450 -fdump-analyzer-feasibility
451 -fdump-analyzer-infinite-loop
452 -fdump-analyzer-json
453 -fdump-analyzer-state-purge
454 -fdump-analyzer-stderr
455 -fdump-analyzer-supergraph
456 -fdump-analyzer-untracked
457 -Wno-analyzer-double-fclose
458 -Wno-analyzer-double-free
459 -Wno-analyzer-exposure-through-output-file
460 -Wno-analyzer-exposure-through-uninit-copy
461 -Wno-analyzer-fd-access-mode-mismatch
462 -Wno-analyzer-fd-double-close
463 -Wno-analyzer-fd-leak
464 -Wno-analyzer-fd-phase-mismatch
465 -Wno-analyzer-fd-type-mismatch
466 -Wno-analyzer-fd-use-after-close
467 -Wno-analyzer-fd-use-without-check
468 -Wno-analyzer-file-leak
469 -Wno-analyzer-free-of-non-heap
470 -Wno-analyzer-imprecise-fp-arithmetic
471 -Wno-analyzer-infinite-loop
472 -Wno-analyzer-infinite-recursion
473 -Wno-analyzer-jump-through-null
474 -Wno-analyzer-malloc-leak
475 -Wno-analyzer-mismatching-deallocation
476 -Wno-analyzer-null-argument
477 -Wno-analyzer-null-dereference
478 -Wno-analyzer-out-of-bounds
479 -Wno-analyzer-overlapping-buffers
480 -Wno-analyzer-possible-null-argument
481 -Wno-analyzer-possible-null-dereference
482 -Wno-analyzer-putenv-of-auto-var
483 -Wno-analyzer-shift-count-negative
484 -Wno-analyzer-shift-count-overflow
485 -Wno-analyzer-stale-setjmp-buffer
486 -Wno-analyzer-tainted-allocation-size
487 -Wno-analyzer-tainted-assertion
488 -Wno-analyzer-tainted-array-index
489 -Wno-analyzer-tainted-divisor
490 -Wno-analyzer-tainted-offset
491 -Wno-analyzer-tainted-size
492 -Wanalyzer-too-complex
493 -Wno-analyzer-unsafe-call-within-signal-handler
494 -Wno-analyzer-use-after-free
495 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
496 -Wno-analyzer-use-of-uninitialized-value
497 -Wno-analyzer-va-arg-type-mismatch
498 -Wno-analyzer-va-list-exhausted
499 -Wno-analyzer-va-list-leak
500 -Wno-analyzer-va-list-use-after-va-end
501 -Wno-analyzer-write-to-const
502 -Wno-analyzer-write-to-string-literal
505 @item C and Objective-C-only Warning Options
506 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations
507 -Wmissing-parameter-type -Wmissing-prototypes -Wmissing-variable-declarations
508 -Wnested-externs -Wold-style-declaration  -Wold-style-definition
509 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion
510 -Wdeclaration-after-statement  -Wpointer-sign}
512 @item Debugging Options
513 @xref{Debugging Options,,Options for Debugging Your Program}.
514 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version}
515 -gbtf -gctf  -gctf@var{level}
516 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches
517 -gstrict-dwarf  -gno-strict-dwarf
518 -gas-loc-support  -gno-as-loc-support
519 -gas-locview-support  -gno-as-locview-support
520 -gcodeview
521 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64
522 -gstatement-frontiers  -gno-statement-frontiers
523 -gvariable-location-views  -gno-variable-location-views
524 -ginternal-reset-location-views  -gno-internal-reset-location-views
525 -ginline-points  -gno-inline-points
526 -gvms -gz@r{[}=@var{type}@r{]}
527 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies
528 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section
529 -fno-eliminate-unused-debug-types
530 -femit-struct-debug-baseonly  -femit-struct-debug-reduced
531 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
532 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always
533 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm
534 -fvar-tracking  -fvar-tracking-assignments}
536 @item Optimization Options
537 @xref{Optimize Options,,Options that Control Optimization}.
538 @gccoptlist{-faggressive-loop-optimizations
539 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
540 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
541 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
542 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
543 -fno-allocation-dce -fallow-store-data-races
544 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}]
545 -fauto-inc-dec  -fbranch-probabilities
546 -fcaller-saves
547 -fcombine-stack-adjustments  -fconserve-stack
548 -ffold-mem-offsets
549 -fcompare-elim  -fcprop-registers  -fcrossjumping
550 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules
551 -fcx-limited-range
552 -fdata-sections  -fdce  -fdelayed-branch
553 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively
554 -fdevirtualize-at-ltrans  -fdse
555 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects
556 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style}
557 -ffinite-loops
558 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections
559 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity
560 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion
561 -fif-conversion2  -findirect-inlining
562 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n}
563 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone
564 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const
565 -fipa-reference  -fipa-reference-addressable
566 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm}
567 -flive-patching=@var{level}
568 -fira-region=@var{region}  -fira-hoist-pressure
569 -fira-loop-pressure  -fno-ira-share-save-slots
570 -fno-ira-share-spill-slots
571 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute
572 -fivopts  -fkeep-inline-functions  -fkeep-static-functions
573 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage
574 -floop-block  -floop-interchange  -floop-strip-mine
575 -floop-unroll-and-jam  -floop-nest-optimize
576 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level
577 -flto-partition=@var{alg}  -fmerge-all-constants
578 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves
579 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg
580 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse
581 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole
582 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock
583 -fno-sched-spec  -fno-signed-zeros
584 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss
585 -fomit-frame-pointer  -foptimize-sibling-calls
586 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning
587 -fprefetch-loop-arrays
588 -fprofile-correction
589 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training
590 -fprofile-values -fprofile-reorder-functions
591 -freciprocal-math  -free  -frename-registers  -freorder-blocks
592 -freorder-blocks-algorithm=@var{algorithm}
593 -freorder-blocks-and-partition  -freorder-functions
594 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops
595 -frounding-math  -fsave-optimization-record
596 -fsched2-use-superblocks  -fsched-pressure
597 -fsched-spec-load  -fsched-spec-load-dangerous
598 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}]
599 -fsched-group-heuristic  -fsched-critical-path-heuristic
600 -fsched-spec-insn-heuristic  -fsched-rank-heuristic
601 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic
602 -fschedule-fusion
603 -fschedule-insns  -fschedule-insns2  -fsection-anchors
604 -fselective-scheduling  -fselective-scheduling2
605 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops
606 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate
607 -fsignaling-nans
608 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops
609 -fsplit-paths
610 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
611 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
612 -fthread-jumps  -ftracer  -ftree-bit-ccp
613 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
614 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
615 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
616 -ftree-loop-if-convert  -ftree-loop-im
617 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
618 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize
619 -ftree-loop-vectorize
620 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta
621 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra
622 -ftree-switch-conversion  -ftree-tail-merge
623 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init
624 -funconstrained-commons -funit-at-a-time  -funroll-all-loops
625 -funroll-loops -funsafe-math-optimizations  -funswitch-loops
626 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt
627 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs
628 --param @var{name}=@var{value}
629 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
631 @item Program Instrumentation Options
632 @xref{Instrumentation Options,,Program Instrumentation Options}.
633 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage
634 -fprofile-abs-path
635 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path}
636 -fprofile-info-section  -fprofile-info-section=@var{name}
637 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
638 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
639 -fprofile-exclude-files=@var{regex}
640 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
641 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style}
642 -fsanitize-trap   -fsanitize-trap=@var{style}
643 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},...
644 -fsanitize-undefined-trap-on-error  -fbounds-check
645 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
646 -fharden-compares -fharden-conditional-branches
647 -fharden-control-flow-redundancy  -fhardcfr-skip-leaf
648 -fhardcfr-check-exceptions  -fhardcfr-check-returning-calls
649 -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
650 -fstack-protector  -fstack-protector-all  -fstack-protector-strong
651 -fstack-protector-explicit  -fstack-check
652 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym}
653 -fno-stack-limit  -fsplit-stack
654 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
655 -fvtv-counts  -fvtv-debug
656 -finstrument-functions  -finstrument-functions-once
657 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
658 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
659 -fprofile-prefix-map=@var{old}=@var{new}
660 -fpatchable-function-entry=@var{N}@r{[},@var{M}@r{]}}
662 @item Preprocessor Options
663 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
664 @gccoptlist{-A@var{question}=@var{answer}
665 -A-@var{question}@r{[}=@var{answer}@r{]}
666 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]}
667 -dD  -dI  -dM  -dN  -dU
668 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers
669 -fexec-charset=@var{charset}  -fextended-identifiers
670 -finput-charset=@var{charset}  -flarge-source-files
671 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
672 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess
673 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion
674 -fwide-exec-charset=@var{charset}  -fworking-directory
675 -H  -imacros @var{file}  -include @var{file}
676 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules
677 -no-integrated-cpp  -P  -pthread  -remap
678 -traditional  -traditional-cpp  -trigraphs
679 -U@var{macro}  -undef
680 -Wp,@var{option}  -Xpreprocessor @var{option}}
682 @item Assembler Options
683 @xref{Assembler Options,,Passing Options to the Assembler}.
684 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
686 @item Linker Options
687 @xref{Link Options,,Options for Linking}.
688 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library}
689 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++
690 -e @var{entry}  --entry=@var{entry}
691 -pie  -pthread  -r  -rdynamic
692 -s  -static  -static-pie  -static-libgcc  -static-libstdc++
693 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan
694 -shared  -shared-libgcc  -symbolic
695 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option}
696 -u @var{symbol}  -z @var{keyword}}
698 @item Directory Options
699 @xref{Directory Options,,Options for Directory Search}.
700 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-
701 -idirafter @var{dir}
702 -imacros @var{file}  -imultilib @var{dir}
703 -iplugindir=@var{dir}  -iprefix @var{file}
704 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir}
705 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}
706 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix
707 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
709 @item Code Generation Options
710 @xref{Code Gen Options,,Options for Code Generation Conventions}.
711 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg}
712 -ffixed-@var{reg}  -fexceptions
713 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables
714 -fasynchronous-unwind-tables
715 -fno-gnu-unique
716 -finhibit-size-directive  -fcommon  -fno-ident
717 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt
718 -fno-jump-tables -fno-bit-tests
719 -frecord-gcc-switches
720 -freg-struct-return  -fshort-enums  -fshort-wchar
721 -fverbose-asm  -fpack-struct[=@var{n}]
722 -fleading-underscore  -ftls-model=@var{model}
723 -fstack-reuse=@var{reuse_level}
724 -ftrampolines -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
725 -ftrapv  -fwrapv
726 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
727 -fstrict-volatile-bitfields  -fsync-libcalls}
729 @item Developer Options
730 @xref{Developer Options,,GCC Developer Options}.
731 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion
732 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
733 -fchecking  -fchecking=@var{n}
734 -fdbg-cnt-list  -fdbg-cnt=@var{counter-value-list}
735 -fdisable-ipa-@var{pass_name}
736 -fdisable-rtl-@var{pass_name}
737 -fdisable-rtl-@var{pass-name}=@var{range-list}
738 -fdisable-tree-@var{pass_name}
739 -fdisable-tree-@var{pass-name}=@var{range-list}
740 -fdump-debug  -fdump-earlydebug
741 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links
742 -fdump-final-insns@r{[}=@var{file}@r{]}
743 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline
744 -fdump-lang-all
745 -fdump-lang-@var{switch}
746 -fdump-lang-@var{switch}-@var{options}
747 -fdump-lang-@var{switch}-@var{options}=@var{filename}
748 -fdump-passes
749 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename}
750 -fdump-statistics
751 -fdump-tree-all
752 -fdump-tree-@var{switch}
753 -fdump-tree-@var{switch}-@var{options}
754 -fdump-tree-@var{switch}-@var{options}=@var{filename}
755 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second
756 -fenable-@var{kind}-@var{pass}
757 -fenable-@var{kind}-@var{pass}=@var{range-list}
758 -fira-verbose=@var{n}
759 -flto-report  -flto-report-wpa  -fmem-report-wpa
760 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report
761 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]}
762 -fmultiflags  -fprofile-report
763 -frandom-seed=@var{string}  -fsched-verbose=@var{n}
764 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose
765 -fstats  -fstack-usage  -ftime-report  -ftime-report-details
766 -fvar-tracking-assignments-toggle  -gtoggle
767 -print-file-name=@var{library}  -print-libgcc-file-name
768 -print-multi-directory  -print-multi-lib  -print-multi-os-directory
769 -print-prog-name=@var{program}  -print-search-dirs  -Q
770 -print-sysroot  -print-sysroot-headers-suffix
771 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
773 @item Machine-Dependent Options
774 @xref{Submodel Options,,Machine-Dependent Options}.
775 @c This list is ordered alphanumerically by subsection name.
776 @c Try and put the significant identifier (CPU or system) first,
777 @c so users have a clue at guessing where the ones they want will be.
779 @emph{AArch64 Options}
780 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian
781 -mgeneral-regs-only
782 -mcmodel=tiny  -mcmodel=small  -mcmodel=large
783 -mstrict-align  -mno-strict-align
784 -momit-leaf-frame-pointer
785 -mtls-dialect=desc  -mtls-dialect=traditional
786 -mtls-size=@var{size}
787 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419
788 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div
789 -mpc-relative-literal-loads
790 -msign-return-address=@var{scope}
791 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
792 +@var{b-key}]|@var{bti}
793 -mharden-sls=@var{opts}
794 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}
795 -moverride=@var{string}  -mverbose-cost-dump
796 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
797 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
798 -moutline-atomics }
800 @emph{Adapteva Epiphany Options}
801 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs
802 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf
803 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num}
804 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16
805 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num}
806 -msplit-vecmove-early  -m1reg-@var{reg}}
808 @emph{AMD GCN Options}
809 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
811 @emph{ARC Options}
812 @gccoptlist{-mbarrel-shifter  -mjli-always
813 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700
814 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr
815 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic
816 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap
817 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape
818 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof
819 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved
820 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num}
821 -mvolatile-cache  -mtp-regno=@var{regno}
822 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc
823 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi
824 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none
825 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode
826 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level}
827 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame
828 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo}
829 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
831 @emph{ARM Options}
832 @gccoptlist{-mapcs-frame  -mno-apcs-frame
833 -mabi=@var{name}
834 -mapcs-stack-check  -mno-apcs-stack-check
835 -mapcs-reentrant  -mno-apcs-reentrant
836 -mgeneral-regs-only
837 -msched-prolog  -mno-sched-prolog
838 -mlittle-endian  -mbig-endian
839 -mbe8  -mbe32
840 -mfloat-abi=@var{name}
841 -mfp16-format=@var{name}
842 -mthumb-interwork  -mno-thumb-interwork
843 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}
844 -mtune=@var{name}  -mprint-tune-info
845 -mstructure-size-boundary=@var{n}
846 -mabort-on-noreturn
847 -mlong-calls  -mno-long-calls
848 -msingle-pic-base  -mno-single-pic-base
849 -mpic-register=@var{reg}
850 -mnop-fun-dllimport
851 -mpoke-function-name
852 -mthumb  -marm  -mflip-thumb
853 -mtpcs-frame  -mtpcs-leaf-frame
854 -mcaller-super-interworking  -mcallee-super-interworking
855 -mtp=@var{name}  -mtls-dialect=@var{dialect}
856 -mword-relocations
857 -mfix-cortex-m3-ldrd
858 -mfix-cortex-a57-aes-1742098
859 -mfix-cortex-a72-aes-1655431
860 -munaligned-access
861 -mneon-for-64bits
862 -mslow-flash-data
863 -masm-syntax-unified
864 -mrestrict-it
865 -mverbose-cost-dump
866 -mpure-code
867 -mcmse
868 -mfix-cmse-cve-2021-35465
869 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
870 -mfdpic
871 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
872 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
874 @emph{AVR Options}
875 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args
876 -mbranch-cost=@var{cost}
877 -mcall-prologues  -mgas-isr-prologues  -mint8
878 -mdouble=@var{bits} -mlong-double=@var{bits}
879 -mn_flash=@var{size}  -mno-interrupts
880 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack
881 -mfract-convert-truncate
882 -mshort-calls  -nodevicelib  -nodevicespecs
883 -Waddr-space-convert  -Wmisspelled-isr}
885 @emph{Blackfin Options}
886 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
887 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer
888 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly
889 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library
890 -mno-id-shared-library  -mshared-library-id=@var{n}
891 -mleaf-id-shared-library  -mno-leaf-id-shared-library
892 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls
893 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram
894 -micplb}
896 @emph{C6X Options}
897 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu}
898 -msim  -msdata=@var{sdata-type}}
900 @emph{CRIS Options}
901 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
902 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
903 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects
904 -mstack-align  -mdata-align  -mconst-align
905 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue
906 -melf  -maout  -sim  -sim2
907 -mmul-bug-workaround  -mno-mul-bug-workaround}
909 @emph{C-SKY Options}
910 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}
911 -mbig-endian  -EB  -mlittle-endian  -EL
912 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu
913 -mfloat-abi=@var{name}
914 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust
915 -mdsp  -medsp  -mvdsp
916 -mdiv  -msmart  -mhigh-registers  -manchor
917 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt
918 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
920 @emph{Darwin Options}
921 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal
922 -arch_only  -bind_at_load  -bundle  -bundle_loader
923 -client_name  -compatibility_version  -current_version
924 -dead_strip
925 -dependency-file  -dylib_file  -dylinker_install_name
926 -dynamic  -dynamiclib  -exported_symbols_list
927 -filelist  -flat_namespace  -force_cpusubtype_ALL
928 -force_flat_namespace  -headerpad_max_install_names
929 -iframework
930 -image_base  -init  -install_name  -keep_private_externs
931 -multi_module  -multiply_defined  -multiply_defined_unused
932 -noall_load   -no_dead_strip_inits_and_terms -nodefaultrpaths
933 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit
934 -pagezero_size  -prebind  -prebind_all_twolevel_modules
935 -private_bundle  -read_only_relocs  -sectalign
936 -sectobjectsymbols  -whyload  -seg1addr
937 -sectcreate  -sectobjectsymbols  -sectorder
938 -segaddr  -segs_read_only_addr  -segs_read_write_addr
939 -seg_addr_table  -seg_addr_table_filename  -seglinkedit
940 -segprot  -segs_read_only_addr  -segs_read_write_addr
941 -single_module  -static  -sub_library  -sub_umbrella
942 -twolevel_namespace  -umbrella  -undefined
943 -unexported_symbols_list  -weak_reference_mismatches
944 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version}
945 -mkernel  -mone-byte-bool}
947 @emph{DEC Alpha Options}
948 @gccoptlist{-mno-fp-regs  -msoft-float
949 -mieee  -mieee-with-inexact  -mieee-conformant
950 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
951 -mtrap-precision=@var{mode}  -mbuild-constants
952 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}
953 -mbwx  -mmax  -mfix  -mcix
954 -mfloat-vax  -mfloat-ieee
955 -mexplicit-relocs  -msmall-data  -mlarge-data
956 -msmall-text  -mlarge-text
957 -mmemory-latency=@var{time}}
959 @emph{eBPF Options}
960 @gccoptlist{-mbig-endian -mlittle-endian
961 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
962 -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
963 -masm=@var{dialect}}
965 @emph{FR30 Options}
966 @gccoptlist{-msmall-model  -mno-lsim}
968 @emph{FT32 Options}
969 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
971 @emph{FRV Options}
972 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64
973 -mhard-float  -msoft-float
974 -malloc-cc  -mfixed-cc  -mdword  -mno-dword
975 -mdouble  -mno-double
976 -mmedia  -mno-media  -mmuladd  -mno-muladd
977 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic
978 -mlinked-fp  -mlong-calls  -malign-labels
979 -mlibrary-pic  -macc-4  -macc-8
980 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move
981 -moptimize-membar  -mno-optimize-membar
982 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec
983 -mvliw-branch  -mno-vliw-branch
984 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec
985 -mno-nested-cond-exec  -mtomcat-stats
986 -mTLS  -mtls
987 -mcpu=@var{cpu}}
989 @emph{GNU/Linux Options}
990 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid
991 -tno-android-cc  -tno-android-ld}
993 @emph{H8/300 Options}
994 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
996 @emph{HPPA Options}
997 @gccoptlist{-march=@var{architecture-type}
998 -matomic-libcalls  -mbig-switch
999 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing
1000 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld
1001 -mfixed-range=@var{register-range}
1002 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls
1003 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs
1004 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
1005 -mno-jump-in-delay  -mno-long-load-store
1006 -mno-portable-runtime  -mno-soft-float
1007 -mno-space-regs  -msoft-float  -mpa-risc-1-0
1008 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime
1009 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio
1010 -munix=@var{unix-std}  -nolibdld  -static  -threads}
1012 @emph{IA-64 Options}
1013 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic
1014 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata
1015 -mconstant-gp  -mauto-pic  -mfused-madd
1016 -minline-float-divide-min-latency
1017 -minline-float-divide-max-throughput
1018 -mno-inline-float-divide
1019 -minline-int-divide-min-latency
1020 -minline-int-divide-max-throughput
1021 -mno-inline-int-divide
1022 -minline-sqrt-min-latency  -minline-sqrt-max-throughput
1023 -mno-inline-sqrt
1024 -mdwarf2-asm  -mearly-stop-bits
1025 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size}
1026 -mtune=@var{cpu-type}  -milp32  -mlp64
1027 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec
1028 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec
1029 -msched-spec-ldc  -msched-spec-control-ldc
1030 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns
1031 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path
1032 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost
1033 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1035 @emph{LM32 Options}
1036 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled
1037 -msign-extend-enabled  -muser-enabled}
1039 @emph{LoongArch Options}
1040 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type}
1041 -mfpu=@var{fpu-type} -msimd=@var{simd-type}
1042 -msoft-float -msingle-float -mdouble-float -mlsx -mno-lsx -mlasx -mno-lasx
1043 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1044 -mcond-move-int  -mno-cond-move-int
1045 -mcond-move-float  -mno-cond-move-float
1046 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1047 -mmax-inline-memcpy-size=@var{n}
1048 -mexplicit-relocs=@var{style} -mexplicit-relocs -mno-explicit-relocs
1049 -mdirect-extern-access -mno-direct-extern-access
1050 -mcmodel=@var{code-model} -mrelax -mpass-mrelax-to-as}
1052 @emph{M32R/D Options}
1053 @gccoptlist{-m32r2  -m32rx  -m32r
1054 -mdebug
1055 -malign-loops  -mno-align-loops
1056 -missue-rate=@var{number}
1057 -mbranch-cost=@var{number}
1058 -mmodel=@var{code-size-model-type}
1059 -msdata=@var{sdata-type}
1060 -mno-flush-func  -mflush-func=@var{name}
1061 -mno-flush-trap  -mflush-trap=@var{number}
1062 -G @var{num}}
1064 @emph{M32C Options}
1065 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1067 @emph{M680x0 Options}
1068 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1069 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1070 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1071 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1072 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1073 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1074 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1075 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1076 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1078 @emph{MCore Options}
1079 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1080 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1081 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1082 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1083 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1085 @emph{MicroBlaze Options}
1086 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1087 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1088 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1089 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1090 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1091 -mpic-data-is-text-relative}
1093 @emph{MIPS Options}
1094 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1095 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1096 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1097 -mips16  -mno-mips16  -mflip-mips16
1098 -minterlink-compressed  -mno-interlink-compressed
1099 -minterlink-mips16  -mno-interlink-mips16
1100 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1101 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1102 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1103 -mno-float  -msingle-float  -mdouble-float
1104 -modd-spreg  -mno-odd-spreg
1105 -mabs=@var{mode}  -mnan=@var{encoding}
1106 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1107 -mmcu  -mmno-mcu
1108 -meva  -mno-eva
1109 -mvirt  -mno-virt
1110 -mxpa  -mno-xpa
1111 -mcrc  -mno-crc
1112 -mginv  -mno-ginv
1113 -mmicromips  -mno-micromips
1114 -mmsa  -mno-msa
1115 -mloongson-mmi  -mno-loongson-mmi
1116 -mloongson-ext  -mno-loongson-ext
1117 -mloongson-ext2  -mno-loongson-ext2
1118 -mfpu=@var{fpu-type}
1119 -msmartmips  -mno-smartmips
1120 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1121 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1122 -mlong64  -mlong32  -msym32  -mno-sym32
1123 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1124 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1125 -membedded-data  -mno-embedded-data
1126 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1127 -mcode-readable=@var{setting}
1128 -msplit-addresses  -mno-split-addresses
1129 -mexplicit-relocs  -mno-explicit-relocs
1130 -mcheck-zero-division  -mno-check-zero-division
1131 -mdivide-traps  -mdivide-breaks
1132 -mload-store-pairs  -mno-load-store-pairs
1133 -munaligned-access  -mno-unaligned-access
1134 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1135 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1136 -mfix-24k  -mno-fix-24k
1137 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1138 -mfix-r5900  -mno-fix-r5900
1139 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1140 -mfix-vr4120  -mno-fix-vr4120
1141 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1142 -mflush-func=@var{func}  -mno-flush-func
1143 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1144 -mcompact-branches=@var{policy}
1145 -mfp-exceptions  -mno-fp-exceptions
1146 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1147 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1148 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1149 -mframe-header-opt  -mno-frame-header-opt}
1151 @emph{MMIX Options}
1152 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1153 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1154 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1155 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1157 @emph{MN10300 Options}
1158 @gccoptlist{-mmult-bug  -mno-mult-bug
1159 -mno-am33  -mam33  -mam33-2  -mam34
1160 -mtune=@var{cpu-type}
1161 -mreturn-pointer-on-d0
1162 -mno-crt0  -mrelax  -mliw  -msetlb}
1164 @emph{Moxie Options}
1165 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1167 @emph{MSP430 Options}
1168 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1169 -mwarn-mcu
1170 -mcode-region=  -mdata-region=
1171 -msilicon-errata=  -msilicon-errata-warn=
1172 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1174 @emph{NDS32 Options}
1175 @gccoptlist{-mbig-endian  -mlittle-endian
1176 -mreduced-regs  -mfull-regs
1177 -mcmov  -mno-cmov
1178 -mext-perf  -mno-ext-perf
1179 -mext-perf2  -mno-ext-perf2
1180 -mext-string  -mno-ext-string
1181 -mv3push  -mno-v3push
1182 -m16bit  -mno-16bit
1183 -misr-vector-size=@var{num}
1184 -mcache-block-size=@var{num}
1185 -march=@var{arch}
1186 -mcmodel=@var{code-model}
1187 -mctor-dtor  -mrelax}
1189 @emph{Nios II Options}
1190 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1191 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1192 -mel  -meb
1193 -mno-bypass-cache  -mbypass-cache
1194 -mno-cache-volatile  -mcache-volatile
1195 -mno-fast-sw-div  -mfast-sw-div
1196 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1197 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1198 -mcustom-fpu-cfg=@var{name}
1199 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1200 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1202 @emph{Nvidia PTX Options}
1203 @gccoptlist{-m64  -mmainkernel  -moptimize}
1205 @emph{OpenRISC Options}
1206 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1207 -msoft-mul  -msoft-div
1208 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1209 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1210 -mcmodel=@var{code-model}}
1212 @emph{PDP-11 Options}
1213 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1214 -mint32  -mno-int16  -mint16  -mno-int32
1215 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1217 @emph{PowerPC Options}
1218 See RS/6000 and PowerPC Options.
1220 @emph{PRU Options}
1221 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1222 -mabi=@var{variant}}
1224 @emph{RISC-V Options}
1225 @gccoptlist{-mbranch-cost=@var{N-instruction}
1226 -mplt  -mno-plt
1227 -mabi=@var{ABI-string}
1228 -mfdiv  -mno-fdiv
1229 -mdiv  -mno-div
1230 -misa-spec=@var{ISA-spec-string}
1231 -march=@var{ISA-string}
1232 -mtune=@var{processor-string}
1233 -mpreferred-stack-boundary=@var{num}
1234 -msmall-data-limit=@var{N-bytes}
1235 -msave-restore  -mno-save-restore
1236 -mshorten-memrefs  -mno-shorten-memrefs
1237 -mstrict-align  -mno-strict-align
1238 -mcmodel=medlow  -mcmodel=medany
1239 -mexplicit-relocs  -mno-explicit-relocs
1240 -mrelax  -mno-relax
1241 -mriscv-attribute  -mno-riscv-attribute
1242 -malign-data=@var{type}
1243 -mbig-endian  -mlittle-endian
1244 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1245 -mstack-protector-guard-offset=@var{offset}
1246 -mcsr-check -mno-csr-check
1247 -minline-atomics  -mno-inline-atomics
1248 -minline-strlen  -mno-inline-strlen
1249 -minline-strcmp  -mno-inline-strcmp
1250 -minline-strncmp  -mno-inline-strncmp}
1252 @emph{RL78 Options}
1253 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1254 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1255 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1257 @emph{RS/6000 and PowerPC Options}
1258 @gccoptlist{-mcpu=@var{cpu-type}
1259 -mtune=@var{cpu-type}
1260 -mcmodel=@var{code-model}
1261 -mpowerpc64
1262 -maltivec  -mno-altivec
1263 -mpowerpc-gpopt  -mno-powerpc-gpopt
1264 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1265 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1266 -mfprnd  -mno-fprnd
1267 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1268 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1269 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1270 -malign-power  -malign-natural
1271 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1272 -mupdate  -mno-update
1273 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1274 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1275 -mstrict-align  -mno-strict-align  -mrelocatable
1276 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1277 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1278 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1279 -mprioritize-restricted-insns=@var{priority}
1280 -msched-costly-dep=@var{dependence_type}
1281 -minsert-sched-nops=@var{scheme}
1282 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1283 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1284 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1285 -mtraceback=@var{traceback_type}
1286 -maix-struct-return  -msvr4-struct-return
1287 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1288 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1289 -mblock-move-inline-limit=@var{num}
1290 -mblock-compare-inline-limit=@var{num}
1291 -mblock-compare-inline-loop-limit=@var{num}
1292 -mno-block-ops-unaligned-vsx
1293 -mstring-compare-inline-limit=@var{num}
1294 -misel  -mno-isel
1295 -mvrsave  -mno-vrsave
1296 -mmulhw  -mno-mulhw
1297 -mdlmzb  -mno-dlmzb
1298 -mprototype  -mno-prototype
1299 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1300 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1301 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1302 -mno-recip-precision
1303 -mveclibabi=@var{type}  -mfriz  -mno-friz
1304 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1305 -msave-toc-indirect  -mno-save-toc-indirect
1306 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector
1307 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1308 -mquad-memory  -mno-quad-memory
1309 -mquad-memory-atomic  -mno-quad-memory-atomic
1310 -mcompat-align-parm  -mno-compat-align-parm
1311 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1312 -mgnu-attribute  -mno-gnu-attribute
1313 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1314 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1315 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1316 -mprivileged -mno-privileged}
1318 @emph{RX Options}
1319 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1320 -mcpu=
1321 -mbig-endian-data  -mlittle-endian-data
1322 -msmall-data
1323 -msim  -mno-sim
1324 -mas100-syntax  -mno-as100-syntax
1325 -mrelax
1326 -mmax-constant-size=
1327 -mint-register=
1328 -mpid
1329 -mallow-string-insns  -mno-allow-string-insns
1330 -mjsr
1331 -mno-warn-multiple-fast-interrupts
1332 -msave-acc-in-interrupts}
1334 @emph{S/390 and zSeries Options}
1335 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1336 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1337 -mlong-double-64  -mlong-double-128
1338 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1339 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1340 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1341 -mhtm  -mvx  -mzvector
1342 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1343 -mfused-madd  -mno-fused-madd
1344 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1345 -mhotpatch=@var{halfwords},@var{halfwords}}
1347 @emph{SH Options}
1348 @gccoptlist{-m1  -m2  -m2e
1349 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1350 -m3  -m3e
1351 -m4-nofpu  -m4-single-only  -m4-single  -m4
1352 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1353 -mb  -ml  -mdalign  -mrelax
1354 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1355 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1356 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1357 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1358 -maccumulate-outgoing-args
1359 -matomic-model=@var{atomic-model}
1360 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1361 -mcbranch-force-delay-slot
1362 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1363 -mpretend-cmove  -mtas}
1365 @emph{Solaris 2 Options}
1366 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1367 -pthreads}
1369 @emph{SPARC Options}
1370 @gccoptlist{-mcpu=@var{cpu-type}
1371 -mtune=@var{cpu-type}
1372 -mcmodel=@var{code-model}
1373 -mmemory-model=@var{mem-model}
1374 -m32  -m64  -mapp-regs  -mno-app-regs
1375 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1376 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1377 -mhard-quad-float  -msoft-quad-float
1378 -mstack-bias  -mno-stack-bias
1379 -mstd-struct-return  -mno-std-struct-return
1380 -munaligned-doubles  -mno-unaligned-doubles
1381 -muser-mode  -mno-user-mode
1382 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1383 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1384 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1385 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1386 -mpopc  -mno-popc  -msubxc  -mno-subxc
1387 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1388 -mlra  -mno-lra}
1390 @emph{System V Options}
1391 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1393 @emph{V850 Options}
1394 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1395 -mprolog-function  -mno-prolog-function  -mspace
1396 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1397 -mapp-regs  -mno-app-regs
1398 -mdisable-callt  -mno-disable-callt
1399 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1400 -mv850e  -mv850  -mv850e3v5
1401 -mloop
1402 -mrelax
1403 -mlong-jumps
1404 -msoft-float
1405 -mhard-float
1406 -mgcc-abi
1407 -mrh850-abi
1408 -mbig-switch}
1410 @emph{VAX Options}
1411 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1413 @emph{Visium Options}
1414 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1415 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1417 @emph{VMS Options}
1418 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1419 -mpointer-size=@var{size}}
1421 @emph{VxWorks Options}
1422 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1423 -Xbind-lazy  -Xbind-now}
1425 @emph{x86 Options}
1426 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1427 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1428 -mfpmath=@var{unit}
1429 -masm=@var{dialect}  -mno-fancy-math-387
1430 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1431 -mno-wide-multiply  -mrtd  -malign-double
1432 -mpreferred-stack-boundary=@var{num}
1433 -mincoming-stack-boundary=@var{num}
1434 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1435 -mrecip  -mrecip=@var{opt}
1436 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1437 -mpartial-vector-fp-math
1438 -mmove-max=@var{bits} -mstore-max=@var{bits}
1439 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1440 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1441 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1442 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1443 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1444 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1445 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1446 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1447 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1448 -mavx512vbmi2 -mavx512bf16 -menqcmd
1449 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1450 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1451 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1452 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1453 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1454 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4 -mapxf
1455 -musermsr
1456 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1457 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1458 -mkl -mwidekl
1459 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1460 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1461 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1462 -mregparm=@var{num}  -msseregparm
1463 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1464 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1465 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1466 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1467 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1468 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1469 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1470 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1471 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1472 -mstack-protector-guard-reg=@var{reg}
1473 -mstack-protector-guard-offset=@var{offset}
1474 -mstack-protector-guard-symbol=@var{symbol}
1475 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1476 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1477 -mindirect-branch-register -mharden-sls=@var{choice}
1478 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1479 -munroll-only-small-loops -mlam=@var{choice}}
1481 @emph{x86 Windows Options}
1482 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mcygwin  -mno-cygwin  -mdll
1483 -mnop-fun-dllimport  -mthread
1484 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1486 @emph{Xstormy16 Options}
1487 @gccoptlist{-msim}
1489 @emph{Xtensa Options}
1490 @gccoptlist{-mconst16  -mno-const16
1491 -mfused-madd  -mno-fused-madd
1492 -mforce-no-pic
1493 -mserialize-volatile  -mno-serialize-volatile
1494 -mtext-section-literals  -mno-text-section-literals
1495 -mauto-litpools  -mno-auto-litpools
1496 -mtarget-align  -mno-target-align
1497 -mlongcalls  -mno-longcalls
1498 -mabi=@var{abi-type}
1499 -mextra-l32r-costs=@var{cycles}
1500 -mstrict-align  -mno-strict-align}
1502 @emph{zSeries Options}
1503 See S/390 and zSeries Options.
1504 @end table
1507 @node Overall Options
1508 @section Options Controlling the Kind of Output
1510 Compilation can involve up to four stages: preprocessing, compilation
1511 proper, assembly and linking, always in that order.  GCC is capable of
1512 preprocessing and compiling several files either into several
1513 assembler input files, or into one assembler input file; then each
1514 assembler input file produces an object file, and linking combines all
1515 the object files (those newly compiled, and those specified as input)
1516 into an executable file.
1518 @cindex file name suffix
1519 For any given input file, the file name suffix determines what kind of
1520 compilation is done:
1522 @table @gcctabopt
1523 @item @var{file}.c
1524 C source code that must be preprocessed.
1526 @item @var{file}.i
1527 C source code that should not be preprocessed.
1529 @item @var{file}.ii
1530 C++ source code that should not be preprocessed.
1532 @item @var{file}.m
1533 Objective-C source code.  Note that you must link with the @file{libobjc}
1534 library to make an Objective-C program work.
1536 @item @var{file}.mi
1537 Objective-C source code that should not be preprocessed.
1539 @item @var{file}.mm
1540 @itemx @var{file}.M
1541 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1542 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1543 to a literal capital M@.
1545 @item @var{file}.mii
1546 Objective-C++ source code that should not be preprocessed.
1548 @item @var{file}.h
1549 C, C++, Objective-C or Objective-C++ header file to be turned into a
1550 precompiled header (default), or C, C++ header file to be turned into an
1551 Ada spec (via the @option{-fdump-ada-spec} switch).
1553 @item @var{file}.cc
1554 @itemx @var{file}.cp
1555 @itemx @var{file}.cxx
1556 @itemx @var{file}.cpp
1557 @itemx @var{file}.CPP
1558 @itemx @var{file}.c++
1559 @itemx @var{file}.C
1560 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1561 the last two letters must both be literally @samp{x}.  Likewise,
1562 @samp{.C} refers to a literal capital C@.
1564 @item @var{file}.mm
1565 @itemx @var{file}.M
1566 Objective-C++ source code that must be preprocessed.
1568 @item @var{file}.mii
1569 Objective-C++ source code that should not be preprocessed.
1571 @item @var{file}.hh
1572 @itemx @var{file}.H
1573 @itemx @var{file}.hp
1574 @itemx @var{file}.hxx
1575 @itemx @var{file}.hpp
1576 @itemx @var{file}.HPP
1577 @itemx @var{file}.h++
1578 @itemx @var{file}.tcc
1579 C++ header file to be turned into a precompiled header or Ada spec.
1581 @item @var{file}.f
1582 @itemx @var{file}.for
1583 @itemx @var{file}.ftn
1584 Fixed form Fortran source code that should not be preprocessed.
1586 @item @var{file}.F
1587 @itemx @var{file}.FOR
1588 @itemx @var{file}.fpp
1589 @itemx @var{file}.FPP
1590 @itemx @var{file}.FTN
1591 Fixed form Fortran source code that must be preprocessed (with the traditional
1592 preprocessor).
1594 @item @var{file}.f90
1595 @itemx @var{file}.f95
1596 @itemx @var{file}.f03
1597 @itemx @var{file}.f08
1598 Free form Fortran source code that should not be preprocessed.
1600 @item @var{file}.F90
1601 @itemx @var{file}.F95
1602 @itemx @var{file}.F03
1603 @itemx @var{file}.F08
1604 Free form Fortran source code that must be preprocessed (with the
1605 traditional preprocessor).
1607 @item @var{file}.go
1608 Go source code.
1610 @item @var{file}.d
1611 D source code.
1613 @item @var{file}.di
1614 D interface file.
1616 @item @var{file}.dd
1617 D documentation code (Ddoc).
1619 @item @var{file}.ads
1620 Ada source code file that contains a library unit declaration (a
1621 declaration of a package, subprogram, or generic, or a generic
1622 instantiation), or a library unit renaming declaration (a package,
1623 generic, or subprogram renaming declaration).  Such files are also
1624 called @dfn{specs}.
1626 @item @var{file}.adb
1627 Ada source code file containing a library unit body (a subprogram or
1628 package body).  Such files are also called @dfn{bodies}.
1630 @c GCC also knows about some suffixes for languages not yet included:
1631 @c Ratfor:
1632 @c @var{file}.r
1634 @item @var{file}.s
1635 Assembler code.
1637 @item @var{file}.S
1638 @itemx @var{file}.sx
1639 Assembler code that must be preprocessed.
1641 @item @var{other}
1642 An object file to be fed straight into linking.
1643 Any file name with no recognized suffix is treated this way.
1644 @end table
1646 @opindex x
1647 You can specify the input language explicitly with the @option{-x} option:
1649 @table @gcctabopt
1650 @item -x @var{language}
1651 Specify explicitly the @var{language} for the following input files
1652 (rather than letting the compiler choose a default based on the file
1653 name suffix).  This option applies to all following input files until
1654 the next @option{-x} option.  Possible values for @var{language} are:
1655 @smallexample
1656 c  c-header  cpp-output
1657 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1658 objective-c  objective-c-header  objective-c-cpp-output
1659 objective-c++ objective-c++-header objective-c++-cpp-output
1660 assembler  assembler-with-cpp
1663 f77  f77-cpp-input f95  f95-cpp-input
1665 @end smallexample
1667 @item -x none
1668 Turn off any specification of a language, so that subsequent files are
1669 handled according to their file name suffixes (as they are if @option{-x}
1670 has not been used at all).
1671 @end table
1673 If you only want some of the stages of compilation, you can use
1674 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1675 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1676 @command{gcc} is to stop.  Note that some combinations (for example,
1677 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1679 @table @gcctabopt
1680 @opindex c
1681 @item -c
1682 Compile or assemble the source files, but do not link.  The linking
1683 stage simply is not done.  The ultimate output is in the form of an
1684 object file for each source file.
1686 By default, the object file name for a source file is made by replacing
1687 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1689 Unrecognized input files, not requiring compilation or assembly, are
1690 ignored.
1692 @opindex S
1693 @item -S
1694 Stop after the stage of compilation proper; do not assemble.  The output
1695 is in the form of an assembler code file for each non-assembler input
1696 file specified.
1698 By default, the assembler file name for a source file is made by
1699 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1701 Input files that don't require compilation are ignored.
1703 @opindex E
1704 @item -E
1705 Stop after the preprocessing stage; do not run the compiler proper.  The
1706 output is in the form of preprocessed source code, which is sent to the
1707 standard output.
1709 Input files that don't require preprocessing are ignored.
1711 @cindex output file option
1712 @opindex o
1713 @item -o @var{file}
1714 Place the primary output in file @var{file}.  This applies to whatever
1715 sort of output is being produced, whether it be an executable file, an
1716 object file, an assembler file or preprocessed C code.
1718 If @option{-o} is not specified, the default is to put an executable
1719 file in @file{a.out}, the object file for
1720 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1721 assembler file in @file{@var{source}.s}, a precompiled header file in
1722 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1723 standard output.
1725 Though @option{-o} names only the primary output, it also affects the
1726 naming of auxiliary and dump outputs.  See the examples below.  Unless
1727 overridden, both auxiliary outputs and dump outputs are placed in the
1728 same directory as the primary output.  In auxiliary outputs, the suffix
1729 of the input file is replaced with that of the auxiliary output file
1730 type; in dump outputs, the suffix of the dump file is appended to the
1731 input file suffix.  In compilation commands, the base name of both
1732 auxiliary and dump outputs is that of the primary output; in compile and
1733 link commands, the primary output name, minus the executable suffix, is
1734 combined with the input file name.  If both share the same base name,
1735 disregarding the suffix, the result of the combination is that base
1736 name, otherwise, they are concatenated, separated by a dash.
1738 @smallexample
1739 gcc -c foo.c ...
1740 @end smallexample
1742 will use @file{foo.o} as the primary output, and place aux outputs and
1743 dumps next to it, e.g., aux file @file{foo.dwo} for
1744 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1745 @option{-fdump-rtl-final}.
1747 If a non-linker output file is explicitly specified, aux and dump files
1748 by default take the same base name:
1750 @smallexample
1751 gcc -c foo.c -o dir/foobar.o ...
1752 @end smallexample
1754 will name aux outputs @file{dir/foobar.*} and dump outputs
1755 @file{dir/foobar.c.*}.
1757 A linker output will instead prefix aux and dump outputs:
1759 @smallexample
1760 gcc foo.c bar.c -o dir/foobar ...
1761 @end smallexample
1763 will generally name aux outputs @file{dir/foobar-foo.*} and
1764 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1765 @file{dir/foobar-bar.c.*}.
1767 The one exception to the above is when the executable shares the base
1768 name with the single input:
1770 @smallexample
1771 gcc foo.c -o dir/foo ...
1772 @end smallexample
1774 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1775 named @file{dir/foo.c.*}.
1777 The location and the names of auxiliary and dump outputs can be adjusted
1778 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1779 @option{-dumpdir}, @option{-save-temps=cwd}, and
1780 @option{-save-temps=obj}.
1783 @opindex dumpbase
1784 @item -dumpbase @var{dumpbase}
1785 This option sets the base name for auxiliary and dump output files.  It
1786 does not affect the name of the primary output file.  Intermediate
1787 outputs, when preserved, are not regarded as primary outputs, but as
1788 auxiliary outputs:
1790 @smallexample
1791 gcc -save-temps -S foo.c
1792 @end smallexample
1794 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1795 then compiles to the (implied) output file @file{foo.s}, whereas:
1797 @smallexample
1798 gcc -save-temps -dumpbase save-foo -c foo.c
1799 @end smallexample
1801 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1802 an intermediate, thus auxiliary output), and then assembles to the
1803 (implied) output file @file{foo.o}.
1805 Absent this option, dump and aux files take their names from the input
1806 file, or from the (non-linker) output file, if one is explicitly
1807 specified: dump output files (e.g. those requested by @option{-fdump-*}
1808 options) with the input name suffix, and aux output files (those
1809 requested by other non-dump options, e.g. @code{-save-temps},
1810 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1812 Similar suffix differentiation of dump and aux outputs can be attained
1813 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1814 @option{-dumpbase-ext .suf}.
1816 If @var{dumpbase} is explicitly specified with any directory component,
1817 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1818 @option{-save-temps=*}) is ignored, and instead of appending to it,
1819 @var{dumpbase} fully overrides it:
1821 @smallexample
1822 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1823   -dumpdir pfx- -save-temps=cwd ...
1824 @end smallexample
1826 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1827 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1828 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1830 When @option{-dumpbase} is specified in a command that compiles multiple
1831 inputs, or that compiles and then links, it may be combined with
1832 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1833 file is compiled using the combined @var{dumppfx}, and default values
1834 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1835 file:
1837 @smallexample
1838 gcc foo.c bar.c -c -dumpbase main ...
1839 @end smallexample
1841 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1842 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1843 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1844 and @file{main-bar.*}.
1846 An empty string specified as @var{dumpbase} avoids the influence of the
1847 output basename in the naming of auxiliary and dump outputs during
1848 compilation, computing default values :
1850 @smallexample
1851 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1852 @end smallexample
1854 will name aux outputs @file{dir/foo.*} and dump outputs
1855 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1856 name, but the directory still defaults to that of the output.
1858 The empty-string dumpbase does not prevent the use of the output
1859 basename for outputs during linking:
1861 @smallexample
1862 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1863 @end smallexample
1865 The compilation of the source files will name auxiliary outputs
1866 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1867 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1868 linking will use @file{dir/foobar.} as the prefix for dumps and
1869 auxiliary files.
1872 @opindex dumpbase-ext
1873 @item -dumpbase-ext @var{auxdropsuf}
1874 When forming the name of an auxiliary (but not a dump) output file, drop
1875 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1876 suffixes.  If not specified, this option defaults to the suffix of a
1877 default @var{dumpbase}, i.e., the suffix of the input file when
1878 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1879 is combined with @var{dumppfx}.
1881 @smallexample
1882 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1883 @end smallexample
1885 creates @file{dir/foo.o} as the main output, and generates auxiliary
1886 outputs in @file{dir/x-foo.*}, taking the location of the primary
1887 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1888 outputs retain the suffix: @file{dir/x-foo.c.*}.
1890 This option is disregarded if it does not match the suffix of a
1891 specified @var{dumpbase}, except as an alternative to the executable
1892 suffix when appending the linker output base name to @var{dumppfx}, as
1893 specified below:
1895 @smallexample
1896 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1897 @end smallexample
1899 creates @file{main.out} as the primary output, and avoids overwriting
1900 the auxiliary and dump outputs by using the executable name minus
1901 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1902 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1903 @file{main-foo.c.*} and @file{main-bar.c.*}.
1906 @opindex dumpdir
1907 @item -dumpdir @var{dumppfx}
1908 When forming the name of an auxiliary or dump output file, use
1909 @var{dumppfx} as a prefix:
1911 @smallexample
1912 gcc -dumpdir pfx- -c foo.c ...
1913 @end smallexample
1915 creates @file{foo.o} as the primary output, and auxiliary outputs named
1916 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1917 @var{dumpbase} derived from the default primary output, derived in turn
1918 from the input name.  Dump outputs also take the input name suffix:
1919 @file{pfx-foo.c.*}.
1921 If @var{dumppfx} is to be used as a directory name, it must end with a
1922 directory separator:
1924 @smallexample
1925 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1926 @end smallexample
1928 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1929 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1930 default @var{dumpbase} derived from the primary output name.  Dump
1931 outputs also take the input name suffix: @file{dir/bar.c.*}.
1933 It defaults to the location of the output file, unless the output
1934 file is a special file like @code{/dev/null}. Options
1935 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1936 default, just like an explicit @option{-dumpdir} option.  In case
1937 multiple such options are given, the last one prevails:
1939 @smallexample
1940 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1941 @end smallexample
1943 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1944 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1945 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1946 default for @option{-save-temps}, nor that the output directory is
1947 implicitly the current directory.  Dump outputs are named
1948 @file{foo.c.*}.
1950 When compiling from multiple input files, if @option{-dumpbase} is
1951 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1952 are appended to (or override, if containing any directory components) an
1953 explicit or defaulted @var{dumppfx}, so that each of the multiple
1954 compilations gets differently-named aux and dump outputs.
1956 @smallexample
1957 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1958 @end smallexample
1960 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1961 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1962 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1963 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1964 single-input compilation:
1966 @smallexample
1967 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1968 @end smallexample
1970 that, applying @option{-dumpbase} to a single source, does not compute
1971 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1972 dump outputs go in @file{dir/pfx-main.*}.
1974 When compiling and then linking from multiple input files, a defaulted
1975 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1976 transformation above (e.g. the compilation of @file{foo.c} and
1977 @file{bar.c} above, but without @option{-c}).  If neither
1978 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1979 base name, minus @var{auxdropsuf}, if specified, or the executable
1980 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1981 instead.  Note, however, that unlike earlier cases of linking:
1983 @smallexample
1984 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1985 @end smallexample
1987 does not append the output name @file{main} to @var{dumppfx}, because
1988 @option{-dumpdir} is explicitly specified.  The goal is that the
1989 explicitly-specified @var{dumppfx} may contain the specified output name
1990 as part of the prefix, if desired; only an explicitly-specified
1991 @option{-dumpbase} would be combined with it, in order to avoid simply
1992 discarding a meaningful option.
1994 When compiling and then linking from a single input file, the linker
1995 output base name will only be appended to the default @var{dumppfx} as
1996 above if it does not share the base name with the single input file
1997 name.  This has been covered in single-input linking cases above, but
1998 not with an explicit @option{-dumpdir} that inhibits the combination,
1999 even if overridden by @option{-save-temps=*}:
2001 @smallexample
2002 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
2003 @end smallexample
2005 Auxiliary outputs are named @file{foo.*}, and dump outputs
2006 @file{foo.c.*}, in the current working directory as ultimately requested
2007 by @option{-save-temps=cwd}.
2009 Summing it all up for an intuitive though slightly imprecise data flow:
2010 the primary output name is broken into a directory part and a basename
2011 part; @var{dumppfx} is set to the former, unless overridden by
2012 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2013 to the latter, unless overriden by @option{-dumpbase}.  If there are
2014 multiple inputs or linking, this @var{dumpbase} may be combined with
2015 @var{dumppfx} and taken from each input file.  Auxiliary output names
2016 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2017 minus suffix, and the auxiliary output suffix; dump output names are
2018 only different in that the suffix from @var{dumpbase} is retained.
2020 When it comes to auxiliary and dump outputs created during LTO
2021 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2022 given or as derived from the linker output name but not from inputs,
2023 even in cases in which this combination would not otherwise be used as
2024 such, is passed down with a trailing period replacing the compiler-added
2025 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2026 being involved in linking, this program does not normally get any
2027 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2029 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2030 names to the received @var{dumppfx}, ensures it contains a directory
2031 component so that it overrides any @option{-dumpdir}, and passes that as
2032 @option{-dumpbase} to sub-compilers.
2034 @opindex v
2035 @item -v
2036 Print (on standard error output) the commands executed to run the stages
2037 of compilation.  Also print the version number of the compiler driver
2038 program and of the preprocessor and the compiler proper.
2040 @opindex ###
2041 @item -###
2042 Like @option{-v} except the commands are not executed and arguments
2043 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2044 This is useful for shell scripts to capture the driver-generated command lines.
2046 @opindex help
2047 @item --help
2048 Print (on the standard output) a description of the command-line options
2049 understood by @command{gcc}.  If the @option{-v} option is also specified
2050 then @option{--help} is also passed on to the various processes
2051 invoked by @command{gcc}, so that they can display the command-line options
2052 they accept.  If the @option{-Wextra} option has also been specified
2053 (prior to the @option{--help} option), then command-line options that
2054 have no documentation associated with them are also displayed.
2056 @opindex target-help
2057 @item --target-help
2058 Print (on the standard output) a description of target-specific command-line
2059 options for each tool.  For some targets extra target-specific
2060 information may also be printed.
2062 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2063 Print (on the standard output) a description of the command-line
2064 options understood by the compiler that fit into all specified classes
2065 and qualifiers.  These are the supported classes:
2067 @table @asis
2068 @item @samp{optimizers}
2069 Display all of the optimization options supported by the
2070 compiler.
2072 @item @samp{warnings}
2073 Display all of the options controlling warning messages
2074 produced by the compiler.
2076 @item @samp{target}
2077 Display target-specific options.  Unlike the
2078 @option{--target-help} option however, target-specific options of the
2079 linker and assembler are not displayed.  This is because those
2080 tools do not currently support the extended @option{--help=} syntax.
2082 @item @samp{params}
2083 Display the values recognized by the @option{--param}
2084 option.
2086 @item @var{language}
2087 Display the options supported for @var{language}, where
2088 @var{language} is the name of one of the languages supported in this
2089 version of GCC@.  If an option is supported by all languages, one needs
2090 to select @samp{common} class.
2092 @item @samp{common}
2093 Display the options that are common to all languages.
2094 @end table
2096 These are the supported qualifiers:
2098 @table @asis
2099 @item @samp{undocumented}
2100 Display only those options that are undocumented.
2102 @item @samp{joined}
2103 Display options taking an argument that appears after an equal
2104 sign in the same continuous piece of text, such as:
2105 @samp{--help=target}.
2107 @item @samp{separate}
2108 Display options taking an argument that appears as a separate word
2109 following the original option, such as: @samp{-o output-file}.
2110 @end table
2112 Thus for example to display all the undocumented target-specific
2113 switches supported by the compiler, use:
2115 @smallexample
2116 --help=target,undocumented
2117 @end smallexample
2119 The sense of a qualifier can be inverted by prefixing it with the
2120 @samp{^} character, so for example to display all binary warning
2121 options (i.e., ones that are either on or off and that do not take an
2122 argument) that have a description, use:
2124 @smallexample
2125 --help=warnings,^joined,^undocumented
2126 @end smallexample
2128 The argument to @option{--help=} should not consist solely of inverted
2129 qualifiers.
2131 Combining several classes is possible, although this usually
2132 restricts the output so much that there is nothing to display.  One
2133 case where it does work, however, is when one of the classes is
2134 @var{target}.  For example, to display all the target-specific
2135 optimization options, use:
2137 @smallexample
2138 --help=target,optimizers
2139 @end smallexample
2141 The @option{--help=} option can be repeated on the command line.  Each
2142 successive use displays its requested class of options, skipping
2143 those that have already been displayed.  If @option{--help} is also
2144 specified anywhere on the command line then this takes precedence
2145 over any @option{--help=} option.
2147 If the @option{-Q} option appears on the command line before the
2148 @option{--help=} option, then the descriptive text displayed by
2149 @option{--help=} is changed.  Instead of describing the displayed
2150 options, an indication is given as to whether the option is enabled,
2151 disabled or set to a specific value (assuming that the compiler
2152 knows this at the point where the @option{--help=} option is used).
2154 Here is a truncated example from the ARM port of @command{gcc}:
2156 @smallexample
2157   % gcc -Q -mabi=2 --help=target -c
2158   The following options are target specific:
2159   -mabi=                                2
2160   -mabort-on-noreturn                   [disabled]
2161   -mapcs                                [disabled]
2162 @end smallexample
2164 The output is sensitive to the effects of previous command-line
2165 options, so for example it is possible to find out which optimizations
2166 are enabled at @option{-O2} by using:
2168 @smallexample
2169 -Q -O2 --help=optimizers
2170 @end smallexample
2172 Alternatively you can discover which binary optimizations are enabled
2173 by @option{-O3} by using:
2175 @smallexample
2176 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2177 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2178 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2179 @end smallexample
2181 @opindex version
2182 @item --version
2183 Display the version number and copyrights of the invoked GCC@.
2185 @opindex pass-exit-codes
2186 @item -pass-exit-codes
2187 Normally the @command{gcc} program exits with the code of 1 if any
2188 phase of the compiler returns a non-success return code.  If you specify
2189 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2190 the numerically highest error produced by any phase returning an error
2191 indication.  The C, C++, and Fortran front ends return 4 if an internal
2192 compiler error is encountered.
2194 @opindex pipe
2195 @item -pipe
2196 Use pipes rather than temporary files for communication between the
2197 various stages of compilation.  This fails to work on some systems where
2198 the assembler is unable to read from a pipe; but the GNU assembler has
2199 no trouble.
2201 @opindex specs
2202 @item -specs=@var{file}
2203 Process @var{file} after the compiler reads in the standard @file{specs}
2204 file, in order to override the defaults which the @command{gcc} driver
2205 program uses when determining what switches to pass to @command{cc1},
2206 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2207 @option{-specs=@var{file}} can be specified on the command line, and they
2208 are processed in order, from left to right.  @xref{Spec Files}, for
2209 information about the format of the @var{file}.
2211 @opindex wrapper
2212 @item -wrapper
2213 Invoke all subcommands under a wrapper program.  The name of the
2214 wrapper program and its parameters are passed as a comma separated
2215 list.
2217 @smallexample
2218 gcc -c t.c -wrapper gdb,--args
2219 @end smallexample
2221 @noindent
2222 This invokes all subprograms of @command{gcc} under
2223 @samp{gdb --args}, thus the invocation of @command{cc1} is
2224 @samp{gdb --args cc1 @dots{}}.
2226 @opindex ffile-prefix-map
2227 @item -ffile-prefix-map=@var{old}=@var{new}
2228 When compiling files residing in directory @file{@var{old}}, record
2229 any references to them in the result of the compilation as if the
2230 files resided in directory @file{@var{new}} instead.  Specifying this
2231 option is equivalent to specifying all the individual
2232 @option{-f*-prefix-map} options.  This can be used to make reproducible
2233 builds that are location independent.  Directories referenced by
2234 directives are not affected by these options.  See also
2235 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2236 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2238 @opindex fcanon-prefix-map
2239 @item -fcanon-prefix-map
2240 For the @option{-f*-prefix-map} options normally comparison
2241 of @file{@var{old}} prefix against the filename that would be normally
2242 referenced in the result of the compilation is done using textual
2243 comparison of the prefixes, or ignoring character case for case insensitive
2244 filesystems and considering slashes and backslashes as equal on DOS based
2245 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2246 to be done on canonicalized paths of @file{@var{old}}
2247 and the referenced filename.
2249 @opindex fplugin
2250 @item -fplugin=@var{name}.so
2251 Load the plugin code in file @var{name}.so, assumed to be a
2252 shared object to be dlopen'd by the compiler.  The base name of
2253 the shared object file is used to identify the plugin for the
2254 purposes of argument parsing (See
2255 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2256 Each plugin should define the callback functions specified in the
2257 Plugins API.
2259 @opindex fplugin-arg
2260 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2261 Define an argument called @var{key} with a value of @var{value}
2262 for the plugin called @var{name}.
2264 @opindex fdump-ada-spec
2265 @item -fdump-ada-spec@r{[}-slim@r{]}
2266 For C and C++ source and include files, generate corresponding Ada specs.
2267 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2268 GNAT User's Guide}, which provides detailed documentation on this feature.
2270 @opindex fada-spec-parent
2271 @item -fada-spec-parent=@var{unit}
2272 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2273 Ada specs as child units of parent @var{unit}.
2275 @opindex fdump-go-spec
2276 @item -fdump-go-spec=@var{file}
2277 For input files in any language, generate corresponding Go
2278 declarations in @var{file}.  This generates Go @code{const},
2279 @code{type}, @code{var}, and @code{func} declarations which may be a
2280 useful way to start writing a Go interface to code written in some
2281 other language.
2283 @include @value{srcdir}/../libiberty/at-file.texi
2284 @end table
2286 @node Invoking G++
2287 @section Compiling C++ Programs
2289 @cindex suffixes for C++ source
2290 @cindex C++ source file suffixes
2291 C++ source files conventionally use one of the suffixes @samp{.C},
2292 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2293 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2294 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2295 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2296 files with these names and compiles them as C++ programs even if you
2297 call the compiler the same way as for compiling C programs (usually
2298 with the name @command{gcc}).
2300 @findex g++
2301 @findex c++
2302 However, the use of @command{gcc} does not add the C++ library.
2303 @command{g++} is a program that calls GCC and automatically specifies linking
2304 against the C++ library.  It treats @samp{.c},
2305 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2306 files unless @option{-x} is used.  This program is also useful when
2307 precompiling a C header file with a @samp{.h} extension for use in C++
2308 compilations.  On many systems, @command{g++} is also installed with
2309 the name @command{c++}.
2311 @cindex invoking @command{g++}
2312 When you compile C++ programs, you may specify many of the same
2313 command-line options that you use for compiling programs in any
2314 language; or command-line options meaningful for C and related
2315 languages; or options that are meaningful only for C++ programs.
2316 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2317 explanations of options for languages related to C@.
2318 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2319 explanations of options that are meaningful only for C++ programs.
2321 @node C Dialect Options
2322 @section Options Controlling C Dialect
2323 @cindex dialect options
2324 @cindex language dialect options
2325 @cindex options, dialect
2327 The following options control the dialect of C (or languages derived
2328 from C, such as C++, Objective-C and Objective-C++) that the compiler
2329 accepts:
2331 @table @gcctabopt
2332 @cindex ANSI support
2333 @cindex ISO support
2334 @opindex ansi
2335 @item -ansi
2336 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2337 equivalent to @option{-std=c++98}.
2339 This turns off certain features of GCC that are incompatible with ISO
2340 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2341 such as the @code{asm} and @code{typeof} keywords, and
2342 predefined macros such as @code{unix} and @code{vax} that identify the
2343 type of system you are using.  It also enables the undesirable and
2344 rarely used ISO trigraph feature.  For the C compiler,
2345 it disables recognition of C++ style @samp{//} comments as well as
2346 the @code{inline} keyword.
2348 The alternate keywords @code{__asm__}, @code{__extension__},
2349 @code{__inline__} and @code{__typeof__} continue to work despite
2350 @option{-ansi}.  You would not want to use them in an ISO C program, of
2351 course, but it is useful to put them in header files that might be included
2352 in compilations done with @option{-ansi}.  Alternate predefined macros
2353 such as @code{__unix__} and @code{__vax__} are also available, with or
2354 without @option{-ansi}.
2356 The @option{-ansi} option does not cause non-ISO programs to be
2357 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2358 addition to @option{-ansi}.  @xref{Warning Options}.
2360 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2361 option is used.  Some header files may notice this macro and refrain
2362 from declaring certain functions or defining certain macros that the
2363 ISO standard doesn't call for; this is to avoid interfering with any
2364 programs that might use these names for other things.
2366 Functions that are normally built in but do not have semantics
2367 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2368 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2369 built-in functions provided by GCC}, for details of the functions
2370 affected.
2372 @opindex std
2373 @item -std=
2374 Determine the language standard. @xref{Standards,,Language Standards
2375 Supported by GCC}, for details of these standard versions.  This option
2376 is currently only supported when compiling C or C++.
2378 The compiler can accept several base standards, such as @samp{c90} or
2379 @samp{c++98}, and GNU dialects of those standards, such as
2380 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2381 compiler accepts all programs following that standard plus those
2382 using GNU extensions that do not contradict it.  For example,
2383 @option{-std=c90} turns off certain features of GCC that are
2384 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2385 keywords, but not other GNU extensions that do not have a meaning in
2386 ISO C90, such as omitting the middle term of a @code{?:}
2387 expression. On the other hand, when a GNU dialect of a standard is
2388 specified, all features supported by the compiler are enabled, even when
2389 those features change the meaning of the base standard.  As a result, some
2390 strict-conforming programs may be rejected.  The particular standard
2391 is used by @option{-Wpedantic} to identify which features are GNU
2392 extensions given that version of the standard. For example
2393 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2394 comments, while @option{-std=gnu99 -Wpedantic} does not.
2396 A value for this option must be provided; possible values are
2398 @table @samp
2399 @item c90
2400 @itemx c89
2401 @itemx iso9899:1990
2402 Support all ISO C90 programs (certain GNU extensions that conflict
2403 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2405 @item iso9899:199409
2406 ISO C90 as modified in amendment 1.
2408 @item c99
2409 @itemx c9x
2410 @itemx iso9899:1999
2411 @itemx iso9899:199x
2412 ISO C99.  This standard is substantially completely supported, modulo
2413 bugs and floating-point issues
2414 (mainly but not entirely relating to optional C99 features from
2415 Annexes F and G).  See
2416 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2417 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2419 @item c11
2420 @itemx c1x
2421 @itemx iso9899:2011
2422 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2423 substantially completely supported, modulo bugs, floating-point issues
2424 (mainly but not entirely relating to optional C11 features from
2425 Annexes F and G) and the optional Annexes K (Bounds-checking
2426 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2428 @item c17
2429 @itemx c18
2430 @itemx iso9899:2017
2431 @itemx iso9899:2018
2432 ISO C17, the 2017 revision of the ISO C standard
2433 (published in 2018).  This standard is
2434 same as C11 except for corrections of defects (all of which are also
2435 applied with @option{-std=c11}) and a new value of
2436 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2438 @item c23
2439 @itemx c2x
2440 @itemx iso9899:2024
2441 ISO C23, the 2023 revision of the ISO C standard (expected to be
2442 published in 2024).  The support for this version is experimental and
2443 incomplete.  The name @samp{c2x} is deprecated.
2445 @item gnu90
2446 @itemx gnu89
2447 GNU dialect of ISO C90 (including some C99 features).
2449 @item gnu99
2450 @itemx gnu9x
2451 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2453 @item gnu11
2454 @itemx gnu1x
2455 GNU dialect of ISO C11.
2456 The name @samp{gnu1x} is deprecated.
2458 @item gnu17
2459 @itemx gnu18
2460 GNU dialect of ISO C17.  This is the default for C code.
2462 @item gnu23
2463 @itemx gnu2x
2464 The next version of the ISO C standard, still under development, plus
2465 GNU extensions.  The support for this version is experimental and
2466 incomplete.  The name @samp{gnu2x} is deprecated.
2468 @item c++98
2469 @itemx c++03
2470 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2471 additional defect reports. Same as @option{-ansi} for C++ code.
2473 @item gnu++98
2474 @itemx gnu++03
2475 GNU dialect of @option{-std=c++98}.
2477 @item c++11
2478 @itemx c++0x
2479 The 2011 ISO C++ standard plus amendments.
2480 The name @samp{c++0x} is deprecated.
2482 @item gnu++11
2483 @itemx gnu++0x
2484 GNU dialect of @option{-std=c++11}.
2485 The name @samp{gnu++0x} is deprecated.
2487 @item c++14
2488 @itemx c++1y
2489 The 2014 ISO C++ standard plus amendments.
2490 The name @samp{c++1y} is deprecated.
2492 @item gnu++14
2493 @itemx gnu++1y
2494 GNU dialect of @option{-std=c++14}.
2495 The name @samp{gnu++1y} is deprecated.
2497 @item c++17
2498 @itemx c++1z
2499 The 2017 ISO C++ standard plus amendments.
2500 The name @samp{c++1z} is deprecated.
2502 @item gnu++17
2503 @itemx gnu++1z
2504 GNU dialect of @option{-std=c++17}.
2505 This is the default for C++ code.
2506 The name @samp{gnu++1z} is deprecated.
2508 @item c++20
2509 @itemx c++2a
2510 The 2020 ISO C++ standard plus amendments.
2511 Support is experimental, and could change in incompatible ways in
2512 future releases.
2513 The name @samp{c++2a} is deprecated.
2515 @item gnu++20
2516 @itemx gnu++2a
2517 GNU dialect of @option{-std=c++20}.
2518 Support is experimental, and could change in incompatible ways in
2519 future releases.
2520 The name @samp{gnu++2a} is deprecated.
2522 @item c++2b
2523 @itemx c++23
2524 The next revision of the ISO C++ standard, planned for
2525 2023.  Support is highly experimental, and will almost certainly
2526 change in incompatible ways in future releases.
2528 @item gnu++2b
2529 @itemx gnu++23
2530 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2531 and will almost certainly change in incompatible ways in future
2532 releases.
2534 @item c++2c
2535 @itemx c++26
2536 The next revision of the ISO C++ standard, planned for
2537 2026.  Support is highly experimental, and will almost certainly
2538 change in incompatible ways in future releases.
2540 @item gnu++2c
2541 @itemx gnu++26
2542 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2543 and will almost certainly change in incompatible ways in future
2544 releases.
2545 @end table
2547 @opindex aux-info
2548 @item -aux-info @var{filename}
2549 Output to the given filename prototyped declarations for all functions
2550 declared and/or defined in a translation unit, including those in header
2551 files.  This option is silently ignored in any language other than C@.
2553 Besides declarations, the file indicates, in comments, the origin of
2554 each declaration (source file and line), whether the declaration was
2555 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2556 @samp{O} for old, respectively, in the first character after the line
2557 number and the colon), and whether it came from a declaration or a
2558 definition (@samp{C} or @samp{F}, respectively, in the following
2559 character).  In the case of function definitions, a K&R-style list of
2560 arguments followed by their declarations is also provided, inside
2561 comments, after the declaration.
2563 @opindex fno-asm
2564 @opindex fasm
2565 @item -fno-asm
2566 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2567 keyword, so that code can use these words as identifiers.  You can use
2568 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2569 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2571 In C++, @code{inline} is a standard keyword and is not affected by
2572 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2573 instead, which disables @code{typeof} but not @code{asm} and
2574 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2575 this switch only affects the @code{asm} and @code{typeof} keywords,
2576 since @code{inline} is a standard keyword in ISO C99.  In C23 mode
2577 (@option{-std=c23} or @option{-std=gnu23}), this switch only affects
2578 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2579 ISO C23.
2581 @opindex fno-builtin
2582 @opindex fbuiltin
2583 @cindex built-in functions
2584 @item -fno-builtin
2585 @itemx -fno-builtin-@var{function}
2586 Don't recognize built-in functions that do not begin with
2587 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2588 functions provided by GCC}, for details of the functions affected,
2589 including those which are not built-in functions when @option{-ansi} or
2590 @option{-std} options for strict ISO C conformance are used because they
2591 do not have an ISO standard meaning.
2593 GCC normally generates special code to handle certain built-in functions
2594 more efficiently; for instance, calls to @code{alloca} may become single
2595 instructions which adjust the stack directly, and calls to @code{memcpy}
2596 may become inline copy loops.  The resulting code is often both smaller
2597 and faster, but since the function calls no longer appear as such, you
2598 cannot set a breakpoint on those calls, nor can you change the behavior
2599 of the functions by linking with a different library.  In addition,
2600 when a function is recognized as a built-in function, GCC may use
2601 information about that function to warn about problems with calls to
2602 that function, or to generate more efficient code, even if the
2603 resulting code still contains calls to that function.  For example,
2604 warnings are given with @option{-Wformat} for bad calls to
2605 @code{printf} when @code{printf} is built in and @code{strlen} is
2606 known not to modify global memory.
2608 With the @option{-fno-builtin-@var{function}} option
2609 only the built-in function @var{function} is
2610 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2611 function is named that is not built-in in this version of GCC, this
2612 option is ignored.  There is no corresponding
2613 @option{-fbuiltin-@var{function}} option; if you wish to enable
2614 built-in functions selectively when using @option{-fno-builtin} or
2615 @option{-ffreestanding}, you may define macros such as:
2617 @smallexample
2618 #define abs(n)          __builtin_abs ((n))
2619 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2620 @end smallexample
2622 @opindex fcond-mismatch
2623 @item -fcond-mismatch
2624 Allow conditional expressions with mismatched types in the second and
2625 third arguments.  The value of such an expression is void.  This option
2626 is not supported for C++.
2628 @opindex ffreestanding
2629 @cindex hosted environment
2630 @item -ffreestanding
2632 Assert that compilation targets a freestanding environment.  This
2633 implies @option{-fno-builtin}.  A freestanding environment
2634 is one in which the standard library may not exist, and program startup may
2635 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2636 This is equivalent to @option{-fno-hosted}.
2638 @xref{Standards,,Language Standards Supported by GCC}, for details of
2639 freestanding and hosted environments.
2641 @opindex fgimple
2642 @item -fgimple
2644 Enable parsing of function definitions marked with @code{__GIMPLE}.
2645 This is an experimental feature that allows unit testing of GIMPLE
2646 passes.
2648 @opindex fgnu-tm
2649 @item -fgnu-tm
2650 When the option @option{-fgnu-tm} is specified, the compiler
2651 generates code for the Linux variant of Intel's current Transactional
2652 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2653 an experimental feature whose interface may change in future versions
2654 of GCC, as the official specification changes.  Please note that not
2655 all architectures are supported for this feature.
2657 For more information on GCC's support for transactional memory,
2658 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2659 Transactional Memory Library}.
2661 Note that the transactional memory feature is not supported with
2662 non-call exceptions (@option{-fnon-call-exceptions}).
2664 @opindex fgnu89-inline
2665 @item -fgnu89-inline
2666 The option @option{-fgnu89-inline} tells GCC to use the traditional
2667 GNU semantics for @code{inline} functions when in C99 mode.
2668 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2669 Using this option is roughly equivalent to adding the
2670 @code{gnu_inline} function attribute to all inline functions
2671 (@pxref{Function Attributes}).
2673 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2674 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2675 specifies the default behavior).
2676 This option is not supported in @option{-std=c90} or
2677 @option{-std=gnu90} mode.
2679 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2680 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2681 in effect for @code{inline} functions.  @xref{Common Predefined
2682 Macros,,,cpp,The C Preprocessor}.
2684 @opindex fhosted
2685 @cindex hosted environment
2686 @item -fhosted
2688 Assert that compilation targets a hosted environment.  This implies
2689 @option{-fbuiltin}.  A hosted environment is one in which the
2690 entire standard library is available, and in which @code{main} has a return
2691 type of @code{int}.  Examples are nearly everything except a kernel.
2692 This is equivalent to @option{-fno-freestanding}.
2694 @opindex flax-vector-conversions
2695 @item -flax-vector-conversions
2696 Allow implicit conversions between vectors with differing numbers of
2697 elements and/or incompatible element types.  This option should not be
2698 used for new code.
2700 @opindex fms-extensions
2701 @item -fms-extensions
2702 Accept some non-standard constructs used in Microsoft header files.
2704 In C++ code, this allows member names in structures to be similar
2705 to previous types declarations.
2707 @smallexample
2708 typedef int UOW;
2709 struct ABC @{
2710   UOW UOW;
2712 @end smallexample
2714 Some cases of unnamed fields in structures and unions are only
2715 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2716 fields within structs/unions}, for details.
2718 Note that this option is off for all targets except for x86
2719 targets using ms-abi.
2721 @opindex foffload
2722 @cindex Offloading targets
2723 @cindex OpenACC offloading targets
2724 @cindex OpenMP offloading targets
2725 @item -foffload=disable
2726 @itemx -foffload=default
2727 @itemx -foffload=@var{target-list}
2728 Specify for which OpenMP and OpenACC offload targets code should be generated.
2729 The default behavior, equivalent to @option{-foffload=default}, is to generate
2730 code for all supported offload targets.  The @option{-foffload=disable} form
2731 generates code only for the host fallback, while
2732 @option{-foffload=@var{target-list}} generates code only for the specified
2733 comma-separated list of offload targets.
2735 Offload targets are specified in GCC's internal target-triplet format. You can
2736 run the compiler with @option{-v} to show the list of configured offload targets
2737 under @code{OFFLOAD_TARGET_NAMES}.
2739 @opindex foffload-options
2740 @cindex Offloading options
2741 @cindex OpenACC offloading options
2742 @cindex OpenMP offloading options
2743 @item -foffload-options=@var{options}
2744 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2746 With @option{-foffload-options=@var{options}}, GCC passes the specified
2747 @var{options} to the compilers for all enabled offloading targets.  You can
2748 specify options that apply only to a specific target or targets by using
2749 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2750 @var{target-list} is a comma-separated list in the same format as for the
2751 @option{-foffload=} option.
2753 Typical command lines are
2755 @smallexample
2756 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2757 -foffload-options=amdgcn-amdhsa=-march=gfx906
2758 @end smallexample
2760 @opindex fopenacc
2761 @cindex OpenACC accelerator programming
2762 @item -fopenacc
2763 Enable handling of OpenACC directives @samp{#pragma acc} in C/C++ and
2764 @samp{!$acc} in free-form Fortran and @samp{!$acc}, @samp{c$acc} and
2765 @samp{*$acc} in fixed-form Fortran.  When @option{-fopenacc} is specified,
2766 the compiler generates accelerated code according to the OpenACC Application
2767 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2768 implies @option{-pthread}, and thus is only supported on targets that
2769 have support for @option{-pthread}.
2771 @opindex fopenacc-dim
2772 @cindex OpenACC accelerator programming
2773 @item -fopenacc-dim=@var{geom}
2774 Specify default compute dimensions for parallel offload regions that do
2775 not explicitly specify.  The @var{geom} value is a triple of
2776 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2777 can be omitted, to use a target-specific default value.
2779 @opindex fopenmp
2780 @cindex OpenMP parallel
2781 @item -fopenmp
2782 Enable handling of OpenMP directives @samp{#pragma omp},
2783 @samp{[[omp::directive(...)]]}, @samp{[[omp::sequence(...)]]} and
2784 @samp{[[omp::decl(...)]]} in C/C++ and @samp{!$omp} in Fortran.  It
2785 additionally enables the conditional compilation sentinel @samp{!$} in
2786 Fortran.  In fixed source form Fortran, the sentinels can also start with
2787 @samp{c} or @samp{*}.  When @option{-fopenmp} is specified, the
2788 compiler generates parallel code according to the OpenMP Application
2789 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2790 implies @option{-pthread}, and thus is only supported on targets that
2791 have support for @option{-pthread}. @option{-fopenmp} implies
2792 @option{-fopenmp-simd}.
2794 @opindex fopenmp-simd
2795 @cindex OpenMP SIMD
2796 @cindex SIMD
2797 @item -fopenmp-simd
2798 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2799 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan}
2800 and @code{loop} directive, and of combined or composite directives with
2801 @code{simd} as constituent with @code{#pragma omp},
2802 @code{[[omp::directive(...)]]}, @code{[[omp::sequence(...)]]} and
2803 @code{[[omp::decl(...)]]} in C/C++ and @code{!$omp} in Fortran.  It
2804 additionally enables the conditional compilation sentinel @samp{!$} in
2805 Fortran.  In fixed source form Fortran, the sentinels can also start with
2806 @samp{c} or @samp{*}.  Other OpenMP directives are ignored.  Unless
2807 @option{-fopenmp} is additionally specified, the @code{loop} region binds
2808 to the current task region, independent of the specified @code{bind} clause.
2810 @opindex fopenmp-target-simd-clone
2811 @cindex OpenMP target SIMD clone
2812 @item -fopenmp-target-simd-clone
2813 @item -fopenmp-target-simd-clone=@var{device-type}
2814 In addition to generating SIMD clones for functions marked with the
2815 @code{declare simd} directive, GCC also generates clones
2816 for functions marked with the OpenMP @code{declare target} directive
2817 that are suitable for vectorization when this option is in effect.  The
2818 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2819 and @code{any}, which correspond to keywords for the @code{device_type}
2820 clause of the @code{declare target} directive; clones are generated for
2821 the intersection of devices specified.
2822 @option{-fopenmp-target-simd-clone} is equivalent to
2823 @option{-fopenmp-target-simd-clone=any} and
2824 @option{-fno-openmp-target-simd-clone} is equivalent to
2825 @option{-fopenmp-target-simd-clone=none}.
2827 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2828 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2829 it is disabled by default.
2831 @opindex fpermitted-flt-eval-methods
2832 @opindex fpermitted-flt-eval-methods=c11
2833 @opindex fpermitted-flt-eval-methods=ts-18661-3
2834 @item -fpermitted-flt-eval-methods=@var{style}
2835 ISO/IEC TS 18661-3 defines new permissible values for
2836 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2837 a semantic type that is an interchange or extended format should be
2838 evaluated to the precision and range of that type.  These new values are
2839 a superset of those permitted under C99/C11, which does not specify the
2840 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2841 conforming to C11 may not have been written expecting the possibility of
2842 the new values.
2844 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2845 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2846 or the extended set of values specified in ISO/IEC TS 18661-3.
2848 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2850 The default when in a standards compliant mode (@option{-std=c11} or similar)
2851 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2852 dialect (@option{-std=gnu11} or similar) is
2853 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2855 @opindex fdeps-
2856 The @samp{-fdeps-*} options are used to extract structured dependency
2857 information for a source.  This involves determining what resources provided by
2858 other source files will be required to compile the source as well as what
2859 resources are provided by the source.  This information can be used to add
2860 required dependencies between compilation rules of dependent sources based on
2861 their contents rather than requiring such information be reflected within the
2862 build tools as well.
2864 @opindex fdeps-file
2865 @item -fdeps-file=@var{file}
2866 Where to write structured dependency information.
2868 @opindex fdeps-format
2869 @item -fdeps-format=@var{format}
2870 The format to use for structured dependency information. @samp{p1689r5} is the
2871 only supported format right now.  Note that when this argument is specified, the
2872 output of @samp{-MF} is stripped of some information (namely C++ modules) so
2873 that it does not use extended makefile syntax not understood by most tools.
2875 @opindex fdeps-target
2876 @item -fdeps-target=@var{file}
2877 Analogous to @option{-MT} but for structured dependency information.  This
2878 indicates the target which will ultimately need any required resources and
2879 provide any resources extracted from the source that may be required by other
2880 sources.
2882 @opindex fplan9-extensions
2883 @item -fplan9-extensions
2884 Accept some non-standard constructs used in Plan 9 code.
2886 This enables @option{-fms-extensions}, permits passing pointers to
2887 structures with anonymous fields to functions that expect pointers to
2888 elements of the type of the field, and permits referring to anonymous
2889 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2890 struct/union fields within structs/unions}, for details.  This is only
2891 supported for C, not C++.
2893 @opindex fsigned-bitfields
2894 @opindex funsigned-bitfields
2895 @opindex fno-signed-bitfields
2896 @opindex fno-unsigned-bitfields
2897 @item -fsigned-bitfields
2898 @itemx -funsigned-bitfields
2899 @itemx -fno-signed-bitfields
2900 @itemx -fno-unsigned-bitfields
2901 These options control whether a bit-field is signed or unsigned, when the
2902 declaration does not use either @code{signed} or @code{unsigned}.  By
2903 default, such a bit-field is signed, because this is consistent: the
2904 basic integer types such as @code{int} are signed types.
2906 @opindex fsigned-char
2907 @item -fsigned-char
2908 Let the type @code{char} be signed, like @code{signed char}.
2910 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2911 the negative form of @option{-funsigned-char}.  Likewise, the option
2912 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2914 @opindex funsigned-char
2915 @item -funsigned-char
2916 Let the type @code{char} be unsigned, like @code{unsigned char}.
2918 Each kind of machine has a default for what @code{char} should
2919 be.  It is either like @code{unsigned char} by default or like
2920 @code{signed char} by default.
2922 Ideally, a portable program should always use @code{signed char} or
2923 @code{unsigned char} when it depends on the signedness of an object.
2924 But many programs have been written to use plain @code{char} and
2925 expect it to be signed, or expect it to be unsigned, depending on the
2926 machines they were written for.  This option, and its inverse, let you
2927 make such a program work with the opposite default.
2929 The type @code{char} is always a distinct type from each of
2930 @code{signed char} or @code{unsigned char}, even though its behavior
2931 is always just like one of those two.
2933 @opindex fstrict-flex-arrays
2934 @opindex fno-strict-flex-arrays
2935 @item -fstrict-flex-arrays
2936 Control when to treat the trailing array of a structure as a flexible array
2937 member for the purpose of accessing the elements of such an array.
2938 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2939 strictest.  A trailing array is treated as a flexible array member only when it
2940 is declared as a flexible array member per C99 standard onwards.
2941 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2942 least strict.  All trailing arrays of structures are treated as flexible array
2943 members.
2945 @opindex fstrict-flex-arrays=@var{level}
2946 @item -fstrict-flex-arrays=@var{level}
2947 Control when to treat the trailing array of a structure as a flexible array
2948 member for the purpose of accessing the elements of such an array.  The value
2949 of @var{level} controls the level of strictness.
2951 The possible values of @var{level} are the same as for the
2952 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2954 You can control this behavior for a specific trailing array field of a
2955 structure by using the variable attribute @code{strict_flex_array} attribute
2956 (@pxref{Variable Attributes}).
2958 @opindex fsso-struct
2959 @item -fsso-struct=@var{endianness}
2960 Set the default scalar storage order of structures and unions to the
2961 specified endianness.  The accepted values are @samp{big-endian},
2962 @samp{little-endian} and @samp{native} for the native endianness of
2963 the target (the default).  This option is not supported for C++.
2965 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2966 code that is not binary compatible with code generated without it if the
2967 specified endianness is not the native endianness of the target.
2968 @end table
2970 @node C++ Dialect Options
2971 @section Options Controlling C++ Dialect
2973 @cindex compiler options, C++
2974 @cindex C++ options, command-line
2975 @cindex options, C++
2976 This section describes the command-line options that are only meaningful
2977 for C++ programs.  You can also use most of the GNU compiler options
2978 regardless of what language your program is in.  For example, you
2979 might compile a file @file{firstClass.C} like this:
2981 @smallexample
2982 g++ -g -fstrict-enums -O -c firstClass.C
2983 @end smallexample
2985 @noindent
2986 In this example, only @option{-fstrict-enums} is an option meant
2987 only for C++ programs; you can use the other options with any
2988 language supported by GCC@.
2990 Some options for compiling C programs, such as @option{-std}, are also
2991 relevant for C++ programs.
2992 @xref{C Dialect Options,,Options Controlling C Dialect}.
2994 Here is a list of options that are @emph{only} for compiling C++ programs:
2996 @table @gcctabopt
2998 @opindex fabi-version
2999 @item -fabi-version=@var{n}
3000 Use version @var{n} of the C++ ABI@.  The default is version 0.
3002 Version 0 refers to the version conforming most closely to
3003 the C++ ABI specification.  Therefore, the ABI obtained using version 0
3004 will change in different versions of G++ as ABI bugs are fixed.
3006 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
3008 Version 2 is the version of the C++ ABI that first appeared in G++
3009 3.4, and was the default through G++ 4.9.
3011 Version 3 corrects an error in mangling a constant address as a
3012 template argument.
3014 Version 4, which first appeared in G++ 4.5, implements a standard
3015 mangling for vector types.
3017 Version 5, which first appeared in G++ 4.6, corrects the mangling of
3018 attribute const/volatile on function pointer types, decltype of a
3019 plain decl, and use of a function parameter in the declaration of
3020 another parameter.
3022 Version 6, which first appeared in G++ 4.7, corrects the promotion
3023 behavior of C++11 scoped enums and the mangling of template argument
3024 packs, const/static_cast, prefix ++ and --, and a class scope function
3025 used as a template argument.
3027 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
3028 builtin type and corrects the mangling of lambdas in default argument
3029 scope.
3031 Version 8, which first appeared in G++ 4.9, corrects the substitution
3032 behavior of function types with function-cv-qualifiers.
3034 Version 9, which first appeared in G++ 5.2, corrects the alignment of
3035 @code{nullptr_t}.
3037 Version 10, which first appeared in G++ 6.1, adds mangling of
3038 attributes that affect type identity, such as ia32 calling convention
3039 attributes (e.g.@: @samp{stdcall}).
3041 Version 11, which first appeared in G++ 7, corrects the mangling of
3042 sizeof... expressions and operator names.  For multiple entities with
3043 the same name within a function, that are declared in different scopes,
3044 the mangling now changes starting with the twelfth occurrence.  It also
3045 implies @option{-fnew-inheriting-ctors}.
3047 Version 12, which first appeared in G++ 8, corrects the calling
3048 conventions for empty classes on the x86_64 target and for classes
3049 with only deleted copy/move constructors.  It accidentally changes the
3050 calling convention for classes with a deleted copy constructor and a
3051 trivial move constructor.
3053 Version 13, which first appeared in G++ 8.2, fixes the accidental
3054 change in version 12.
3056 Version 14, which first appeared in G++ 10, corrects the mangling of
3057 the nullptr expression.
3059 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3060 tag regression.
3062 Version 16, which first appeared in G++ 11, changes the mangling of
3063 @code{__alignof__} to be distinct from that of @code{alignof}, and
3064 dependent operator names.
3066 Version 17, which first appeared in G++ 12, fixes layout of classes
3067 that inherit from aggregate classes with default member initializers
3068 in C++14 and up.
3070 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3071 that have additional context.
3073 Version 19, which first appeard in G++ 14, fixes manglings of structured
3074 bindings to include ABI tags.
3076 See also @option{-Wabi}.
3078 @opindex fabi-compat-version
3079 @item -fabi-compat-version=@var{n}
3080 On targets that support strong aliases, G++
3081 works around mangling changes by creating an alias with the correct
3082 mangled name when defining a symbol with an incorrect mangled name.
3083 This switch specifies which ABI version to use for the alias.
3085 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3086 compatibility).  If another ABI version is explicitly selected, this
3087 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3088 use @option{-fabi-compat-version=2}.
3090 If this option is not provided but @option{-Wabi=@var{n}} is, that
3091 version is used for compatibility aliases.  If this option is provided
3092 along with @option{-Wabi} (without the version), the version from this
3093 option is used for the warning.
3095 @opindex fno-access-control
3096 @opindex faccess-control
3097 @item -fno-access-control
3098 Turn off all access checking.  This switch is mainly useful for working
3099 around bugs in the access control code.
3101 @opindex faligned-new
3102 @item -faligned-new
3103 Enable support for C++17 @code{new} of types that require more
3104 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3105 numeric argument such as @code{-faligned-new=32} can be used to
3106 specify how much alignment (in bytes) is provided by that function,
3107 but few users will need to override the default of
3108 @code{alignof(std::max_align_t)}.
3110 This flag is enabled by default for @option{-std=c++17}.
3112 @opindex fchar8_t
3113 @opindex fno-char8_t
3114 @item -fchar8_t
3115 @itemx -fno-char8_t
3116 Enable support for @code{char8_t} as adopted for C++20.  This includes
3117 the addition of a new @code{char8_t} fundamental type, changes to the
3118 types of UTF-8 string and character literals, new signatures for
3119 user-defined literals, associated standard library updates, and new
3120 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3122 This option enables functions to be overloaded for ordinary and UTF-8
3123 strings:
3125 @smallexample
3126 int f(const char *);    // #1
3127 int f(const char8_t *); // #2
3128 int v1 = f("text");     // Calls #1
3129 int v2 = f(u8"text");   // Calls #2
3130 @end smallexample
3132 @noindent
3133 and introduces new signatures for user-defined literals:
3135 @smallexample
3136 int operator""_udl1(char8_t);
3137 int v3 = u8'x'_udl1;
3138 int operator""_udl2(const char8_t*, std::size_t);
3139 int v4 = u8"text"_udl2;
3140 template<typename T, T...> int operator""_udl3();
3141 int v5 = u8"text"_udl3;
3142 @end smallexample
3144 @noindent
3145 The change to the types of UTF-8 string and character literals introduces
3146 incompatibilities with ISO C++11 and later standards.  For example, the
3147 following code is well-formed under ISO C++11, but is ill-formed when
3148 @option{-fchar8_t} is specified.
3150 @smallexample
3151 const char *cp = u8"xx";// error: invalid conversion from
3152                         //        `const char8_t*' to `const char*'
3153 int f(const char*);
3154 auto v = f(u8"xx");     // error: invalid conversion from
3155                         //        `const char8_t*' to `const char*'
3156 std::string s@{u8"xx"@};  // error: no matching function for call to
3157                         //        `std::basic_string<char>::basic_string()'
3158 using namespace std::literals;
3159 s = u8"xx"s;            // error: conversion from
3160                         //        `basic_string<char8_t>' to non-scalar
3161                         //        type `basic_string<char>' requested
3162 @end smallexample
3164 @opindex fcheck-new
3165 @item -fcheck-new
3166 Check that the pointer returned by @code{operator new} is non-null
3167 before attempting to modify the storage allocated.  This check is
3168 normally unnecessary because the C++ standard specifies that
3169 @code{operator new} only returns @code{0} if it is declared
3170 @code{throw()}, in which case the compiler always checks the
3171 return value even without this option.  In all other cases, when
3172 @code{operator new} has a non-empty exception specification, memory
3173 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3174 @samp{new (nothrow)}.
3176 @opindex fconcepts
3177 @opindex fconcepts-ts
3178 @item -fconcepts
3179 @itemx -fconcepts-ts
3180 Enable support for the C++ Concepts feature for constraining template
3181 arguments.  With @option{-std=c++20} and above, Concepts are part of
3182 the language standard, so @option{-fconcepts} defaults to on.
3184 Some constructs that were allowed by the earlier C++ Extensions for
3185 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3186 into the standard, can additionally be enabled by
3187 @option{-fconcepts-ts}.
3189 @opindex fconstexpr-depth
3190 @item -fconstexpr-depth=@var{n}
3191 Set the maximum nested evaluation depth for C++11 constexpr functions
3192 to @var{n}.  A limit is needed to detect endless recursion during
3193 constant expression evaluation.  The minimum specified by the standard
3194 is 512.
3196 @opindex fconstexpr-cache-depth
3197 @item -fconstexpr-cache-depth=@var{n}
3198 Set the maximum level of nested evaluation depth for C++11 constexpr
3199 functions that will be cached to @var{n}.  This is a heuristic that
3200 trades off compilation speed (when the cache avoids repeated
3201 calculations) against memory consumption (when the cache grows very
3202 large from highly recursive evaluations).  The default is 8.  Very few
3203 users are likely to want to adjust it, but if your code does heavy
3204 constexpr calculations you might want to experiment to find which
3205 value works best for you.
3207 @opindex fconstexpr-fp-except
3208 @item -fconstexpr-fp-except
3209 Annex F of the C standard specifies that IEC559 floating point
3210 exceptions encountered at compile time should not stop compilation.
3211 C++ compilers have historically not followed this guidance, instead
3212 treating floating point division by zero as non-constant even though
3213 it has a well defined value.  This flag tells the compiler to give
3214 Annex F priority over other rules saying that a particular operation
3215 is undefined.
3217 @smallexample
3218 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3219 @end smallexample
3221 @opindex fconstexpr-loop-limit
3222 @item -fconstexpr-loop-limit=@var{n}
3223 Set the maximum number of iterations for a loop in C++14 constexpr functions
3224 to @var{n}.  A limit is needed to detect infinite loops during
3225 constant expression evaluation.  The default is 262144 (1<<18).
3227 @opindex fconstexpr-ops-limit
3228 @item -fconstexpr-ops-limit=@var{n}
3229 Set the maximum number of operations during a single constexpr evaluation.
3230 Even when number of iterations of a single loop is limited with the above limit,
3231 if there are several nested loops and each of them has many iterations but still
3232 smaller than the above limit, or if in a body of some loop or even outside
3233 of a loop too many expressions need to be evaluated, the resulting constexpr
3234 evaluation might take too long.
3235 The default is 33554432 (1<<25).
3237 @opindex fcontracts
3238 @item -fcontracts
3239 Enable experimental support for the C++ Contracts feature, as briefly
3240 added to and then removed from the C++20 working paper (N4820).  The
3241 implementation also includes proposed enhancements from papers P1290,
3242 P1332, and P1429.  This functionality is intended mostly for those
3243 interested in experimentation towards refining the feature to get it
3244 into shape for a future C++ standard.
3246 On violation of a checked contract, the violation handler is called.
3247 Users can replace the violation handler by defining
3248 @smallexample
3249 void
3250 handle_contract_violation (const std::experimental::contract_violation&);
3251 @end smallexample
3253 There are different sets of additional flags that can be used together
3254 to specify which contracts will be checked and how, for N4820
3255 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3256 used together.
3258 @table @gcctabopt
3259 @opindex fcontract-mode
3260 @item -fcontract-mode=[on|off]
3261 Control whether any contracts have any semantics at all.  Defaults to on.
3263 @opindex fcontract-assumption-mode
3264 @item -fcontract-assumption-mode=[on|off]
3265 [N4820] Control whether contracts with level @samp{axiom}
3266 should have the assume semantic.  Defaults to on.
3268 @opindex fcontract-build-level
3269 @item -fcontract-build-level=[off|default|audit]
3270 [N4820] Specify which level of contracts to generate checks
3271 for.  Defaults to @samp{default}.
3273 @opindex fcontract-continuation-mode
3274 @item -fcontract-continuation-mode=[on|off]
3275 [N4820] Control whether to allow the program to continue executing
3276 after a contract violation.  That is, do checked contracts have the
3277 @samp{maybe} semantic described below rather than the @samp{never}
3278 semantic.  Defaults to off.
3280 @opindex fcontract-role
3281 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3282 [P1332] Specify the concrete semantics for each contract level
3283 of a particular contract role.
3285 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3286 [P1429] Specify the concrete semantic for a particular
3287 contract level.
3289 @opindex fcontract-strict-declarations
3290 @item -fcontract-strict-declarations=[on|off]
3291 Control whether to reject adding contracts to a function after its
3292 first declaration.  Defaults to off.
3293 @end table
3295 The possible concrete semantics for that can be specified with
3296 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3298 @table @code
3299 @item ignore
3300 This contract has no effect.
3302 @item assume
3303 This contract is treated like C++23 @code{[[assume]]}.
3305 @item check_never_continue
3306 @itemx never
3307 @itemx abort
3308 This contract is checked.  If it fails, the violation handler is
3309 called.  If the handler returns, @code{std::terminate} is called.
3311 @item check_maybe_continue
3312 @itemx maybe
3313 This contract is checked.  If it fails, the violation handler is
3314 called.  If the handler returns, execution continues normally.
3315 @end table
3317 @opindex fcoroutines
3318 @item -fcoroutines
3319 Enable support for the C++ coroutines extension (experimental).
3321 @opindex fno-elide-constructors
3322 @opindex felide-constructors
3323 @item -fno-elide-constructors
3324 The C++ standard allows an implementation to omit creating a temporary
3325 that is only used to initialize another object of the same type.
3326 Specifying this option disables that optimization, and forces G++ to
3327 call the copy constructor in all cases.  This option also causes G++
3328 to call trivial member functions which otherwise would be expanded inline.
3330 In C++17, the compiler is required to omit these temporaries, but this
3331 option still affects trivial member functions.
3333 @opindex fno-enforce-eh-specs
3334 @opindex fenforce-eh-specs
3335 @item -fno-enforce-eh-specs
3336 Don't generate code to check for violation of exception specifications
3337 at run time.  This option violates the C++ standard, but may be useful
3338 for reducing code size in production builds, much like defining
3339 @code{NDEBUG}.  This does not give user code permission to throw
3340 exceptions in violation of the exception specifications; the compiler
3341 still optimizes based on the specifications, so throwing an
3342 unexpected exception results in undefined behavior at run time.
3344 @opindex fextern-tls-init
3345 @opindex fno-extern-tls-init
3346 @item -fextern-tls-init
3347 @itemx -fno-extern-tls-init
3348 The C++11 and OpenMP standards allow @code{thread_local} and
3349 @code{threadprivate} variables to have dynamic (runtime)
3350 initialization.  To support this, any use of such a variable goes
3351 through a wrapper function that performs any necessary initialization.
3352 When the use and definition of the variable are in the same
3353 translation unit, this overhead can be optimized away, but when the
3354 use is in a different translation unit there is significant overhead
3355 even if the variable doesn't actually need dynamic initialization.  If
3356 the programmer can be sure that no use of the variable in a
3357 non-defining TU needs to trigger dynamic initialization (either
3358 because the variable is statically initialized, or a use of the
3359 variable in the defining TU will be executed before any uses in
3360 another TU), they can avoid this overhead with the
3361 @option{-fno-extern-tls-init} option.
3363 On targets that support symbol aliases, the default is
3364 @option{-fextern-tls-init}.  On targets that do not support symbol
3365 aliases, the default is @option{-fno-extern-tls-init}.
3367 @opindex ffold-simple-inlines
3368 @opindex fno-fold-simple-inlines
3369 @item -ffold-simple-inlines
3370 @itemx -fno-fold-simple-inlines
3371 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3372 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3373 means no debug information will be generated for such calls.  Since these
3374 functions are rarely interesting to debug, this flag is enabled by default
3375 unless @option{-fno-inline} is active.
3377 @opindex fno-gnu-keywords
3378 @opindex fgnu-keywords
3379 @item -fno-gnu-keywords
3380 Do not recognize @code{typeof} as a keyword, so that code can use this
3381 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3382 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3383 @option{-std=c++98}, @option{-std=c++11}, etc.
3385 @opindex fimplicit-constexpr
3386 @item -fimplicit-constexpr
3387 Make inline functions implicitly constexpr, if they satisfy the
3388 requirements for a constexpr function.  This option can be used in
3389 C++14 mode or later.  This can result in initialization changing from
3390 dynamic to static and other optimizations.
3392 @opindex fno-implicit-templates
3393 @opindex fimplicit-templates
3394 @item -fno-implicit-templates
3395 Never emit code for non-inline templates that are instantiated
3396 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3397 If you use this option, you must take care to structure your code to
3398 include all the necessary explicit instantiations to avoid getting
3399 undefined symbols at link time.
3400 @xref{Template Instantiation}, for more information.
3402 @opindex fno-implicit-inline-templates
3403 @opindex fimplicit-inline-templates
3404 @item -fno-implicit-inline-templates
3405 Don't emit code for implicit instantiations of inline templates, either.
3406 The default is to handle inlines differently so that compiles with and
3407 without optimization need the same set of explicit instantiations.
3409 @opindex fno-implement-inlines
3410 @opindex fimplement-inlines
3411 @item -fno-implement-inlines
3412 To save space, do not emit out-of-line copies of inline functions
3413 controlled by @code{#pragma implementation}.  This causes linker
3414 errors if these functions are not inlined everywhere they are called.
3416 @opindex fmodules-ts
3417 @opindex fno-modules-ts
3418 @item -fmodules-ts
3419 @itemx -fno-modules-ts
3420 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3421 @option{-fno-modules-ts} is usually not needed, as that is the
3422 default.  Even though this is a C++20 feature, it is not currently
3423 implicitly enabled by selecting that standard version.
3425 @opindex fmodule-header
3426 @item -fmodule-header
3427 @itemx -fmodule-header=user
3428 @itemx -fmodule-header=system
3429 Compile a header file to create an importable header unit.
3431 @opindex fmodule-implicit-inline
3432 @item -fmodule-implicit-inline
3433 Member functions defined in their class definitions are not implicitly
3434 inline for modular code.  This is different to traditional C++
3435 behavior, for good reasons.  However, it may result in a difficulty
3436 during code porting.  This option makes such function definitions
3437 implicitly inline.  It does however generate an ABI incompatibility,
3438 so you must use it everywhere or nowhere.  (Such definitions outside
3439 of a named module remain implicitly inline, regardless.)
3441 @opindex fno-module-lazy
3442 @opindex fmodule-lazy
3443 @item -fno-module-lazy
3444 Disable lazy module importing and module mapper creation.
3446 @vindex CXX_MODULE_MAPPER @r{environment variable}
3447 @opindex fmodule-mapper
3448 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3449 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3450 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3451 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3452 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3453 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3454 An oracle to query for module name to filename mappings.  If
3455 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3456 and if that is unset, an in-process default is provided.
3458 @opindex fmodule-only
3459 @item -fmodule-only
3460 Only emit the Compiled Module Interface, inhibiting any object file.
3462 @opindex fms-extensions
3463 @item -fms-extensions
3464 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3465 int and getting a pointer to member function via non-standard syntax.
3467 @opindex fnew-inheriting-ctors
3468 @item -fnew-inheriting-ctors
3469 Enable the P0136 adjustment to the semantics of C++11 constructor
3470 inheritance.  This is part of C++17 but also considered to be a Defect
3471 Report against C++11 and C++14.  This flag is enabled by default
3472 unless @option{-fabi-version=10} or lower is specified.
3474 @opindex fnew-ttp-matching
3475 @item -fnew-ttp-matching
3476 Enable the P0522 resolution to Core issue 150, template template
3477 parameters and default arguments: this allows a template with default
3478 template arguments as an argument for a template template parameter
3479 with fewer template parameters.  This flag is enabled by default for
3480 @option{-std=c++17}.
3482 @opindex fno-nonansi-builtins
3483 @opindex fnonansi-builtins
3484 @item -fno-nonansi-builtins
3485 Disable built-in declarations of functions that are not mandated by
3486 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3487 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3489 @opindex fnothrow-opt
3490 @item -fnothrow-opt
3491 Treat a @code{throw()} exception specification as if it were a
3492 @code{noexcept} specification to reduce or eliminate the text size
3493 overhead relative to a function with no exception specification.  If
3494 the function has local variables of types with non-trivial
3495 destructors, the exception specification actually makes the
3496 function smaller because the EH cleanups for those variables can be
3497 optimized away.  The semantic effect is that an exception thrown out of
3498 a function with such an exception specification results in a call
3499 to @code{terminate} rather than @code{unexpected}.
3501 @opindex fno-operator-names
3502 @opindex foperator-names
3503 @item -fno-operator-names
3504 Do not treat the operator name keywords @code{and}, @code{bitand},
3505 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3506 synonyms as keywords.
3508 @opindex fno-optional-diags
3509 @opindex foptional-diags
3510 @item -fno-optional-diags
3511 Disable diagnostics that the standard says a compiler does not need to
3512 issue.  Currently, the only such diagnostic issued by G++ is the one for
3513 a name having multiple meanings within a class.
3515 @opindex fno-pretty-templates
3516 @opindex fpretty-templates
3517 @item -fno-pretty-templates
3518 When an error message refers to a specialization of a function
3519 template, the compiler normally prints the signature of the
3520 template followed by the template arguments and any typedefs or
3521 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3522 rather than @code{void f(int)}) so that it's clear which template is
3523 involved.  When an error message refers to a specialization of a class
3524 template, the compiler omits any template arguments that match
3525 the default template arguments for that template.  If either of these
3526 behaviors make it harder to understand the error message rather than
3527 easier, you can use @option{-fno-pretty-templates} to disable them.
3529 @opindex fno-rtti
3530 @opindex frtti
3531 @item -fno-rtti
3532 Disable generation of information about every class with virtual
3533 functions for use by the C++ run-time type identification features
3534 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3535 of the language, you can save some space by using this flag.  Note that
3536 exception handling uses the same information, but G++ generates it as
3537 needed. The @code{dynamic_cast} operator can still be used for casts that
3538 do not require run-time type information, i.e.@: casts to @code{void *} or to
3539 unambiguous base classes.
3541 Mixing code compiled with @option{-frtti} with that compiled with
3542 @option{-fno-rtti} may not work.  For example, programs may
3543 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3544 for a class compiled with @option{-frtti}.  
3546 @opindex fsized-deallocation
3547 @item -fsized-deallocation
3548 Enable the built-in global declarations
3549 @smallexample
3550 void operator delete (void *, std::size_t) noexcept;
3551 void operator delete[] (void *, std::size_t) noexcept;
3552 @end smallexample
3553 as introduced in C++14.  This is useful for user-defined replacement
3554 deallocation functions that, for example, use the size of the object
3555 to make deallocation faster.  Enabled by default under
3556 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3557 warns about places that might want to add a definition.
3559 @opindex fstrict-enums
3560 @item -fstrict-enums
3561 Allow the compiler to optimize using the assumption that a value of
3562 enumerated type can only be one of the values of the enumeration (as
3563 defined in the C++ standard; basically, a value that can be
3564 represented in the minimum number of bits needed to represent all the
3565 enumerators).  This assumption may not be valid if the program uses a
3566 cast to convert an arbitrary integer value to the enumerated type.
3567 This option has no effect for an enumeration type with a fixed underlying
3568 type.
3570 @opindex fstrong-eval-order
3571 @item -fstrong-eval-order
3572 Evaluate member access, array subscripting, and shift expressions in
3573 left-to-right order, and evaluate assignment in right-to-left order,
3574 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3575 @option{-fstrong-eval-order=some} enables just the ordering of member
3576 access and shift expressions, and is the default without
3577 @option{-std=c++17}.
3579 @opindex ftemplate-backtrace-limit
3580 @item -ftemplate-backtrace-limit=@var{n}
3581 Set the maximum number of template instantiation notes for a single
3582 warning or error to @var{n}.  The default value is 10.
3584 @opindex ftemplate-depth
3585 @item -ftemplate-depth=@var{n}
3586 Set the maximum instantiation depth for template classes to @var{n}.
3587 A limit on the template instantiation depth is needed to detect
3588 endless recursions during template class instantiation.  ANSI/ISO C++
3589 conforming programs must not rely on a maximum depth greater than 17
3590 (changed to 1024 in C++11).  The default value is 900, as the compiler
3591 can run out of stack space before hitting 1024 in some situations.
3593 @opindex fno-threadsafe-statics
3594 @opindex fthreadsafe-statics
3595 @item -fno-threadsafe-statics
3596 Do not emit the extra code to use the routines specified in the C++
3597 ABI for thread-safe initialization of local statics.  You can use this
3598 option to reduce code size slightly in code that doesn't need to be
3599 thread-safe.
3601 @opindex fuse-cxa-atexit
3602 @item -fuse-cxa-atexit
3603 Register destructors for objects with static storage duration with the
3604 @code{__cxa_atexit} function rather than the @code{atexit} function.
3605 This option is required for fully standards-compliant handling of static
3606 destructors, but only works if your C library supports
3607 @code{__cxa_atexit}.
3609 @opindex fno-use-cxa-get-exception-ptr
3610 @opindex fuse-cxa-get-exception-ptr
3611 @item -fno-use-cxa-get-exception-ptr
3612 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3613 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3614 if the runtime routine is not available.
3616 @opindex fvisibility-inlines-hidden
3617 @item -fvisibility-inlines-hidden
3618 This switch declares that the user does not attempt to compare
3619 pointers to inline functions or methods where the addresses of the two functions
3620 are taken in different shared objects.
3622 The effect of this is that GCC may, effectively, mark inline methods with
3623 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3624 appear in the export table of a DSO and do not require a PLT indirection
3625 when used within the DSO@.  Enabling this option can have a dramatic effect
3626 on load and link times of a DSO as it massively reduces the size of the
3627 dynamic export table when the library makes heavy use of templates.
3629 The behavior of this switch is not quite the same as marking the
3630 methods as hidden directly, because it does not affect static variables
3631 local to the function or cause the compiler to deduce that
3632 the function is defined in only one shared object.
3634 You may mark a method as having a visibility explicitly to negate the
3635 effect of the switch for that method.  For example, if you do want to
3636 compare pointers to a particular inline method, you might mark it as
3637 having default visibility.  Marking the enclosing class with explicit
3638 visibility has no effect.
3640 Explicitly instantiated inline methods are unaffected by this option
3641 as their linkage might otherwise cross a shared library boundary.
3642 @xref{Template Instantiation}.
3644 @opindex fvisibility-ms-compat
3645 @item -fvisibility-ms-compat
3646 This flag attempts to use visibility settings to make GCC's C++
3647 linkage model compatible with that of Microsoft Visual Studio.
3649 The flag makes these changes to GCC's linkage model:
3651 @enumerate
3652 @item
3653 It sets the default visibility to @code{hidden}, like
3654 @option{-fvisibility=hidden}.
3656 @item
3657 Types, but not their members, are not hidden by default.
3659 @item
3660 The One Definition Rule is relaxed for types without explicit
3661 visibility specifications that are defined in more than one
3662 shared object: those declarations are permitted if they are
3663 permitted when this option is not used.
3664 @end enumerate
3666 In new code it is better to use @option{-fvisibility=hidden} and
3667 export those classes that are intended to be externally visible.
3668 Unfortunately it is possible for code to rely, perhaps accidentally,
3669 on the Visual Studio behavior.
3671 Among the consequences of these changes are that static data members
3672 of the same type with the same name but defined in different shared
3673 objects are different, so changing one does not change the other;
3674 and that pointers to function members defined in different shared
3675 objects may not compare equal.  When this flag is given, it is a
3676 violation of the ODR to define types with the same name differently.
3678 @opindex fno-weak
3679 @opindex fweak
3680 @item -fno-weak
3681 Do not use weak symbol support, even if it is provided by the linker.
3682 By default, G++ uses weak symbols if they are available.  This
3683 option exists only for testing, and should not be used by end-users;
3684 it results in inferior code and has no benefits.  This option may
3685 be removed in a future release of G++.
3687 @opindex fext-numeric-literals
3688 @opindex fno-ext-numeric-literals
3689 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3690 Accept imaginary, fixed-point, or machine-defined
3691 literal number suffixes as GNU extensions.
3692 When this option is turned off these suffixes are treated
3693 as C++11 user-defined literal numeric suffixes.
3694 This is on by default for all pre-C++11 dialects and all GNU dialects:
3695 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3696 @option{-std=gnu++14}.
3697 This option is off by default
3698 for ISO C++11 onwards (@option{-std=c++11}, ...).
3700 @opindex nostdinc++
3701 @item -nostdinc++
3702 Do not search for header files in the standard directories specific to
3703 C++, but do still search the other standard directories.  (This option
3704 is used when building the C++ library.)
3706 @opindex flang-info-include-translate
3707 @opindex flang-info-include-translate-not
3708 @item -flang-info-include-translate
3709 @itemx -flang-info-include-translate-not
3710 @itemx -flang-info-include-translate=@var{header}
3711 Inform of include translation events.  The first will note accepted
3712 include translations, the second will note declined include
3713 translations.  The @var{header} form will inform of include
3714 translations relating to that specific header.  If @var{header} is of
3715 the form @code{"user"} or @code{<system>} it will be resolved to a
3716 specific user or system header using the include path.
3718 @opindex flang-info-module-cmi
3719 @item -flang-info-module-cmi
3720 @itemx -flang-info-module-cmi=@var{module}
3721 Inform of Compiled Module Interface pathnames.  The first will note
3722 all read CMI pathnames.  The @var{module} form will not reading a
3723 specific module's CMI.  @var{module} may be a named module or a
3724 header-unit (the latter indicated by either being a pathname containing
3725 directory separators or enclosed in @code{<>} or @code{""}).
3727 @opindex stdlib
3728 @item -stdlib=@var{libstdc++,libc++}
3729 When G++ is configured to support this option, it allows specification of
3730 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3731 (the default, native C++ runtime for G++) and @var{libc++} which is the
3732 C++ runtime installed on some operating systems (e.g. Darwin versions from
3733 Darwin11 onwards).  The option switches G++ to use the headers from the
3734 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3735 when a C++ runtime is required for linking.
3736 @end table
3738 In addition, these warning options have meanings only for C++ programs:
3740 @table @gcctabopt
3741 @opindex Wabi-tag
3742 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3743 Warn when a type with an ABI tag is used in a context that does not
3744 have that ABI tag.  See @ref{C++ Attributes} for more information
3745 about ABI tags.
3747 @opindex Wcomma-subscript
3748 @opindex Wno-comma-subscript
3749 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3750 Warn about uses of a comma expression within a subscripting expression.
3751 This usage was deprecated in C++20 and is going to be removed in C++23.
3752 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3754 @smallexample
3755 @group
3756 void f(int *a, int b, int c) @{
3757     a[b,c];     // deprecated in C++20, invalid in C++23
3758     a[(b,c)];   // OK
3760 @end group
3761 @end smallexample
3763 In C++23 it is valid to have comma separated expressions in a subscript
3764 when an overloaded subscript operator is found and supports the right
3765 number and types of arguments.  G++ will accept the formerly valid syntax
3766 for code that is not valid in C++23 but used to be valid but deprecated
3767 in C++20 with a pedantic warning that can be disabled with
3768 @option{-Wno-comma-subscript}.
3770 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3771 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3773 This warning is upgraded to an error by @option{-pedantic-errors} in
3774 C++23 mode or later.
3776 @opindex Wctad-maybe-unsupported
3777 @opindex Wno-ctad-maybe-unsupported
3778 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3779 Warn when performing class template argument deduction (CTAD) on a type with
3780 no explicitly written deduction guides.  This warning will point out cases
3781 where CTAD succeeded only because the compiler synthesized the implicit
3782 deduction guides, which might not be what the programmer intended.  Certain
3783 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3784 types that are designed to support CTAD.  This warning can be suppressed with
3785 the following pattern:
3787 @smallexample
3788 struct allow_ctad_t; // any name works
3789 template <typename T> struct S @{
3790   S(T) @{ @}
3792 // Guide with incomplete parameter type will never be considered.
3793 S(allow_ctad_t) -> S<void>;
3794 @end smallexample
3796 @opindex Wctor-dtor-privacy
3797 @opindex Wno-ctor-dtor-privacy
3798 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3799 Warn when a class seems unusable because all the constructors or
3800 destructors in that class are private, and it has neither friends nor
3801 public static member functions.  Also warn if there are no non-private
3802 methods, and there's at least one private member function that isn't
3803 a constructor or destructor.
3805 @opindex Wdangling-reference
3806 @opindex Wno-dangling-reference
3807 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3808 Warn when a reference is bound to a temporary whose lifetime has ended.
3809 For example:
3811 @smallexample
3812 int n = 1;
3813 const int& r = std::max(n - 1, n + 1); // r is dangling
3814 @end smallexample
3816 In the example above, two temporaries are created, one for each
3817 argument, and a reference to one of the temporaries is returned.
3818 However, both temporaries are destroyed at the end of the full
3819 expression, so the reference @code{r} is dangling.  This warning
3820 also detects dangling references in member initializer lists:
3822 @smallexample
3823 const int& f(const int& i) @{ return i; @}
3824 struct S @{
3825   const int &r; // r is dangling
3826   S() : r(f(10)) @{ @}
3828 @end smallexample
3830 Member functions are checked as well, but only their object argument:
3832 @smallexample
3833 struct S @{
3834    const S& self () @{ return *this; @}
3836 const S& s = S().self(); // s is dangling
3837 @end smallexample
3839 Certain functions are safe in this respect, for example @code{std::use_facet}:
3840 they take and return a reference, but they don't return one of its arguments,
3841 which can fool the warning.  Such functions can be excluded from the warning
3842 by wrapping them in a @code{#pragma}:
3844 @smallexample
3845 #pragma GCC diagnostic push
3846 #pragma GCC diagnostic ignored "-Wdangling-reference"
3847 const T& foo (const T&) @{ @dots{} @}
3848 #pragma GCC diagnostic pop
3849 @end smallexample
3851 @option{-Wdangling-reference} also warns about code like
3853 @smallexample
3854 auto p = std::minmax(1, 2);
3855 @end smallexample
3857 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3858 both references dangle after the end of the full expression that contains
3859 the call to @code{std::minmax}.
3861 This warning is enabled by @option{-Wall}.
3863 @opindex Wdelete-non-virtual-dtor
3864 @opindex Wno-delete-non-virtual-dtor
3865 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3866 Warn when @code{delete} is used to destroy an instance of a class that
3867 has virtual functions and non-virtual destructor. It is unsafe to delete
3868 an instance of a derived class through a pointer to a base class if the
3869 base class does not have a virtual destructor.  This warning is enabled
3870 by @option{-Wall}.
3872 @opindex Wdeprecated-copy
3873 @opindex Wno-deprecated-copy
3874 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3875 Warn that the implicit declaration of a copy constructor or copy
3876 assignment operator is deprecated if the class has a user-provided
3877 copy constructor or copy assignment operator, in C++11 and up.  This
3878 warning is enabled by @option{-Wextra}.  With
3879 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3880 user-provided destructor.
3882 @opindex Wdeprecated-enum-enum-conversion
3883 @opindex Wno-deprecated-enum-enum-conversion
3884 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3885 Disable the warning about the case when the usual arithmetic conversions
3886 are applied on operands where one is of enumeration type and the other is
3887 of a different enumeration type.  This conversion was deprecated in C++20.
3888 For example:
3890 @smallexample
3891 enum E1 @{ e @};
3892 enum E2 @{ f @};
3893 int k = f - e;
3894 @end smallexample
3896 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3897 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3898 by @option{-Wenum-conversion}.
3900 @opindex Wdeprecated-enum-float-conversion
3901 @opindex Wno-deprecated-enum-float-conversion
3902 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3903 Disable the warning about the case when the usual arithmetic conversions
3904 are applied on operands where one is of enumeration type and the other is
3905 of a floating-point type.  This conversion was deprecated in C++20.  For
3906 example:
3908 @smallexample
3909 enum E1 @{ e @};
3910 enum E2 @{ f @};
3911 bool b = e <= 3.7;
3912 @end smallexample
3914 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3915 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3916 by @option{-Wenum-conversion}.
3918 @opindex Welaborated-enum-base
3919 @opindex Wno-elaborated-enum-base
3920 @item -Wno-elaborated-enum-base
3921 For C++11 and above, warn if an (invalid) additional enum-base is used
3922 in an elaborated-type-specifier.  That is, if an enum with given
3923 underlying type and no enumerator list is used in a declaration other
3924 than just a standalone declaration of the enum.  Enabled by default.  This
3925 warning is upgraded to an error with -pedantic-errors.
3927 @opindex Winit-list-lifetime
3928 @opindex Wno-init-list-lifetime
3929 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3930 Do not warn about uses of @code{std::initializer_list} that are likely
3931 to result in dangling pointers.  Since the underlying array for an
3932 @code{initializer_list} is handled like a normal C++ temporary object,
3933 it is easy to inadvertently keep a pointer to the array past the end
3934 of the array's lifetime.  For example:
3936 @itemize @bullet
3937 @item
3938 If a function returns a temporary @code{initializer_list}, or a local
3939 @code{initializer_list} variable, the array's lifetime ends at the end
3940 of the return statement, so the value returned has a dangling pointer.
3942 @item
3943 If a new-expression creates an @code{initializer_list}, the array only
3944 lives until the end of the enclosing full-expression, so the
3945 @code{initializer_list} in the heap has a dangling pointer.
3947 @item
3948 When an @code{initializer_list} variable is assigned from a
3949 brace-enclosed initializer list, the temporary array created for the
3950 right side of the assignment only lives until the end of the
3951 full-expression, so at the next statement the @code{initializer_list}
3952 variable has a dangling pointer.
3954 @smallexample
3955 // li's initial underlying array lives as long as li
3956 std::initializer_list<int> li = @{ 1,2,3 @};
3957 // assignment changes li to point to a temporary array
3958 li = @{ 4, 5 @};
3959 // now the temporary is gone and li has a dangling pointer
3960 int i = li.begin()[0] // undefined behavior
3961 @end smallexample
3963 @item
3964 When a list constructor stores the @code{begin} pointer from the
3965 @code{initializer_list} argument, this doesn't extend the lifetime of
3966 the array, so if a class variable is constructed from a temporary
3967 @code{initializer_list}, the pointer is left dangling by the end of
3968 the variable declaration statement.
3970 @end itemize
3972 @opindex Winvalid-constexpr
3973 @opindex Wno-invalid-constexpr
3974 @item -Winvalid-constexpr
3976 Warn when a function never produces a constant expression.  In C++20
3977 and earlier, for every @code{constexpr} function and function template,
3978 there must be at least one set of function arguments in at least one
3979 instantiation such that an invocation of the function or constructor
3980 could be an evaluated subexpression of a core constant expression.
3981 C++23 removed this restriction, so it's possible to have a function
3982 or a function template marked @code{constexpr} for which no invocation
3983 satisfies the requirements of a core constant expression.
3985 This warning is enabled as a pedantic warning by default in C++20 and
3986 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
3987 which case it will be an ordinary warning.  For example:
3989 @smallexample
3990 void f (int& i);
3991 constexpr void
3992 g (int& i)
3994   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3995   f(i);
3997 @end smallexample
3999 @opindex Winvalid-imported-macros
4000 @opindex Wno-invalid-imported-macros
4001 @item -Winvalid-imported-macros
4002 Verify all imported macro definitions are valid at the end of
4003 compilation.  This is not enabled by default, as it requires
4004 additional processing to determine.  It may be useful when preparing
4005 sets of header-units to ensure consistent macros.
4007 @opindex Wliteral-suffix
4008 @opindex Wno-literal-suffix
4009 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
4010 Do not warn when a string or character literal is followed by a
4011 ud-suffix which does not begin with an underscore.  As a conforming
4012 extension, GCC treats such suffixes as separate preprocessing tokens
4013 in order to maintain backwards compatibility with code that uses
4014 formatting macros from @code{<inttypes.h>}.  For example:
4016 @smallexample
4017 #define __STDC_FORMAT_MACROS
4018 #include <inttypes.h>
4019 #include <stdio.h>
4021 int main() @{
4022   int64_t i64 = 123;
4023   printf("My int64: %" PRId64"\n", i64);
4025 @end smallexample
4027 In this case, @code{PRId64} is treated as a separate preprocessing token.
4029 This option also controls warnings when a user-defined literal
4030 operator is declared with a literal suffix identifier that doesn't
4031 begin with an underscore. Literal suffix identifiers that don't begin
4032 with an underscore are reserved for future standardization.
4034 These warnings are enabled by default.
4036 @opindex Wnarrowing
4037 @opindex Wno-narrowing
4038 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
4039 For C++11 and later standards, narrowing conversions are diagnosed by default,
4040 as required by the standard.  A narrowing conversion from a constant produces
4041 an error, and a narrowing conversion from a non-constant produces a warning,
4042 but @option{-Wno-narrowing} suppresses the diagnostic.
4043 Note that this does not affect the meaning of well-formed code;
4044 narrowing conversions are still considered ill-formed in SFINAE contexts.
4046 With @option{-Wnarrowing} in C++98, warn when a narrowing
4047 conversion prohibited by C++11 occurs within
4048 @samp{@{ @}}, e.g.
4050 @smallexample
4051 int i = @{ 2.2 @}; // error: narrowing from double to int
4052 @end smallexample
4054 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4056 @opindex Wnoexcept
4057 @opindex Wno-noexcept
4058 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4059 Warn when a noexcept-expression evaluates to false because of a call
4060 to a function that does not have a non-throwing exception
4061 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4062 the compiler to never throw an exception.
4064 @opindex Wnoexcept-type
4065 @opindex Wno-noexcept-type
4066 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4067 Warn if the C++17 feature making @code{noexcept} part of a function
4068 type changes the mangled name of a symbol relative to C++14.  Enabled
4069 by @option{-Wabi} and @option{-Wc++17-compat}.
4071 As an example:
4073 @smallexample
4074 template <class T> void f(T t) @{ t(); @};
4075 void g() noexcept;
4076 void h() @{ f(g); @} 
4077 @end smallexample
4079 @noindent
4080 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4081 C++17 it calls @code{f<void(*)()noexcept>}.
4083 @opindex Wclass-memaccess
4084 @opindex Wno-class-memaccess
4085 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4086 Warn when the destination of a call to a raw memory function such as
4087 @code{memset} or @code{memcpy} is an object of class type, and when writing
4088 into such an object might bypass the class non-trivial or deleted constructor
4089 or copy assignment, violate const-correctness or encapsulation, or corrupt
4090 virtual table pointers.  Modifying the representation of such objects may
4091 violate invariants maintained by member functions of the class.  For example,
4092 the call to @code{memset} below is undefined because it modifies a non-trivial
4093 class object and is, therefore, diagnosed.  The safe way to either initialize
4094 or clear the storage of objects of such types is by using the appropriate
4095 constructor or assignment operator, if one is available.
4096 @smallexample
4097 std::string str = "abc";
4098 memset (&str, 0, sizeof str);
4099 @end smallexample
4100 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4101 Explicitly casting the pointer to the class object to @code{void *} or
4102 to a type that can be safely accessed by the raw memory function suppresses
4103 the warning.
4105 @opindex Wnon-virtual-dtor
4106 @opindex Wno-non-virtual-dtor
4107 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4108 Warn when a class has virtual functions and an accessible non-virtual
4109 destructor itself or in an accessible polymorphic base class, in which
4110 case it is possible but unsafe to delete an instance of a derived
4111 class through a pointer to the class itself or base class.  This
4112 warning is automatically enabled if @option{-Weffc++} is specified.
4113 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4114 should be preferred because it warns about the unsafe cases without false
4115 positives.
4117 @opindex Wregister
4118 @opindex Wno-register
4119 @item -Wregister @r{(C++ and Objective-C++ only)}
4120 Warn on uses of the @code{register} storage class specifier, except
4121 when it is part of the GNU @ref{Explicit Register Variables} extension.
4122 The use of the @code{register} keyword as storage class specifier has
4123 been deprecated in C++11 and removed in C++17.
4124 Enabled by default with @option{-std=c++17}.
4126 @opindex Wreorder
4127 @opindex Wno-reorder
4128 @cindex reordering, warning
4129 @cindex warning for reordering of member initializers
4130 @item -Wreorder @r{(C++ and Objective-C++ only)}
4131 Warn when the order of member initializers given in the code does not
4132 match the order in which they must be executed.  For instance:
4134 @smallexample
4135 struct A @{
4136   int i;
4137   int j;
4138   A(): j (0), i (1) @{ @}
4140 @end smallexample
4142 @noindent
4143 The compiler rearranges the member initializers for @code{i}
4144 and @code{j} to match the declaration order of the members, emitting
4145 a warning to that effect.  This warning is enabled by @option{-Wall}.
4147 @opindex Wpessimizing-move
4148 @opindex Wno-pessimizing-move
4149 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4150 This warning warns when a call to @code{std::move} prevents copy
4151 elision.  A typical scenario when copy elision can occur is when returning in
4152 a function with a class return type, when the expression being returned is the
4153 name of a non-volatile automatic object, and is not a function parameter, and
4154 has the same type as the function return type.
4156 @smallexample
4157 struct T @{
4158 @dots{}
4160 T fn()
4162   T t;
4163   @dots{}
4164   return std::move (t);
4166 @end smallexample
4168 But in this example, the @code{std::move} call prevents copy elision.
4170 This warning is enabled by @option{-Wall}.
4172 @opindex Wredundant-move
4173 @opindex Wno-redundant-move
4174 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4175 This warning warns about redundant calls to @code{std::move}; that is, when
4176 a move operation would have been performed even without the @code{std::move}
4177 call.  This happens because the compiler is forced to treat the object as if
4178 it were an rvalue in certain situations such as returning a local variable,
4179 where copy elision isn't applicable.  Consider:
4181 @smallexample
4182 struct T @{
4183 @dots{}
4185 T fn(T t)
4187   @dots{}
4188   return std::move (t);
4190 @end smallexample
4192 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4193 Issue 1579, another example is:
4195 @smallexample
4196 struct T @{ // convertible to U
4197 @dots{}
4199 struct U @{
4200 @dots{}
4202 U fn()
4204   T t;
4205   @dots{}
4206   return std::move (t);
4208 @end smallexample
4209 In this example, copy elision isn't applicable because the type of the
4210 expression being returned and the function return type differ, yet G++
4211 treats the return value as if it were designated by an rvalue.
4213 This warning is enabled by @option{-Wextra}.
4215 @opindex Wrange-loop-construct
4216 @opindex Wno-range-loop-construct
4217 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4218 This warning warns when a C++ range-based for-loop is creating an unnecessary
4219 copy.  This can happen when the range declaration is not a reference, but
4220 probably should be.  For example:
4222 @smallexample
4223 struct S @{ char arr[128]; @};
4224 void fn () @{
4225   S arr[5];
4226   for (const auto x : arr) @{ @dots{} @}
4228 @end smallexample
4230 It does not warn when the type being copied is a trivially-copyable type whose
4231 size is less than 64 bytes.
4233 This warning also warns when a loop variable in a range-based for-loop is
4234 initialized with a value of a different type resulting in a copy.  For example:
4236 @smallexample
4237 void fn() @{
4238   int arr[10];
4239   for (const double &x : arr) @{ @dots{} @}
4241 @end smallexample
4243 In the example above, in every iteration of the loop a temporary value of
4244 type @code{double} is created and destroyed, to which the reference
4245 @code{const double &} is bound.
4247 This warning is enabled by @option{-Wall}.
4249 @opindex Wredundant-tags
4250 @opindex Wno-redundant-tags
4251 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4252 Warn about redundant class-key and enum-key in references to class types
4253 and enumerated types in contexts where the key can be eliminated without
4254 causing an ambiguity.  For example:
4256 @smallexample
4257 struct foo;
4258 struct foo *p;   // warn that keyword struct can be eliminated
4259 @end smallexample
4261 @noindent
4262 On the other hand, in this example there is no warning:
4264 @smallexample
4265 struct foo;
4266 void foo ();   // "hides" struct foo
4267 void bar (struct foo&);  // no warning, keyword struct is necessary
4268 @end smallexample
4270 @opindex Wsubobject-linkage
4271 @opindex Wno-subobject-linkage
4272 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4273 Do not warn
4274 if a class type has a base or a field whose type uses the anonymous
4275 namespace or depends on a type with no linkage.  If a type A depends on
4276 a type B with no or internal linkage, defining it in multiple
4277 translation units would be an ODR violation because the meaning of B
4278 is different in each translation unit.  If A only appears in a single
4279 translation unit, the best way to silence the warning is to give it
4280 internal linkage by putting it in an anonymous namespace as well.  The
4281 compiler doesn't give this warning for types defined in the main .C
4282 file, as those are unlikely to have multiple definitions.
4283 @option{-Wsubobject-linkage} is enabled by default.
4285 @opindex Weffc++
4286 @opindex Wno-effc++
4287 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4288 Warn about violations of the following style guidelines from Scott Meyers'
4289 @cite{Effective C++} series of books:
4291 @itemize @bullet
4292 @item
4293 Define a copy constructor and an assignment operator for classes
4294 with dynamically-allocated memory.
4296 @item
4297 Prefer initialization to assignment in constructors.
4299 @item
4300 Have @code{operator=} return a reference to @code{*this}.
4302 @item
4303 Don't try to return a reference when you must return an object.
4305 @item
4306 Distinguish between prefix and postfix forms of increment and
4307 decrement operators.
4309 @item
4310 Never overload @code{&&}, @code{||}, or @code{,}.
4312 @end itemize
4314 This option also enables @option{-Wnon-virtual-dtor}, which is also
4315 one of the effective C++ recommendations.  However, the check is
4316 extended to warn about the lack of virtual destructor in accessible
4317 non-polymorphic bases classes too.
4319 When selecting this option, be aware that the standard library
4320 headers do not obey all of these guidelines; use @samp{grep -v}
4321 to filter out those warnings.
4323 @opindex Wexceptions
4324 @opindex Wno-exceptions
4325 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4326 Disable the warning about the case when an exception handler is shadowed by
4327 another handler, which can point out a wrong ordering of exception handlers.
4329 @opindex Wstrict-null-sentinel
4330 @opindex Wno-strict-null-sentinel
4331 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4332 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4333 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4334 to @code{__null}.  Although it is a null pointer constant rather than a
4335 null pointer, it is guaranteed to be of the same size as a pointer.
4336 But this use is not portable across different compilers.
4338 @opindex Wno-non-template-friend
4339 @opindex Wnon-template-friend
4340 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4341 Disable warnings when non-template friend functions are declared
4342 within a template.  In very old versions of GCC that predate implementation
4343 of the ISO standard, declarations such as 
4344 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4345 could be interpreted as a particular specialization of a template
4346 function; the warning exists to diagnose compatibility problems, 
4347 and is enabled by default.
4349 @opindex Wold-style-cast
4350 @opindex Wno-old-style-cast
4351 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4352 Warn if an old-style (C-style) cast to a non-void type is used within
4353 a C++ program.  The new-style casts (@code{dynamic_cast},
4354 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4355 less vulnerable to unintended effects and much easier to search for.
4357 @opindex Woverloaded-virtual
4358 @opindex Wno-overloaded-virtual
4359 @cindex overloaded virtual function, warning
4360 @cindex warning for overloaded virtual function
4361 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4362 @itemx -Woverloaded-virtual=@var{n}
4363 Warn when a function declaration hides virtual functions from a
4364 base class.  For example, in:
4366 @smallexample
4367 struct A @{
4368   virtual void f();
4371 struct B: public A @{
4372   void f(int); // does not override
4374 @end smallexample
4376 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4377 like:
4379 @smallexample
4380 B* b;
4381 b->f();
4382 @end smallexample
4384 @noindent
4385 fails to compile.
4387 In cases where the different signatures are not an accident, the
4388 simplest solution is to add a using-declaration to the derived class
4389 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4391 The optional level suffix controls the behavior when all the
4392 declarations in the derived class override virtual functions in the
4393 base class, even if not all of the base functions are overridden:
4395 @smallexample
4396 struct C @{
4397   virtual void f();
4398   virtual void f(int);
4401 struct D: public C @{
4402   void f(int); // does override
4404 @end smallexample
4406 This pattern is less likely to be a mistake; if D is only used
4407 virtually, the user might have decided that the base class semantics
4408 for some of the overloads are fine.
4410 At level 1, this case does not warn; at level 2, it does.
4411 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4412 included in @option{-Wall}.
4414 @opindex Wno-pmf-conversions
4415 @opindex Wpmf-conversions
4416 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4417 Disable the diagnostic for converting a bound pointer to member function
4418 to a plain pointer.
4420 @opindex Wsign-promo
4421 @opindex Wno-sign-promo
4422 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4423 Warn when overload resolution chooses a promotion from unsigned or
4424 enumerated type to a signed type, over a conversion to an unsigned type of
4425 the same size.  Previous versions of G++ tried to preserve
4426 unsignedness, but the standard mandates the current behavior.
4428 @opindex Wtemplates
4429 @opindex Wno-templates
4430 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4431 Warn when a primary template declaration is encountered.  Some coding
4432 rules disallow templates, and this may be used to enforce that rule.
4433 The warning is inactive inside a system header file, such as the STL, so
4434 one can still use the STL.  One may also instantiate or specialize
4435 templates.
4437 @opindex Wmismatched-new-delete
4438 @opindex Wno-mismatched-new-delete
4439 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4440 Warn for mismatches between calls to @code{operator new} or @code{operator
4441 delete} and the corresponding call to the allocation or deallocation function.
4442 This includes invocations of C++ @code{operator delete} with pointers
4443 returned from either mismatched forms of @code{operator new}, or from other
4444 functions that allocate objects for which the @code{operator delete} isn't
4445 a suitable deallocator, as well as calls to other deallocation functions
4446 with pointers returned from @code{operator new} for which the deallocation
4447 function isn't suitable.
4449 For example, the @code{delete} expression in the function below is diagnosed
4450 because it doesn't match the array form of the @code{new} expression
4451 the pointer argument was returned from.  Similarly, the call to @code{free}
4452 is also diagnosed.
4454 @smallexample
4455 void f ()
4457   int *a = new int[n];
4458   delete a;   // warning: mismatch in array forms of expressions
4460   char *p = new char[n];
4461   free (p);   // warning: mismatch between new and free
4463 @end smallexample
4465 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4466 involving allocation and deallocation functions other than @code{operator
4467 new} and @code{operator delete}.
4469 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4471 @opindex Wmismatched-tags
4472 @opindex Wno-mismatched-tags
4473 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4474 Warn for declarations of structs, classes, and class templates and their
4475 specializations with a class-key that does not match either the definition
4476 or the first declaration if no definition is provided.
4478 For example, the declaration of @code{struct Object} in the argument list
4479 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4480 class-key @code{struct} or replace it with @code{class} to match its definition.
4481 @smallexample
4482 class Object @{
4483 public:
4484   virtual ~Object () = 0;
4486 void draw (struct Object*);
4487 @end smallexample
4489 It is not wrong to declare a class with the class-key @code{struct} as
4490 the example above shows.  The @option{-Wmismatched-tags} option is intended
4491 to help achieve a consistent style of class declarations.  In code that is
4492 intended to be portable to Windows-based compilers the warning helps prevent
4493 unresolved references due to the difference in the mangling of symbols
4494 declared with different class-keys.  The option can be used either on its
4495 own or in conjunction with @option{-Wredundant-tags}.
4497 @opindex Wmultiple-inheritance
4498 @opindex Wno-multiple-inheritance
4499 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4500 Warn when a class is defined with multiple direct base classes.  Some
4501 coding rules disallow multiple inheritance, and this may be used to
4502 enforce that rule.  The warning is inactive inside a system header file,
4503 such as the STL, so one can still use the STL.  One may also define
4504 classes that indirectly use multiple inheritance.
4506 @opindex Wvirtual-inheritance
4507 @opindex Wno-virtual-inheritance
4508 @item -Wvirtual-inheritance
4509 Warn when a class is defined with a virtual direct base class.  Some
4510 coding rules disallow multiple inheritance, and this may be used to
4511 enforce that rule.  The warning is inactive inside a system header file,
4512 such as the STL, so one can still use the STL.  One may also define
4513 classes that indirectly use virtual inheritance.
4515 @opindex Wvirtual-move-assign
4516 @opindex Wno-virtual-move-assign
4517 @item -Wno-virtual-move-assign
4518 Suppress warnings about inheriting from a virtual base with a
4519 non-trivial C++11 move assignment operator.  This is dangerous because
4520 if the virtual base is reachable along more than one path, it is
4521 moved multiple times, which can mean both objects end up in the
4522 moved-from state.  If the move assignment operator is written to avoid
4523 moving from a moved-from object, this warning can be disabled.
4525 @opindex Wnamespaces
4526 @opindex Wno-namespaces
4527 @item -Wnamespaces
4528 Warn when a namespace definition is opened.  Some coding rules disallow
4529 namespaces, and this may be used to enforce that rule.  The warning is
4530 inactive inside a system header file, such as the STL, so one can still
4531 use the STL.  One may also use using directives and qualified names.
4533 @opindex Wterminate
4534 @opindex Wno-terminate
4535 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4536 Disable the warning about a throw-expression that will immediately
4537 result in a call to @code{terminate}.
4539 @opindex Wvexing-parse
4540 @opindex Wno-vexing-parse
4541 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4542 Warn about the most vexing parse syntactic ambiguity.  This warns about
4543 the cases when a declaration looks like a variable definition, but the
4544 C++ language requires it to be interpreted as a function declaration.
4545 For instance:
4547 @smallexample
4548 void f(double a) @{
4549   int i();        // extern int i (void);
4550   int n(int(a));  // extern int n (int);
4552 @end smallexample
4554 Another example:
4556 @smallexample
4557 struct S @{ S(int); @};
4558 void f(double a) @{
4559   S x(int(a));   // extern struct S x (int);
4560   S y(int());    // extern struct S y (int (*) (void));
4561   S z();         // extern struct S z (void);
4563 @end smallexample
4565 The warning will suggest options how to deal with such an ambiguity; e.g.,
4566 it can suggest removing the parentheses or using braces instead.
4568 This warning is enabled by default.
4570 @opindex Wno-class-conversion
4571 @opindex Wclass-conversion
4572 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4573 Do not warn when a conversion function converts an
4574 object to the same type, to a base class of that type, or to void; such
4575 a conversion function will never be called.
4577 @opindex Wvolatile
4578 @opindex Wno-volatile
4579 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4580 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4581 postfix and prefix @code{++} and @code{--} expressions of
4582 @code{volatile}-qualified types, using simple assignments where the left
4583 operand is a @code{volatile}-qualified non-class type for their value,
4584 compound assignments where the left operand is a @code{volatile}-qualified
4585 non-class type, @code{volatile}-qualified function return type,
4586 @code{volatile}-qualified parameter type, and structured bindings of a
4587 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4589 Enabled by default with @option{-std=c++20}.
4591 @opindex Wzero-as-null-pointer-constant
4592 @opindex Wno-zero-as-null-pointer-constant
4593 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4594 Warn when a literal @samp{0} is used as null pointer constant.  This can
4595 be useful to facilitate the conversion to @code{nullptr} in C++11.
4597 @opindex Waligned-new
4598 @opindex Wno-aligned-new
4599 @item -Waligned-new
4600 Warn about a new-expression of a type that requires greater alignment
4601 than the @code{alignof(std::max_align_t)} but uses an allocation
4602 function without an explicit alignment parameter. This option is
4603 enabled by @option{-Wall}.
4605 Normally this only warns about global allocation functions, but
4606 @option{-Waligned-new=all} also warns about class member allocation
4607 functions.
4609 @opindex Wplacement-new
4610 @opindex Wno-placement-new
4611 @item -Wno-placement-new
4612 @itemx -Wplacement-new=@var{n}
4613 Warn about placement new expressions with undefined behavior, such as
4614 constructing an object in a buffer that is smaller than the type of
4615 the object.  For example, the placement new expression below is diagnosed
4616 because it attempts to construct an array of 64 integers in a buffer only
4617 64 bytes large.
4618 @smallexample
4619 char buf [64];
4620 new (buf) int[64];
4621 @end smallexample
4622 This warning is enabled by default.
4624 @table @gcctabopt
4625 @item -Wplacement-new=1
4626 This is the default warning level of @option{-Wplacement-new}.  At this
4627 level the warning is not issued for some strictly undefined constructs that
4628 GCC allows as extensions for compatibility with legacy code.  For example,
4629 the following @code{new} expression is not diagnosed at this level even
4630 though it has undefined behavior according to the C++ standard because
4631 it writes past the end of the one-element array.
4632 @smallexample
4633 struct S @{ int n, a[1]; @};
4634 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4635 new (s->a)int [32]();
4636 @end smallexample
4638 @item -Wplacement-new=2
4639 At this level, in addition to diagnosing all the same constructs as at level
4640 1, a diagnostic is also issued for placement new expressions that construct
4641 an object in the last member of structure whose type is an array of a single
4642 element and whose size is less than the size of the object being constructed.
4643 While the previous example would be diagnosed, the following construct makes
4644 use of the flexible member array extension to avoid the warning at level 2.
4645 @smallexample
4646 struct S @{ int n, a[]; @};
4647 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4648 new (s->a)int [32]();
4649 @end smallexample
4651 @end table
4653 @opindex Wcatch-value
4654 @opindex Wno-catch-value
4655 @item -Wcatch-value
4656 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4657 Warn about catch handlers that do not catch via reference.
4658 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4659 warn about polymorphic class types that are caught by value.
4660 With @option{-Wcatch-value=2} warn about all class types that are caught
4661 by value. With @option{-Wcatch-value=3} warn about all types that are
4662 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4664 @opindex Wconditionally-supported
4665 @opindex Wno-conditionally-supported
4666 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4667 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4669 @opindex Wdelete-incomplete
4670 @opindex Wno-delete-incomplete
4671 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4672 Do not warn when deleting a pointer to incomplete type, which may cause
4673 undefined behavior at runtime.  This warning is enabled by default.
4675 @opindex Wextra-semi
4676 @opindex Wno-extra-semi
4677 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4678 Warn about redundant semicolons after in-class function definitions.
4680 @opindex Winaccessible-base
4681 @opindex Wno-inaccessible-base
4682 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4683 This option controls warnings
4684 when a base class is inaccessible in a class derived from it due to
4685 ambiguity.  The warning is enabled by default.
4686 Note that the warning for ambiguous virtual
4687 bases is enabled by the @option{-Wextra} option.
4688 @smallexample
4689 @group
4690 struct A @{ int a; @};
4692 struct B : A @{ @};
4694 struct C : B, A @{ @};
4695 @end group
4696 @end smallexample
4698 @opindex Winherited-variadic-ctor
4699 @opindex Wno-inherited-variadic-ctor
4700 @item -Wno-inherited-variadic-ctor
4701 Suppress warnings about use of C++11 inheriting constructors when the
4702 base class inherited from has a C variadic constructor; the warning is
4703 on by default because the ellipsis is not inherited.
4705 @opindex Wno-invalid-offsetof
4706 @opindex Winvalid-offsetof
4707 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4708 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4709 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4710 to a non-standard-layout type is undefined.  In existing C++ implementations,
4711 however, @code{offsetof} typically gives meaningful results.
4712 This flag is for users who are aware that they are
4713 writing nonportable code and who have deliberately chosen to ignore the
4714 warning about it.
4716 The restrictions on @code{offsetof} may be relaxed in a future version
4717 of the C++ standard.
4719 @opindex Wsized-deallocation
4720 @opindex Wno-sized-deallocation
4721 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4722 Warn about a definition of an unsized deallocation function
4723 @smallexample
4724 void operator delete (void *) noexcept;
4725 void operator delete[] (void *) noexcept;
4726 @end smallexample
4727 without a definition of the corresponding sized deallocation function
4728 @smallexample
4729 void operator delete (void *, std::size_t) noexcept;
4730 void operator delete[] (void *, std::size_t) noexcept;
4731 @end smallexample
4732 or vice versa.  Enabled by @option{-Wextra} along with
4733 @option{-fsized-deallocation}.
4735 @opindex Wno-suggest-final-types
4736 @opindex Wsuggest-final-types
4737 @item -Wsuggest-final-types
4738 Warn about types with virtual methods where code quality would be improved
4739 if the type were declared with the C++11 @code{final} specifier,
4740 or, if possible,
4741 declared in an anonymous namespace. This allows GCC to more aggressively
4742 devirtualize the polymorphic calls. This warning is more effective with
4743 link-time optimization,
4744 where the information about the class hierarchy graph is
4745 more complete.
4747 @opindex Wno-suggest-final-methods
4748 @opindex Wsuggest-final-methods
4749 @item -Wsuggest-final-methods
4750 Warn about virtual methods where code quality would be improved if the method
4751 were declared with the C++11 @code{final} specifier,
4752 or, if possible, its type were
4753 declared in an anonymous namespace or with the @code{final} specifier.
4754 This warning is
4755 more effective with link-time optimization, where the information about the
4756 class hierarchy graph is more complete. It is recommended to first consider
4757 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4758 annotations.
4760 @opindex Wsuggest-override
4761 @opindex Wno-suggest-override
4762 @item -Wsuggest-override
4763 Warn about overriding virtual functions that are not marked with the
4764 @code{override} keyword.
4766 @opindex Wuse-after-free
4767 @opindex Wno-use-after-free
4768 @item -Wuse-after-free
4769 @itemx -Wuse-after-free=@var{n}
4770 Warn about uses of pointers to dynamically allocated objects that have
4771 been rendered indeterminate by a call to a deallocation function.
4772 The warning is enabled at all optimization levels but may yield different
4773 results with optimization than without.
4775 @table @gcctabopt
4776 @item -Wuse-after-free=1
4777 At level 1 the warning attempts to diagnose only unconditional uses
4778 of pointers made indeterminate by a deallocation call or a successful
4779 call to @code{realloc}, regardless of whether or not the call resulted
4780 in an actual reallocatio of memory.  This includes double-@code{free}
4781 calls as well as uses in arithmetic and relational expressions.  Although
4782 undefined, uses of indeterminate pointers in equality (or inequality)
4783 expressions are not diagnosed at this level.
4784 @item -Wuse-after-free=2
4785 At level 2, in addition to unconditional uses, the warning also diagnoses
4786 conditional uses of pointers made indeterminate by a deallocation call.
4787 As at level 2, uses in equality (or inequality) expressions are not
4788 diagnosed.  For example, the second call to @code{free} in the following
4789 function is diagnosed at this level:
4790 @smallexample
4791 struct A @{ int refcount; void *data; @};
4793 void release (struct A *p)
4795   int refcount = --p->refcount;
4796   free (p);
4797   if (refcount == 0)
4798     free (p->data);   // warning: p may be used after free
4800 @end smallexample
4801 @item -Wuse-after-free=3
4802 At level 3, the warning also diagnoses uses of indeterminate pointers in
4803 equality expressions.  All uses of indeterminate pointers are undefined
4804 but equality tests sometimes appear after calls to @code{realloc} as
4805 an attempt to determine whether the call resulted in relocating the object
4806 to a different address.  They are diagnosed at a separate level to aid
4807 legacy code gradually transition to safe alternatives.  For example,
4808 the equality test in the function below is diagnosed at this level:
4809 @smallexample
4810 void adjust_pointers (int**, int);
4812 void grow (int **p, int n)
4814   int **q = (int**)realloc (p, n *= 2);
4815   if (q == p)
4816     return;
4817   adjust_pointers ((int**)q, n);
4819 @end smallexample
4820 To avoid the warning at this level, store offsets into allocated memory
4821 instead of pointers.  This approach obviates needing to adjust the stored
4822 pointers after reallocation.
4823 @end table
4825 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4827 @opindex Wuseless-cast
4828 @opindex Wno-useless-cast
4829 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
4830 Warn when an expression is cast to its own type.  This warning does not
4831 occur when a class object is converted to a non-reference type as that
4832 is a way to create a temporary:
4834 @smallexample
4835 struct S @{ @};
4836 void g (S&&);
4837 void f (S&& arg)
4839   g (S(arg)); // make arg prvalue so that it can bind to S&&
4841 @end smallexample
4843 @opindex Wconversion-null
4844 @opindex Wno-conversion-null
4845 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4846 Do not warn for conversions between @code{NULL} and non-pointer
4847 types. @option{-Wconversion-null} is enabled by default.
4849 @end table
4851 @node Objective-C and Objective-C++ Dialect Options
4852 @section Options Controlling Objective-C and Objective-C++ Dialects
4854 @cindex compiler options, Objective-C and Objective-C++
4855 @cindex Objective-C and Objective-C++ options, command-line
4856 @cindex options, Objective-C and Objective-C++
4857 (NOTE: This manual does not describe the Objective-C and Objective-C++
4858 languages themselves.  @xref{Standards,,Language Standards
4859 Supported by GCC}, for references.)
4861 This section describes the command-line options that are only meaningful
4862 for Objective-C and Objective-C++ programs.  You can also use most of
4863 the language-independent GNU compiler options.
4864 For example, you might compile a file @file{some_class.m} like this:
4866 @smallexample
4867 gcc -g -fgnu-runtime -O -c some_class.m
4868 @end smallexample
4870 @noindent
4871 In this example, @option{-fgnu-runtime} is an option meant only for
4872 Objective-C and Objective-C++ programs; you can use the other options with
4873 any language supported by GCC@.
4875 Note that since Objective-C is an extension of the C language, Objective-C
4876 compilations may also use options specific to the C front-end (e.g.,
4877 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4878 C++-specific options (e.g., @option{-Wabi}).
4880 Here is a list of options that are @emph{only} for compiling Objective-C
4881 and Objective-C++ programs:
4883 @table @gcctabopt
4884 @opindex fconstant-string-class
4885 @item -fconstant-string-class=@var{class-name}
4886 Use @var{class-name} as the name of the class to instantiate for each
4887 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4888 class name is @code{NXConstantString} if the GNU runtime is being used, and
4889 @code{NSConstantString} if the NeXT runtime is being used (see below).  On
4890 Darwin / macOS platforms, the @option{-fconstant-cfstrings} option, if
4891 also present, overrides the @option{-fconstant-string-class} setting and cause
4892 @code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings.
4893 Note that @option{-fconstant-cfstrings} is an alias for the target-specific
4894 @option{-mconstant-cfstrings} equivalent.
4896 @opindex fgnu-runtime
4897 @item -fgnu-runtime
4898 Generate object code compatible with the standard GNU Objective-C
4899 runtime.  This is the default for most types of systems.
4901 @opindex fnext-runtime
4902 @item -fnext-runtime
4903 Generate output compatible with the NeXT runtime.  This is the default
4904 for NeXT-based systems, including Darwin / macOS.  The macro
4905 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4906 used.
4908 @opindex fno-nil-receivers
4909 @opindex fnil-receivers
4910 @item -fno-nil-receivers
4911 Assume that all Objective-C message dispatches (@code{[receiver
4912 message:arg]}) in this translation unit ensure that the receiver is
4913 not @code{nil}.  This allows for more efficient entry points in the
4914 runtime to be used.  This option is only available in conjunction with
4915 the NeXT runtime and ABI version 0 or 1.
4917 @opindex fobjc-abi-version
4918 @item -fobjc-abi-version=@var{n}
4919 Use version @var{n} of the Objective-C ABI for the selected runtime.
4920 This option is currently supported only for the NeXT runtime.  In that
4921 case, Version 0 is the traditional (32-bit) ABI without support for
4922 properties and other Objective-C 2.0 additions.  Version 1 is the
4923 traditional (32-bit) ABI with support for properties and other
4924 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4925 nothing is specified, the default is Version 0 on 32-bit target
4926 machines, and Version 2 on 64-bit target machines.
4928 @opindex fobjc-call-cxx-cdtors
4929 @item -fobjc-call-cxx-cdtors
4930 For each Objective-C class, check if any of its instance variables is a
4931 C++ object with a non-trivial default constructor.  If so, synthesize a
4932 special @code{- (id) .cxx_construct} instance method which runs
4933 non-trivial default constructors on any such instance variables, in order,
4934 and then return @code{self}.  Similarly, check if any instance variable
4935 is a C++ object with a non-trivial destructor, and if so, synthesize a
4936 special @code{- (void) .cxx_destruct} method which runs
4937 all such default destructors, in reverse order.
4939 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4940 methods thusly generated only operate on instance variables
4941 declared in the current Objective-C class, and not those inherited
4942 from superclasses.  It is the responsibility of the Objective-C
4943 runtime to invoke all such methods in an object's inheritance
4944 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4945 by the runtime immediately after a new object instance is allocated;
4946 the @code{- (void) .cxx_destruct} methods are invoked immediately
4947 before the runtime deallocates an object instance.
4949 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4950 support for invoking the @code{- (id) .cxx_construct} and
4951 @code{- (void) .cxx_destruct} methods.
4953 @opindex fobjc-direct-dispatch
4954 @item -fobjc-direct-dispatch
4955 Allow fast jumps to the message dispatcher.  On Darwin this is
4956 accomplished via the comm page.
4958 @opindex fobjc-exceptions
4959 @item -fobjc-exceptions
4960 Enable syntactic support for structured exception handling in
4961 Objective-C, similar to what is offered by C++.  This option
4962 is required to use the Objective-C keywords @code{@@try},
4963 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4964 @code{@@synchronized}.  This option is available with both the GNU
4965 runtime and the NeXT runtime (but not available in conjunction with
4966 the NeXT runtime on Mac OS X 10.2 and earlier).
4968 @opindex fobjc-gc
4969 @item -fobjc-gc
4970 Enable garbage collection (GC) in Objective-C and Objective-C++
4971 programs.  This option is only available with the NeXT runtime; the
4972 GNU runtime has a different garbage collection implementation that
4973 does not require special compiler flags.
4975 @opindex fobjc-nilcheck
4976 @item -fobjc-nilcheck
4977 For the NeXT runtime with version 2 of the ABI, check for a nil
4978 receiver in method invocations before doing the actual method call.
4979 This is the default and can be disabled using
4980 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4981 checked for nil in this way no matter what this flag is set to.
4982 Currently this flag does nothing when the GNU runtime, or an older
4983 version of the NeXT runtime ABI, is used.
4985 @opindex fobjc-std
4986 @item -fobjc-std=objc1
4987 Conform to the language syntax of Objective-C 1.0, the language
4988 recognized by GCC 4.0.  This only affects the Objective-C additions to
4989 the C/C++ language; it does not affect conformance to C/C++ standards,
4990 which is controlled by the separate C/C++ dialect option flags.  When
4991 this option is used with the Objective-C or Objective-C++ compiler,
4992 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4993 This is useful if you need to make sure that your Objective-C code can
4994 be compiled with older versions of GCC@.
4996 @opindex freplace-objc-classes
4997 @item -freplace-objc-classes
4998 Emit a special marker instructing @command{ld(1)} not to statically link in
4999 the resulting object file, and allow @command{dyld(1)} to load it in at
5000 run time instead.  This is used in conjunction with the Fix-and-Continue
5001 debugging mode, where the object file in question may be recompiled and
5002 dynamically reloaded in the course of program execution, without the need
5003 to restart the program itself.  Currently, Fix-and-Continue functionality
5004 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
5005 and later.
5007 @opindex fzero-link
5008 @item -fzero-link
5009 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
5010 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
5011 compile time) with static class references that get initialized at load time,
5012 which improves run-time performance.  Specifying the @option{-fzero-link} flag
5013 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
5014 to be retained.  This is useful in Zero-Link debugging mode, since it allows
5015 for individual class implementations to be modified during program execution.
5016 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
5017 regardless of command-line options.
5019 @opindex fno-local-ivars
5020 @opindex flocal-ivars
5021 @item -fno-local-ivars
5022 By default instance variables in Objective-C can be accessed as if
5023 they were local variables from within the methods of the class they're
5024 declared in.  This can lead to shadowing between instance variables
5025 and other variables declared either locally inside a class method or
5026 globally with the same name.  Specifying the @option{-fno-local-ivars}
5027 flag disables this behavior thus avoiding variable shadowing issues.
5029 @opindex fivar-visibility
5030 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
5031 Set the default instance variable visibility to the specified option
5032 so that instance variables declared outside the scope of any access
5033 modifier directives default to the specified visibility.
5035 @opindex gen-decls
5036 @item -gen-decls
5037 Dump interface declarations for all classes seen in the source file to a
5038 file named @file{@var{sourcename}.decl}.
5040 @opindex Wassign-intercept
5041 @opindex Wno-assign-intercept
5042 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
5043 Warn whenever an Objective-C assignment is being intercepted by the
5044 garbage collector.
5046 @opindex Wproperty-assign-default
5047 @opindex Wno-property-assign-default
5048 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
5049 Do not warn if a property for an Objective-C object has no assign
5050 semantics specified.
5052 @opindex Wno-protocol
5053 @opindex Wprotocol
5054 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
5055 If a class is declared to implement a protocol, a warning is issued for
5056 every method in the protocol that is not implemented by the class.  The
5057 default behavior is to issue a warning for every method not explicitly
5058 implemented in the class, even if a method implementation is inherited
5059 from the superclass.  If you use the @option{-Wno-protocol} option, then
5060 methods inherited from the superclass are considered to be implemented,
5061 and no warning is issued for them.
5063 @opindex Wobjc-root-class
5064 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
5065 Warn if a class interface lacks a superclass. Most classes will inherit
5066 from @code{NSObject} (or @code{Object}) for example.  When declaring
5067 classes intended to be root classes, the warning can be suppressed by
5068 marking their interfaces with @code{__attribute__((objc_root_class))}.
5070 @opindex Wselector
5071 @opindex Wno-selector
5072 @item -Wselector @r{(Objective-C and Objective-C++ only)}
5073 Warn if multiple methods of different types for the same selector are
5074 found during compilation.  The check is performed on the list of methods
5075 in the final stage of compilation.  Additionally, a check is performed
5076 for each selector appearing in a @code{@@selector(@dots{})}
5077 expression, and a corresponding method for that selector has been found
5078 during compilation.  Because these checks scan the method table only at
5079 the end of compilation, these warnings are not produced if the final
5080 stage of compilation is not reached, for example because an error is
5081 found during compilation, or because the @option{-fsyntax-only} option is
5082 being used.
5084 @opindex Wstrict-selector-match
5085 @opindex Wno-strict-selector-match
5086 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5087 Warn if multiple methods with differing argument and/or return types are
5088 found for a given selector when attempting to send a message using this
5089 selector to a receiver of type @code{id} or @code{Class}.  When this flag
5090 is off (which is the default behavior), the compiler omits such warnings
5091 if any differences found are confined to types that share the same size
5092 and alignment.
5094 @opindex Wundeclared-selector
5095 @opindex Wno-undeclared-selector
5096 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5097 Warn if a @code{@@selector(@dots{})} expression referring to an
5098 undeclared selector is found.  A selector is considered undeclared if no
5099 method with that name has been declared before the
5100 @code{@@selector(@dots{})} expression, either explicitly in an
5101 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5102 an @code{@@implementation} section.  This option always performs its
5103 checks as soon as a @code{@@selector(@dots{})} expression is found,
5104 while @option{-Wselector} only performs its checks in the final stage of
5105 compilation.  This also enforces the coding style convention
5106 that methods and selectors must be declared before being used.
5108 @opindex print-objc-runtime-info
5109 @item -print-objc-runtime-info
5110 Generate C header describing the largest structure that is passed by
5111 value, if any.
5113 @end table
5115 @node Diagnostic Message Formatting Options
5116 @section Options to Control Diagnostic Messages Formatting
5117 @cindex options to control diagnostics formatting
5118 @cindex diagnostic messages
5119 @cindex message formatting
5121 Traditionally, diagnostic messages have been formatted irrespective of
5122 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5123 options described below
5124 to control the formatting algorithm for diagnostic messages, 
5125 e.g.@: how many characters per line, how often source location
5126 information should be reported.  Note that some language front ends may not
5127 honor these options.
5129 @table @gcctabopt
5130 @opindex fmessage-length
5131 @item -fmessage-length=@var{n}
5132 Try to format error messages so that they fit on lines of about
5133 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5134 done; each error message appears on a single line.  This is the
5135 default for all front ends.
5137 Note - this option also affects the display of the @samp{#error} and
5138 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5139 function/type/variable attribute.  It does not however affect the
5140 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5142 @item -fdiagnostics-plain-output
5143 This option requests that diagnostic output look as plain as possible, which
5144 may be useful when running @command{dejagnu} or other utilities that need to
5145 parse diagnostics output and prefer that it remain more stable over time.
5146 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5147 options:
5148 @gccoptlist{-fno-diagnostics-show-caret
5149 -fno-diagnostics-show-line-numbers
5150 -fdiagnostics-color=never
5151 -fdiagnostics-urls=never
5152 -fdiagnostics-path-format=separate-events
5153 -fdiagnostics-text-art-charset=none}
5154 In the future, if GCC changes the default appearance of its diagnostics, the
5155 corresponding option to disable the new behavior will be added to this list.
5157 @opindex fdiagnostics-show-location
5158 @item -fdiagnostics-show-location=once
5159 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5160 reporter to emit source location information @emph{once}; that is, in
5161 case the message is too long to fit on a single physical line and has to
5162 be wrapped, the source location won't be emitted (as prefix) again,
5163 over and over, in subsequent continuation lines.  This is the default
5164 behavior.
5166 @item -fdiagnostics-show-location=every-line
5167 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5168 messages reporter to emit the same source location information (as
5169 prefix) for physical lines that result from the process of breaking
5170 a message which is too long to fit on a single line.
5172 @opindex fdiagnostics-color
5173 @cindex highlight, color
5174 @vindex GCC_COLORS @r{environment variable}
5175 @item -fdiagnostics-color[=@var{WHEN}]
5176 @itemx -fno-diagnostics-color
5177 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5178 or @samp{auto}.  The default depends on how the compiler has been configured,
5179 it can be any of the above @var{WHEN} options or also @samp{never}
5180 if @env{GCC_COLORS} environment variable isn't present in the environment,
5181 and @samp{auto} otherwise.
5182 @samp{auto} makes GCC use color only when the standard error is a terminal,
5183 and when not executing in an emacs shell.
5184 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5185 aliases for @option{-fdiagnostics-color=always} and
5186 @option{-fdiagnostics-color=never}, respectively.
5188 The colors are defined by the environment variable @env{GCC_COLORS}.
5189 Its value is a colon-separated list of capabilities and Select Graphic
5190 Rendition (SGR) substrings. SGR commands are interpreted by the
5191 terminal or terminal emulator.  (See the section in the documentation
5192 of your text terminal for permitted values and their meanings as
5193 character attributes.)  These substring values are integers in decimal
5194 representation and can be concatenated with semicolons.
5195 Common values to concatenate include
5196 @samp{1} for bold,
5197 @samp{4} for underline,
5198 @samp{5} for blink,
5199 @samp{7} for inverse,
5200 @samp{39} for default foreground color,
5201 @samp{30} to @samp{37} for foreground colors,
5202 @samp{90} to @samp{97} for 16-color mode foreground colors,
5203 @samp{38;5;0} to @samp{38;5;255}
5204 for 88-color and 256-color modes foreground colors,
5205 @samp{49} for default background color,
5206 @samp{40} to @samp{47} for background colors,
5207 @samp{100} to @samp{107} for 16-color mode background colors,
5208 and @samp{48;5;0} to @samp{48;5;255}
5209 for 88-color and 256-color modes background colors.
5211 The default @env{GCC_COLORS} is
5212 @smallexample
5213 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5214 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5215 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5216 type-diff=01;32:fnname=01;32:targs=35
5217 @end smallexample
5218 @noindent
5219 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5220 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5221 @samp{01} is bold, and @samp{31} is red.
5222 Setting @env{GCC_COLORS} to the empty string disables colors.
5223 Supported capabilities are as follows.
5225 @table @code
5226 @vindex error GCC_COLORS @r{capability}
5227 @item error=
5228 SGR substring for error: markers.
5230 @vindex warning GCC_COLORS @r{capability}
5231 @item warning=
5232 SGR substring for warning: markers.
5234 @vindex note GCC_COLORS @r{capability}
5235 @item note=
5236 SGR substring for note: markers.
5238 @vindex path GCC_COLORS @r{capability}
5239 @item path=
5240 SGR substring for colorizing paths of control-flow events as printed
5241 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5242 individual events and lines indicating interprocedural calls and returns.
5244 @vindex range1 GCC_COLORS @r{capability}
5245 @item range1=
5246 SGR substring for first additional range.
5248 @vindex range2 GCC_COLORS @r{capability}
5249 @item range2=
5250 SGR substring for second additional range.
5252 @vindex locus GCC_COLORS @r{capability}
5253 @item locus=
5254 SGR substring for location information, @samp{file:line} or
5255 @samp{file:line:column} etc.
5257 @vindex quote GCC_COLORS @r{capability}
5258 @item quote=
5259 SGR substring for information printed within quotes.
5261 @vindex fnname GCC_COLORS @r{capability}
5262 @item fnname=
5263 SGR substring for names of C++ functions.
5265 @vindex targs GCC_COLORS @r{capability}
5266 @item targs=
5267 SGR substring for C++ function template parameter bindings.
5269 @vindex fixit-insert GCC_COLORS @r{capability}
5270 @item fixit-insert=
5271 SGR substring for fix-it hints suggesting text to
5272 be inserted or replaced.
5274 @vindex fixit-delete GCC_COLORS @r{capability}
5275 @item fixit-delete=
5276 SGR substring for fix-it hints suggesting text to
5277 be deleted.
5279 @vindex diff-filename GCC_COLORS @r{capability}
5280 @item diff-filename=
5281 SGR substring for filename headers within generated patches.
5283 @vindex diff-hunk GCC_COLORS @r{capability}
5284 @item diff-hunk=
5285 SGR substring for the starts of hunks within generated patches.
5287 @vindex diff-delete GCC_COLORS @r{capability}
5288 @item diff-delete=
5289 SGR substring for deleted lines within generated patches.
5291 @vindex diff-insert GCC_COLORS @r{capability}
5292 @item diff-insert=
5293 SGR substring for inserted lines within generated patches.
5295 @vindex type-diff GCC_COLORS @r{capability}
5296 @item type-diff=
5297 SGR substring for highlighting mismatching types within template
5298 arguments in the C++ frontend.
5299 @end table
5301 @opindex fdiagnostics-urls
5302 @cindex urls
5303 @vindex GCC_URLS @r{environment variable}
5304 @vindex TERM_URLS @r{environment variable}
5305 @item -fdiagnostics-urls[=@var{WHEN}]
5306 Use escape sequences to embed URLs in diagnostics.  For example, when
5307 @option{-fdiagnostics-show-option} emits text showing the command-line
5308 option controlling a diagnostic, embed a URL for documentation of that
5309 option.
5311 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5312 @samp{auto} makes GCC use URL escape sequences only when the standard error
5313 is a terminal, and when not executing in an emacs shell or any graphical
5314 terminal which is known to be incompatible with this feature, see below.
5316 The default depends on how the compiler has been configured.
5317 It can be any of the above @var{WHEN} options.
5319 GCC can also be configured (via the
5320 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5321 so that the default is affected by environment variables.
5322 Under such a configuration, GCC defaults to using @samp{auto}
5323 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5324 present and non-empty in the environment of the compiler, or @samp{never}
5325 if neither are.
5327 However, even with @option{-fdiagnostics-urls=always} the behavior is
5328 dependent on those environment variables:
5329 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5330 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5331 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5332 Any other non-empty value enables the feature.
5333 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5334 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5335 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5337 At this time GCC tries to detect also a few terminals that are known to
5338 not implement the URL feature, and have bugs or at least had bugs in
5339 some versions that are still in use, where the URL escapes are likely
5340 to misbehave, i.e. print garbage on the screen.
5341 That list is currently xfce4-terminal, certain known to be buggy
5342 gnome-terminal versions, the linux console, and mingw.
5343 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5345 @opindex fno-diagnostics-show-option
5346 @opindex fdiagnostics-show-option
5347 @item -fno-diagnostics-show-option
5348 By default, each diagnostic emitted includes text indicating the
5349 command-line option that directly controls the diagnostic (if such an
5350 option is known to the diagnostic machinery).  Specifying the
5351 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5353 @opindex fno-diagnostics-show-caret
5354 @opindex fdiagnostics-show-caret
5355 @item -fno-diagnostics-show-caret
5356 By default, each diagnostic emitted includes the original source line
5357 and a caret @samp{^} indicating the column.  This option suppresses this
5358 information.  The source line is truncated to @var{n} characters, if
5359 the @option{-fmessage-length=n} option is given.  When the output is done
5360 to the terminal, the width is limited to the width given by the
5361 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5363 @opindex fno-diagnostics-show-labels
5364 @opindex fdiagnostics-show-labels
5365 @item -fno-diagnostics-show-labels
5366 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5367 diagnostics can label ranges of source code with pertinent information, such
5368 as the types of expressions:
5370 @smallexample
5371     printf ("foo %s bar", long_i + long_j);
5372                  ~^       ~~~~~~~~~~~~~~~
5373                   |              |
5374                   char *         long int
5375 @end smallexample
5377 This option suppresses the printing of these labels (in the example above,
5378 the vertical bars and the ``char *'' and ``long int'' text).
5380 @opindex fno-diagnostics-show-cwe
5381 @opindex fdiagnostics-show-cwe
5382 @item -fno-diagnostics-show-cwe
5383 Diagnostic messages can optionally have an associated
5384 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5385 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5386 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5387 By default, if this information is present, it will be printed with
5388 the diagnostic.  This option suppresses the printing of this metadata.
5390 @opindex fno-diagnostics-show-rules
5391 @opindex fdiagnostics-show-rules
5392 @item -fno-diagnostics-show-rules
5393 Diagnostic messages can optionally have rules associated with them, such
5394 as from a coding standard, or a specification.
5395 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5396 By default, if this information is present, it will be printed with
5397 the diagnostic.  This option suppresses the printing of this metadata.
5399 @opindex fno-diagnostics-show-line-numbers
5400 @opindex fdiagnostics-show-line-numbers
5401 @item -fno-diagnostics-show-line-numbers
5402 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5403 a left margin is printed, showing line numbers.  This option suppresses this
5404 left margin.
5406 @opindex fdiagnostics-minimum-margin-width
5407 @item -fdiagnostics-minimum-margin-width=@var{width}
5408 This option controls the minimum width of the left margin printed by
5409 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5411 @opindex fdiagnostics-parseable-fixits
5412 @item -fdiagnostics-parseable-fixits
5413 Emit fix-it hints in a machine-parseable format, suitable for consumption
5414 by IDEs.  For each fix-it, a line will be printed after the relevant
5415 diagnostic, starting with the string ``fix-it:''.  For example:
5417 @smallexample
5418 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5419 @end smallexample
5421 The location is expressed as a half-open range, expressed as a count of
5422 bytes, starting at byte 1 for the initial column.  In the above example,
5423 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5424 given string:
5426 @smallexample
5427 00000000011111111112222222222
5428 12345678901234567890123456789
5429   gtk_widget_showall (dlg);
5430   ^^^^^^^^^^^^^^^^^^
5431   gtk_widget_show_all
5432 @end smallexample
5434 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5435 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5436 (e.g. vertical tab as ``\013'').
5438 An empty replacement string indicates that the given range is to be removed.
5439 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5440 be inserted at the given position.
5442 @opindex fdiagnostics-generate-patch
5443 @item -fdiagnostics-generate-patch
5444 Print fix-it hints to stderr in unified diff format, after any diagnostics
5445 are printed.  For example:
5447 @smallexample
5448 --- test.c
5449 +++ test.c
5450 @@ -42,5 +42,5 @@
5452  void show_cb(GtkDialog *dlg)
5453  @{
5454 -  gtk_widget_showall(dlg);
5455 +  gtk_widget_show_all(dlg);
5456  @}
5458 @end smallexample
5460 The diff may or may not be colorized, following the same rules
5461 as for diagnostics (see @option{-fdiagnostics-color}).
5463 @opindex fdiagnostics-show-template-tree
5464 @item -fdiagnostics-show-template-tree
5466 In the C++ frontend, when printing diagnostics showing mismatching
5467 template types, such as:
5469 @smallexample
5470   could not convert 'std::map<int, std::vector<double> >()'
5471     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5472 @end smallexample
5474 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5475 tree-like structure showing the common and differing parts of the types,
5476 such as:
5478 @smallexample
5479   map<
5480     [...],
5481     vector<
5482       [double != float]>>
5483 @end smallexample
5485 The parts that differ are highlighted with color (``double'' and
5486 ``float'' in this case).
5488 @opindex fno-elide-type
5489 @opindex felide-type
5490 @item -fno-elide-type
5491 By default when the C++ frontend prints diagnostics showing mismatching
5492 template types, common parts of the types are printed as ``[...]'' to
5493 simplify the error message.  For example:
5495 @smallexample
5496   could not convert 'std::map<int, std::vector<double> >()'
5497     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5498 @end smallexample
5500 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5501 This flag also affects the output of the
5502 @option{-fdiagnostics-show-template-tree} flag.
5504 @opindex fdiagnostics-path-format
5505 @item -fdiagnostics-path-format=@var{KIND}
5506 Specify how to print paths of control-flow events for diagnostics that
5507 have such a path associated with them.
5509 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5510 the default.
5512 @samp{none} means to not print diagnostic paths.
5514 @samp{separate-events} means to print a separate ``note'' diagnostic for
5515 each event within the diagnostic.  For example:
5517 @smallexample
5518 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5519 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5520 test.c:27:3: note: (2) when 'i < count'
5521 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5522 @end smallexample
5524 @samp{inline-events} means to print the events ``inline'' within the source
5525 code.  This view attempts to consolidate the events into runs of
5526 sufficiently-close events, printing them as labelled ranges within the source.
5528 For example, the same events as above might be printed as:
5530 @smallexample
5531   'test': events 1-3
5532     |
5533     |   25 |   list = PyList_New(0);
5534     |      |          ^~~~~~~~~~~~~
5535     |      |          |
5536     |      |          (1) when 'PyList_New' fails, returning NULL
5537     |   26 |
5538     |   27 |   for (i = 0; i < count; i++) @{
5539     |      |   ~~~
5540     |      |   |
5541     |      |   (2) when 'i < count'
5542     |   28 |     item = PyLong_FromLong(random());
5543     |   29 |     PyList_Append(list, item);
5544     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5545     |      |     |
5546     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5547     |
5548 @end smallexample
5550 Interprocedural control flow is shown by grouping the events by stack frame,
5551 and using indentation to show how stack frames are nested, pushed, and popped.
5553 For example:
5555 @smallexample
5556   'test': events 1-2
5557     |
5558     |  133 | @{
5559     |      | ^
5560     |      | |
5561     |      | (1) entering 'test'
5562     |  134 |   boxed_int *obj = make_boxed_int (i);
5563     |      |                    ~~~~~~~~~~~~~~~~~~
5564     |      |                    |
5565     |      |                    (2) calling 'make_boxed_int'
5566     |
5567     +--> 'make_boxed_int': events 3-4
5568            |
5569            |  120 | @{
5570            |      | ^
5571            |      | |
5572            |      | (3) entering 'make_boxed_int'
5573            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5574            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5575            |      |                                    |
5576            |      |                                    (4) calling 'wrapped_malloc'
5577            |
5578            +--> 'wrapped_malloc': events 5-6
5579                   |
5580                   |    7 | @{
5581                   |      | ^
5582                   |      | |
5583                   |      | (5) entering 'wrapped_malloc'
5584                   |    8 |   return malloc (size);
5585                   |      |          ~~~~~~~~~~~~~
5586                   |      |          |
5587                   |      |          (6) calling 'malloc'
5588                   |
5589     <-------------+
5590     |
5591  'test': event 7
5592     |
5593     |  138 |   free_boxed_int (obj);
5594     |      |   ^~~~~~~~~~~~~~~~~~~~
5595     |      |   |
5596     |      |   (7) calling 'free_boxed_int'
5597     |
5598 (etc)
5599 @end smallexample
5601 @opindex fdiagnostics-show-path-depths
5602 @item -fdiagnostics-show-path-depths
5603 This option provides additional information when printing control-flow paths
5604 associated with a diagnostic.
5606 If this is option is provided then the stack depth will be printed for
5607 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5608 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5609 the stack depth and function declaration will be appended when printing
5610 each event.
5612 This is intended for use by GCC developers and plugin developers when
5613 debugging diagnostics that report interprocedural control flow.
5615 @opindex fno-show-column
5616 @opindex fshow-column
5617 @item -fno-show-column
5618 Do not print column numbers in diagnostics.  This may be necessary if
5619 diagnostics are being scanned by a program that does not understand the
5620 column numbers, such as @command{dejagnu}.
5622 @opindex fdiagnostics-column-unit
5623 @item -fdiagnostics-column-unit=@var{UNIT}
5624 Select the units for the column number.  This affects traditional diagnostics
5625 (in the absence of @option{-fno-show-column}), as well as JSON format
5626 diagnostics if requested.
5628 The default @var{UNIT}, @samp{display}, considers the number of display
5629 columns occupied by each character.  This may be larger than the number
5630 of bytes required to encode the character, in the case of tab
5631 characters, or it may be smaller, in the case of multibyte characters.
5632 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5633 display column, and its UTF-8 encoding requires two bytes; the character
5634 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5635 its UTF-8 encoding requires four bytes.
5637 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5638 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5640 @opindex fdiagnostics-column-origin
5641 @item -fdiagnostics-column-origin=@var{ORIGIN}
5642 Select the origin for column numbers, i.e. the column number assigned to the
5643 first column.  The default value of 1 corresponds to traditional GCC
5644 behavior and to the GNU style guide.  Some utilities may perform better with an
5645 origin of 0; any non-negative value may be specified.
5647 @opindex fdiagnostics-escape-format
5648 @item -fdiagnostics-escape-format=@var{FORMAT}
5649 When GCC prints pertinent source lines for a diagnostic it normally attempts
5650 to print the source bytes directly.  However, some diagnostics relate to encoding
5651 issues in the source file, such as malformed UTF-8, or issues with Unicode
5652 normalization.  These diagnostics are flagged so that GCC will escape bytes
5653 that are not printable ASCII when printing their pertinent source lines.
5655 This option controls how such bytes should be escaped.
5657 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5658 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5659 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5660 displayed as hexadecimal in the form @samp{<XX>}.
5662 For example, a source line containing the string @samp{before} followed by the
5663 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5664 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5665 the string @samp{after} will be printed for such a diagnostic as:
5667 @smallexample
5668  before<U+03C0><BF>after
5669 @end smallexample
5671 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5672 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5673 Unicode characters.  For the example above, the following will be printed:
5675 @smallexample
5676  before<CF><80><BF>after
5677 @end smallexample
5679 @opindex fdiagnostics-text-art-charset
5680 @item -fdiagnostics-text-art-charset=@var{CHARSET}
5681 Some diagnostics can contain ``text art'' diagrams: visualizations created
5682 from text, intended to be viewed in a monospaced font.
5684 This option selects which characters should be used for printing such
5685 diagrams, if any.  @var{CHARSET} is @samp{none}, @samp{ascii}, @samp{unicode},
5686 or @samp{emoji}.
5688 The @samp{none} value suppresses the printing of such diagrams.
5689 The @samp{ascii} value will ensure that such diagrams are pure ASCII
5690 (``ASCII art'').  The @samp{unicode} value will allow for conservative use of
5691 unicode drawing characters (such as box-drawing characters).  The @samp{emoji}
5692 value further adds the possibility of emoji in the output (such as emitting
5693 U+26A0 WARNING SIGN followed by U+FE0F VARIATION SELECTOR-16 to select the
5694 emoji variant of the character).
5696 The default is @samp{emoji}, except when the environment variable @env{LANG}
5697 is set to @samp{C}, in which case the default is @samp{ascii}.
5699 @opindex fdiagnostics-format
5700 @item -fdiagnostics-format=@var{FORMAT}
5701 Select a different format for printing diagnostics.
5702 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5703 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5705 The default is @samp{text}.
5707 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5708 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5709 named @file{@var{source}.sarif}, respectively.
5711 The @samp{json} format is a synonym for @samp{json-stderr}.
5712 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5713 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5714 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5716 The emitted JSON consists of a top-level JSON array containing JSON objects
5717 representing the diagnostics.  The JSON is emitted as one line, without
5718 formatting; the examples below have been formatted for clarity.
5720 Diagnostics can have child diagnostics.  For example, this error and note:
5722 @smallexample
5723 misleading-indentation.c:15:3: warning: this 'if' clause does not
5724   guard... [-Wmisleading-indentation]
5725    15 |   if (flag)
5726       |   ^~
5727 misleading-indentation.c:17:5: note: ...this statement, but the latter
5728   is misleadingly indented as if it were guarded by the 'if'
5729    17 |     y = 2;
5730       |     ^
5731 @end smallexample
5733 @noindent
5734 might be printed in JSON form (after formatting) like this:
5736 @smallexample
5738     @{
5739         "kind": "warning",
5740         "locations": [
5741             @{
5742                 "caret": @{
5743                     "display-column": 3,
5744                     "byte-column": 3,
5745                     "column": 3,
5746                     "file": "misleading-indentation.c",
5747                     "line": 15
5748                 @},
5749                 "finish": @{
5750                     "display-column": 4,
5751                     "byte-column": 4,
5752                     "column": 4,
5753                     "file": "misleading-indentation.c",
5754                     "line": 15
5755                 @}
5756             @}
5757         ],
5758         "message": "this \u2018if\u2019 clause does not guard...",
5759         "option": "-Wmisleading-indentation",
5760         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5761         "children": [
5762             @{
5763                 "kind": "note",
5764                 "locations": [
5765                     @{
5766                         "caret": @{
5767                             "display-column": 5,
5768                             "byte-column": 5,
5769                             "column": 5,
5770                             "file": "misleading-indentation.c",
5771                             "line": 17
5772                         @}
5773                     @}
5774                 ],
5775                 "escape-source": false,
5776                 "message": "...this statement, but the latter is @dots{}"
5777             @}
5778         ]
5779         "escape-source": false,
5780         "column-origin": 1,
5781     @}
5783 @end smallexample
5785 @noindent
5786 where the @code{note} is a child of the @code{warning}.
5788 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5789 an @code{option} key describing the command-line option controlling the
5790 warning.
5792 A diagnostic can contain zero or more locations.  Each location has an
5793 optional @code{label} string and up to three positions within it: a
5794 @code{caret} position and optional @code{start} and @code{finish} positions.
5795 A position is described by a @code{file} name, a @code{line} number, and
5796 three numbers indicating a column position:
5797 @itemize @bullet
5799 @item
5800 @code{display-column} counts display columns, accounting for tabs and
5801 multibyte characters.
5803 @item
5804 @code{byte-column} counts raw bytes.
5806 @item
5807 @code{column} is equal to one of
5808 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5809 option.
5811 @end itemize
5812 All three columns are relative to the origin specified by
5813 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5814 be set, for instance, to 0 for compatibility with other utilities that
5815 number columns from 0.  The column origin is recorded in the JSON output in
5816 the @code{column-origin} tag.  In the remaining examples below, the extra
5817 column number outputs have been omitted for brevity.
5819 For example, this error:
5821 @smallexample
5822 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5823    'struct s'@} and 'T' @{aka 'struct t'@})
5824    64 |   return callee_4a () + callee_4b ();
5825       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5826       |          |              |
5827       |          |              T @{aka struct t@}
5828       |          S @{aka struct s@}
5829 @end smallexample
5831 @noindent
5832 has three locations.  Its primary location is at the ``+'' token at column
5833 23.  It has two secondary locations, describing the left and right-hand sides
5834 of the expression, which have labels.  It might be printed in JSON form as:
5836 @smallexample
5837     @{
5838         "children": [],
5839         "kind": "error",
5840         "locations": [
5841             @{
5842                 "caret": @{
5843                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5844                 @}
5845             @},
5846             @{
5847                 "caret": @{
5848                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5849                 @},
5850                 "finish": @{
5851                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5852                 @},
5853                 "label": "S @{aka struct s@}"
5854             @},
5855             @{
5856                 "caret": @{
5857                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5858                 @},
5859                 "finish": @{
5860                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5861                 @},
5862                 "label": "T @{aka struct t@}"
5863             @}
5864         ],
5865         "escape-source": false,
5866         "message": "invalid operands to binary + @dots{}"
5867     @}
5868 @end smallexample
5870 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5871 consisting of half-open intervals, similar to the output of
5872 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5873 with a replacement fix-it hint:
5875 @smallexample
5876 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5877   mean 'color'?
5878     8 |   return ptr->colour;
5879       |               ^~~~~~
5880       |               color
5881 @end smallexample
5883 @noindent
5884 might be printed in JSON form as:
5886 @smallexample
5887     @{
5888         "children": [],
5889         "fixits": [
5890             @{
5891                 "next": @{
5892                     "column": 21,
5893                     "file": "demo.c",
5894                     "line": 8
5895                 @},
5896                 "start": @{
5897                     "column": 15,
5898                     "file": "demo.c",
5899                     "line": 8
5900                 @},
5901                 "string": "color"
5902             @}
5903         ],
5904         "kind": "error",
5905         "locations": [
5906             @{
5907                 "caret": @{
5908                     "column": 15,
5909                     "file": "demo.c",
5910                     "line": 8
5911                 @},
5912                 "finish": @{
5913                     "column": 20,
5914                     "file": "demo.c",
5915                     "line": 8
5916                 @}
5917             @}
5918         ],
5919         "escape-source": false,
5920         "message": "\u2018struct s\u2019 has no member named @dots{}"
5921     @}
5922 @end smallexample
5924 @noindent
5925 where the fix-it hint suggests replacing the text from @code{start} up
5926 to but not including @code{next} with @code{string}'s value.  Deletions
5927 are expressed via an empty value for @code{string}, insertions by
5928 having @code{start} equal @code{next}.
5930 If the diagnostic has a path of control-flow events associated with it,
5931 it has a @code{path} array of objects representing the events.  Each
5932 event object has a @code{description} string, a @code{location} object,
5933 along with a @code{function} string and a @code{depth} number for
5934 representing interprocedural paths.  The @code{function} represents the
5935 current function at that event, and the @code{depth} represents the
5936 stack depth relative to some baseline: the higher, the more frames are
5937 within the stack.
5939 For example, the intraprocedural example shown for
5940 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5942 @smallexample
5943     "path": [
5944         @{
5945             "depth": 0,
5946             "description": "when 'PyList_New' fails, returning NULL",
5947             "function": "test",
5948             "location": @{
5949                 "column": 10,
5950                 "file": "test.c",
5951                 "line": 25
5952             @}
5953         @},
5954         @{
5955             "depth": 0,
5956             "description": "when 'i < count'",
5957             "function": "test",
5958             "location": @{
5959                 "column": 3,
5960                 "file": "test.c",
5961                 "line": 27
5962             @}
5963         @},
5964         @{
5965             "depth": 0,
5966             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5967             "function": "test",
5968             "location": @{
5969                 "column": 5,
5970                 "file": "test.c",
5971                 "line": 29
5972             @}
5973         @}
5974     ]
5975 @end smallexample
5977 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5978 non-ASCII bytes should be escaped when printing the pertinent lines of
5979 source code (@code{true} for diagnostics involving source encoding issues).
5981 @end table
5983 @node Warning Options
5984 @section Options to Request or Suppress Warnings
5985 @cindex options to control warnings
5986 @cindex warning messages
5987 @cindex messages, warning
5988 @cindex suppressing warnings
5990 Warnings are diagnostic messages that report constructions that
5991 are not inherently erroneous but that are risky or suggest there
5992 may have been an error.
5994 The following language-independent options do not enable specific
5995 warnings but control the kinds of diagnostics produced by GCC@.
5997 @table @gcctabopt
5998 @cindex syntax checking
5999 @opindex fsyntax-only
6000 @item -fsyntax-only
6001 Check the code for syntax errors, but don't do anything beyond that.
6003 @opindex fmax-errors
6004 @item -fmax-errors=@var{n}
6005 Limits the maximum number of error messages to @var{n}, at which point
6006 GCC bails out rather than attempting to continue processing the source
6007 code.  If @var{n} is 0 (the default), there is no limit on the number
6008 of error messages produced.  If @option{-Wfatal-errors} is also
6009 specified, then @option{-Wfatal-errors} takes precedence over this
6010 option.
6012 @opindex w
6013 @item -w
6014 Inhibit all warning messages.
6016 @opindex Werror
6017 @opindex Wno-error
6018 @item -Werror
6019 Make all warnings into errors.
6021 @opindex Werror=
6022 @opindex Wno-error=
6023 @item -Werror=
6024 Make the specified warning into an error.  The specifier for a warning
6025 is appended; for example @option{-Werror=switch} turns the warnings
6026 controlled by @option{-Wswitch} into errors.  This switch takes a
6027 negative form, to be used to negate @option{-Werror} for specific
6028 warnings; for example @option{-Wno-error=switch} makes
6029 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
6030 is in effect.
6032 The warning message for each controllable warning includes the
6033 option that controls the warning.  That option can then be used with
6034 @option{-Werror=} and @option{-Wno-error=} as described above.
6035 (Printing of the option in the warning message can be disabled using the
6036 @option{-fno-diagnostics-show-option} flag.)
6038 Note that specifying @option{-Werror=}@var{foo} automatically implies
6039 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
6040 imply anything.
6042 @opindex Wfatal-errors
6043 @opindex Wno-fatal-errors
6044 @item -Wfatal-errors
6045 This option causes the compiler to abort compilation on the first error
6046 occurred rather than trying to keep going and printing further error
6047 messages.
6049 @end table
6051 You can request many specific warnings with options beginning with
6052 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6053 implicit declarations.  Each of these specific warning options also
6054 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6055 example, @option{-Wno-implicit}.  This manual lists only one of the
6056 two forms, whichever is not the default.  For further
6057 language-specific options also refer to @ref{C++ Dialect Options} and
6058 @ref{Objective-C and Objective-C++ Dialect Options}.
6059 Additional warnings can be produced by enabling the static analyzer;
6060 @xref{Static Analyzer Options}.
6062 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6063 options, such as @option{-Wunused}, which may turn on further options,
6064 such as @option{-Wunused-value}. The combined effect of positive and
6065 negative forms is that more specific options have priority over less
6066 specific ones, independently of their position in the command-line. For
6067 options of the same specificity, the last one takes effect. Options
6068 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6069 as if they appeared at the end of the command-line.
6071 When an unrecognized warning option is requested (e.g.,
6072 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6073 that the option is not recognized.  However, if the @option{-Wno-} form
6074 is used, the behavior is slightly different: no diagnostic is
6075 produced for @option{-Wno-unknown-warning} unless other diagnostics
6076 are being produced.  This allows the use of new @option{-Wno-} options
6077 with old compilers, but if something goes wrong, the compiler
6078 warns that an unrecognized option is present.
6080 The effectiveness of some warnings depends on optimizations also being
6081 enabled. For example @option{-Wsuggest-final-types} is more effective
6082 with link-time optimization and some instances of other warnings may
6083 not be issued at all unless optimization is enabled.  While optimization
6084 in general improves the efficacy of control and data flow sensitive
6085 warnings, in some cases it may also cause false positives.
6087 @table @gcctabopt
6088 @opindex pedantic
6089 @opindex Wpedantic
6090 @opindex Wno-pedantic
6091 @item -Wpedantic
6092 @itemx -pedantic
6093 Issue all the warnings demanded by strict ISO C and ISO C++;
6094 diagnose all programs that use forbidden extensions, and some other
6095 programs that do not follow ISO C and ISO C++.  This follows the version
6096 of the ISO C or C++ standard specified by any @option{-std} option used.
6098 Valid ISO C and ISO C++ programs should compile properly with or without
6099 this option (though a rare few require @option{-ansi} or a
6100 @option{-std} option specifying the version of the standard)@.  However,
6101 without this option, certain GNU extensions and traditional C and C++
6102 features are supported as well.  With this option, they are diagnosed
6103 (or rejected with @option{-pedantic-errors}).
6105 @option{-Wpedantic} does not cause warning messages for use of the
6106 alternate keywords whose names begin and end with @samp{__}.  This alternate
6107 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6108 i.e. @samp{__intN__}.
6109 Pedantic warnings are also disabled in the expression that follows
6110 @code{__extension__}.  However, only system header files should use
6111 these escape routes; application programs should avoid them.
6112 @xref{Alternate Keywords}.
6114 Some warnings about non-conforming programs are controlled by options
6115 other than @option{-Wpedantic}; in many cases they are implied by
6116 @option{-Wpedantic} but can be disabled separately by their specific
6117 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6119 Where the standard specified with @option{-std} represents a GNU
6120 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6121 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6122 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6123 where they are required by the base standard.  (It does not make sense
6124 for such warnings to be given only for features not in the specified GNU
6125 C dialect, since by definition the GNU dialects of C include all
6126 features the compiler supports with the given option, and there would be
6127 nothing to warn about.)
6129 @opindex pedantic-errors
6130 @item -pedantic-errors
6131 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6132 requires a diagnostic, in some cases where there is undefined behavior
6133 at compile-time and in some other cases that do not prevent compilation
6134 of programs that are valid according to the standard. This is not
6135 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6136 useful, as it only makes errors of the diagnostics that are controlled by
6137 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6138 are always enabled or controlled by options other than @option{-Wpedantic}.
6140 If you want the required diagnostics that are warnings by default to
6141 be errors instead, but don't also want to enable the @option{-Wpedantic}
6142 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6143 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6144 only as warnings).
6146 Some required diagnostics are errors by default, but can be reduced to
6147 warnings using @option{-fpermissive} or their specific warning option,
6148 e.g. @option{-Wno-error=narrowing}.
6150 Some diagnostics for non-ISO practices are controlled by specific
6151 warning options other than @option{-Wpedantic}, but are also made
6152 errors by @option{-pedantic-errors}.  For instance:
6154 @gccoptlist{
6155 -Wattributes @r{(for standard attributes)}
6156 -Wchanges-meaning @r{(C++)}
6157 -Wcomma-subscript @r{(C++23 or later)}
6158 -Wdeclaration-after-statement @r{(C90 or earlier)}
6159 -Welaborated-enum-base @r{(C++11 or later)}
6160 -Wimplicit-int @r{(C99 or later)}
6161 -Wimplicit-function-declaration @r{(C99 or later)}
6162 -Wincompatible-pointer-types
6163 -Wint-conversion
6164 -Wlong-long @r{(C90 or earlier)}
6165 -Wmain
6166 -Wnarrowing @r{(C++11 or later)}
6167 -Wpointer-arith
6168 -Wpointer-sign
6169 -Wincompatible-pointer-types
6170 -Wregister @r{(C++17 or later)}
6171 -Wvla @r{(C90 or earlier)}
6172 -Wwrite-strings @r{(C++11 or later)}
6175 @opindex fpermissive
6176 @item -fpermissive
6177 Downgrade some required diagnostics about nonconformant code from
6178 errors to warnings.  Thus, using @option{-fpermissive} allows some
6179 nonconforming code to compile.  Some C++ diagnostics are controlled
6180 only by this flag, but it also downgrades some C and C++ diagnostics
6181 that have their own flag:
6183 @gccoptlist{
6184 -Wnarrowing @r{(C++)}
6187 The @option{-fpermissive} option is the default for historic C language
6188 modes (@option{-std=c89}, @option{-std=gnu89}, @option{-std=c90},
6189 @option{-std=gnu90}).
6191 @opindex Wall
6192 @opindex Wno-all
6193 @item -Wall
6194 This enables all the warnings about constructions that some users
6195 consider questionable, and that are easy to avoid (or modify to
6196 prevent the warning), even in conjunction with macros.  This also
6197 enables some language-specific warnings described in @ref{C++ Dialect
6198 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6200 @option{-Wall} turns on the following warning flags:
6202 @gccoptlist{-Waddress
6203 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6204 -Warray-compare
6205 -Warray-parameter=2 @r{(C and Objective-C only)}
6206 -Wbool-compare
6207 -Wbool-operation
6208 -Wc++11-compat  -Wc++14-compat
6209 -Wcatch-value @r{(C++ and Objective-C++ only)}
6210 -Wchar-subscripts
6211 -Wcomment
6212 -Wdangling-pointer=2
6213 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6214 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6215 -Wenum-int-mismatch @r{(C and Objective-C only)}
6216 -Wformat
6217 -Wformat-overflow
6218 -Wformat-truncation
6219 -Wint-in-bool-context
6220 -Wimplicit @r{(C and Objective-C only)}
6221 -Wimplicit-int @r{(C and Objective-C only)}
6222 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6223 -Winit-self @r{(only for C++)}
6224 -Wlogical-not-parentheses
6225 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6226 -Wmaybe-uninitialized
6227 -Wmemset-elt-size
6228 -Wmemset-transposed-args
6229 -Wmisleading-indentation @r{(only for C/C++)}
6230 -Wmismatched-dealloc
6231 -Wmismatched-new-delete @r{(only for C/C++)}
6232 -Wmissing-attributes
6233 -Wmissing-braces @r{(only for C/ObjC)}
6234 -Wmultistatement-macros
6235 -Wnarrowing @r{(only for C++)}
6236 -Wnonnull
6237 -Wnonnull-compare
6238 -Wopenmp-simd
6239 -Wparentheses
6240 -Wpessimizing-move @r{(only for C++)}
6241 -Wpointer-sign
6242 -Wrange-loop-construct @r{(only for C++)}
6243 -Wreorder
6244 -Wrestrict
6245 -Wreturn-type
6246 -Wself-move @r{(only for C++)}
6247 -Wsequence-point
6248 -Wsign-compare @r{(only in C++)}
6249 -Wsizeof-array-div
6250 -Wsizeof-pointer-div
6251 -Wsizeof-pointer-memaccess
6252 -Wstrict-aliasing
6253 -Wstrict-overflow=1
6254 -Wswitch
6255 -Wtautological-compare
6256 -Wtrigraphs
6257 -Wuninitialized
6258 -Wunknown-pragmas
6259 -Wunused-function
6260 -Wunused-label
6261 -Wunused-value
6262 -Wunused-variable
6263 -Wuse-after-free=2
6264 -Wvla-parameter @r{(C and Objective-C only)}
6265 -Wvolatile-register-var
6266 -Wzero-length-bounds}
6268 Note that some warning flags are not implied by @option{-Wall}.  Some of
6269 them warn about constructions that users generally do not consider
6270 questionable, but which occasionally you might wish to check for;
6271 others warn about constructions that are necessary or hard to avoid in
6272 some cases, and there is no simple way to modify the code to suppress
6273 the warning. Some of them are enabled by @option{-Wextra} but many of
6274 them must be enabled individually.
6276 @opindex W
6277 @opindex Wextra
6278 @opindex Wno-extra
6279 @item -Wextra
6280 This enables some extra warning flags that are not enabled by
6281 @option{-Wall}. (This option used to be called @option{-W}.  The older
6282 name is still supported, but the newer name is more descriptive.)
6284 @gccoptlist{-Wclobbered
6285 -Wcast-function-type
6286 -Wdeprecated-copy @r{(C++ only)}
6287 -Wempty-body
6288 -Wenum-conversion @r{(C only)}
6289 -Wignored-qualifiers
6290 -Wimplicit-fallthrough=3
6291 -Wmissing-field-initializers
6292 -Wmissing-parameter-type @r{(C only)}
6293 -Wold-style-declaration @r{(C only)}
6294 -Woverride-init
6295 -Wsign-compare @r{(C only)}
6296 -Wstring-compare
6297 -Wredundant-move @r{(only for C++)}
6298 -Wtype-limits
6299 -Wuninitialized
6300 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6301 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6302 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6305 The option @option{-Wextra} also prints warning messages for the
6306 following cases:
6308 @itemize @bullet
6310 @item
6311 A pointer is compared against integer zero with @code{<}, @code{<=},
6312 @code{>}, or @code{>=}.
6314 @item
6315 (C++ only) An enumerator and a non-enumerator both appear in a
6316 conditional expression.
6318 @item
6319 (C++ only) Ambiguous virtual bases.
6321 @item
6322 (C++ only) Subscripting an array that has been declared @code{register}.
6324 @item
6325 (C++ only) Taking the address of a variable that has been declared
6326 @code{register}.
6328 @item
6329 (C++ only) A base class is not initialized in the copy constructor
6330 of a derived class.
6332 @end itemize
6334 @opindex Wabi
6335 @opindex Wno-abi
6336 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6338 Warn about code affected by ABI changes.  This includes code that may
6339 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6340 for the particular target.
6342 Since G++ now defaults to updating the ABI with each major release,
6343 normally @option{-Wabi} warns only about C++ ABI compatibility
6344 problems if there is a check added later in a release series for an
6345 ABI issue discovered since the initial release.  @option{-Wabi} warns
6346 about more things if an older ABI version is selected (with
6347 @option{-fabi-version=@var{n}}).
6349 @option{-Wabi} can also be used with an explicit version number to
6350 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6351 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6352 @option{-fabi-version=2}.
6354 If an explicit version number is provided and
6355 @option{-fabi-compat-version} is not specified, the version number
6356 from this option is used for compatibility aliases.  If no explicit
6357 version number is provided with this option, but
6358 @option{-fabi-compat-version} is specified, that version number is
6359 used for C++ ABI warnings.
6361 Although an effort has been made to warn about
6362 all such cases, there are probably some cases that are not warned about,
6363 even though G++ is generating incompatible code.  There may also be
6364 cases where warnings are emitted even though the code that is generated
6365 is compatible.
6367 You should rewrite your code to avoid these warnings if you are
6368 concerned about the fact that code generated by G++ may not be binary
6369 compatible with code generated by other compilers.
6371 Known incompatibilities in @option{-fabi-version=2} (which was the
6372 default from GCC 3.4 to 4.9) include:
6374 @itemize @bullet
6376 @item
6377 A template with a non-type template parameter of reference type was
6378 mangled incorrectly:
6379 @smallexample
6380 extern int N;
6381 template <int &> struct S @{@};
6382 void n (S<N>) @{2@}
6383 @end smallexample
6385 This was fixed in @option{-fabi-version=3}.
6387 @item
6388 SIMD vector types declared using @code{__attribute ((vector_size))} were
6389 mangled in a non-standard way that does not allow for overloading of
6390 functions taking vectors of different sizes.
6392 The mangling was changed in @option{-fabi-version=4}.
6394 @item
6395 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6396 qualifiers, and @code{decltype} of a plain declaration was folded away.
6398 These mangling issues were fixed in @option{-fabi-version=5}.
6400 @item
6401 Scoped enumerators passed as arguments to a variadic function are
6402 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6403 On most targets this does not actually affect the parameter passing
6404 ABI, as there is no way to pass an argument smaller than @code{int}.
6406 Also, the ABI changed the mangling of template argument packs,
6407 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6408 a class scope function used as a template argument.
6410 These issues were corrected in @option{-fabi-version=6}.
6412 @item
6413 Lambdas in default argument scope were mangled incorrectly, and the
6414 ABI changed the mangling of @code{nullptr_t}.
6416 These issues were corrected in @option{-fabi-version=7}.
6418 @item
6419 When mangling a function type with function-cv-qualifiers, the
6420 un-qualified function type was incorrectly treated as a substitution
6421 candidate.
6423 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6425 @item
6426 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6427 unaligned accesses.  Note that this did not affect the ABI of a
6428 function with a @code{nullptr_t} parameter, as parameters have a
6429 minimum alignment.
6431 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6433 @item
6434 Target-specific attributes that affect the identity of a type, such as
6435 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6436 did not affect the mangled name, leading to name collisions when
6437 function pointers were used as template arguments.
6439 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6441 @end itemize
6443 This option also enables warnings about psABI-related changes.
6444 The known psABI changes at this point include:
6446 @itemize @bullet
6448 @item
6449 For SysV/x86-64, unions with @code{long double} members are
6450 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6451 the case.  For example:
6453 @smallexample
6454 union U @{
6455   long double ld;
6456   int i;
6458 @end smallexample
6460 @noindent
6461 @code{union U} is now always passed in memory.
6463 @end itemize
6465 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6466 C++ requires that unqualified uses of a name within a class have the
6467 same meaning in the complete scope of the class, so declaring the name
6468 after using it is ill-formed:
6469 @smallexample
6470 struct A;
6471 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6472 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6473 @end smallexample
6474 By default, the B1 case is only a warning because the two declarations
6475 have the same type, while the B2 case is an error.  Both diagnostics
6476 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6477 error case can be reduced to a warning with
6478 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6480 Both diagnostics are also suppressed by @option{-fms-extensions}.
6482 @opindex Wchar-subscripts
6483 @opindex Wno-char-subscripts
6484 @item -Wchar-subscripts
6485 Warn if an array subscript has type @code{char}.  This is a common cause
6486 of error, as programmers often forget that this type is signed on some
6487 machines.
6488 This warning is enabled by @option{-Wall}.
6490 @opindex Wno-coverage-mismatch
6491 @opindex Wcoverage-mismatch
6492 @item -Wno-coverage-mismatch
6493 Warn if feedback profiles do not match when using the
6494 @option{-fprofile-use} option.
6495 If a source file is changed between compiling with @option{-fprofile-generate}
6496 and with @option{-fprofile-use}, the files with the profile feedback can fail
6497 to match the source file and GCC cannot use the profile feedback
6498 information.  By default, this warning is enabled and is treated as an
6499 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6500 warning or @option{-Wno-error=coverage-mismatch} can be used to
6501 disable the error.  Disabling the error for this warning can result in
6502 poorly optimized code and is useful only in the
6503 case of very minor changes such as bug fixes to an existing code-base.
6504 Completely disabling the warning is not recommended.
6506 @opindex Wno-coverage-invalid-line-number
6507 @opindex Wcoverage-invalid-line-number
6508 @item -Wno-coverage-invalid-line-number
6509 Warn in case a function ends earlier than it begins due
6510 to an invalid linenum macros.  The warning is emitted only
6511 with @option{--coverage} enabled.
6513 By default, this warning is enabled and is treated as an
6514 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6515 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6516 disable the error.
6518 @opindex Wno-cpp
6519 @opindex Wcpp
6520 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6521 Suppress warning messages emitted by @code{#warning} directives.
6523 @opindex Wdouble-promotion
6524 @opindex Wno-double-promotion
6525 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6526 Give a warning when a value of type @code{float} is implicitly
6527 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6528 floating-point unit implement @code{float} in hardware, but emulate
6529 @code{double} in software.  On such a machine, doing computations
6530 using @code{double} values is much more expensive because of the
6531 overhead required for software emulation.
6533 It is easy to accidentally do computations with @code{double} because
6534 floating-point literals are implicitly of type @code{double}.  For
6535 example, in:
6536 @smallexample
6537 @group
6538 float area(float radius)
6540    return 3.14159 * radius * radius;
6542 @end group
6543 @end smallexample
6544 the compiler performs the entire computation with @code{double}
6545 because the floating-point literal is a @code{double}.
6547 @opindex Wduplicate-decl-specifier
6548 @opindex Wno-duplicate-decl-specifier
6549 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6550 Warn if a declaration has duplicate @code{const}, @code{volatile},
6551 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6552 @option{-Wall}.
6554 @opindex Wformat
6555 @opindex Wno-format
6556 @opindex ffreestanding
6557 @opindex fno-builtin
6558 @opindex Wformat=
6559 @item -Wformat
6560 @itemx -Wformat=@var{n}
6561 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6562 the arguments supplied have types appropriate to the format string
6563 specified, and that the conversions specified in the format string make
6564 sense.  This includes standard functions, and others specified by format
6565 attributes (@pxref{Function Attributes}), in the @code{printf},
6566 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6567 not in the C standard) families (or other target-specific families).
6568 Which functions are checked without format attributes having been
6569 specified depends on the standard version selected, and such checks of
6570 functions without the attribute specified are disabled by
6571 @option{-ffreestanding} or @option{-fno-builtin}.
6573 The formats are checked against the format features supported by GNU
6574 libc version 2.2.  These include all ISO C90 and C99 features, as well
6575 as features from the Single Unix Specification and some BSD and GNU
6576 extensions.  Other library implementations may not support all these
6577 features; GCC does not support warning about features that go beyond a
6578 particular library's limitations.  However, if @option{-Wpedantic} is used
6579 with @option{-Wformat}, warnings are given about format features not
6580 in the selected standard version (but not for @code{strfmon} formats,
6581 since those are not in any version of the C standard).  @xref{C Dialect
6582 Options,,Options Controlling C Dialect}.
6584 @table @gcctabopt
6585 @opindex Wformat
6586 @opindex Wformat=1
6587 @item -Wformat=1
6588 @itemx -Wformat
6589 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6590 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6591 @option{-Wformat} also checks for null format arguments for several
6592 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6593 aspects of this level of format checking can be disabled by the
6594 options: @option{-Wno-format-contains-nul},
6595 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6596 @option{-Wformat} is enabled by @option{-Wall}.
6598 @opindex Wformat=2
6599 @item -Wformat=2
6600 Enable @option{-Wformat} plus additional format checks.  Currently
6601 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6602 -Wformat-y2k}.
6603 @end table
6605 @opindex Wno-format-contains-nul
6606 @opindex Wformat-contains-nul
6607 @item -Wno-format-contains-nul
6608 If @option{-Wformat} is specified, do not warn about format strings that
6609 contain NUL bytes.
6611 @opindex Wno-format-extra-args
6612 @opindex Wformat-extra-args
6613 @item -Wno-format-extra-args
6614 If @option{-Wformat} is specified, do not warn about excess arguments to a
6615 @code{printf} or @code{scanf} format function.  The C standard specifies
6616 that such arguments are ignored.
6618 Where the unused arguments lie between used arguments that are
6619 specified with @samp{$} operand number specifications, normally
6620 warnings are still given, since the implementation could not know what
6621 type to pass to @code{va_arg} to skip the unused arguments.  However,
6622 in the case of @code{scanf} formats, this option suppresses the
6623 warning if the unused arguments are all pointers, since the Single
6624 Unix Specification says that such unused arguments are allowed.
6626 @opindex Wformat-overflow
6627 @opindex Wno-format-overflow
6628 @item -Wformat-overflow
6629 @itemx -Wformat-overflow=@var{level}
6630 Warn about calls to formatted input/output functions such as @code{sprintf}
6631 and @code{vsprintf} that might overflow the destination buffer.  When the
6632 exact number of bytes written by a format directive cannot be determined
6633 at compile-time it is estimated based on heuristics that depend on the
6634 @var{level} argument and on optimization.  While enabling optimization
6635 will in most cases improve the accuracy of the warning, it may also
6636 result in false positives.
6638 @table @gcctabopt
6639 @opindex Wformat-overflow
6640 @opindex Wno-format-overflow
6641 @item -Wformat-overflow
6642 @itemx -Wformat-overflow=1
6643 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6644 employs a conservative approach that warns only about calls that most
6645 likely overflow the buffer.  At this level, numeric arguments to format
6646 directives with unknown values are assumed to have the value of one, and
6647 strings of unknown length to be empty.  Numeric arguments that are known
6648 to be bounded to a subrange of their type, or string arguments whose output
6649 is bounded either by their directive's precision or by a finite set of
6650 string literals, are assumed to take on the value within the range that
6651 results in the most bytes on output.  For example, the call to @code{sprintf}
6652 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6653 the terminating NUL character (@code{'\0'}) appended by the function
6654 to the destination buffer will be written past its end.  Increasing
6655 the size of the buffer by a single byte is sufficient to avoid the
6656 warning, though it may not be sufficient to avoid the overflow.
6658 @smallexample
6659 void f (int a, int b)
6661   char buf [13];
6662   sprintf (buf, "a = %i, b = %i\n", a, b);
6664 @end smallexample
6666 @item -Wformat-overflow=2
6667 Level @var{2} warns also about calls that might overflow the destination
6668 buffer given an argument of sufficient length or magnitude.  At level
6669 @var{2}, unknown numeric arguments are assumed to have the minimum
6670 representable value for signed types with a precision greater than 1, and
6671 the maximum representable value otherwise.  Unknown string arguments whose
6672 length cannot be assumed to be bounded either by the directive's precision,
6673 or by a finite set of string literals they may evaluate to, or the character
6674 array they may point to, are assumed to be 1 character long.
6676 At level @var{2}, the call in the example above is again diagnosed, but
6677 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6678 @code{%i} directive will write some of its digits beyond the end of
6679 the destination buffer.  To make the call safe regardless of the values
6680 of the two variables, the size of the destination buffer must be increased
6681 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6682 an informational note following the warning.
6684 An alternative to increasing the size of the destination buffer is to
6685 constrain the range of formatted values.  The maximum length of string
6686 arguments can be bounded by specifying the precision in the format
6687 directive.  When numeric arguments of format directives can be assumed
6688 to be bounded by less than the precision of their type, choosing
6689 an appropriate length modifier to the format specifier will reduce
6690 the required buffer size.  For example, if @var{a} and @var{b} in the
6691 example above can be assumed to be within the precision of
6692 the @code{short int} type then using either the @code{%hi} format
6693 directive or casting the argument to @code{short} reduces the maximum
6694 required size of the buffer to 24 bytes.
6696 @smallexample
6697 void f (int a, int b)
6699   char buf [23];
6700   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6702 @end smallexample
6703 @end table
6705 @opindex Wno-format-zero-length
6706 @opindex Wformat-zero-length
6707 @item -Wno-format-zero-length
6708 If @option{-Wformat} is specified, do not warn about zero-length formats.
6709 The C standard specifies that zero-length formats are allowed.
6711 @opindex Wformat-nonliteral
6712 @opindex Wno-format-nonliteral
6713 @item -Wformat-nonliteral
6714 If @option{-Wformat} is specified, also warn if the format string is not a
6715 string literal and so cannot be checked, unless the format function
6716 takes its format arguments as a @code{va_list}.
6718 @opindex Wformat-security
6719 @opindex Wno-format-security
6720 @item -Wformat-security
6721 If @option{-Wformat} is specified, also warn about uses of format
6722 functions that represent possible security problems.  At present, this
6723 warns about calls to @code{printf} and @code{scanf} functions where the
6724 format string is not a string literal and there are no format arguments,
6725 as in @code{printf (foo);}.  This may be a security hole if the format
6726 string came from untrusted input and contains @samp{%n}.  (This is
6727 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6728 in future warnings may be added to @option{-Wformat-security} that are not
6729 included in @option{-Wformat-nonliteral}.)
6731 @opindex Wformat-signedness
6732 @opindex Wno-format-signedness
6733 @item -Wformat-signedness
6734 If @option{-Wformat} is specified, also warn if the format string
6735 requires an unsigned argument and the argument is signed and vice versa.
6737 @opindex Wformat-truncation
6738 @opindex Wno-format-truncation
6739 @item -Wformat-truncation
6740 @itemx -Wformat-truncation=@var{level}
6741 Warn about calls to formatted input/output functions such as @code{snprintf}
6742 and @code{vsnprintf} that might result in output truncation.  When the exact
6743 number of bytes written by a format directive cannot be determined at
6744 compile-time it is estimated based on heuristics that depend on
6745 the @var{level} argument and on optimization.  While enabling optimization
6746 will in most cases improve the accuracy of the warning, it may also result
6747 in false positives.  Except as noted otherwise, the option uses the same
6748 logic @option{-Wformat-overflow}.
6750 @table @gcctabopt
6751 @opindex Wformat-truncation
6752 @opindex Wno-format-truncation
6753 @item -Wformat-truncation
6754 @itemx -Wformat-truncation=1
6755 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6756 employs a conservative approach that warns only about calls to bounded
6757 functions whose return value is unused and that will most likely result
6758 in output truncation.
6760 @item -Wformat-truncation=2
6761 Level @var{2} warns also about calls to bounded functions whose return
6762 value is used and that might result in truncation given an argument of
6763 sufficient length or magnitude.
6764 @end table
6766 @opindex Wformat-y2k
6767 @opindex Wno-format-y2k
6768 @item -Wformat-y2k
6769 If @option{-Wformat} is specified, also warn about @code{strftime}
6770 formats that may yield only a two-digit year.
6772 @opindex Wnonnull
6773 @opindex Wno-nonnull
6774 @item -Wnonnull
6775 Warn about passing a null pointer for arguments marked as
6776 requiring a non-null value by the @code{nonnull} function attribute.
6778 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6779 can be disabled with the @option{-Wno-nonnull} option.
6781 @opindex Wnonnull-compare
6782 @opindex Wno-nonnull-compare
6783 @item -Wnonnull-compare
6784 Warn when comparing an argument marked with the @code{nonnull}
6785 function attribute against null inside the function.
6787 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6788 can be disabled with the @option{-Wno-nonnull-compare} option.
6790 @opindex Wnull-dereference
6791 @opindex Wno-null-dereference
6792 @item -Wnull-dereference
6793 Warn if the compiler detects paths that trigger erroneous or
6794 undefined behavior due to dereferencing a null pointer.  This option
6795 is only active when @option{-fdelete-null-pointer-checks} is active,
6796 which is enabled by optimizations in most targets.  The precision of
6797 the warnings depends on the optimization options used.
6799 @opindex Wnrvo
6800 @opindex Wno-nrvo
6801 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6802 Warn if the compiler does not elide the copy from a local variable to
6803 the return value of a function in a context where it is allowed by
6804 [class.copy.elision].  This elision is commonly known as the Named
6805 Return Value Optimization.  For instance, in the example below the
6806 compiler cannot elide copies from both v1 and v2, so it elides neither.
6808 @smallexample
6809 std::vector<int> f()
6811   std::vector<int> v1, v2;
6812   // ...
6813   if (cond) return v1;
6814   else return v2; // warning: not eliding copy
6816 @end smallexample
6818 @opindex Winfinite-recursion
6819 @opindex Wno-infinite-recursion
6820 @item -Winfinite-recursion
6821 Warn about infinitely recursive calls.  The warning is effective at all
6822 optimization levels but requires optimization in order to detect infinite
6823 recursion in calls between two or more functions.
6824 @option{-Winfinite-recursion} is included in @option{-Wall}.
6826 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6827 similar diagnostic, but is implemented in a different way (as part of
6828 @option{-fanalyzer}).
6830 @opindex Winit-self
6831 @opindex Wno-init-self
6832 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6833 Warn about uninitialized variables that are initialized with themselves.
6834 Note this option can only be used with the @option{-Wuninitialized} option.
6836 For example, GCC warns about @code{i} being uninitialized in the
6837 following snippet only when @option{-Winit-self} has been specified:
6838 @smallexample
6839 @group
6840 int f()
6842   int i = i;
6843   return i;
6845 @end group
6846 @end smallexample
6848 This warning is enabled by @option{-Wall} in C++.
6850 @opindex Wimplicit-int
6851 @opindex Wno-implicit-int
6852 @item -Wno-implicit-int @r{(C and Objective-C only)}
6853 This option controls warnings when a declaration does not specify a type.
6854 This warning is enabled by default in C99 and later dialects of C,
6855 and also by @option{-Wall}.
6857 This warning is upgraded to an error by @option{-pedantic-errors}.
6859 @opindex Wimplicit-function-declaration
6860 @opindex Wno-implicit-function-declaration
6861 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6862 This option controls warnings when a function is used before being declared.
6863 This warning is enabled by default in C99 and later dialects of C,
6864 and also by @option{-Wall}.
6866 This warning is upgraded to an error by @option{-pedantic-errors}.
6868 @opindex Wimplicit
6869 @opindex Wno-implicit
6870 @item -Wimplicit @r{(C and Objective-C only)}
6871 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6872 This warning is enabled by @option{-Wall}.
6874 @opindex Wimplicit-fallthrough
6875 @opindex Wno-implicit-fallthrough
6876 @item -Wimplicit-fallthrough
6877 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6878 and @option{-Wno-implicit-fallthrough} is the same as
6879 @option{-Wimplicit-fallthrough=0}.
6881 @opindex Wimplicit-fallthrough=
6882 @item -Wimplicit-fallthrough=@var{n}
6883 Warn when a switch case falls through.  For example:
6885 @smallexample
6886 @group
6887 switch (cond)
6888   @{
6889   case 1:
6890     a = 1;
6891     break;
6892   case 2:
6893     a = 2;
6894   case 3:
6895     a = 3;
6896     break;
6897   @}
6898 @end group
6899 @end smallexample
6901 This warning does not warn when the last statement of a case cannot
6902 fall through, e.g. when there is a return statement or a call to function
6903 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6904 also takes into account control flow statements, such as ifs, and only
6905 warns when appropriate.  E.g.@:
6907 @smallexample
6908 @group
6909 switch (cond)
6910   @{
6911   case 1:
6912     if (i > 3) @{
6913       bar (5);
6914       break;
6915     @} else if (i < 1) @{
6916       bar (0);
6917     @} else
6918       return;
6919   default:
6920     @dots{}
6921   @}
6922 @end group
6923 @end smallexample
6925 Since there are occasions where a switch case fall through is desirable,
6926 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6927 to be used along with a null statement to suppress this warning that
6928 would normally occur:
6930 @smallexample
6931 @group
6932 switch (cond)
6933   @{
6934   case 1:
6935     bar (0);
6936     __attribute__ ((fallthrough));
6937   default:
6938     @dots{}
6939   @}
6940 @end group
6941 @end smallexample
6943 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6944 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6945 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6946 Instead of these attributes, it is also possible to add a fallthrough comment
6947 to silence the warning.  The whole body of the C or C++ style comment should
6948 match the given regular expressions listed below.  The option argument @var{n}
6949 specifies what kind of comments are accepted:
6951 @itemize @bullet
6953 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6955 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6956 expression, any comment is used as fallthrough comment.
6958 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6959 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6961 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6962 following regular expressions:
6964 @itemize @bullet
6966 @item @code{-fallthrough}
6968 @item @code{@@fallthrough@@}
6970 @item @code{lint -fallthrough[ \t]*}
6972 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6974 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6976 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6978 @end itemize
6980 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6981 following regular expressions:
6983 @itemize @bullet
6985 @item @code{-fallthrough}
6987 @item @code{@@fallthrough@@}
6989 @item @code{lint -fallthrough[ \t]*}
6991 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6993 @end itemize
6995 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6996 fallthrough comments, only attributes disable the warning.
6998 @end itemize
7000 The comment needs to be followed after optional whitespace and other comments
7001 by @code{case} or @code{default} keywords or by a user label that precedes some
7002 @code{case} or @code{default} label.
7004 @smallexample
7005 @group
7006 switch (cond)
7007   @{
7008   case 1:
7009     bar (0);
7010     /* FALLTHRU */
7011   default:
7012     @dots{}
7013   @}
7014 @end group
7015 @end smallexample
7017 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
7019 @opindex Wif-not-aligned
7020 @opindex Wno-if-not-aligned
7021 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7022 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
7023 should be issued.  These warnings are enabled by default.
7025 @opindex Wignored-qualifiers
7026 @opindex Wno-ignored-qualifiers
7027 @item -Wignored-qualifiers @r{(C and C++ only)}
7028 Warn if the return type of a function has a type qualifier
7029 such as @code{const}.  For ISO C such a type qualifier has no effect,
7030 since the value returned by a function is not an lvalue.
7031 For C++, the warning is only emitted for scalar types or @code{void}.
7032 ISO C prohibits qualified @code{void} return types on function
7033 definitions, so such return types always receive a warning
7034 even without this option.
7036 This warning is also enabled by @option{-Wextra}.
7038 @opindex Wignored-attributes
7039 @opindex Wno-ignored-attributes
7040 @item -Wno-ignored-attributes @r{(C and C++ only)}
7041 This option controls warnings when an attribute is ignored.
7042 This is different from the
7043 @option{-Wattributes} option in that it warns whenever the compiler decides
7044 to drop an attribute, not that the attribute is either unknown, used in a
7045 wrong place, etc.  This warning is enabled by default.
7047 @opindex Wmain
7048 @opindex Wno-main
7049 @item -Wmain
7050 Warn if the type of @code{main} is suspicious.  @code{main} should be
7051 a function with external linkage, returning int, taking either zero
7052 arguments, two, or three arguments of appropriate types.  This warning
7053 is enabled by default in C++ and is enabled by either @option{-Wall}
7054 or @option{-Wpedantic}.
7056 This warning is upgraded to an error by @option{-pedantic-errors}.
7058 @opindex Wmisleading-indentation
7059 @opindex Wno-misleading-indentation
7060 @item -Wmisleading-indentation @r{(C and C++ only)}
7061 Warn when the indentation of the code does not reflect the block structure.
7062 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
7063 @code{for} clauses with a guarded statement that does not use braces,
7064 followed by an unguarded statement with the same indentation.
7066 In the following example, the call to ``bar'' is misleadingly indented as
7067 if it were guarded by the ``if'' conditional.
7069 @smallexample
7070   if (some_condition ())
7071     foo ();
7072     bar ();  /* Gotcha: this is not guarded by the "if".  */
7073 @end smallexample
7075 In the case of mixed tabs and spaces, the warning uses the
7076 @option{-ftabstop=} option to determine if the statements line up
7077 (defaulting to 8).
7079 The warning is not issued for code involving multiline preprocessor logic
7080 such as the following example.
7082 @smallexample
7083   if (flagA)
7084     foo (0);
7085 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7086   if (flagB)
7087 #endif
7088     foo (1);
7089 @end smallexample
7091 The warning is not issued after a @code{#line} directive, since this
7092 typically indicates autogenerated code, and no assumptions can be made
7093 about the layout of the file that the directive references.
7095 This warning is enabled by @option{-Wall} in C and C++.
7097 @opindex Wmissing-attributes
7098 @opindex Wno-missing-attributes
7099 @item -Wmissing-attributes
7100 Warn when a declaration of a function is missing one or more attributes
7101 that a related function is declared with and whose absence may adversely
7102 affect the correctness or efficiency of generated code.  For example,
7103 the warning is issued for declarations of aliases that use attributes
7104 to specify less restrictive requirements than those of their targets.
7105 This typically represents a potential optimization opportunity.
7106 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7107 issued when the alias is more restrictive than the target, which could
7108 lead to incorrect code generation.
7109 Attributes considered include @code{alloc_align}, @code{alloc_size},
7110 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7111 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7112 @code{returns_nonnull}, and @code{returns_twice}.
7114 In C++, the warning is issued when an explicit specialization of a primary
7115 template declared with attribute @code{alloc_align}, @code{alloc_size},
7116 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7117 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7118 @code{error}, and @code{warning} suppress the warning.
7119 (@pxref{Function Attributes}).
7121 You can use the @code{copy} attribute to apply the same
7122 set of attributes to a declaration as that on another declaration without
7123 explicitly enumerating the attributes. This attribute can be applied
7124 to declarations of functions (@pxref{Common Function Attributes}),
7125 variables (@pxref{Common Variable Attributes}), or types
7126 (@pxref{Common Type Attributes}).
7128 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7130 For example, since the declaration of the primary function template
7131 below makes use of both attribute @code{malloc} and @code{alloc_size}
7132 the declaration of the explicit specialization of the template is
7133 diagnosed because it is missing one of the attributes.
7135 @smallexample
7136 template <class T>
7137 T* __attribute__ ((malloc, alloc_size (1)))
7138 allocate (size_t);
7140 template <>
7141 void* __attribute__ ((malloc))   // missing alloc_size
7142 allocate<void> (size_t);
7143 @end smallexample
7145 @opindex Wmissing-braces
7146 @opindex Wno-missing-braces
7147 @item -Wmissing-braces
7148 Warn if an aggregate or union initializer is not fully bracketed.  In
7149 the following example, the initializer for @code{a} is not fully
7150 bracketed, but that for @code{b} is fully bracketed.
7152 @smallexample
7153 int a[2][2] = @{ 0, 1, 2, 3 @};
7154 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7155 @end smallexample
7157 This warning is enabled by @option{-Wall}.
7159 @opindex Wmissing-include-dirs
7160 @opindex Wno-missing-include-dirs
7161 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7162 Warn if a user-supplied include directory does not exist. This option is disabled
7163 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7164 enabled by default by warning for -I and -J, only.
7166 @opindex Wmissing-profile
7167 @opindex Wno-missing-profile
7168 @item -Wno-missing-profile
7169 This option controls warnings if feedback profiles are missing when using the
7170 @option{-fprofile-use} option.
7171 This option diagnoses those cases where a new function or a new file is added
7172 between compiling with @option{-fprofile-generate} and with
7173 @option{-fprofile-use}, without regenerating the profiles.
7174 In these cases, the profile feedback data files do not contain any
7175 profile feedback information for
7176 the newly added function or file respectively.  Also, in the case when profile
7177 count data (.gcda) files are removed, GCC cannot use any profile feedback
7178 information.  In all these cases, warnings are issued to inform you that a
7179 profile generation step is due.
7180 Ignoring the warning can result in poorly optimized code.
7181 @option{-Wno-missing-profile} can be used to
7182 disable the warning, but this is not recommended and should be done only
7183 when non-existent profile data is justified.
7185 @opindex Wmismatched-dealloc
7186 @opindex Wno-mismatched-dealloc
7187 @item -Wmismatched-dealloc
7189 Warn for calls to deallocation functions with pointer arguments returned
7190 from from allocations functions for which the former isn't a suitable
7191 deallocator.  A pair of functions can be associated as matching allocators
7192 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7193 the @option{-fno-builtin} option the standard functions @code{calloc},
7194 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7195 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7196 associated as matching allocators and deallocators.  In the following
7197 example @code{mydealloc} is the deallocator for pointers returned from
7198 @code{myalloc}.
7200 @smallexample
7201 void mydealloc (void*);
7203 __attribute__ ((malloc (mydealloc, 1))) void*
7204 myalloc (size_t);
7206 void f (void)
7208   void *p = myalloc (32);
7209   // @dots{}use p@dots{}
7210   free (p);   // warning: not a matching deallocator for myalloc
7211   mydealloc (p);   // ok
7213 @end smallexample
7215 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7216 mismatches involving either @code{operator new} or @code{operator delete}.
7218 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7220 @opindex Wmultistatement-macros
7221 @opindex Wno-multistatement-macros
7222 @item -Wmultistatement-macros
7223 Warn about unsafe multiple statement macros that appear to be guarded
7224 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7225 @code{while}, in which only the first statement is actually guarded after
7226 the macro is expanded.
7228 For example:
7230 @smallexample
7231 #define DOIT x++; y++
7232 if (c)
7233   DOIT;
7234 @end smallexample
7236 will increment @code{y} unconditionally, not just when @code{c} holds.
7237 The can usually be fixed by wrapping the macro in a do-while loop:
7238 @smallexample
7239 #define DOIT do @{ x++; y++; @} while (0)
7240 if (c)
7241   DOIT;
7242 @end smallexample
7244 This warning is enabled by @option{-Wall} in C and C++.
7246 @opindex Wparentheses
7247 @opindex Wno-parentheses
7248 @item -Wparentheses
7249 Warn if parentheses are omitted in certain contexts, such
7250 as when there is an assignment in a context where a truth value
7251 is expected, or when operators are nested whose precedence people
7252 often get confused about.
7254 Also warn if a comparison like @code{x<=y<=z} appears; this is
7255 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7256 interpretation from that of ordinary mathematical notation.
7258 Also warn for dangerous uses of the GNU extension to
7259 @code{?:} with omitted middle operand. When the condition
7260 in the @code{?}: operator is a boolean expression, the omitted value is
7261 always 1.  Often programmers expect it to be a value computed
7262 inside the conditional expression instead.
7264 For C++ this also warns for some cases of unnecessary parentheses in
7265 declarations, which can indicate an attempt at a function call instead
7266 of a declaration:
7267 @smallexample
7269   // Declares a local variable called mymutex.
7270   std::unique_lock<std::mutex> (mymutex);
7271   // User meant std::unique_lock<std::mutex> lock (mymutex);
7273 @end smallexample
7275 This warning is enabled by @option{-Wall}.
7277 @opindex Wself-move
7278 @opindex Wno-self-move
7279 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7280 This warning warns when a value is moved to itself with @code{std::move}.
7281 Such a @code{std::move} typically has no effect.
7283 @smallexample
7284 struct T @{
7285 @dots{}
7287 void fn()
7289   T t;
7290   @dots{}
7291   t = std::move (t);
7293 @end smallexample
7295 This warning is enabled by @option{-Wall}.
7297 @opindex Wsequence-point
7298 @opindex Wno-sequence-point
7299 @item -Wsequence-point
7300 Warn about code that may have undefined semantics because of violations
7301 of sequence point rules in the C and C++ standards.
7303 The C and C++ standards define the order in which expressions in a C/C++
7304 program are evaluated in terms of @dfn{sequence points}, which represent
7305 a partial ordering between the execution of parts of the program: those
7306 executed before the sequence point, and those executed after it.  These
7307 occur after the evaluation of a full expression (one which is not part
7308 of a larger expression), after the evaluation of the first operand of a
7309 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7310 function is called (but after the evaluation of its arguments and the
7311 expression denoting the called function), and in certain other places.
7312 Other than as expressed by the sequence point rules, the order of
7313 evaluation of subexpressions of an expression is not specified.  All
7314 these rules describe only a partial order rather than a total order,
7315 since, for example, if two functions are called within one expression
7316 with no sequence point between them, the order in which the functions
7317 are called is not specified.  However, the standards committee have
7318 ruled that function calls do not overlap.
7320 It is not specified when between sequence points modifications to the
7321 values of objects take effect.  Programs whose behavior depends on this
7322 have undefined behavior; the C and C++ standards specify that ``Between
7323 the previous and next sequence point an object shall have its stored
7324 value modified at most once by the evaluation of an expression.
7325 Furthermore, the prior value shall be read only to determine the value
7326 to be stored.''.  If a program breaks these rules, the results on any
7327 particular implementation are entirely unpredictable.
7329 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7330 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7331 diagnosed by this option, and it may give an occasional false positive
7332 result, but in general it has been found fairly effective at detecting
7333 this sort of problem in programs.
7335 The C++17 standard will define the order of evaluation of operands in
7336 more cases: in particular it requires that the right-hand side of an
7337 assignment be evaluated before the left-hand side, so the above
7338 examples are no longer undefined.  But this option will still warn
7339 about them, to help people avoid writing code that is undefined in C
7340 and earlier revisions of C++.
7342 The standard is worded confusingly, therefore there is some debate
7343 over the precise meaning of the sequence point rules in subtle cases.
7344 Links to discussions of the problem, including proposed formal
7345 definitions, may be found on the GCC readings page, at
7346 @uref{https://gcc.gnu.org/@/readings.html}.
7348 This warning is enabled by @option{-Wall} for C and C++.
7350 @opindex Wno-return-local-addr
7351 @opindex Wreturn-local-addr
7352 @item -Wno-return-local-addr
7353 Do not warn about returning a pointer (or in C++, a reference) to a
7354 variable that goes out of scope after the function returns.
7356 @opindex Wreturn-mismatch
7357 @opindex Wno-return-mismatch
7358 @item -Wreturn-mismatch
7359 Warn about return statements without an expressions in functions which
7360 do not return @code{void}.  Also warn about a @code{return} statement
7361 with an expression in a function whose return type is @code{void},
7362 unless the expression type is also @code{void}.  As a GNU extension, the
7363 latter case is accepted without a warning unless @option{-Wpedantic} is
7364 used.
7366 Attempting to use the return value of a non-@code{void} function other
7367 than @code{main} that flows off the end by reaching the closing curly
7368 brace that terminates the function is undefined.
7370 This warning is specific to C and enabled by default.
7372 @opindex Wreturn-type
7373 @opindex Wno-return-type
7374 @item -Wreturn-type
7375 Warn whenever a function is defined with a return type that defaults to
7376 @code{int} (unless @option{-Wimplicit-int} is active, which takes
7377 precedence).  Also warn if execution may reach the end of the function
7378 body, or if the function does not contain any return statement at all.
7380 Attempting to use the return value of a non-@code{void} function other
7381 than @code{main} that flows off the end by reaching the closing curly
7382 brace that terminates the function is undefined.
7384 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7385 than @code{main} results in undefined behavior even when the value of
7386 the function is not used.
7388 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7390 @opindex Wshift-count-negative
7391 @opindex Wno-shift-count-negative
7392 @item -Wno-shift-count-negative
7393 Controls warnings if a shift count is negative.
7394 This warning is enabled by default.
7396 @opindex Wshift-count-overflow
7397 @opindex Wno-shift-count-overflow
7398 @item -Wno-shift-count-overflow
7399 Controls warnings if a shift count is greater than or equal to the bit width
7400 of the type.  This warning is enabled by default.
7402 @opindex Wshift-negative-value
7403 @opindex Wno-shift-negative-value
7404 @item -Wshift-negative-value
7405 Warn if left shifting a negative value.  This warning is enabled by
7406 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7408 @opindex Wshift-overflow
7409 @opindex Wno-shift-overflow
7410 @item -Wno-shift-overflow
7411 @itemx -Wshift-overflow=@var{n}
7412 These options control warnings about left shift overflows.
7414 @table @gcctabopt
7415 @item -Wshift-overflow=1
7416 This is the warning level of @option{-Wshift-overflow} and is enabled
7417 by default in C99 and C++11 modes (and newer).  This warning level does
7418 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7419 an overflow is still rejected in contexts where an integer constant expression
7420 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7421 shifts always wrap.
7423 @item -Wshift-overflow=2
7424 This warning level also warns about left-shifting 1 into the sign bit,
7425 unless C++14 mode (or newer) is active.
7426 @end table
7428 @opindex Wswitch
7429 @opindex Wno-switch
7430 @item -Wswitch
7431 Warn whenever a @code{switch} statement has an index of enumerated type
7432 and lacks a @code{case} for one or more of the named codes of that
7433 enumeration.  (The presence of a @code{default} label prevents this
7434 warning.)  @code{case} labels outside the enumeration range also
7435 provoke warnings when this option is used (even if there is a
7436 @code{default} label).
7437 This warning is enabled by @option{-Wall}.
7439 @opindex Wswitch-default
7440 @opindex Wno-switch-default
7441 @item -Wswitch-default
7442 Warn whenever a @code{switch} statement does not have a @code{default}
7443 case.
7445 @opindex Wswitch-enum
7446 @opindex Wno-switch-enum
7447 @item -Wswitch-enum
7448 Warn whenever a @code{switch} statement has an index of enumerated type
7449 and lacks a @code{case} for one or more of the named codes of that
7450 enumeration.  @code{case} labels outside the enumeration range also
7451 provoke warnings when this option is used.  The only difference
7452 between @option{-Wswitch} and this option is that this option gives a
7453 warning about an omitted enumeration code even if there is a
7454 @code{default} label.
7456 @opindex Wswitch-bool
7457 @opindex Wno-switch-bool
7458 @item -Wno-switch-bool
7459 Do not warn when a @code{switch} statement has an index of boolean type
7460 and the case values are outside the range of a boolean type.
7461 It is possible to suppress this warning by casting the controlling
7462 expression to a type other than @code{bool}.  For example:
7463 @smallexample
7464 @group
7465 switch ((int) (a == 4))
7466   @{
7467   @dots{}
7468   @}
7469 @end group
7470 @end smallexample
7471 This warning is enabled by default for C and C++ programs.
7473 @opindex Wswitch-outside-range
7474 @opindex Wno-switch-outside-range
7475 @item -Wno-switch-outside-range
7476 This option controls warnings when a @code{switch} case has a value
7477 that is outside of its
7478 respective type range.  This warning is enabled by default for
7479 C and C++ programs.
7481 @opindex Wswitch-unreachable
7482 @opindex Wno-switch-unreachable
7483 @item -Wno-switch-unreachable
7484 Do not warn when a @code{switch} statement contains statements between the
7485 controlling expression and the first case label, which will never be
7486 executed.  For example:
7487 @smallexample
7488 @group
7489 switch (cond)
7490   @{
7491    i = 15;
7492   @dots{}
7493    case 5:
7494   @dots{}
7495   @}
7496 @end group
7497 @end smallexample
7498 @option{-Wswitch-unreachable} does not warn if the statement between the
7499 controlling expression and the first case label is just a declaration:
7500 @smallexample
7501 @group
7502 switch (cond)
7503   @{
7504    int i;
7505   @dots{}
7506    case 5:
7507    i = 5;
7508   @dots{}
7509   @}
7510 @end group
7511 @end smallexample
7512 This warning is enabled by default for C and C++ programs.
7514 @opindex Wsync-nand
7515 @opindex Wno-sync-nand
7516 @item -Wsync-nand @r{(C and C++ only)}
7517 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7518 built-in functions are used.  These functions changed semantics in GCC 4.4.
7520 @opindex Wtrivial-auto-var-init
7521 @opindex Wno-trivial-auto-var-init
7522 @item -Wtrivial-auto-var-init
7523 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7524 variable.  A common situation is an automatic variable that is declared
7525 between the controlling expression and the first case label of a @code{switch}
7526 statement.
7528 @opindex Wunused-but-set-parameter
7529 @opindex Wno-unused-but-set-parameter
7530 @item -Wunused-but-set-parameter
7531 Warn whenever a function parameter is assigned to, but otherwise unused
7532 (aside from its declaration).
7534 To suppress this warning use the @code{unused} attribute
7535 (@pxref{Variable Attributes}).
7537 This warning is also enabled by @option{-Wunused} together with
7538 @option{-Wextra}.
7540 @opindex Wunused-but-set-variable
7541 @opindex Wno-unused-but-set-variable
7542 @item -Wunused-but-set-variable
7543 Warn whenever a local variable is assigned to, but otherwise unused
7544 (aside from its declaration).
7545 This warning is enabled by @option{-Wall}.
7547 To suppress this warning use the @code{unused} attribute
7548 (@pxref{Variable Attributes}).
7550 This warning is also enabled by @option{-Wunused}, which is enabled
7551 by @option{-Wall}.
7553 @opindex Wunused-function
7554 @opindex Wno-unused-function
7555 @item -Wunused-function
7556 Warn whenever a static function is declared but not defined or a
7557 non-inline static function is unused.
7558 This warning is enabled by @option{-Wall}.
7560 @opindex Wunused-label
7561 @opindex Wno-unused-label
7562 @item -Wunused-label
7563 Warn whenever a label is declared but not used.
7564 This warning is enabled by @option{-Wall}.
7566 To suppress this warning use the @code{unused} attribute
7567 (@pxref{Variable Attributes}).
7569 @opindex Wunused-local-typedefs
7570 @opindex Wno-unused-local-typedefs
7571 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7572 Warn when a typedef locally defined in a function is not used.
7573 This warning is enabled by @option{-Wall}.
7575 @opindex Wunused-parameter
7576 @opindex Wno-unused-parameter
7577 @item -Wunused-parameter
7578 Warn whenever a function parameter is unused aside from its declaration.
7580 To suppress this warning use the @code{unused} attribute
7581 (@pxref{Variable Attributes}).
7583 @opindex Wunused-result
7584 @opindex Wno-unused-result
7585 @item -Wno-unused-result
7586 Do not warn if a caller of a function marked with attribute
7587 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7588 its return value. The default is @option{-Wunused-result}.
7590 @opindex Wunused-variable
7591 @opindex Wno-unused-variable
7592 @item -Wunused-variable
7593 Warn whenever a local or static variable is unused aside from its
7594 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7595 but not for C++. This warning is enabled by @option{-Wall}.
7597 To suppress this warning use the @code{unused} attribute
7598 (@pxref{Variable Attributes}).
7600 @opindex Wunused-const-variable
7601 @opindex Wno-unused-const-variable
7602 @item -Wunused-const-variable
7603 @itemx -Wunused-const-variable=@var{n}
7604 Warn whenever a constant static variable is unused aside from its declaration.
7605 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7606 for C, but not for C++. In C this declares variable storage, but in C++ this
7607 is not an error since const variables take the place of @code{#define}s.
7609 To suppress this warning use the @code{unused} attribute
7610 (@pxref{Variable Attributes}).
7612 @table @gcctabopt
7613 @item -Wunused-const-variable=1
7614 This is the warning level that is enabled by @option{-Wunused-variable} for
7615 C.  It warns only about unused static const variables defined in the main
7616 compilation unit, but not about static const variables declared in any
7617 header included.
7619 @item -Wunused-const-variable=2
7620 This warning level also warns for unused constant static variables in
7621 headers (excluding system headers).  This is the warning level of
7622 @option{-Wunused-const-variable} and must be explicitly requested since
7623 in C++ this isn't an error and in C it might be harder to clean up all
7624 headers included.
7625 @end table
7627 @opindex Wunused-value
7628 @opindex Wno-unused-value
7629 @item -Wunused-value
7630 Warn whenever a statement computes a result that is explicitly not
7631 used. To suppress this warning cast the unused expression to
7632 @code{void}. This includes an expression-statement or the left-hand
7633 side of a comma expression that contains no side effects. For example,
7634 an expression such as @code{x[i,j]} causes a warning, while
7635 @code{x[(void)i,j]} does not.
7637 This warning is enabled by @option{-Wall}.
7639 @opindex Wunused
7640 @opindex Wno-unused
7641 @item -Wunused
7642 All the above @option{-Wunused} options combined.
7644 In order to get a warning about an unused function parameter, you must
7645 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7646 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7648 @opindex Wuninitialized
7649 @opindex Wno-uninitialized
7650 @item -Wuninitialized
7651 Warn if an object with automatic or allocated storage duration is used
7652 without having been initialized.  In C++, also warn if a non-static
7653 reference or non-static @code{const} member appears in a class without
7654 constructors.
7656 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7657 object to a @code{const}-qualified argument of a built-in function known to
7658 read the object is also diagnosed by this warning.
7659 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7661 If you want to warn about code that uses the uninitialized value of the
7662 variable in its own initializer, use the @option{-Winit-self} option.
7664 These warnings occur for individual uninitialized elements of
7665 structure, union or array variables as well as for variables that are
7666 uninitialized as a whole.  They do not occur for variables or elements
7667 declared @code{volatile}.  Because these warnings depend on
7668 optimization, the exact variables or elements for which there are
7669 warnings depend on the precise optimization options and version of GCC
7670 used.
7672 Note that there may be no warning about a variable that is used only
7673 to compute a value that itself is never used, because such
7674 computations may be deleted by data flow analysis before the warnings
7675 are printed.
7677 In C++, this warning also warns about using uninitialized objects in
7678 member-initializer-lists.  For example, GCC warns about @code{b} being
7679 uninitialized in the following snippet:
7681 @smallexample
7682 struct A @{
7683   int a;
7684   int b;
7685   A() : a(b) @{ @}
7687 @end smallexample
7689 @opindex Winvalid-memory-model
7690 @opindex Wno-invalid-memory-model
7691 @item -Wno-invalid-memory-model
7692 This option controls warnings
7693 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7694 and the C11 atomic generic functions with a memory consistency argument
7695 that is either invalid for the operation or outside the range of values
7696 of the @code{memory_order} enumeration.  For example, since the
7697 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7698 defined for the relaxed, release, and sequentially consistent memory
7699 orders the following code is diagnosed:
7701 @smallexample
7702 void store (int *i)
7704   __atomic_store_n (i, 0, memory_order_consume);
7706 @end smallexample
7708 @option{-Winvalid-memory-model} is enabled by default.
7710 @opindex Wmaybe-uninitialized
7711 @opindex Wno-maybe-uninitialized
7712 @item -Wmaybe-uninitialized
7713 For an object with automatic or allocated storage duration, if there exists
7714 a path from the function entry to a use of the object that is initialized,
7715 but there exist some other paths for which the object is not initialized,
7716 the compiler emits a warning if it cannot prove the uninitialized paths
7717 are not executed at run time.
7719 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7720 object to a @code{const}-qualified function argument is also diagnosed by
7721 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7722 known to read the object.)  Annotating the function with attribute
7723 @code{access (none)} indicates that the argument isn't used to access
7724 the object and avoids the warning (@pxref{Common Function Attributes}).
7726 These warnings are only possible in optimizing compilation, because otherwise
7727 GCC does not keep track of the state of variables.
7729 These warnings are made optional because GCC may not be able to determine when
7730 the code is correct in spite of appearing to have an error.  Here is one
7731 example of how this can happen:
7733 @smallexample
7734 @group
7736   int x;
7737   switch (y)
7738     @{
7739     case 1: x = 1;
7740       break;
7741     case 2: x = 4;
7742       break;
7743     case 3: x = 5;
7744     @}
7745   foo (x);
7747 @end group
7748 @end smallexample
7750 @noindent
7751 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7752 always initialized, but GCC doesn't know this. To suppress the
7753 warning, you need to provide a default case with assert(0) or
7754 similar code.
7756 @cindex @code{longjmp} warnings
7757 This option also warns when a non-volatile automatic variable might be
7758 changed by a call to @code{longjmp}.
7759 The compiler sees only the calls to @code{setjmp}.  It cannot know
7760 where @code{longjmp} will be called; in fact, a signal handler could
7761 call it at any point in the code.  As a result, you may get a warning
7762 even when there is in fact no problem because @code{longjmp} cannot
7763 in fact be called at the place that would cause a problem.
7765 Some spurious warnings can be avoided if you declare all the functions
7766 you use that never return as @code{noreturn}.  @xref{Function
7767 Attributes}.
7769 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7771 @opindex Wunknown-pragmas
7772 @opindex Wno-unknown-pragmas
7773 @cindex warning for unknown pragmas
7774 @cindex unknown pragmas, warning
7775 @cindex pragmas, warning of unknown
7776 @item -Wunknown-pragmas
7777 Warn when a @code{#pragma} directive is encountered that is not understood by 
7778 GCC@.  If this command-line option is used, warnings are even issued
7779 for unknown pragmas in system header files.  This is not the case if
7780 the warnings are only enabled by the @option{-Wall} command-line option.
7782 @opindex Wno-pragmas
7783 @opindex Wpragmas
7784 @item -Wno-pragmas
7785 Do not warn about misuses of pragmas, such as incorrect parameters,
7786 invalid syntax, or conflicts between pragmas.  See also
7787 @option{-Wunknown-pragmas}.
7789 @opindex Wno-prio-ctor-dtor
7790 @opindex Wprio-ctor-dtor
7791 @item -Wno-prio-ctor-dtor
7792 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7793 The use of constructor and destructor attributes allow you to assign a
7794 priority to the constructor/destructor to control its order of execution
7795 before @code{main} is called or after it returns.  The priority values must be
7796 greater than 100 as the compiler reserves priority values between 0--100 for
7797 the implementation.
7799 @opindex Wstrict-aliasing
7800 @opindex Wno-strict-aliasing
7801 @item -Wstrict-aliasing
7802 This option is only active when @option{-fstrict-aliasing} is active.
7803 It warns about code that might break the strict aliasing rules that the
7804 compiler is using for optimization.  The warning does not catch all
7805 cases, but does attempt to catch the more common pitfalls.  It is
7806 included in @option{-Wall}.
7807 It is equivalent to @option{-Wstrict-aliasing=3}
7809 @opindex Wstrict-aliasing=n
7810 @item -Wstrict-aliasing=n
7811 This option is only active when @option{-fstrict-aliasing} is active.
7812 It warns about code that might break the strict aliasing rules that the
7813 compiler is using for optimization.
7814 Higher levels correspond to higher accuracy (fewer false positives).
7815 Higher levels also correspond to more effort, similar to the way @option{-O} 
7816 works.
7817 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7819 Level 1: Most aggressive, quick, least accurate.
7820 Possibly useful when higher levels
7821 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7822 false negatives.  However, it has many false positives.
7823 Warns for all pointer conversions between possibly incompatible types,
7824 even if never dereferenced.  Runs in the front end only.
7826 Level 2: Aggressive, quick, not too precise.
7827 May still have many false positives (not as many as level 1 though),
7828 and few false negatives (but possibly more than level 1).
7829 Unlike level 1, it only warns when an address is taken.  Warns about
7830 incomplete types.  Runs in the front end only.
7832 Level 3 (default for @option{-Wstrict-aliasing}):
7833 Should have very few false positives and few false
7834 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7835 Takes care of the common pun+dereference pattern in the front end:
7836 @code{*(int*)&some_float}.
7837 If optimization is enabled, it also runs in the back end, where it deals
7838 with multiple statement cases using flow-sensitive points-to information.
7839 Only warns when the converted pointer is dereferenced.
7840 Does not warn about incomplete types.
7842 @opindex Wstrict-overflow
7843 @opindex Wno-strict-overflow
7844 @item -Wstrict-overflow
7845 @itemx -Wstrict-overflow=@var{n}
7846 This option is only active when signed overflow is undefined.
7847 It warns about cases where the compiler optimizes based on the
7848 assumption that signed overflow does not occur.  Note that it does not
7849 warn about all cases where the code might overflow: it only warns
7850 about cases where the compiler implements some optimization.  Thus
7851 this warning depends on the optimization level.
7853 An optimization that assumes that signed overflow does not occur is
7854 perfectly safe if the values of the variables involved are such that
7855 overflow never does, in fact, occur.  Therefore this warning can
7856 easily give a false positive: a warning about code that is not
7857 actually a problem.  To help focus on important issues, several
7858 warning levels are defined.  No warnings are issued for the use of
7859 undefined signed overflow when estimating how many iterations a loop
7860 requires, in particular when determining whether a loop will be
7861 executed at all.
7863 @table @gcctabopt
7864 @item -Wstrict-overflow=1
7865 Warn about cases that are both questionable and easy to avoid.  For
7866 example the compiler simplifies
7867 @code{x + 1 > x} to @code{1}.  This level of
7868 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7869 are not, and must be explicitly requested.
7871 @item -Wstrict-overflow=2
7872 Also warn about other cases where a comparison is simplified to a
7873 constant.  For example: @code{abs (x) >= 0}.  This can only be
7874 simplified when signed integer overflow is undefined, because
7875 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7876 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7877 @option{-Wstrict-overflow=2}.
7879 @item -Wstrict-overflow=3
7880 Also warn about other cases where a comparison is simplified.  For
7881 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7883 @item -Wstrict-overflow=4
7884 Also warn about other simplifications not covered by the above cases.
7885 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7887 @item -Wstrict-overflow=5
7888 Also warn about cases where the compiler reduces the magnitude of a
7889 constant involved in a comparison.  For example: @code{x + 2 > y} is
7890 simplified to @code{x + 1 >= y}.  This is reported only at the
7891 highest warning level because this simplification applies to many
7892 comparisons, so this warning level gives a very large number of
7893 false positives.
7894 @end table
7896 @opindex Wstring-compare
7897 @opindex Wno-string-compare
7898 @item -Wstring-compare
7899 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7900 determined to be either zero or non-zero in tests for such equality
7901 owing to the length of one argument being greater than the size of
7902 the array the other argument is stored in (or the bound in the case
7903 of @code{strncmp}).  Such calls could be mistakes.  For example,
7904 the call to @code{strcmp} below is diagnosed because its result is
7905 necessarily non-zero irrespective of the contents of the array @code{a}.
7907 @smallexample
7908 extern char a[4];
7909 void f (char *d)
7911   strcpy (d, "string");
7912   @dots{}
7913   if (0 == strcmp (a, d))   // cannot be true
7914     puts ("a and d are the same");
7916 @end smallexample
7918 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7920 @opindex Wstringop-overflow
7921 @opindex Wno-stringop-overflow
7922 @item -Wno-stringop-overflow
7923 @item -Wstringop-overflow
7924 @itemx -Wstringop-overflow=@var{type}
7925 Warn for calls to string manipulation functions such as @code{memcpy} and
7926 @code{strcpy} that are determined to overflow the destination buffer.  The
7927 optional argument is one greater than the type of Object Size Checking to
7928 perform to determine the size of the destination.  @xref{Object Size Checking}.
7929 The argument is meaningful only for functions that operate on character arrays
7930 but not for raw memory functions like @code{memcpy} which always make use
7931 of Object Size type-0.  The option also warns for calls that specify a size
7932 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7933 The option produces the best results with optimization enabled but can detect
7934 a small subset of simple buffer overflows even without optimization in
7935 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7936 correspond to the standard functions.  In any case, the option warns about
7937 just a subset of buffer overflows detected by the corresponding overflow
7938 checking built-ins.  For example, the option issues a warning for
7939 the @code{strcpy} call below because it copies at least 5 characters
7940 (the string @code{"blue"} including the terminating NUL) into the buffer
7941 of size 4.
7943 @smallexample
7944 enum Color @{ blue, purple, yellow @};
7945 const char* f (enum Color clr)
7947   static char buf [4];
7948   const char *str;
7949   switch (clr)
7950     @{
7951       case blue: str = "blue"; break;
7952       case purple: str = "purple"; break;
7953       case yellow: str = "yellow"; break;
7954     @}
7956   return strcpy (buf, str);   // warning here
7958 @end smallexample
7960 Option @option{-Wstringop-overflow=2} is enabled by default.
7962 @table @gcctabopt
7963 @opindex Wstringop-overflow
7964 @opindex Wno-stringop-overflow
7965 @item -Wstringop-overflow
7966 @itemx -Wstringop-overflow=1
7967 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7968 to determine the sizes of destination objects.  At this setting the option
7969 does not warn for writes past the end of subobjects of larger objects accessed
7970 by pointers unless the size of the largest surrounding object is known.  When
7971 the destination may be one of several objects it is assumed to be the largest
7972 one of them.  On Linux systems, when optimization is enabled at this setting
7973 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7974 is defined to a non-zero value.
7976 @item -Wstringop-overflow=2
7977 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7978 to determine the sizes of destination objects.  At this setting the option
7979 warns about overflows when writing to members of the largest complete
7980 objects whose exact size is known.  However, it does not warn for excessive
7981 writes to the same members of unknown objects referenced by pointers since
7982 they may point to arrays containing unknown numbers of elements.  This is
7983 the default setting of the option.
7985 @item -Wstringop-overflow=3
7986 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7987 to determine the sizes of destination objects.  At this setting the option
7988 warns about overflowing the smallest object or data member.  This is the
7989 most restrictive setting of the option that may result in warnings for safe
7990 code.
7992 @item -Wstringop-overflow=4
7993 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7994 to determine the sizes of destination objects.  At this setting the option
7995 warns about overflowing any data members, and when the destination is
7996 one of several objects it uses the size of the largest of them to decide
7997 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7998 setting of the option may result in warnings for benign code.
7999 @end table
8001 @opindex Wstringop-overread
8002 @opindex Wno-stringop-overread
8003 @item -Wno-stringop-overread
8004 Warn for calls to string manipulation functions such as @code{memchr}, or
8005 @code{strcpy} that are determined to read past the end of the source
8006 sequence.
8008 Option @option{-Wstringop-overread} is enabled by default.
8010 @opindex Wstringop-truncation
8011 @opindex Wno-stringop-truncation
8012 @item -Wno-stringop-truncation
8013 Do not warn for calls to bounded string manipulation functions
8014 such as @code{strncat},
8015 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
8016 or leave the destination unchanged.
8018 In the following example, the call to @code{strncat} specifies a bound that
8019 is less than the length of the source string.  As a result, the copy of
8020 the source will be truncated and so the call is diagnosed.  To avoid the
8021 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
8023 @smallexample
8024 void append (char *buf, size_t bufsize)
8026   strncat (buf, ".txt", 3);
8028 @end smallexample
8030 As another example, the following call to @code{strncpy} results in copying
8031 to @code{d} just the characters preceding the terminating NUL, without
8032 appending the NUL to the end.  Assuming the result of @code{strncpy} is
8033 necessarily a NUL-terminated string is a common mistake, and so the call
8034 is diagnosed.  To avoid the warning when the result is not expected to be
8035 NUL-terminated, call @code{memcpy} instead.
8037 @smallexample
8038 void copy (char *d, const char *s)
8040   strncpy (d, s, strlen (s));
8042 @end smallexample
8044 In the following example, the call to @code{strncpy} specifies the size
8045 of the destination buffer as the bound.  If the length of the source
8046 string is equal to or greater than this size the result of the copy will
8047 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
8048 the warning, specify @code{sizeof buf - 1} as the bound and set the last
8049 element of the buffer to @code{NUL}.
8051 @smallexample
8052 void copy (const char *s)
8054   char buf[80];
8055   strncpy (buf, s, sizeof buf);
8056   @dots{}
8058 @end smallexample
8060 In situations where a character array is intended to store a sequence
8061 of bytes with no terminating @code{NUL} such an array may be annotated
8062 with attribute @code{nonstring} to avoid this warning.  Such arrays,
8063 however, are not suitable arguments to functions that expect
8064 @code{NUL}-terminated strings.  To help detect accidental misuses of
8065 such arrays GCC issues warnings unless it can prove that the use is
8066 safe.  @xref{Common Variable Attributes}.
8068 @opindex Wstrict-flex-arrays
8069 @opindex Wno-strict-flex-arrays
8070 @item -Wstrict-flex-arrays
8071 Warn about inproper usages of flexible array members
8072 according to the @var{level} of the @code{strict_flex_array (@var{level})}
8073 attribute attached to the trailing array field of a structure if it's
8074 available, otherwise according to the @var{level} of the option
8075 @option{-fstrict-flex-arrays=@var{level}}.
8077 This option is effective only when @var{level} is bigger than 0.  Otherwise,
8078 it will be ignored with a warning.
8080 when @var{level}=1, warnings will be issued for a trailing array reference
8081 of a structure that have 2 or more elements if the trailing array is referenced
8082 as a flexible array member.
8084 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
8085 issued for a trailing one-element array reference of a structure
8086 if the array is referenced as a flexible array member.
8088 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8089 issued for a trailing zero-length array reference of a structure
8090 if the array is referenced as a flexible array member.
8093 @opindex Wsuggest-attribute=
8094 @opindex Wno-suggest-attribute=
8095 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
8096 Warn for cases where adding an attribute may be beneficial. The
8097 attributes currently supported are listed below.
8099 @table @gcctabopt
8100 @opindex Wsuggest-attribute=pure
8101 @opindex Wno-suggest-attribute=pure
8102 @opindex Wsuggest-attribute=const
8103 @opindex Wno-suggest-attribute=const
8104 @opindex Wsuggest-attribute=noreturn
8105 @opindex Wno-suggest-attribute=noreturn
8106 @opindex Wmissing-noreturn
8107 @opindex Wno-missing-noreturn
8108 @opindex Wsuggest-attribute=malloc
8109 @opindex Wno-suggest-attribute=malloc
8110 @item -Wsuggest-attribute=pure
8111 @itemx -Wsuggest-attribute=const
8112 @itemx -Wsuggest-attribute=noreturn
8113 @itemx -Wmissing-noreturn
8114 @itemx -Wsuggest-attribute=malloc
8116 Warn about functions that might be candidates for attributes
8117 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
8118 only warns for functions visible in other compilation units or (in the case of
8119 @code{pure} and @code{const}) if it cannot prove that the function returns
8120 normally. A function returns normally if it doesn't contain an infinite loop or
8121 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8122 requires option @option{-fipa-pure-const}, which is enabled by default at
8123 @option{-O} and higher.  Higher optimization levels improve the accuracy
8124 of the analysis.
8126 @opindex Wsuggest-attribute=format
8127 @opindex Wmissing-format-attribute
8128 @opindex Wno-suggest-attribute=format
8129 @opindex Wno-missing-format-attribute
8130 @opindex Wformat
8131 @opindex Wno-format
8132 @item -Wsuggest-attribute=format
8133 @itemx -Wmissing-format-attribute
8135 Warn about function pointers that might be candidates for @code{format}
8136 attributes.  Note these are only possible candidates, not absolute ones.
8137 GCC guesses that function pointers with @code{format} attributes that
8138 are used in assignment, initialization, parameter passing or return
8139 statements should have a corresponding @code{format} attribute in the
8140 resulting type.  I.e.@: the left-hand side of the assignment or
8141 initialization, the type of the parameter variable, or the return type
8142 of the containing function respectively should also have a @code{format}
8143 attribute to avoid the warning.
8145 GCC also warns about function definitions that might be
8146 candidates for @code{format} attributes.  Again, these are only
8147 possible candidates.  GCC guesses that @code{format} attributes
8148 might be appropriate for any function that calls a function like
8149 @code{vprintf} or @code{vscanf}, but this might not always be the
8150 case, and some functions for which @code{format} attributes are
8151 appropriate may not be detected.
8153 @opindex Wsuggest-attribute=cold
8154 @opindex Wno-suggest-attribute=cold
8155 @item -Wsuggest-attribute=cold
8157 Warn about functions that might be candidates for @code{cold} attribute.  This
8158 is based on static detection and generally only warns about functions which
8159 always leads to a call to another @code{cold} function such as wrappers of
8160 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8161 @end table
8163 @opindex Wno-alloc-size
8164 @opindex Walloc-size
8165 @item -Walloc-size
8166 Warn about calls to allocation functions decorated with attribute
8167 @code{alloc_size} that specify insufficient size for the target type of
8168 the pointer the result is assigned to, including those to the built-in
8169 forms of the functions @code{aligned_alloc}, @code{alloca},
8170 @code{calloc},
8171 @code{malloc}, and @code{realloc}.
8173 @opindex Wno-alloc-zero
8174 @opindex Walloc-zero
8175 @item -Walloc-zero
8176 Warn about calls to allocation functions decorated with attribute
8177 @code{alloc_size} that specify zero bytes, including those to the built-in
8178 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8179 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8180 when called with a zero size differs among implementations (and in the case
8181 of @code{realloc} has been deprecated) relying on it may result in subtle
8182 portability bugs and should be avoided.
8184 @opindex Walloc-size-larger-than=
8185 @opindex Wno-alloc-size-larger-than
8186 @item -Walloc-size-larger-than=@var{byte-size}
8187 Warn about calls to functions decorated with attribute @code{alloc_size}
8188 that attempt to allocate objects larger than the specified number of bytes,
8189 or where the result of the size computation in an integer type with infinite
8190 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8191 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8192 Warnings controlled by the option can be disabled either by specifying
8193 @var{byte-size} of @samp{SIZE_MAX} or more or by
8194 @option{-Wno-alloc-size-larger-than}.
8195 @xref{Function Attributes}.
8197 @opindex Wno-alloc-size-larger-than
8198 @item -Wno-alloc-size-larger-than
8199 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8200 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8201 larger.
8203 @opindex Wno-alloca
8204 @opindex Walloca
8205 @item -Walloca
8206 This option warns on all uses of @code{alloca} in the source.
8208 @opindex Walloca-larger-than=
8209 @opindex Wno-alloca-larger-than
8210 @item -Walloca-larger-than=@var{byte-size}
8211 This option warns on calls to @code{alloca} with an integer argument whose
8212 value is either zero, or that is not bounded by a controlling predicate
8213 that limits its value to at most @var{byte-size}.  It also warns for calls
8214 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8215 types are considered unbounded even if they appear to be constrained to
8216 the expected range.
8218 For example, a bounded case of @code{alloca} could be:
8220 @smallexample
8221 void func (size_t n)
8223   void *p;
8224   if (n <= 1000)
8225     p = alloca (n);
8226   else
8227     p = malloc (n);
8228   f (p);
8230 @end smallexample
8232 In the above example, passing @code{-Walloca-larger-than=1000} would not
8233 issue a warning because the call to @code{alloca} is known to be at most
8234 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8235 the compiler would emit a warning.
8237 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8238 controlling predicate constraining its integer argument.  For example:
8240 @smallexample
8241 void func ()
8243   void *p = alloca (n);
8244   f (p);
8246 @end smallexample
8248 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8249 a warning, but this time because of the lack of bounds checking.
8251 Note, that even seemingly correct code involving signed integers could
8252 cause a warning:
8254 @smallexample
8255 void func (signed int n)
8257   if (n < 500)
8258     @{
8259       p = alloca (n);
8260       f (p);
8261     @}
8263 @end smallexample
8265 In the above example, @var{n} could be negative, causing a larger than
8266 expected argument to be implicitly cast into the @code{alloca} call.
8268 This option also warns when @code{alloca} is used in a loop.
8270 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8271 but is usually only effective  when @option{-ftree-vrp} is active (default
8272 for @option{-O2} and above).
8274 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8276 @opindex Wno-alloca-larger-than
8277 @item -Wno-alloca-larger-than
8278 Disable @option{-Walloca-larger-than=} warnings.  The option is
8279 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8281 @opindex Warith-conversion
8282 @opindex Wno-arith-conversion
8283 @item -Warith-conversion
8284 Do warn about implicit conversions from arithmetic operations even
8285 when conversion of the operands to the same type cannot change their
8286 values.  This affects warnings from @option{-Wconversion},
8287 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8289 @smallexample
8290 @group
8291 void f (char c, int i)
8293   c = c + i; // warns with @option{-Wconversion}
8294   c = c + 1; // only warns with @option{-Warith-conversion}
8296 @end group
8297 @end smallexample
8299 @opindex Wno-array-bounds
8300 @opindex Warray-bounds
8301 @item -Warray-bounds
8302 @itemx -Warray-bounds=@var{n}
8303 Warn about out of bounds subscripts or offsets into arrays.  This warning
8304 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8305 is active (the default for @option{-O2} and above) but a subset of instances
8306 are issued even without optimization.
8308 By default, the trailing array of a structure will be treated as a flexible
8309 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8310 if it is declared as either a flexible array member per C99 standard onwards
8311 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8312 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8313 zero-length arrays or one-element arrays are not warned by default.
8315 You can add the option @option{-fstrict-flex-arrays} or
8316 @option{-fstrict-flex-arrays=@var{level}} to control how this
8317 option treat trailing array of a structure as a flexible array member:
8319 when @var{level}<=1, no change to the default behavior.
8321 when @var{level}=2, additional warnings will be issued for out of bounds
8322 subscripts or offsets into one-element arrays;
8324 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8325 issued for out of bounds subscripts or offsets into zero-length arrays.
8327 @table @gcctabopt
8328 @item -Warray-bounds=1
8329 This is the default warning level of @option{-Warray-bounds} and is enabled
8330 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8332 @item -Warray-bounds=2
8333 This warning level also warns about the intermediate results of pointer
8334 arithmetic that may yield out of bounds values. This warning level may
8335 give a larger number of false positives and is deactivated by default.
8336 @end table
8338 @opindex Warray-compare
8339 @opindex Wno-array-compare
8340 @item -Warray-compare
8341 Warn about equality and relational comparisons between two operands of array
8342 type.  This comparison was deprecated in C++20.  For example:
8344 @smallexample
8345 int arr1[5];
8346 int arr2[5];
8347 bool same = arr1 == arr2;
8348 @end smallexample
8350 @option{-Warray-compare} is enabled by @option{-Wall}.
8352 @opindex Wno-array-parameter
8353 @item -Warray-parameter
8354 @itemx -Warray-parameter=@var{n}
8355 Warn about redeclarations of functions involving arguments of array or
8356 pointer types of inconsistent kinds or forms, and enable the detection
8357 of out-of-bounds accesses to such parameters by warnings such as
8358 @option{-Warray-bounds}.
8360 If the first function declaration uses the array form the bound specified
8361 in the array is assumed to be the minimum number of elements expected to
8362 be provided in calls to the function and the maximum number of elements
8363 accessed by it.  Failing to provide arguments of sufficient size or accessing
8364 more than the maximum number of elements may be diagnosed by warnings such
8365 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
8366 involving array parameters declared using the @code{T[static N]} form.
8368 For example, the warning triggers for the following redeclarations because
8369 the first one allows an array of any size to be passed to @code{f} while
8370 the second one with the keyword @code{static} specifies that the array
8371 argument must have at least four elements.
8373 @smallexample
8374 void f (int[static 4]);
8375 void f (int[]);           // warning (inconsistent array form)
8377 void g (void)
8379   int *p = (int *)malloc (4);
8380   f (p);                  // warning (array too small)
8381   @dots{}
8383 @end smallexample
8385 At level 2 the warning also triggers for redeclarations involving any other
8386 inconsistency in array or pointer argument forms denoting array sizes.
8387 Pointers and arrays of unspecified bound are considered equivalent and do
8388 not trigger a warning.
8390 @smallexample
8391 void g (int*);
8392 void g (int[]);     // no warning
8393 void g (int[8]);    // warning (inconsistent array bound)
8394 @end smallexample
8396 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8397 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8398 involving Variable Length Array arguments.
8400 @opindex Wattribute-alias
8401 @opindex Wno-attribute-alias
8402 @item -Wattribute-alias=@var{n}
8403 @itemx -Wno-attribute-alias
8404 Warn about declarations using the @code{alias} and similar attributes whose
8405 target is incompatible with the type of the alias.
8406 @xref{Function Attributes,,Declaring Attributes of Functions}.
8408 @table @gcctabopt
8409 @item -Wattribute-alias=1
8410 The default warning level of the @option{-Wattribute-alias} option diagnoses
8411 incompatibilities between the type of the alias declaration and that of its
8412 target.  Such incompatibilities are typically indicative of bugs.
8414 @item -Wattribute-alias=2
8416 At this level @option{-Wattribute-alias} also diagnoses cases where
8417 the attributes of the alias declaration are more restrictive than the
8418 attributes applied to its target.  These mismatches can potentially
8419 result in incorrect code generation.  In other cases they may be
8420 benign and could be resolved simply by adding the missing attribute to
8421 the target.  For comparison, see the @option{-Wmissing-attributes}
8422 option, which controls diagnostics when the alias declaration is less
8423 restrictive than the target, rather than more restrictive.
8425 Attributes considered include @code{alloc_align}, @code{alloc_size},
8426 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8427 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8428 @code{returns_nonnull}, and @code{returns_twice}.
8429 @end table
8431 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8432 This is the default.  You can disable these warnings with either
8433 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8435 @opindex Wbidi-chars=
8436 @opindex Wbidi-chars
8437 @opindex Wno-bidi-chars
8438 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8439 Warn about possibly misleading UTF-8 bidirectional control characters in
8440 comments, string literals, character constants, and identifiers.  Such
8441 characters can change left-to-right writing direction into right-to-left
8442 (and vice versa), which can cause confusion between the logical order and
8443 visual order.  This may be dangerous; for instance, it may seem that a piece
8444 of code is not commented out, whereas it in fact is.
8446 There are three levels of warning supported by GCC@.  The default is
8447 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8448 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8449 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8450 characters.
8452 By default, this warning does not warn about UCNs.  It is, however, possible
8453 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8454 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8455 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8456 @option{-Wbidi-chars=any} was specified.
8458 @opindex Wno-bool-compare
8459 @opindex Wbool-compare
8460 @item -Wbool-compare
8461 Warn about boolean expression compared with an integer value different from
8462 @code{true}/@code{false}.  For instance, the following comparison is
8463 always false:
8464 @smallexample
8465 int n = 5;
8466 @dots{}
8467 if ((n > 1) == 2) @{ @dots{} @}
8468 @end smallexample
8469 This warning is enabled by @option{-Wall}.
8471 @opindex Wno-bool-operation
8472 @opindex Wbool-operation
8473 @item -Wbool-operation
8474 Warn about suspicious operations on expressions of a boolean type.  For
8475 instance, bitwise negation of a boolean is very likely a bug in the program.
8476 For C, this warning also warns about incrementing or decrementing a boolean,
8477 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8478 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8480 This warning is enabled by @option{-Wall}.
8482 @opindex Wno-duplicated-branches
8483 @opindex Wduplicated-branches
8484 @item -Wduplicated-branches
8485 Warn when an if-else has identical branches.  This warning detects cases like
8486 @smallexample
8487 if (p != NULL)
8488   return 0;
8489 else
8490   return 0;
8491 @end smallexample
8492 It doesn't warn when both branches contain just a null statement.  This warning
8493 also warn for conditional operators:
8494 @smallexample
8495   int i = x ? *p : *p;
8496 @end smallexample
8498 @opindex Wno-duplicated-cond
8499 @opindex Wduplicated-cond
8500 @item -Wduplicated-cond
8501 Warn about duplicated conditions in an if-else-if chain.  For instance,
8502 warn for the following code:
8503 @smallexample
8504 if (p->q != NULL) @{ @dots{} @}
8505 else if (p->q != NULL) @{ @dots{} @}
8506 @end smallexample
8508 @opindex Wno-frame-address
8509 @opindex Wframe-address
8510 @item -Wframe-address
8511 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8512 is called with an argument greater than 0.  Such calls may return indeterminate
8513 values or crash the program.  The warning is included in @option{-Wall}.
8515 @opindex Wno-discarded-qualifiers
8516 @opindex Wdiscarded-qualifiers
8517 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8518 Do not warn if type qualifiers on pointers are being discarded.
8519 Typically, the compiler warns if a @code{const char *} variable is
8520 passed to a function that takes a @code{char *} parameter.  This option
8521 can be used to suppress such a warning.
8523 @opindex Wno-discarded-array-qualifiers
8524 @opindex Wdiscarded-array-qualifiers
8525 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8526 Do not warn if type qualifiers on arrays which are pointer targets
8527 are being discarded.  Typically, the compiler warns if a
8528 @code{const int (*)[]} variable is passed to a function that
8529 takes a @code{int (*)[]} parameter.  This option can be used to
8530 suppress such a warning.
8532 @opindex Wno-incompatible-pointer-types
8533 @opindex Wincompatible-pointer-types
8534 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8535 Do not warn when there is a conversion between pointers that have incompatible
8536 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8537 which warns for pointer argument passing or assignment with different
8538 signedness.
8540 This warning is upgraded to an error by @option{-pedantic-errors}.
8542 @opindex Wno-int-conversion
8543 @opindex Wint-conversion
8544 @item -Wno-int-conversion @r{(C and Objective-C only)}
8545 Do not warn about incompatible integer to pointer and pointer to integer
8546 conversions.  This warning is about implicit conversions; for explicit
8547 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8548 @option{-Wno-pointer-to-int-cast} may be used.
8550 This warning is upgraded to an error by @option{-pedantic-errors}.
8552 @opindex Wzero-length-bounds
8553 @opindex Wzero-length-bounds
8554 @item -Wzero-length-bounds
8555 Warn about accesses to elements of zero-length array members that might
8556 overlap other members of the same object.  Declaring interior zero-length
8557 arrays is discouraged because accesses to them are undefined.
8558 @xref{Zero Length}.
8560 For example, the first two stores in function @code{bad} are diagnosed
8561 because the array elements overlap the subsequent members @code{b} and
8562 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8563 because it is beyond the bounds of the enclosing object.
8565 @smallexample
8566 struct X @{ int a[0]; int b, c; @};
8567 struct X x;
8569 void bad (void)
8571   x.a[0] = 0;   // -Wzero-length-bounds
8572   x.a[1] = 1;   // -Wzero-length-bounds
8573   x.a[2] = 2;   // -Warray-bounds
8575 @end smallexample
8577 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8579 @opindex Wno-div-by-zero
8580 @opindex Wdiv-by-zero
8581 @item -Wno-div-by-zero
8582 Do not warn about compile-time integer division by zero.  Floating-point
8583 division by zero is not warned about, as it can be a legitimate way of
8584 obtaining infinities and NaNs.
8586 @opindex Wsystem-headers
8587 @opindex Wno-system-headers
8588 @cindex warnings from system headers
8589 @cindex system headers, warnings from
8590 @item -Wsystem-headers
8591 Print warning messages for constructs found in system header files.
8592 Warnings from system headers are normally suppressed, on the assumption
8593 that they usually do not indicate real problems and would only make the
8594 compiler output harder to read.  Using this command-line option tells
8595 GCC to emit warnings from system headers as if they occurred in user
8596 code.  However, note that using @option{-Wall} in conjunction with this
8597 option does @emph{not} warn about unknown pragmas in system
8598 headers---for that, @option{-Wunknown-pragmas} must also be used.
8600 @opindex Wtautological-compare
8601 @opindex Wno-tautological-compare
8602 @item -Wtautological-compare
8603 Warn if a self-comparison always evaluates to true or false.  This
8604 warning detects various mistakes such as:
8605 @smallexample
8606 int i = 1;
8607 @dots{}
8608 if (i > i) @{ @dots{} @}
8609 @end smallexample
8611 This warning also warns about bitwise comparisons that always evaluate
8612 to true or false, for instance:
8613 @smallexample
8614 if ((a & 16) == 10) @{ @dots{} @}
8615 @end smallexample
8616 will always be false.
8618 This warning is enabled by @option{-Wall}.
8620 @opindex Wtrampolines
8621 @opindex Wno-trampolines
8622 @item -Wtrampolines
8623 Warn about trampolines generated for pointers to nested functions.
8624 A trampoline is a small piece of data or code that is created at run
8625 time on the stack when the address of a nested function is taken, and is
8626 used to call the nested function indirectly.  For some targets, it is
8627 made up of data only and thus requires no special treatment.  But, for
8628 most targets, it is made up of code and thus requires the stack to be
8629 made executable in order for the program to work properly.
8631 @opindex Wfloat-equal
8632 @opindex Wno-float-equal
8633 @item -Wfloat-equal
8634 Warn if floating-point values are used in equality comparisons.
8636 The idea behind this is that sometimes it is convenient (for the
8637 programmer) to consider floating-point values as approximations to
8638 infinitely precise real numbers.  If you are doing this, then you need
8639 to compute (by analyzing the code, or in some other way) the maximum or
8640 likely maximum error that the computation introduces, and allow for it
8641 when performing comparisons (and when producing output, but that's a
8642 different problem).  In particular, instead of testing for equality, you
8643 should check to see whether the two values have ranges that overlap; and
8644 this is done with the relational operators, so equality comparisons are
8645 probably mistaken.
8647 @opindex Wtraditional
8648 @opindex Wno-traditional
8649 @item -Wtraditional @r{(C and Objective-C only)}
8650 Warn about certain constructs that behave differently in traditional and
8651 ISO C@.  Also warn about ISO C constructs that have no traditional C
8652 equivalent, and/or problematic constructs that should be avoided.
8654 @itemize @bullet
8655 @item
8656 Macro parameters that appear within string literals in the macro body.
8657 In traditional C macro replacement takes place within string literals,
8658 but in ISO C it does not.
8660 @item
8661 In traditional C, some preprocessor directives did not exist.
8662 Traditional preprocessors only considered a line to be a directive
8663 if the @samp{#} appeared in column 1 on the line.  Therefore
8664 @option{-Wtraditional} warns about directives that traditional C
8665 understands but ignores because the @samp{#} does not appear as the
8666 first character on the line.  It also suggests you hide directives like
8667 @code{#pragma} not understood by traditional C by indenting them.  Some
8668 traditional implementations do not recognize @code{#elif}, so this option
8669 suggests avoiding it altogether.
8671 @item
8672 A function-like macro that appears without arguments.
8674 @item
8675 The unary plus operator.
8677 @item
8678 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8679 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8680 constants.)  Note, these suffixes appear in macros defined in the system
8681 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8682 Use of these macros in user code might normally lead to spurious
8683 warnings, however GCC's integrated preprocessor has enough context to
8684 avoid warning in these cases.
8686 @item
8687 A function declared external in one block and then used after the end of
8688 the block.
8690 @item
8691 A @code{switch} statement has an operand of type @code{long}.
8693 @item
8694 A non-@code{static} function declaration follows a @code{static} one.
8695 This construct is not accepted by some traditional C compilers.
8697 @item
8698 The ISO type of an integer constant has a different width or
8699 signedness from its traditional type.  This warning is only issued if
8700 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8701 typically represent bit patterns, are not warned about.
8703 @item
8704 Usage of ISO string concatenation is detected.
8706 @item
8707 Initialization of automatic aggregates.
8709 @item
8710 Identifier conflicts with labels.  Traditional C lacks a separate
8711 namespace for labels.
8713 @item
8714 Initialization of unions.  If the initializer is zero, the warning is
8715 omitted.  This is done under the assumption that the zero initializer in
8716 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8717 initializer warnings and relies on default initialization to zero in the
8718 traditional C case.
8720 @item
8721 Conversions by prototypes between fixed/floating-point values and vice
8722 versa.  The absence of these prototypes when compiling with traditional
8723 C causes serious problems.  This is a subset of the possible
8724 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8726 @item
8727 Use of ISO C style function definitions.  This warning intentionally is
8728 @emph{not} issued for prototype declarations or variadic functions
8729 because these ISO C features appear in your code when using
8730 libiberty's traditional C compatibility macros, @code{PARAMS} and
8731 @code{VPARAMS}.  This warning is also bypassed for nested functions
8732 because that feature is already a GCC extension and thus not relevant to
8733 traditional C compatibility.
8734 @end itemize
8736 @opindex Wtraditional-conversion
8737 @opindex Wno-traditional-conversion
8738 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8739 Warn if a prototype causes a type conversion that is different from what
8740 would happen to the same argument in the absence of a prototype.  This
8741 includes conversions of fixed point to floating and vice versa, and
8742 conversions changing the width or signedness of a fixed-point argument
8743 except when the same as the default promotion.
8745 @opindex Wdeclaration-after-statement
8746 @opindex Wno-declaration-after-statement
8747 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8748 Warn when a declaration is found after a statement in a block.  This
8749 construct, known from C++, was introduced with ISO C99 and is by default
8750 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8752 This warning is upgraded to an error by @option{-pedantic-errors}.
8754 @opindex Wshadow
8755 @opindex Wno-shadow
8756 @item -Wshadow
8757 Warn whenever a local variable or type declaration shadows another
8758 variable, parameter, type, class member (in C++), or instance variable
8759 (in Objective-C) or whenever a built-in function is shadowed.  Note
8760 that in C++, the compiler warns if a local variable shadows an
8761 explicit typedef, but not if it shadows a struct/class/enum.
8762 If this warning is enabled, it includes also all instances of
8763 local shadowing.  This means that @option{-Wno-shadow=local}
8764 and @option{-Wno-shadow=compatible-local} are ignored when
8765 @option{-Wshadow} is used.
8766 Same as @option{-Wshadow=global}.
8768 @opindex Wno-shadow-ivar
8769 @opindex Wshadow-ivar
8770 @item -Wno-shadow-ivar @r{(Objective-C only)}
8771 Do not warn whenever a local variable shadows an instance variable in an
8772 Objective-C method.
8774 @opindex Wshadow=global
8775 @item -Wshadow=global
8776 Warn for any shadowing.
8777 Same as @option{-Wshadow}.
8779 @opindex Wshadow=local
8780 @item -Wshadow=local
8781 Warn when a local variable shadows another local variable or parameter.
8783 @opindex Wshadow=compatible-local
8784 @item -Wshadow=compatible-local
8785 Warn when a local variable shadows another local variable or parameter
8786 whose type is compatible with that of the shadowing variable.  In C++,
8787 type compatibility here means the type of the shadowing variable can be
8788 converted to that of the shadowed variable.  The creation of this flag
8789 (in addition to @option{-Wshadow=local}) is based on the idea that when
8790 a local variable shadows another one of incompatible type, it is most
8791 likely intentional, not a bug or typo, as shown in the following example:
8793 @smallexample
8794 @group
8795 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8797   for (int i = 0; i < N; ++i)
8798   @{
8799     ...
8800   @}
8801   ...
8803 @end group
8804 @end smallexample
8806 Since the two variable @code{i} in the example above have incompatible types,
8807 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8808 Because their types are incompatible, if a programmer accidentally uses one
8809 in place of the other, type checking is expected to catch that and emit an
8810 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8811 possibly reduce the number of warnings triggered by intentional shadowing.
8812 Note that this also means that shadowing @code{const char *i} by
8813 @code{char *i} does not emit a warning.
8815 This warning is also enabled by @option{-Wshadow=local}.
8817 @opindex Wlarger-than=
8818 @opindex Wlarger-than-@var{byte-size}
8819 @item -Wlarger-than=@var{byte-size}
8820 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8821 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8822 Warnings controlled by the option can be disabled either by specifying
8823 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8825 Also warn for calls to bounded functions such as @code{memchr} or
8826 @code{strnlen} that specify a bound greater than the largest possible
8827 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8828 can only be disabled by @option{-Wno-larger-than}.
8830 @opindex Wno-larger-than
8831 @item -Wno-larger-than
8832 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8833 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8835 @opindex Wframe-larger-than=
8836 @opindex Wno-frame-larger-than
8837 @item -Wframe-larger-than=@var{byte-size}
8838 Warn if the size of a function frame exceeds @var{byte-size}.
8839 The computation done to determine the stack frame size is approximate
8840 and not conservative.
8841 The actual requirements may be somewhat greater than @var{byte-size}
8842 even if you do not get a warning.  In addition, any space allocated
8843 via @code{alloca}, variable-length arrays, or related constructs
8844 is not included by the compiler when determining
8845 whether or not to issue a warning.
8846 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8847 Warnings controlled by the option can be disabled either by specifying
8848 @var{byte-size} of @samp{SIZE_MAX} or more or by
8849 @option{-Wno-frame-larger-than}.
8851 @opindex Wno-frame-larger-than
8852 @item -Wno-frame-larger-than
8853 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8854 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8856 @opindex Wfree-nonheap-object
8857 @opindex Wno-free-nonheap-object
8858 @item -Wfree-nonheap-object
8859 Warn when attempting to deallocate an object that was either not allocated
8860 on the heap, or by using a pointer that was not returned from a prior call
8861 to the corresponding allocation function.  For example, because the call
8862 to @code{stpcpy} returns a pointer to the terminating nul character and
8863 not to the beginning of the object, the call to @code{free} below is
8864 diagnosed.
8866 @smallexample
8867 void f (char *p)
8869   p = stpcpy (p, "abc");
8870   // ...
8871   free (p);   // warning
8873 @end smallexample
8875 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8877 @opindex Wstack-usage
8878 @opindex Wno-stack-usage
8879 @item -Wstack-usage=@var{byte-size}
8880 Warn if the stack usage of a function might exceed @var{byte-size}.
8881 The computation done to determine the stack usage is conservative.
8882 Any space allocated via @code{alloca}, variable-length arrays, or related
8883 constructs is included by the compiler when determining whether or not to
8884 issue a warning.
8886 The message is in keeping with the output of @option{-fstack-usage}.
8888 @itemize
8889 @item
8890 If the stack usage is fully static but exceeds the specified amount, it's:
8892 @smallexample
8893   warning: stack usage is 1120 bytes
8894 @end smallexample
8895 @item
8896 If the stack usage is (partly) dynamic but bounded, it's:
8898 @smallexample
8899   warning: stack usage might be 1648 bytes
8900 @end smallexample
8901 @item
8902 If the stack usage is (partly) dynamic and not bounded, it's:
8904 @smallexample
8905   warning: stack usage might be unbounded
8906 @end smallexample
8907 @end itemize
8909 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8910 Warnings controlled by the option can be disabled either by specifying
8911 @var{byte-size} of @samp{SIZE_MAX} or more or by
8912 @option{-Wno-stack-usage}.
8914 @opindex Wno-stack-usage
8915 @item -Wno-stack-usage
8916 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8917 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8919 @opindex Wunsafe-loop-optimizations
8920 @opindex Wno-unsafe-loop-optimizations
8921 @item -Wunsafe-loop-optimizations
8922 Warn if the loop cannot be optimized because the compiler cannot
8923 assume anything on the bounds of the loop indices.  With
8924 @option{-funsafe-loop-optimizations} warn if the compiler makes
8925 such assumptions.
8927 @opindex Wno-pedantic-ms-format
8928 @opindex Wpedantic-ms-format
8929 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8930 When used in combination with @option{-Wformat}
8931 and @option{-pedantic} without GNU extensions, this option
8932 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8933 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8934 which depend on the MS runtime.
8936 @opindex Wpointer-arith
8937 @opindex Wno-pointer-arith
8938 @item -Wpointer-arith
8939 Warn about anything that depends on the ``size of'' a function type or
8940 of @code{void}.  GNU C assigns these types a size of 1, for
8941 convenience in calculations with @code{void *} pointers and pointers
8942 to functions.  In C++, warn also when an arithmetic operation involves
8943 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8945 This warning is upgraded to an error by @option{-pedantic-errors}.
8947 @opindex Wpointer-compare
8948 @opindex Wno-pointer-compare
8949 @item -Wno-pointer-compare
8950 Do not warn if a pointer is compared with a zero character constant.
8951 This usually
8952 means that the pointer was meant to be dereferenced.  For example:
8954 @smallexample
8955 const char *p = foo ();
8956 if (p == '\0')
8957   return 42;
8958 @end smallexample
8960 Note that the code above is invalid in C++11.
8962 This warning is enabled by default.
8964 @opindex Wtsan
8965 @opindex Wno-tsan
8966 @item -Wtsan
8967 Warn about unsupported features in ThreadSanitizer.
8969 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8970 can report false positives.
8972 This warning is enabled by default.
8974 @opindex Wtype-limits
8975 @opindex Wno-type-limits
8976 @item -Wtype-limits
8977 Warn if a comparison is always true or always false due to the limited
8978 range of the data type, but do not warn for constant expressions.  For
8979 example, warn if an unsigned variable is compared against zero with
8980 @code{<} or @code{>=}.  This warning is also enabled by
8981 @option{-Wextra}.
8983 @opindex Wabsolute-value
8984 @opindex Wno-absolute-value
8985 @item -Wabsolute-value @r{(C and Objective-C only)}
8986 Warn for calls to standard functions that compute the absolute value
8987 of an argument when a more appropriate standard function is available.
8988 For example, calling @code{abs(3.14)} triggers the warning because the
8989 appropriate function to call to compute the absolute value of a double
8990 argument is @code{fabs}.  The option also triggers warnings when the
8991 argument in a call to such a function has an unsigned type.  This
8992 warning can be suppressed with an explicit type cast and it is also
8993 enabled by @option{-Wextra}.
8995 @include cppwarnopts.texi
8997 @opindex Wbad-function-cast
8998 @opindex Wno-bad-function-cast
8999 @item -Wbad-function-cast @r{(C and Objective-C only)}
9000 Warn when a function call is cast to a non-matching type.
9001 For example, warn if a call to a function returning an integer type 
9002 is cast to a pointer type.
9004 @opindex Wc90-c99-compat
9005 @opindex Wno-c90-c99-compat
9006 @item -Wc90-c99-compat @r{(C and Objective-C only)}
9007 Warn about features not present in ISO C90, but present in ISO C99.
9008 For instance, warn about use of variable length arrays, @code{long long}
9009 type, @code{bool} type, compound literals, designated initializers, and so
9010 on.  This option is independent of the standards mode.  Warnings are disabled
9011 in the expression that follows @code{__extension__}.
9013 @opindex Wc99-c11-compat
9014 @opindex Wno-c99-c11-compat
9015 @item -Wc99-c11-compat @r{(C and Objective-C only)}
9016 Warn about features not present in ISO C99, but present in ISO C11.
9017 For instance, warn about use of anonymous structures and unions,
9018 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
9019 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
9020 and so on.  This option is independent of the standards mode.  Warnings are
9021 disabled in the expression that follows @code{__extension__}.
9023 @opindex Wc11-c23-compat
9024 @opindex Wno-c11-c23-compat
9025 @item -Wc11-c23-compat @r{(C and Objective-C only)}
9026 @itemx -Wc11-c2x-compat @r{(C and Objective-C only)}
9027 Warn about features not present in ISO C11, but present in ISO C23.
9028 For instance, warn about omitting the string in @code{_Static_assert},
9029 use of @samp{[[]]} syntax for attributes, use of decimal
9030 floating-point types, and so on.  This option is independent of the
9031 standards mode.  Warnings are disabled in the expression that follows
9032 @code{__extension__}.  The name @option{-Wc11-c2x-compat} is
9033 deprecated.
9035 When not compiling in C23 mode, these warnings are upgraded to errors
9036 by @option{-pedantic-errors}.
9038 @opindex Wc++-compat
9039 @opindex Wno-c++-compat
9040 @item -Wc++-compat @r{(C and Objective-C only)}
9041 Warn about ISO C constructs that are outside of the common subset of
9042 ISO C and ISO C++, e.g.@: request for implicit conversion from
9043 @code{void *} to a pointer to non-@code{void} type.
9045 @opindex Wc++11-compat
9046 @opindex Wno-c++11-compat
9047 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
9048 Warn about C++ constructs whose meaning differs between ISO C++ 1998
9049 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
9050 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
9051 enabled by @option{-Wall}.
9053 @opindex Wc++14-compat
9054 @opindex Wno-c++14-compat
9055 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
9056 Warn about C++ constructs whose meaning differs between ISO C++ 2011
9057 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
9059 @opindex Wc++17-compat
9060 @opindex Wno-c++17-compat
9061 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
9062 Warn about C++ constructs whose meaning differs between ISO C++ 2014
9063 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
9065 @opindex Wc++20-compat
9066 @opindex Wno-c++20-compat
9067 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
9068 Warn about C++ constructs whose meaning differs between ISO C++ 2017
9069 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
9071 @opindex Wc++11-extensions
9072 @opindex Wno-c++11-extensions
9073 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
9074 Do not warn about C++11 constructs in code being compiled using
9075 an older C++ standard.  Even without this option, some C++11 constructs
9076 will only be diagnosed if @option{-Wpedantic} is used.
9078 @opindex Wc++14-extensions
9079 @opindex Wno-c++14-extensions
9080 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
9081 Do not warn about C++14 constructs in code being compiled using
9082 an older C++ standard.  Even without this option, some C++14 constructs
9083 will only be diagnosed if @option{-Wpedantic} is used.
9085 @opindex Wc++17-extensions
9086 @opindex Wno-c++17-extensions
9087 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9088 Do not warn about C++17 constructs in code being compiled using
9089 an older C++ standard.  Even without this option, some C++17 constructs
9090 will only be diagnosed if @option{-Wpedantic} is used.
9092 @opindex Wc++20-extensions
9093 @opindex Wno-c++20-extensions
9094 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9095 Do not warn about C++20 constructs in code being compiled using
9096 an older C++ standard.  Even without this option, some C++20 constructs
9097 will only be diagnosed if @option{-Wpedantic} is used.
9099 @opindex Wc++23-extensions
9100 @opindex Wno-c++23-extensions
9101 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9102 Do not warn about C++23 constructs in code being compiled using
9103 an older C++ standard.  Even without this option, some C++23 constructs
9104 will only be diagnosed if @option{-Wpedantic} is used.
9106 @opindex Wcast-qual
9107 @opindex Wno-cast-qual
9108 @item -Wcast-qual
9109 Warn whenever a pointer is cast so as to remove a type qualifier from
9110 the target type.  For example, warn if a @code{const char *} is cast
9111 to an ordinary @code{char *}.
9113 Also warn when making a cast that introduces a type qualifier in an
9114 unsafe way.  For example, casting @code{char **} to @code{const char **}
9115 is unsafe, as in this example:
9117 @smallexample
9118   /* p is char ** value.  */
9119   const char **q = (const char **) p;
9120   /* Assignment of readonly string to const char * is OK.  */
9121   *q = "string";
9122   /* Now char** pointer points to read-only memory.  */
9123   **p = 'b';
9124 @end smallexample
9126 @opindex Wcast-align
9127 @opindex Wno-cast-align
9128 @item -Wcast-align
9129 Warn whenever a pointer is cast such that the required alignment of the
9130 target is increased.  For example, warn if a @code{char *} is cast to
9131 an @code{int *} on machines where integers can only be accessed at
9132 two- or four-byte boundaries.
9134 @opindex Wcast-align=strict
9135 @item -Wcast-align=strict
9136 Warn whenever a pointer is cast such that the required alignment of the
9137 target is increased.  For example, warn if a @code{char *} is cast to
9138 an @code{int *} regardless of the target machine.
9140 @opindex Wcast-function-type
9141 @opindex Wno-cast-function-type
9142 @item -Wcast-function-type
9143 Warn when a function pointer is cast to an incompatible function pointer.
9144 In a cast involving function types with a variable argument list only
9145 the types of initial arguments that are provided are considered.
9146 Any parameter of pointer-type matches any other pointer-type.  Any benign
9147 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9148 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9149 type @code{void (*) (void)} is special and matches everything, which can
9150 be used to suppress this warning.
9151 In a cast involving pointer to member types this warning warns whenever
9152 the type cast is changing the pointer to member type.
9153 This warning is enabled by @option{-Wextra}.
9155 @opindex Wwrite-strings
9156 @opindex Wno-write-strings
9157 @item -Wwrite-strings
9158 When compiling C, give string constants the type @code{const
9159 char[@var{length}]} so that copying the address of one into a
9160 non-@code{const} @code{char *} pointer produces a warning.  These
9161 warnings help you find at compile time code that can try to write
9162 into a string constant, but only if you have been very careful about
9163 using @code{const} in declarations and prototypes.  Otherwise, it is
9164 just a nuisance. This is why we did not make @option{-Wall} request
9165 these warnings.
9167 When compiling C++, warn about the deprecated conversion from string
9168 literals to @code{char *}.  This warning is enabled by default for C++
9169 programs.
9171 This warning is upgraded to an error by @option{-pedantic-errors} in
9172 C++11 mode or later.
9174 @opindex Wclobbered
9175 @opindex Wno-clobbered
9176 @item -Wclobbered
9177 Warn for variables that might be changed by @code{longjmp} or
9178 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9180 @opindex Wcomplain-wrong-lang
9181 @opindex Wno-complain-wrong-lang
9182 @item -Wno-complain-wrong-lang
9183 By default, language front ends complain when a command-line option is
9184 valid, but not applicable to that front end.
9185 This may be disabled with @option{-Wno-complain-wrong-lang},
9186 which is mostly useful when invoking a single compiler driver for
9187 multiple source files written in different languages, for example:
9189 @smallexample
9190 $ g++ -fno-rtti a.cc b.f90
9191 @end smallexample
9193 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9194 and the Fortran front end to compile @file{b.f90}.
9195 The latter front end diagnoses
9196 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9197 which may be disabled with @option{-Wno-complain-wrong-lang}.
9199 @opindex Wcompare-distinct-pointer-types
9200 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9201 Warn if pointers of distinct types are compared without a cast.  This
9202 warning is enabled by default.
9204 @opindex Wconversion
9205 @opindex Wno-conversion
9206 @item -Wconversion
9207 Warn for implicit conversions that may alter a value. This includes
9208 conversions between real and integer, like @code{abs (x)} when
9209 @code{x} is @code{double}; conversions between signed and unsigned,
9210 like @code{unsigned ui = -1}; and conversions to smaller types, like
9211 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9212 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9213 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9214 conversions between signed and unsigned integers can be disabled by
9215 using @option{-Wno-sign-conversion}.
9217 For C++, also warn for confusing overload resolution for user-defined
9218 conversions; and conversions that never use a type conversion
9219 operator: conversions to @code{void}, the same type, a base class or a
9220 reference to them. Warnings about conversions between signed and
9221 unsigned integers are disabled by default in C++ unless
9222 @option{-Wsign-conversion} is explicitly enabled.
9224 Warnings about conversion from arithmetic on a small type back to that
9225 type are only given with @option{-Warith-conversion}.
9227 @opindex Wdangling-else
9228 @opindex Wno-dangling-else
9229 @item -Wdangling-else
9230 Warn about constructions where there may be confusion to which
9231 @code{if} statement an @code{else} branch belongs.  Here is an example of
9232 such a case:
9234 @smallexample
9235 @group
9237   if (a)
9238     if (b)
9239       foo ();
9240   else
9241     bar ();
9243 @end group
9244 @end smallexample
9246 In C/C++, every @code{else} branch belongs to the innermost possible
9247 @code{if} statement, which in this example is @code{if (b)}.  This is
9248 often not what the programmer expected, as illustrated in the above
9249 example by indentation the programmer chose.  When there is the
9250 potential for this confusion, GCC issues a warning when this flag
9251 is specified.  To eliminate the warning, add explicit braces around
9252 the innermost @code{if} statement so there is no way the @code{else}
9253 can belong to the enclosing @code{if}.  The resulting code
9254 looks like this:
9256 @smallexample
9257 @group
9259   if (a)
9260     @{
9261       if (b)
9262         foo ();
9263       else
9264         bar ();
9265     @}
9267 @end group
9268 @end smallexample
9270 This warning is enabled by @option{-Wparentheses}.
9272 @opindex Wdangling-pointer
9273 @opindex Wno-dangling-pointer
9274 @item -Wdangling-pointer
9275 @itemx -Wdangling-pointer=@var{n}
9276 Warn about uses of pointers (or C++ references) to objects with automatic
9277 storage duration after their lifetime has ended.  This includes local
9278 variables declared in nested blocks, compound literals and other unnamed
9279 temporary objects.  In addition, warn about storing the address of such
9280 objects in escaped pointers.  The warning is enabled at all optimization
9281 levels but may yield different results with optimization than without.
9283 @table @gcctabopt
9284 @item -Wdangling-pointer=1
9285 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9286 For example
9287 @smallexample
9288 int f (int c1, int c2, x)
9290   char *p = strchr ((char[])@{ c1, c2 @}, c3);
9291   // warning: dangling pointer to a compound literal
9292   return p ? *p : 'x';
9294 @end smallexample
9295 In the following function the store of the address of the local variable
9296 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9297 @smallexample
9298 void g (int **p)
9300   int x = 7;
9301   // warning: storing the address of a local variable in *p
9302   *p = &x;
9304 @end smallexample
9306 @item -Wdangling-pointer=2
9307 At level 2, in addition to unconditional uses the warning also diagnoses
9308 conditional uses of dangling pointers.
9310 For example, because the array @var{a} in the following function is out of
9311 scope when the pointer @var{s} that was set to point is used, the warning
9312 triggers at this level.
9314 @smallexample
9315 void f (char *s)
9317   if (!s)
9318     @{
9319       char a[12] = "tmpname";
9320       s = a;
9321     @}
9322   // warning: dangling pointer to a may be used
9323   strcat (s, ".tmp");
9324   ...
9326 @end smallexample
9327 @end table
9329 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9331 @opindex Wdate-time
9332 @opindex Wno-date-time
9333 @item -Wdate-time
9334 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9335 are encountered as they might prevent bit-wise-identical reproducible
9336 compilations.
9338 @opindex Wempty-body
9339 @opindex Wno-empty-body
9340 @item -Wempty-body
9341 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9342 while} statement.  This warning is also enabled by @option{-Wextra}.
9344 @opindex Wendif-labels
9345 @opindex Wno-endif-labels
9346 @item -Wno-endif-labels
9347 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9349 @opindex Wenum-compare
9350 @opindex Wno-enum-compare
9351 @item -Wenum-compare
9352 Warn about a comparison between values of different enumerated types.
9353 In C++ enumerated type mismatches in conditional expressions are also
9354 diagnosed and the warning is enabled by default.  In C this warning is 
9355 enabled by @option{-Wall}.
9357 @opindex Wenum-conversion
9358 @opindex Wno-enum-conversion
9359 @item -Wenum-conversion
9360 Warn when a value of enumerated type is implicitly converted to a 
9361 different enumerated type.  This warning is enabled by @option{-Wextra}
9362 in C@.
9364 @opindex Wenum-int-mismatch
9365 @opindex Wno-enum-int-mismatch
9366 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9367 Warn about mismatches between an enumerated type and an integer type in
9368 declarations.  For example:
9370 @smallexample
9371 enum E @{ l = -1, z = 0, g = 1 @};
9372 int foo(void);
9373 enum E foo(void);
9374 @end smallexample
9376 In C, an enumerated type is compatible with @code{char}, a signed
9377 integer type, or an unsigned integer type.  However, since the choice
9378 of the underlying type of an enumerated type is implementation-defined,
9379 such mismatches may cause portability issues.  In C++, such mismatches
9380 are an error.  In C, this warning is enabled by @option{-Wall} and
9381 @option{-Wc++-compat}.
9383 @opindex Wjump-misses-init
9384 @opindex Wno-jump-misses-init
9385 @item -Wjump-misses-init @r{(C, Objective-C only)}
9386 Warn if a @code{goto} statement or a @code{switch} statement jumps
9387 forward across the initialization of a variable, or jumps backward to a
9388 label after the variable has been initialized.  This only warns about
9389 variables that are initialized when they are declared.  This warning is
9390 only supported for C and Objective-C; in C++ this sort of branch is an
9391 error in any case.
9393 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9394 can be disabled with the @option{-Wno-jump-misses-init} option.
9396 @opindex Wsign-compare
9397 @opindex Wno-sign-compare
9398 @cindex warning for comparison of signed and unsigned values
9399 @cindex comparison of signed and unsigned values, warning
9400 @cindex signed and unsigned values, comparison warning
9401 @item -Wsign-compare
9402 Warn when a comparison between signed and unsigned values could produce
9403 an incorrect result when the signed value is converted to unsigned.
9404 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9405 also enabled by @option{-Wextra}.
9407 @opindex Wsign-conversion
9408 @opindex Wno-sign-conversion
9409 @item -Wsign-conversion
9410 Warn for implicit conversions that may change the sign of an integer
9411 value, like assigning a signed integer expression to an unsigned
9412 integer variable. An explicit cast silences the warning. In C, this
9413 option is enabled also by @option{-Wconversion}.
9415 @opindex Wflex-array-member-not-at-end
9416 @opindex Wno-flex-array-member-not-at-end
9417 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9418 Warn when a structure containing a C99 flexible array member as the last
9419 field is not at the end of another structure.
9420 This warning warns e.g. about
9422 @smallexample
9423 struct flex  @{ int length; char data[]; @};
9424 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9425 @end smallexample
9427 @opindex Wfloat-conversion
9428 @opindex Wno-float-conversion
9429 @item -Wfloat-conversion
9430 Warn for implicit conversions that reduce the precision of a real value.
9431 This includes conversions from real to integer, and from higher precision
9432 real to lower precision real values.  This option is also enabled by
9433 @option{-Wconversion}.
9435 @opindex Wno-scalar-storage-order
9436 @opindex Wscalar-storage-order
9437 @item -Wno-scalar-storage-order
9438 Do not warn on suspicious constructs involving reverse scalar storage order.
9440 @opindex Wsizeof-array-div
9441 @opindex Wno-sizeof-array-div
9442 @item -Wsizeof-array-div
9443 Warn about divisions of two sizeof operators when the first one is applied
9444 to an array and the divisor does not equal the size of the array element.
9445 In such a case, the computation will not yield the number of elements in the
9446 array, which is likely what the user intended.  This warning warns e.g. about
9447 @smallexample
9448 int fn ()
9450   int arr[10];
9451   return sizeof (arr) / sizeof (short);
9453 @end smallexample
9455 This warning is enabled by @option{-Wall}.
9457 @opindex Wsizeof-pointer-div
9458 @opindex Wno-sizeof-pointer-div
9459 @item -Wsizeof-pointer-div
9460 Warn for suspicious divisions of two sizeof expressions that divide
9461 the pointer size by the element size, which is the usual way to compute
9462 the array size but won't work out correctly with pointers.  This warning
9463 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9464 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9466 @opindex Wsizeof-pointer-memaccess
9467 @opindex Wno-sizeof-pointer-memaccess
9468 @item -Wsizeof-pointer-memaccess
9469 Warn for suspicious length parameters to certain string and memory built-in
9470 functions if the argument uses @code{sizeof}.  This warning triggers for
9471 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9472 an array, but a pointer, and suggests a possible fix, or about
9473 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9474 also warns about calls to bounded string copy functions like @code{strncat}
9475 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9476 the source array.  For example, in the following function the call to
9477 @code{strncat} specifies the size of the source string as the bound.  That
9478 is almost certainly a mistake and so the call is diagnosed.
9479 @smallexample
9480 void make_file (const char *name)
9482   char path[PATH_MAX];
9483   strncpy (path, name, sizeof path - 1);
9484   strncat (path, ".text", sizeof ".text");
9485   @dots{}
9487 @end smallexample
9489 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9491 @opindex Wsizeof-array-argument
9492 @opindex Wno-sizeof-array-argument
9493 @item -Wno-sizeof-array-argument
9494 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9495 declared as an array in a function definition.  This warning is enabled by
9496 default for C and C++ programs.
9498 @opindex Wmemset-elt-size
9499 @opindex Wno-memset-elt-size
9500 @item -Wmemset-elt-size
9501 Warn for suspicious calls to the @code{memset} built-in function, if the
9502 first argument references an array, and the third argument is a number
9503 equal to the number of elements, but not equal to the size of the array
9504 in memory.  This indicates that the user has omitted a multiplication by
9505 the element size.  This warning is enabled by @option{-Wall}.
9507 @opindex Wmemset-transposed-args
9508 @opindex Wno-memset-transposed-args
9509 @item -Wmemset-transposed-args
9510 Warn for suspicious calls to the @code{memset} built-in function where
9511 the second argument is not zero and the third argument is zero.  For
9512 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9513 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9514 is only emitted if the third argument is a literal zero.  Otherwise, if
9515 it is an expression that is folded to zero, or a cast of zero to some
9516 type, it is far less likely that the arguments have been mistakenly
9517 transposed and no warning is emitted.  This warning is enabled
9518 by @option{-Wall}.
9520 @opindex Waddress
9521 @opindex Wno-address
9522 @item -Waddress
9523 Warn about suspicious uses of address expressions. These include comparing
9524 the address of a function or a declared object to the null pointer constant
9525 such as in
9526 @smallexample
9527 void f (void);
9528 void g (void)
9530   if (!f)   // warning: expression evaluates to false
9531     abort ();
9533 @end smallexample
9534 comparisons of a pointer to a string literal, such as in
9535 @smallexample
9536 void f (const char *x)
9538   if (x == "abc")   // warning: expression evaluates to false
9539     puts ("equal");
9541 @end smallexample
9542 and tests of the results of pointer addition or subtraction for equality
9543 to null, such as in
9544 @smallexample
9545 void f (const int *p, int i)
9547   return p + i == NULL;
9549 @end smallexample
9550 Such uses typically indicate a programmer error: the address of most
9551 functions and objects necessarily evaluates to true (the exception are
9552 weak symbols), so their use in a conditional might indicate missing
9553 parentheses in a function call or a missing dereference in an array
9554 expression.  The subset of the warning for object pointers can be
9555 suppressed by casting the pointer operand to an integer type such
9556 as @code{intptr_t} or @code{uintptr_t}.
9557 Comparisons against string literals result in unspecified behavior
9558 and are not portable, and suggest the intent was to call @code{strcmp}.
9559 The warning is suppressed if the suspicious expression is the result
9560 of macro expansion.
9561 @option{-Waddress} warning is enabled by @option{-Wall}.
9563 @opindex Waddress-of-packed-member
9564 @opindex Wno-address-of-packed-member
9565 @item -Wno-address-of-packed-member
9566 Do not warn when the address of packed member of struct or union is taken,
9567 which usually results in an unaligned pointer value.  This is
9568 enabled by default.
9570 @opindex Wlogical-op
9571 @opindex Wno-logical-op
9572 @item -Wlogical-op
9573 Warn about suspicious uses of logical operators in expressions.
9574 This includes using logical operators in contexts where a
9575 bit-wise operator is likely to be expected.  Also warns when
9576 the operands of a logical operator are the same:
9577 @smallexample
9578 extern int a;
9579 if (a < 0 && a < 0) @{ @dots{} @}
9580 @end smallexample
9582 @opindex Wlogical-not-parentheses
9583 @opindex Wno-logical-not-parentheses
9584 @item -Wlogical-not-parentheses
9585 Warn about logical not used on the left hand side operand of a comparison.
9586 This option does not warn if the right operand is considered to be a boolean
9587 expression.  Its purpose is to detect suspicious code like the following:
9588 @smallexample
9589 int a;
9590 @dots{}
9591 if (!a > 1) @{ @dots{} @}
9592 @end smallexample
9594 It is possible to suppress the warning by wrapping the LHS into
9595 parentheses:
9596 @smallexample
9597 if ((!a) > 1) @{ @dots{} @}
9598 @end smallexample
9600 This warning is enabled by @option{-Wall}.
9602 @opindex Waggregate-return
9603 @opindex Wno-aggregate-return
9604 @item -Waggregate-return
9605 Warn if any functions that return structures or unions are defined or
9606 called.  (In languages where you can return an array, this also elicits
9607 a warning.)
9609 @opindex Wno-aggressive-loop-optimizations
9610 @opindex Waggressive-loop-optimizations
9611 @item -Wno-aggressive-loop-optimizations
9612 Warn if in a loop with constant number of iterations the compiler detects
9613 undefined behavior in some statement during one or more of the iterations.
9615 @opindex Wno-attributes
9616 @opindex Wattributes
9617 @item -Wno-attributes
9618 Do not warn if an unexpected @code{__attribute__} is used, such as
9619 unrecognized attributes, function attributes applied to variables,
9620 etc.  This does not stop errors for incorrect use of supported
9621 attributes.
9623 Warnings about ill-formed uses of standard attributes are upgraded to
9624 errors by @option{-pedantic-errors}.
9626 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9627 warnings about unknown scoped attributes (in C++11 and C23).  For example,
9628 @option{-Wno-attributes=vendor::attr} disables warning about the following
9629 declaration:
9631 @smallexample
9632 [[vendor::attr]] void f();
9633 @end smallexample
9635 It is also possible to disable warning about all attributes in a namespace
9636 using @option{-Wno-attributes=vendor::} which prevents warning about both
9637 of these declarations:
9639 @smallexample
9640 [[vendor::safe]] void f();
9641 [[vendor::unsafe]] void f2();
9642 @end smallexample
9644 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9646 @opindex Wno-builtin-declaration-mismatch
9647 @opindex Wbuiltin-declaration-mismatch
9648 @item -Wno-builtin-declaration-mismatch
9649 Warn if a built-in function is declared with an incompatible signature
9650 or as a non-function, or when a built-in function declared with a type
9651 that does not include a prototype is called with arguments whose promoted
9652 types do not match those expected by the function.  When @option{-Wextra}
9653 is specified, also warn when a built-in function that takes arguments is
9654 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9655 warning is enabled by default.  To avoid the warning include the appropriate
9656 header to bring the prototypes of built-in functions into scope.
9658 For example, the call to @code{memset} below is diagnosed by the warning
9659 because the function expects a value of type @code{size_t} as its argument
9660 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9661 the declaration of the function is diagnosed as well.
9662 @smallexample
9663 extern void* memset ();
9664 void f (void *d)
9666   memset (d, '\0', 32);
9668 @end smallexample
9670 @opindex Wno-builtin-macro-redefined
9671 @opindex Wbuiltin-macro-redefined
9672 @item -Wno-builtin-macro-redefined
9673 Do not warn if certain built-in macros are redefined.  This suppresses
9674 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9675 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9677 @opindex Wstrict-prototypes
9678 @opindex Wno-strict-prototypes
9679 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9680 Warn if a function is declared or defined without specifying the
9681 argument types.  (An old-style function definition is permitted without
9682 a warning if preceded by a declaration that specifies the argument
9683 types.)
9685 @opindex Wold-style-declaration
9686 @opindex Wno-old-style-declaration
9687 @item -Wold-style-declaration @r{(C and Objective-C only)}
9688 Warn for obsolescent usages, according to the C Standard, in a
9689 declaration. For example, warn if storage-class specifiers like
9690 @code{static} are not the first things in a declaration.  This warning
9691 is also enabled by @option{-Wextra}.
9693 @opindex Wold-style-definition
9694 @opindex Wno-old-style-definition
9695 @item -Wold-style-definition @r{(C and Objective-C only)}
9696 Warn if an old-style function definition is used.  A warning is given
9697 even if there is a previous prototype.  A definition using @samp{()}
9698 is not considered an old-style definition in C23 mode, because it is
9699 equivalent to @samp{(void)} in that case, but is considered an
9700 old-style definition for older standards.
9702 @opindex Wmissing-parameter-type
9703 @opindex Wno-missing-parameter-type
9704 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9705 A function parameter is declared without a type specifier in K&R-style
9706 functions:
9708 @smallexample
9709 void foo(bar) @{ @}
9710 @end smallexample
9712 This warning is also enabled by @option{-Wextra}.
9714 @opindex Wmissing-prototypes
9715 @opindex Wno-missing-prototypes
9716 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9717 Warn if a global function is defined without a previous prototype
9718 declaration.  This warning is issued even if the definition itself
9719 provides a prototype.  Use this option to detect global functions
9720 that do not have a matching prototype declaration in a header file.
9721 This option is not valid for C++ because all function declarations
9722 provide prototypes and a non-matching declaration declares an
9723 overload rather than conflict with an earlier declaration.
9724 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9726 @opindex Wmissing-variable-declarations
9727 @opindex Wno-missing-variable-declarations
9728 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9729 Warn if a global variable is defined without a previous declaration.
9730 Use this option to detect global variables that do not have a matching
9731 extern declaration in a header file.
9733 @opindex Wmissing-declarations
9734 @opindex Wno-missing-declarations
9735 @item -Wmissing-declarations
9736 Warn if a global function is defined without a previous declaration.
9737 Do so even if the definition itself provides a prototype.
9738 Use this option to detect global functions that are not declared in
9739 header files.  In C, no warnings are issued for functions with previous
9740 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9741 missing prototypes.  In C++, no warnings are issued for function templates,
9742 or for inline functions, or for functions in anonymous namespaces.
9744 @opindex Wmissing-field-initializers
9745 @opindex Wno-missing-field-initializers
9746 @opindex W
9747 @opindex Wextra
9748 @opindex Wno-extra
9749 @item -Wmissing-field-initializers
9750 Warn if a structure's initializer has some fields missing.  For
9751 example, the following code causes such a warning, because
9752 @code{x.h} is implicitly zero:
9754 @smallexample
9755 struct s @{ int f, g, h; @};
9756 struct s x = @{ 3, 4 @};
9757 @end smallexample
9759 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
9760 In C this option does not warn about designated initializers, so the
9761 following modification does not trigger a warning:
9763 @smallexample
9764 struct s @{ int f, g, h; @};
9765 struct s x = @{ .f = 3, .g = 4 @};
9766 @end smallexample
9768 In C this option does not warn about the universal zero initializer
9769 @samp{@{ 0 @}}:
9771 @smallexample
9772 struct s @{ int f, g, h; @};
9773 struct s x = @{ 0 @};
9774 @end smallexample
9776 Likewise, in C++ this option does not warn about the empty @{ @}
9777 initializer, for example:
9779 @smallexample
9780 struct s @{ int f, g, h; @};
9781 s x = @{ @};
9782 @end smallexample
9784 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9785 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9787 @opindex Wmissing-requires
9788 @opindex Wno-missing-requires
9789 @item -Wno-missing-requires
9791 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9793 @smallexample
9794 bool satisfied = requires @{ C<T> @};
9795 @end smallexample
9797 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9798 expression, which it is for all T.  Presumably the user meant to write
9800 @smallexample
9801 bool satisfied = requires @{ requires C<T> @};
9802 @end smallexample
9804 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9805 type @samp{T}.
9807 This warning can be disabled with @option{-Wno-missing-requires}.
9809 @opindex Wmissing-template-keyword
9810 @opindex Wno-missing-template-keyword
9811 @item -Wno-missing-template-keyword
9813 The member access tokens ., -> and :: must be followed by the @code{template}
9814 keyword if the parent object is dependent and the member being named is a
9815 template.
9817 @smallexample
9818 template <class X>
9819 void DoStuff (X x)
9821   x.template DoSomeOtherStuff<X>(); // Good.
9822   x.DoMoreStuff<X>(); // Warning, x is dependent.
9824 @end smallexample
9826 In rare cases it is possible to get false positives. To silence this, wrap
9827 the expression in parentheses. For example, the following is treated as a
9828 template, even where m and N are integers:
9830 @smallexample
9831 void NotATemplate (my_class t)
9833   int N = 5;
9835   bool test = t.m < N > (0); // Treated as a template.
9836   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9838 @end smallexample
9840 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9842 @opindex Wno-multichar
9843 @opindex Wmultichar
9844 @item -Wno-multichar
9845 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9846 Usually they indicate a typo in the user's code, as they have
9847 implementation-defined values, and should not be used in portable code.
9849 @opindex Wnormalized=
9850 @opindex Wnormalized
9851 @opindex Wno-normalized
9852 @cindex NFC
9853 @cindex NFKC
9854 @cindex character set, input normalization
9855 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9856 In ISO C and ISO C++, two identifiers are different if they are
9857 different sequences of characters.  However, sometimes when characters
9858 outside the basic ASCII character set are used, you can have two
9859 different character sequences that look the same.  To avoid confusion,
9860 the ISO 10646 standard sets out some @dfn{normalization rules} which
9861 when applied ensure that two sequences that look the same are turned into
9862 the same sequence.  GCC can warn you if you are using identifiers that
9863 have not been normalized; this option controls that warning.
9865 There are four levels of warning supported by GCC@.  The default is
9866 @option{-Wnormalized=nfc}, which warns about any identifier that is
9867 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9868 recommended form for most uses.  It is equivalent to
9869 @option{-Wnormalized}.
9871 Unfortunately, there are some characters allowed in identifiers by
9872 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9873 identifiers.  That is, there's no way to use these symbols in portable
9874 ISO C or C++ and have all your identifiers in NFC@.
9875 @option{-Wnormalized=id} suppresses the warning for these characters.
9876 It is hoped that future versions of the standards involved will correct
9877 this, which is why this option is not the default.
9879 You can switch the warning off for all characters by writing
9880 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9881 only do this if you are using some other normalization scheme (like
9882 ``D''), because otherwise you can easily create bugs that are
9883 literally impossible to see.
9885 Some characters in ISO 10646 have distinct meanings but look identical
9886 in some fonts or display methodologies, especially once formatting has
9887 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9888 LETTER N'', displays just like a regular @code{n} that has been
9889 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9890 normalization scheme to convert all these into a standard form as
9891 well, and GCC warns if your code is not in NFKC if you use
9892 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9893 about every identifier that contains the letter O because it might be
9894 confused with the digit 0, and so is not the default, but may be
9895 useful as a local coding convention if the programming environment 
9896 cannot be fixed to display these characters distinctly.
9898 @opindex Wno-attribute-warning
9899 @opindex Wattribute-warning
9900 @item -Wno-attribute-warning
9901 Do not warn about usage of functions (@pxref{Function Attributes})
9902 declared with @code{warning} attribute.  By default, this warning is
9903 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9904 warning or @option{-Wno-error=attribute-warning} can be used to
9905 disable the error when compiled with @option{-Werror} flag.
9907 @opindex Wno-deprecated
9908 @opindex Wdeprecated
9909 @item -Wno-deprecated
9910 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9912 @opindex Wno-deprecated-declarations
9913 @opindex Wdeprecated-declarations
9914 @item -Wno-deprecated-declarations
9915 Do not warn about uses of functions (@pxref{Function Attributes}),
9916 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9917 Attributes}) marked as deprecated by using the @code{deprecated}
9918 attribute.
9920 @opindex Wno-overflow
9921 @opindex Woverflow
9922 @item -Wno-overflow
9923 Do not warn about compile-time overflow in constant expressions.
9925 @opindex Wno-odr
9926 @opindex Wodr
9927 @item -Wno-odr
9928 Warn about One Definition Rule violations during link-time optimization.
9929 Enabled by default.
9931 @opindex Wopenacc-parallelism
9932 @opindex Wno-openacc-parallelism
9933 @cindex OpenACC accelerator programming
9934 @item -Wopenacc-parallelism
9935 Warn about potentially suboptimal choices related to OpenACC parallelism.
9937 @opindex Wopenmp-simd
9938 @opindex Wno-openmp-simd
9939 @item -Wopenmp-simd
9940 Warn if the vectorizer cost model overrides the OpenMP
9941 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9942 option can be used to relax the cost model.
9944 @opindex Woverride-init
9945 @opindex Wno-override-init
9946 @opindex W
9947 @opindex Wextra
9948 @opindex Wno-extra
9949 @item -Woverride-init @r{(C and Objective-C only)}
9950 Warn if an initialized field without side effects is overridden when
9951 using designated initializers (@pxref{Designated Inits, , Designated
9952 Initializers}).
9954 This warning is included in @option{-Wextra}.  To get other
9955 @option{-Wextra} warnings without this one, use @option{-Wextra
9956 -Wno-override-init}.
9958 @opindex Woverride-init-side-effects
9959 @opindex Wno-override-init-side-effects
9960 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9961 Do not warn if an initialized field with side effects is overridden when
9962 using designated initializers (@pxref{Designated Inits, , Designated
9963 Initializers}).  This warning is enabled by default.
9965 @opindex Wpacked
9966 @opindex Wno-packed
9967 @item -Wpacked
9968 Warn if a structure is given the packed attribute, but the packed
9969 attribute has no effect on the layout or size of the structure.
9970 Such structures may be mis-aligned for little benefit.  For
9971 instance, in this code, the variable @code{f.x} in @code{struct bar}
9972 is misaligned even though @code{struct bar} does not itself
9973 have the packed attribute:
9975 @smallexample
9976 @group
9977 struct foo @{
9978   int x;
9979   char a, b, c, d;
9980 @} __attribute__((packed));
9981 struct bar @{
9982   char z;
9983   struct foo f;
9985 @end group
9986 @end smallexample
9988 @opindex Wpacked-bitfield-compat
9989 @opindex Wno-packed-bitfield-compat
9990 @item -Wnopacked-bitfield-compat
9991 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9992 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9993 the change can lead to differences in the structure layout.  GCC
9994 informs you when the offset of such a field has changed in GCC 4.4.
9995 For example there is no longer a 4-bit padding between field @code{a}
9996 and @code{b} in this structure:
9998 @smallexample
9999 struct foo
10001   char a:4;
10002   char b:8;
10003 @} __attribute__ ((packed));
10004 @end smallexample
10006 This warning is enabled by default.  Use
10007 @option{-Wno-packed-bitfield-compat} to disable this warning.
10009 @opindex Wpacked-not-aligned
10010 @opindex Wno-packed-not-aligned
10011 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
10012 Warn if a structure field with explicitly specified alignment in a
10013 packed struct or union is misaligned.  For example, a warning will
10014 be issued on @code{struct S}, like, @code{warning: alignment 1 of
10015 'struct S' is less than 8}, in this code:
10017 @smallexample
10018 @group
10019 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
10020 struct __attribute__ ((packed)) S @{
10021   struct S8 s8;
10023 @end group
10024 @end smallexample
10026 This warning is enabled by @option{-Wall}.
10028 @opindex Wpadded
10029 @opindex Wno-padded
10030 @item -Wpadded
10031 Warn if padding is included in a structure, either to align an element
10032 of the structure or to align the whole structure.  Sometimes when this
10033 happens it is possible to rearrange the fields of the structure to
10034 reduce the padding and so make the structure smaller.
10036 @opindex Wredundant-decls
10037 @opindex Wno-redundant-decls
10038 @item -Wredundant-decls
10039 Warn if anything is declared more than once in the same scope, even in
10040 cases where multiple declaration is valid and changes nothing.
10042 @opindex Wrestrict
10043 @opindex Wno-restrict
10044 @item -Wrestrict
10045 Warn when an object referenced by a @code{restrict}-qualified parameter
10046 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
10047 argument, or when copies between such objects overlap.  For example,
10048 the call to the @code{strcpy} function below attempts to truncate the string
10049 by replacing its initial characters with the last four.  However, because
10050 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
10051 the call is diagnosed.
10053 @smallexample
10054 void foo (void)
10056   char a[] = "abcd1234";
10057   strcpy (a, a + 4);
10058   @dots{}
10060 @end smallexample
10061 The @option{-Wrestrict} option detects some instances of simple overlap
10062 even without optimization but works best at @option{-O2} and above.  It
10063 is included in @option{-Wall}.
10065 @opindex Wnested-externs
10066 @opindex Wno-nested-externs
10067 @item -Wnested-externs @r{(C and Objective-C only)}
10068 Warn if an @code{extern} declaration is encountered within a function.
10070 @opindex Winline
10071 @opindex Wno-inline
10072 @item -Winline
10073 Warn if a function that is declared as inline cannot be inlined.
10074 Even with this option, the compiler does not warn about failures to
10075 inline functions declared in system headers.
10077 The compiler uses a variety of heuristics to determine whether or not
10078 to inline a function.  For example, the compiler takes into account
10079 the size of the function being inlined and the amount of inlining
10080 that has already been done in the current function.  Therefore,
10081 seemingly insignificant changes in the source program can cause the
10082 warnings produced by @option{-Winline} to appear or disappear.
10084 @opindex Winterference-size
10085 @item -Winterference-size
10086 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10087 without specifying its value with @option{--param destructive-interference-size}.
10088 Also warn about questionable values for that option.
10090 This variable is intended to be used for controlling class layout, to
10091 avoid false sharing in concurrent code:
10093 @smallexample
10094 struct independent_fields @{
10095   alignas(std::hardware_destructive_interference_size)
10096     std::atomic<int> one;
10097   alignas(std::hardware_destructive_interference_size)
10098     std::atomic<int> two;
10100 @end smallexample
10102 Here @samp{one} and @samp{two} are intended to be far enough apart
10103 that stores to one won't require accesses to the other to reload the
10104 cache line.
10106 By default, @option{--param destructive-interference-size} and
10107 @option{--param constructive-interference-size} are set based on the
10108 current @option{-mtune} option, typically to the L1 cache line size
10109 for the particular target CPU, sometimes to a range if tuning for a
10110 generic target.  So all translation units that depend on ABI
10111 compatibility for the use of these variables must be compiled with
10112 the same @option{-mtune} (or @option{-mcpu}).
10114 If ABI stability is important, such as if the use is in a header for a
10115 library, you should probably not use the hardware interference size
10116 variables at all.  Alternatively, you can force a particular value
10117 with @option{--param}.
10119 If you are confident that your use of the variable does not affect ABI
10120 outside a single build of your project, you can turn off the warning
10121 with @option{-Wno-interference-size}.
10123 @opindex Wint-in-bool-context
10124 @opindex Wno-int-in-bool-context
10125 @item -Wint-in-bool-context
10126 Warn for suspicious use of integer values where boolean values are expected,
10127 such as conditional expressions (?:) using non-boolean integer constants in
10128 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10129 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10130 for all kinds of multiplications regardless of the data type.
10131 This warning is enabled by @option{-Wall}.
10133 @opindex Wno-int-to-pointer-cast
10134 @opindex Wint-to-pointer-cast
10135 @item -Wno-int-to-pointer-cast
10136 Suppress warnings from casts to pointer type of an integer of a
10137 different size. In C++, casting to a pointer type of smaller size is
10138 an error. @option{Wint-to-pointer-cast} is enabled by default.
10141 @opindex Wno-pointer-to-int-cast
10142 @opindex Wpointer-to-int-cast
10143 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10144 Suppress warnings from casts from a pointer to an integer type of a
10145 different size.
10147 @opindex Winvalid-pch
10148 @opindex Wno-invalid-pch
10149 @item -Winvalid-pch
10150 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10151 the search path but cannot be used.
10153 @opindex Winvalid-utf8
10154 @opindex Wno-invalid-utf8
10155 @item -Winvalid-utf8
10156 Warn if an invalid UTF-8 character is found.
10157 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10158 is used and turned into error with @option{-pedantic-errors}.
10160 @opindex Wunicode
10161 @opindex Wno-unicode
10162 @item -Wno-unicode
10163 Don't diagnose invalid forms of delimited or named escape sequences which are
10164 treated as separate tokens.  @option{Wunicode} is enabled by default.
10166 @opindex Wlong-long
10167 @opindex Wno-long-long
10168 @item -Wlong-long
10169 Warn if @code{long long} type is used.  This is enabled by either
10170 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10171 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10173 This warning is upgraded to an error by @option{-pedantic-errors}.
10175 @opindex Wvariadic-macros
10176 @opindex Wno-variadic-macros
10177 @item -Wvariadic-macros
10178 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10179 alternate syntax is used in ISO C99 mode.  This is enabled by either
10180 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10181 messages, use @option{-Wno-variadic-macros}.
10183 @opindex Wvarargs
10184 @opindex Wno-varargs
10185 @item -Wno-varargs
10186 Do not warn upon questionable usage of the macros used to handle variable
10187 arguments like @code{va_start}.  These warnings are enabled by default.
10189 @opindex Wvector-operation-performance
10190 @opindex Wno-vector-operation-performance
10191 @item -Wvector-operation-performance
10192 Warn if vector operation is not implemented via SIMD capabilities of the
10193 architecture.  Mainly useful for the performance tuning.
10194 Vector operation can be implemented @code{piecewise}, which means that the
10195 scalar operation is performed on every vector element; 
10196 @code{in parallel}, which means that the vector operation is implemented
10197 using scalars of wider type, which normally is more performance efficient;
10198 and @code{as a single scalar}, which means that vector fits into a
10199 scalar type.
10201 @opindex Wvla
10202 @opindex Wno-vla
10203 @item -Wvla
10204 Warn if a variable-length array is used in the code.
10205 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10206 the variable-length array.
10208 This warning is upgraded to an error by @option{-pedantic-errors}.
10210 @opindex Wvla-larger-than=
10211 @opindex Wno-vla-larger-than
10212 @item -Wvla-larger-than=@var{byte-size}
10213 If this option is used, the compiler warns for declarations of
10214 variable-length arrays whose size is either unbounded, or bounded
10215 by an argument that allows the array size to exceed @var{byte-size}
10216 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10217 works, but with variable-length arrays.
10219 Note that GCC may optimize small variable-length arrays of a known
10220 value into plain arrays, so this warning may not get triggered for
10221 such arrays.
10223 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10224 is typically only effective when @option{-ftree-vrp} is active (default
10225 for @option{-O2} and above).
10227 See also @option{-Walloca-larger-than=@var{byte-size}}.
10229 @opindex Wno-vla-larger-than
10230 @item -Wno-vla-larger-than
10231 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10232 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10234 @opindex Wno-vla-parameter
10235 @item -Wvla-parameter
10236 Warn about redeclarations of functions involving arguments of Variable
10237 Length Array types of inconsistent kinds or forms, and enable the detection
10238 of out-of-bounds accesses to such parameters by warnings such as
10239 @option{-Warray-bounds}.
10241 If the first function declaration uses the VLA form the bound specified
10242 in the array is assumed to be the minimum number of elements expected to
10243 be provided in calls to the function and the maximum number of elements
10244 accessed by it.  Failing to provide arguments of sufficient size or
10245 accessing more than the maximum number of elements may be diagnosed.
10247 For example, the warning triggers for the following redeclarations because
10248 the first one allows an array of any size to be passed to @code{f} while
10249 the second one specifies that the array argument must have at least @code{n}
10250 elements.  In addition, calling @code{f} with the associated VLA bound
10251 parameter in excess of the actual VLA bound triggers a warning as well.
10253 @smallexample
10254 void f (int n, int[n]);
10255 // warning: argument 2 previously declared as a VLA
10256 void f (int, int[]);
10258 void g (int n)
10260     if (n > 4)
10261       return;
10262     int a[n];
10263     // warning: access to a by f may be out of bounds
10264     f (sizeof a, a);
10265   @dots{}
10268 @end smallexample
10270 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10271 @option{-Warray-parameter} option triggers warnings for similar problems
10272 involving ordinary array arguments.
10274 @opindex Wvolatile-register-var
10275 @opindex Wno-volatile-register-var
10276 @item -Wvolatile-register-var
10277 Warn if a register variable is declared volatile.  The volatile
10278 modifier does not inhibit all optimizations that may eliminate reads
10279 and/or writes to register variables.  This warning is enabled by
10280 @option{-Wall}.
10282 @opindex Wxor-used-as-pow
10283 @opindex Wno-xor-used-as-pow
10284 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10285 Warn about uses of @code{^}, the exclusive or operator, where it appears
10286 the user meant exponentiation.  Specifically, the warning occurs when the
10287 left-hand side is the decimal constant 2 or 10 and the right-hand side
10288 is also a decimal constant.
10290 In C and C++, @code{^} means exclusive or, whereas in some other languages
10291 (e.g. TeX and some versions of BASIC) it means exponentiation.
10293 This warning is enabled by default.  It can be silenced by converting one
10294 of the operands to hexadecimal.
10296 @opindex Wdisabled-optimization
10297 @opindex Wno-disabled-optimization
10298 @item -Wdisabled-optimization
10299 Warn if a requested optimization pass is disabled.  This warning does
10300 not generally indicate that there is anything wrong with your code; it
10301 merely indicates that GCC's optimizers are unable to handle the code
10302 effectively.  Often, the problem is that your code is too big or too
10303 complex; GCC refuses to optimize programs when the optimization
10304 itself is likely to take inordinate amounts of time.
10306 @opindex Wpointer-sign
10307 @opindex Wno-pointer-sign
10308 @item -Wpointer-sign @r{(C and Objective-C only)}
10309 Warn for pointer argument passing or assignment with different signedness.
10310 This option is only supported for C and Objective-C@.  It is implied by
10311 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10312 @option{-Wno-pointer-sign}.
10314 This warning is upgraded to an error by @option{-pedantic-errors}.
10316 @opindex Wstack-protector
10317 @opindex Wno-stack-protector
10318 @item -Wstack-protector
10319 This option is only active when @option{-fstack-protector} is active.  It
10320 warns about functions that are not protected against stack smashing.
10322 @opindex Woverlength-strings
10323 @opindex Wno-overlength-strings
10324 @item -Woverlength-strings
10325 Warn about string constants that are longer than the ``minimum
10326 maximum'' length specified in the C standard.  Modern compilers
10327 generally allow string constants that are much longer than the
10328 standard's minimum limit, but very portable programs should avoid
10329 using longer strings.
10331 The limit applies @emph{after} string constant concatenation, and does
10332 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10333 C99, it was raised to 4095.  C++98 does not specify a normative
10334 minimum maximum, so we do not diagnose overlength strings in C++@.
10336 This option is implied by @option{-Wpedantic}, and can be disabled with
10337 @option{-Wno-overlength-strings}.
10339 @opindex Wunsuffixed-float-constants
10340 @opindex Wno-unsuffixed-float-constants
10341 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10343 Issue a warning for any floating constant that does not have
10344 a suffix.  When used together with @option{-Wsystem-headers} it
10345 warns about such constants in system header files.  This can be useful
10346 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10347 from the decimal floating-point extension to C99.
10349 @opindex Wlto-type-mismatch
10350 @opindex Wno-lto-type-mismatch
10351 @item -Wno-lto-type-mismatch
10353 During the link-time optimization, do not warn about type mismatches in
10354 global declarations from different compilation units.
10355 Requires @option{-flto} to be enabled.  Enabled by default.
10357 @opindex Wdesignated-init
10358 @opindex Wno-designated-init
10359 @item -Wno-designated-init @r{(C and Objective-C only)}
10360 Suppress warnings when a positional initializer is used to initialize
10361 a structure that has been marked with the @code{designated_init}
10362 attribute.
10364 @end table
10366 @node Static Analyzer Options
10367 @section Options That Control Static Analysis
10369 @table @gcctabopt
10370 @opindex analyzer
10371 @opindex fanalyzer
10372 @opindex fno-analyzer
10373 @item -fanalyzer
10374 This option enables an static analysis of program flow which looks
10375 for ``interesting'' interprocedural paths through the
10376 code, and issues warnings for problems found on them.
10378 This analysis is much more expensive than other GCC warnings.
10380 In technical terms, it performs coverage-guided symbolic execution of
10381 the code being compiled.  It is neither sound nor complete: it can
10382 have false positives and false negatives.  It is a bug-finding tool,
10383 rather than a tool for proving program correctness.
10385 The analyzer is only suitable for use on C code in this release.
10387 Enabling this option effectively enables the following warnings:
10389 @gccoptlist{
10390 -Wanalyzer-allocation-size
10391 -Wanalyzer-deref-before-check
10392 -Wanalyzer-double-fclose
10393 -Wanalyzer-double-free
10394 -Wanalyzer-exposure-through-output-file
10395 -Wanalyzer-exposure-through-uninit-copy
10396 -Wanalyzer-fd-access-mode-mismatch
10397 -Wanalyzer-fd-double-close
10398 -Wanalyzer-fd-leak
10399 -Wanalyzer-fd-phase-mismatch
10400 -Wanalyzer-fd-type-mismatch
10401 -Wanalyzer-fd-use-after-close
10402 -Wanalyzer-fd-use-without-check
10403 -Wanalyzer-file-leak
10404 -Wanalyzer-free-of-non-heap
10405 -Wanalyzer-imprecise-fp-arithmetic
10406 -Wanalyzer-infinite-loop
10407 -Wanalyzer-infinite-recursion
10408 -Wanalyzer-jump-through-null
10409 -Wanalyzer-malloc-leak
10410 -Wanalyzer-mismatching-deallocation
10411 -Wanalyzer-null-argument
10412 -Wanalyzer-null-dereference
10413 -Wanalyzer-out-of-bounds
10414 -Wanalyzer-overlapping-buffers
10415 -Wanalyzer-possible-null-argument
10416 -Wanalyzer-possible-null-dereference
10417 -Wanalyzer-putenv-of-auto-var
10418 -Wanalyzer-shift-count-negative
10419 -Wanalyzer-shift-count-overflow
10420 -Wanalyzer-stale-setjmp-buffer
10421 -Wanalyzer-tainted-allocation-size
10422 -Wanalyzer-tainted-array-index
10423 -Wanalyzer-tainted-assertion
10424 -Wanalyzer-tainted-divisor
10425 -Wanalyzer-tainted-offset
10426 -Wanalyzer-tainted-size
10427 -Wanalyzer-unsafe-call-within-signal-handler
10428 -Wanalyzer-use-after-free
10429 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10430 -Wanalyzer-use-of-uninitialized-value
10431 -Wanalyzer-va-arg-type-mismatch
10432 -Wanalyzer-va-list-exhausted
10433 -Wanalyzer-va-list-leak
10434 -Wanalyzer-va-list-use-after-va-end
10435 -Wanalyzer-write-to-const
10436 -Wanalyzer-write-to-string-literal
10439 This option is only available if GCC was configured with analyzer
10440 support enabled.
10442 @opindex Wanalyzer-too-complex
10443 @opindex Wno-analyzer-too-complex
10444 @item -Wanalyzer-too-complex
10445 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10446 to attempt to explore the control flow and data flow in the program,
10447 but these can be defeated by sufficiently complicated code.
10449 By default, the analysis silently stops if the code is too
10450 complicated for the analyzer to fully explore and it reaches an internal
10451 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10453 @opindex Wanalyzer-allocation-size
10454 @opindex Wno-analyzer-allocation-size
10455 @item -Wno-analyzer-allocation-size
10456 This warning requires @option{-fanalyzer}, which enables it;
10457 to disable it, use @option{-Wno-analyzer-allocation-size}.
10459 This diagnostic warns for paths through the code in which a pointer to
10460 a buffer is assigned to point at a buffer with a size that is not a
10461 multiple of @code{sizeof (*pointer)}.
10463 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10465 @opindex Wanalyzer-deref-before-check
10466 @opindex Wno-analyzer-deref-before-check
10467 @item -Wno-analyzer-deref-before-check
10468 This warning requires @option{-fanalyzer}, which enables it; use
10469 @option{-Wno-analyzer-deref-before-check}
10470 to disable it.
10472 This diagnostic warns for paths through the code in which a pointer
10473 is checked for @code{NULL} *after* it has already been
10474 dereferenced, suggesting that the pointer could have been NULL.
10475 Such cases suggest that the check for NULL is either redundant,
10476 or that it needs to be moved to before the pointer is dereferenced.
10478 This diagnostic also considers values passed to a function argument
10479 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10480 value, and thus will complain if such values are checked for @code{NULL}
10481 after returning from such a function call.
10483 This diagnostic is unlikely to be reported when any level of optimization
10484 is enabled, as GCC's optimization logic will typically consider such
10485 checks for NULL as being redundant, and optimize them away before the
10486 analyzer "sees" them.  Hence optimization should be disabled when
10487 attempting to trigger this diagnostic.
10489 @opindex Wanalyzer-double-fclose
10490 @opindex Wno-analyzer-double-fclose
10491 @item -Wno-analyzer-double-fclose
10492 This warning requires @option{-fanalyzer}, which enables it; use
10493 @option{-Wno-analyzer-double-fclose} to disable it.
10495 This diagnostic warns for paths through the code in which a @code{FILE *}
10496 can have @code{fclose} called on it more than once.
10498 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10500 @opindex Wanalyzer-double-free
10501 @opindex Wno-analyzer-double-free
10502 @item -Wno-analyzer-double-free
10503 This warning requires @option{-fanalyzer}, which enables it; use
10504 @option{-Wno-analyzer-double-free} to disable it.
10506 This diagnostic warns for paths through the code in which a pointer
10507 can have a deallocator called on it more than once, either @code{free},
10508 or a deallocator referenced by attribute @code{malloc}.
10510 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10512 @opindex Wanalyzer-exposure-through-output-file
10513 @opindex Wno-analyzer-exposure-through-output-file
10514 @item -Wno-analyzer-exposure-through-output-file
10515 This warning requires @option{-fanalyzer}, which enables it; use
10516 @option{-Wno-analyzer-exposure-through-output-file}
10517 to disable it.
10519 This diagnostic warns for paths through the code in which a
10520 security-sensitive value is written to an output file
10521 (such as writing a password to a log file).
10523 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10525 @opindex Wanalyzer-exposure-through-uninit-copy
10526 @opindex Wno-analyzer-exposure-through-uninit-copy
10527 @item -Wanalyzer-exposure-through-uninit-copy
10528 This warning requires both @option{-fanalyzer} and the use of a plugin
10529 to specify a function that copies across a ``trust boundary''.  Use
10530 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10532 This diagnostic warns for ``infoleaks'' - paths through the code in which
10533 uninitialized values are copied across a security boundary
10534 (such as code within an OS kernel that copies a partially-initialized
10535 struct on the stack to user space).
10537 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10539 @opindex Wanalyzer-fd-access-mode-mismatch
10540 @opindex Wno-analyzer-fd-access-mode-mismatch
10541 @item -Wno-analyzer-fd-access-mode-mismatch
10542 This warning requires @option{-fanalyzer}, which enables it; use
10543 @option{-Wno-analyzer-fd-access-mode-mismatch}
10544 to disable it.
10546 This diagnostic warns for paths through code in which a
10547 @code{read} on a write-only file descriptor is attempted, or vice versa.
10549 This diagnostic also warns for code paths in a which a function with attribute
10550 @code{fd_arg_read (N)} is called with a file descriptor opened with
10551 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10552 @code{fd_arg_write (N)} is called with a file descriptor opened with
10553 @code{O_RDONLY} at referenced argument @var{N}.
10555 @opindex Wanalyzer-fd-double-close
10556 @opindex Wno-analyzer-fd-double-close
10557 @item -Wno-analyzer-fd-double-close
10558 This warning requires @option{-fanalyzer}, which enables it; use
10559 @option{-Wno-analyzer-fd-double-close}
10560 to disable it.
10562 This diagnostic warns for paths through code in which a
10563 file descriptor can be closed more than once.
10565 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10567 @opindex Wanalyzer-fd-leak
10568 @opindex Wno-analyzer-fd-leak
10569 @item -Wno-analyzer-fd-leak
10570 This warning requires @option{-fanalyzer}, which enables it; use
10571 @option{-Wno-analyzer-fd-leak}
10572 to disable it.
10574 This diagnostic warns for paths through code in which an
10575 open file descriptor is leaked.
10577 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10579 @opindex Wanalyzer-fd-phase-mismatch
10580 @opindex Wno-analyzer-fd-phase-mismatch
10581 @item -Wno-analyzer-fd-phase-mismatch
10582 This warning requires @option{-fanalyzer}, which enables it; use
10583 @option{-Wno-analyzer-fd-phase-mismatch}
10584 to disable it.
10586 This diagnostic warns for paths through code in which an operation is
10587 attempted in the wrong phase of a file descriptor's lifetime.
10588 For example, it will warn on attempts to call @code{accept} on a stream
10589 socket that has not yet had @code{listen} successfully called on it.
10591 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10593 @opindex Wanalyzer-fd-type-mismatch
10594 @opindex Wno-analyzer-fd-type-mismatch
10595 @item -Wno-analyzer-fd-type-mismatch
10596 This warning requires @option{-fanalyzer}, which enables it; use
10597 @option{-Wno-analyzer-fd-type-mismatch}
10598 to disable it.
10600 This diagnostic warns for paths through code in which an
10601 operation is attempted on the wrong type of file descriptor.
10602 For example, it will warn on attempts to use socket operations
10603 on a file descriptor obtained via @code{open}, or when attempting
10604 to use a stream socket operation on a datagram socket.
10606 @opindex Wanalyzer-fd-use-after-close
10607 @opindex Wno-analyzer-fd-use-after-close
10608 @item -Wno-analyzer-fd-use-after-close
10609 This warning requires @option{-fanalyzer}, which enables it; use
10610 @option{-Wno-analyzer-fd-use-after-close}
10611 to disable it.
10613 This diagnostic warns for paths through code in which a
10614 read or write is called on a closed file descriptor.
10616 This diagnostic also warns for paths through code in which
10617 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10618 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10619 referenced argument @code{N}.
10621 @opindex Wanalyzer-fd-use-without-check
10622 @opindex Wno-analyzer-fd-use-without-check
10623 @item -Wno-analyzer-fd-use-without-check
10624 This warning requires @option{-fanalyzer}, which enables it; use
10625 @option{-Wno-analyzer-fd-use-without-check}
10626 to disable it.
10628 This diagnostic warns for paths through code in which a
10629 file descriptor is used without being checked for validity.
10631 This diagnostic also warns for paths through code in which
10632 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10633 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10634 argument @code{N}, without being checked for validity.
10636 @opindex Wanalyzer-file-leak
10637 @opindex Wno-analyzer-file-leak
10638 @item -Wno-analyzer-file-leak
10639 This warning requires @option{-fanalyzer}, which enables it; use
10640 @option{-Wno-analyzer-file-leak}
10641 to disable it.
10643 This diagnostic warns for paths through the code in which a
10644 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10646 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10648 @opindex Wanalyzer-free-of-non-heap
10649 @opindex Wno-analyzer-free-of-non-heap
10650 @item -Wno-analyzer-free-of-non-heap
10651 This warning requires @option{-fanalyzer}, which enables it; use
10652 @option{-Wno-analyzer-free-of-non-heap}
10653 to disable it.
10655 This diagnostic warns for paths through the code in which @code{free}
10656 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10658 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10660 @opindex Wanalyzer-imprecise-fp-arithmetic
10661 @opindex Wno-analyzer-imprecise-fp-arithmetic
10662 @item -Wno-analyzer-imprecise-fp-arithmetic
10663 This warning requires @option{-fanalyzer}, which enables it; use
10664 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10665 to disable it.
10667 This diagnostic warns for paths through the code in which floating-point
10668 arithmetic is used in locations where precise computation is needed.  This
10669 diagnostic only warns on use of floating-point operands inside the
10670 calculation of an allocation size at the moment.
10672 @opindex Wanalyzer-infinite-loop
10673 @opindex Wno-analyzer-infinite-loop
10674 @item -Wno-analyzer-infinite-loop
10675 This warning requires @option{-fanalyzer}, which enables it; use
10676 @option{-Wno-analyzer-infinite-loop} to disable it.
10678 This diagnostics warns for paths through the code which appear to
10679 lead to an infinite loop.
10681 Specifically, the analyzer will issue this warning when it "sees" a loop
10682 in which:
10683 @itemize @bullet
10684 @item
10685 no externally-visible work could be being done within the loop
10686 @item
10687 there is no way to escape from the loop
10688 @item
10689 the analyzer is sufficiently confident about the program state
10690 throughout the loop to know that the above are true
10691 @end itemize
10693 One way for this warning to be emitted is when there is an execution
10694 path through a loop for which taking the path on one iteration implies
10695 that the same path will be taken on all subsequent iterations.
10697 For example, consider:
10699 @smallexample
10700   while (1)
10701     @{
10702       char opcode = *cpu_state.pc;
10703       switch (opcode)
10704        @{
10705        case OPCODE_FOO:
10706          handle_opcode_foo (&cpu_state);
10707          break;
10708        case OPCODE_BAR:
10709          handle_opcode_bar (&cpu_state);
10710          break;
10711        @}
10712     @}
10713 @end smallexample
10715 The analyzer will complain for the above case because if @code{opcode}
10716 ever matches none of the cases, the @code{switch} will follow the
10717 implicit @code{default} case, making the body of the loop be a ``no-op''
10718 with @code{cpu_state.pc} unchanged, and thus using the same value of
10719 @code{opcode} on all subseqent iterations, leading to an infinite loop.
10721 See @uref{https://cwe.mitre.org/data/definitions/835.html, CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')}.
10723 @opindex Wanalyzer-infinite-recursion
10724 @opindex Wno-analyzer-infinite-recursion
10725 @item -Wno-analyzer-infinite-recursion
10726 This warning requires @option{-fanalyzer}, which enables it; use
10727 @option{-Wno-analyzer-infinite-recursion} to disable it.
10729 This diagnostics warns for paths through the code which appear to
10730 lead to infinite recursion.
10732 Specifically, when the analyzer "sees" a recursive call, it will compare
10733 the state of memory at the entry to the new frame with that at the entry
10734 to the previous frame of that function on the stack.  The warning is
10735 issued if nothing in memory appears to be changing; any changes observed
10736 to parameters or globals are assumed to lead to termination of the
10737 recursion and thus suppress the warning.
10739 This diagnostic is likely to miss cases of infinite recursion that
10740 are convered to iteration by the optimizer before the analyzer "sees"
10741 them.  Hence optimization should be disabled when attempting to trigger
10742 this diagnostic.
10744 Compare with @option{-Winfinite-recursion}, which provides a similar
10745 diagnostic, but is implemented in a different way.
10747 See @uref{https://cwe.mitre.org/data/definitions/674.html, CWE-674: Uncontrolled Recursion}.
10749 @opindex Wanalyzer-jump-through-null
10750 @opindex Wno-analyzer-jump-through-null
10751 @item -Wno-analyzer-jump-through-null
10752 This warning requires @option{-fanalyzer}, which enables it; use
10753 @option{-Wno-analyzer-jump-through-null}
10754 to disable it.
10756 This diagnostic warns for paths through the code in which a @code{NULL}
10757 function pointer is called.
10759 @opindex Wanalyzer-malloc-leak
10760 @opindex Wno-analyzer-malloc-leak
10761 @item -Wno-analyzer-malloc-leak
10762 This warning requires @option{-fanalyzer}, which enables it; use
10763 @option{-Wno-analyzer-malloc-leak}
10764 to disable it.
10766 This diagnostic warns for paths through the code in which a
10767 pointer allocated via an allocator is leaked: either @code{malloc},
10768 or a function marked with attribute @code{malloc}.
10770 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10772 @opindex Wanalyzer-mismatching-deallocation
10773 @opindex Wno-analyzer-mismatching-deallocation
10774 @item -Wno-analyzer-mismatching-deallocation
10775 This warning requires @option{-fanalyzer}, which enables it; use
10776 @option{-Wno-analyzer-mismatching-deallocation}
10777 to disable it.
10779 This diagnostic warns for paths through the code in which the
10780 wrong deallocation function is called on a pointer value, based on
10781 which function was used to allocate the pointer value.  The diagnostic
10782 will warn about mismatches between @code{free}, scalar @code{delete}
10783 and vector @code{delete[]}, and those marked as allocator/deallocator
10784 pairs using attribute @code{malloc}.
10786 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10788 @opindex Wanalyzer-out-of-bounds
10789 @opindex Wno-analyzer-out-of-bounds
10790 @item -Wno-analyzer-out-of-bounds
10791 This warning requires @option{-fanalyzer}, which enables it; use
10792 @option{-Wno-analyzer-out-of-bounds} to disable it.
10794 This diagnostic warns for paths through the code in which a buffer is
10795 definitely read or written out-of-bounds.  The diagnostic applies for
10796 cases where the analyzer is able to determine a constant offset and for
10797 accesses past the end of a buffer, also a constant capacity.  Further,
10798 the diagnostic does limited checking for accesses past the end when the
10799 offset as well as the capacity is symbolic.
10801 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10803 For cases where the analyzer is able, it will emit a text art diagram
10804 visualizing the spatial relationship between the memory region that the
10805 analyzer predicts would be accessed, versus the range of memory that is
10806 valid to access: whether they overlap, are touching, are close or far
10807 apart; which one is before or after in memory, the relative sizes
10808 involved, the direction of the access (read vs write), and, in some
10809 cases, the values of data involved.  This diagram can be suppressed
10810 using @option{-fdiagnostics-text-art-charset=none}.
10812 @opindex Wanalyzer-overlapping-buffers
10813 @opindex Wno-analyzer-overlapping-buffers
10814 @item -Wno-analyzer-overlapping-buffers
10815 This warning requires @option{-fanalyzer}, which enables it; use
10816 @option{-Wno-analyzer-overlapping-buffers} to disable it.
10818 This diagnostic warns for paths through the code in which overlapping
10819 buffers are passed to an API for which the behavior on such buffers
10820 is undefined.
10822 Specifically, the diagnostic occurs on calls to the following functions
10823 @itemize @bullet
10824 @item @code{memcpy}
10825 @item @code{strcat}
10826 @item @code{strcpy}
10827 @end itemize
10828 for cases where the buffers are known to overlap.
10830 @opindex Wanalyzer-possible-null-argument
10831 @opindex Wno-analyzer-possible-null-argument
10832 @item -Wno-analyzer-possible-null-argument
10833 This warning requires @option{-fanalyzer}, which enables it; use
10834 @option{-Wno-analyzer-possible-null-argument} to disable it.
10836 This diagnostic warns for paths through the code in which a
10837 possibly-NULL value is passed to a function argument marked
10838 with @code{__attribute__((nonnull))} as requiring a non-NULL
10839 value.
10841 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10843 @opindex Wanalyzer-possible-null-dereference
10844 @opindex Wno-analyzer-possible-null-dereference
10845 @item -Wno-analyzer-possible-null-dereference
10846 This warning requires @option{-fanalyzer}, which enables it; use
10847 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10849 This diagnostic warns for paths through the code in which a
10850 possibly-NULL value is dereferenced.
10852 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10854 @opindex Wanalyzer-null-argument
10855 @opindex Wno-analyzer-null-argument
10856 @item -Wno-analyzer-null-argument
10857 This warning requires @option{-fanalyzer}, which enables it; use
10858 @option{-Wno-analyzer-null-argument} to disable it.
10860 This diagnostic warns for paths through the code in which a
10861 value known to be NULL is passed to a function argument marked
10862 with @code{__attribute__((nonnull))} as requiring a non-NULL
10863 value.
10865 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10867 @opindex Wanalyzer-null-dereference
10868 @opindex Wno-analyzer-null-dereference
10869 @item -Wno-analyzer-null-dereference
10870 This warning requires @option{-fanalyzer}, which enables it; use
10871 @option{-Wno-analyzer-null-dereference} to disable it.
10873 This diagnostic warns for paths through the code in which a
10874 value known to be NULL is dereferenced.
10876 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10878 @opindex Wanalyzer-putenv-of-auto-var
10879 @opindex Wno-analyzer-putenv-of-auto-var
10880 @item -Wno-analyzer-putenv-of-auto-var
10881 This warning requires @option{-fanalyzer}, which enables it; use
10882 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10884 This diagnostic warns for paths through the code in which a
10885 call to @code{putenv} is passed a pointer to an automatic variable
10886 or an on-stack buffer.
10888 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}.
10890 @opindex Wanalyzer-shift-count-negative
10891 @opindex Wno-analyzer-shift-count-negative
10892 @item -Wno-analyzer-shift-count-negative
10893 This warning requires @option{-fanalyzer}, which enables it; use
10894 @option{-Wno-analyzer-shift-count-negative} to disable it.
10896 This diagnostic warns for paths through the code in which a
10897 shift is attempted with a negative count.  It is analogous to
10898 the @option{-Wshift-count-negative} diagnostic implemented in
10899 the C/C++ front ends, but is implemented based on analyzing
10900 interprocedural paths, rather than merely parsing the syntax tree.
10901 However, the analyzer does not prioritize detection of such paths, so
10902 false negatives are more likely relative to other warnings.
10904 @opindex Wanalyzer-shift-count-overflow
10905 @opindex Wno-analyzer-shift-count-overflow
10906 @item -Wno-analyzer-shift-count-overflow
10907 This warning requires @option{-fanalyzer}, which enables it; use
10908 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10910 This diagnostic warns for paths through the code in which a
10911 shift is attempted with a count greater than or equal to the
10912 precision of the operand's type.  It is analogous to
10913 the @option{-Wshift-count-overflow} diagnostic implemented in
10914 the C/C++ front ends, but is implemented based on analyzing
10915 interprocedural paths, rather than merely parsing the syntax tree.
10916 However, the analyzer does not prioritize detection of such paths, so
10917 false negatives are more likely relative to other warnings.
10919 @opindex Wanalyzer-stale-setjmp-buffer
10920 @opindex Wno-analyzer-stale-setjmp-buffer
10921 @item -Wno-analyzer-stale-setjmp-buffer
10922 This warning requires @option{-fanalyzer}, which enables it; use
10923 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10925 This diagnostic warns for paths through the code in which
10926 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10927 to a @code{setjmp} call in a function that has returned.
10929 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10930 location, it records the stack frame.  The stack frame becomes invalid
10931 when the function containing the @code{setjmp} call returns.  Attempting
10932 to rewind to it via @code{longjmp} would reference a stack frame that
10933 no longer exists, and likely lead to a crash (or worse).
10935 @opindex Wanalyzer-tainted-allocation-size
10936 @opindex Wno-analyzer-tainted-allocation-size
10937 @item -Wno-analyzer-tainted-allocation-size
10938 This warning requires @option{-fanalyzer} which enables it;
10939 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10941 This diagnostic warns for paths through the code in which a value
10942 that could be under an attacker's control is used as the size
10943 of an allocation without being sanitized, so that an attacker could
10944 inject an excessively large allocation and potentially cause a denial
10945 of service attack.
10947 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10949 @opindex Wanalyzer-tainted-assertion
10950 @opindex Wno-analyzer-tainted-assertion
10951 @item -Wno-analyzer-tainted-assertion
10953 This warning requires @option{-fanalyzer} which enables it;
10954 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10956 This diagnostic warns for paths through the code in which a value
10957 that could be under an attacker's control is used as part of a
10958 condition without being first sanitized, and that condition guards a
10959 call to a function marked with attribute @code{noreturn}
10960 (such as the function @code{__builtin_unreachable}).  Such functions
10961 typically indicate abnormal termination of the program, such as for
10962 assertion failure handlers.  For example:
10964 @smallexample
10965 assert (some_tainted_value < SOME_LIMIT);
10966 @end smallexample
10968 In such cases:
10970 @itemize
10971 @item
10972 when assertion-checking is enabled: an attacker could trigger
10973 a denial of service by injecting an assertion failure
10975 @item
10976 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10977 an attacker could inject data that subverts the process, since it
10978 presumably violates a precondition that is being assumed by the code.
10980 @end itemize
10982 Note that when assertion-checking is disabled, the assertions are
10983 typically removed by the preprocessor before the analyzer has a chance
10984 to "see" them, so this diagnostic can only generate warnings on builds
10985 in which assertion-checking is enabled.
10987 For the purpose of this warning, any function marked with attribute
10988 @code{noreturn} is considered as a possible assertion failure
10989 handler, including @code{__builtin_unreachable}.  Note that these functions
10990 are sometimes removed by the optimizer before the analyzer "sees" them.
10991 Hence optimization should be disabled when attempting to trigger this
10992 diagnostic.
10994 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10996 The warning can also report problematic constructions such as
10998 @smallexample
10999 switch (some_tainted_value) @{
11000 case 0:
11001   /* [...etc; various valid cases omitted...] */
11002   break;
11004 default:
11005   __builtin_unreachable (); /* BUG: attacker can trigger this  */
11007 @end smallexample
11009 despite the above not being an assertion failure, strictly speaking.
11011 @opindex Wanalyzer-tainted-array-index
11012 @opindex Wno-analyzer-tainted-array-index
11013 @item -Wno-analyzer-tainted-array-index
11014 This warning requires @option{-fanalyzer} which enables it;
11015 use @option{-Wno-analyzer-tainted-array-index} to disable it.
11017 This diagnostic warns for paths through the code in which a value
11018 that could be under an attacker's control is used as the index
11019 of an array access without being sanitized, so that an attacker
11020 could inject an out-of-bounds access.
11022 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11024 @opindex Wanalyzer-tainted-divisor
11025 @opindex Wno-analyzer-tainted-divisor
11026 @item -Wno-analyzer-tainted-divisor
11027 This warning requires @option{-fanalyzer} which enables it;
11028 use @option{-Wno-analyzer-tainted-divisor} to disable it.
11030 This diagnostic warns for paths through the code in which a value
11031 that could be under an attacker's control is used as the divisor
11032 in a division or modulus operation without being sanitized, so that
11033 an attacker could inject a division-by-zero.
11035 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
11037 @opindex Wanalyzer-tainted-offset
11038 @opindex Wno-analyzer-tainted-offset
11039 @item -Wno-analyzer-tainted-offset
11040 This warning requires @option{-fanalyzer} which enables it;
11041 use @option{-Wno-analyzer-tainted-offset} to disable it.
11043 This diagnostic warns for paths through the code in which a value
11044 that could be under an attacker's control is used as a pointer offset
11045 without being sanitized, so that an attacker could inject an out-of-bounds
11046 access.
11048 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
11050 @opindex Wanalyzer-tainted-size
11051 @opindex Wno-analyzer-tainted-size
11052 @item -Wno-analyzer-tainted-size
11053 This warning requires @option{-fanalyzer} which enables it;
11054 use @option{-Wno-analyzer-tainted-size} to disable it.
11056 This diagnostic warns for paths through the code in which a value
11057 that could be under an attacker's control is used as the size of
11058 an operation such as @code{memset} without being sanitized, so that an
11059 attacker could inject an out-of-bounds access.
11061 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
11063 @opindex Wanalyzer-unsafe-call-within-signal-handler
11064 @opindex Wno-analyzer-unsafe-call-within-signal-handler
11065 @item -Wno-analyzer-unsafe-call-within-signal-handler
11066 This warning requires @option{-fanalyzer}, which enables it; use
11067 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
11069 This diagnostic warns for paths through the code in which a
11070 function known to be async-signal-unsafe (such as @code{fprintf}) is
11071 called from a signal handler.
11073 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
11075 @opindex Wanalyzer-use-after-free
11076 @opindex Wno-analyzer-use-after-free
11077 @item -Wno-analyzer-use-after-free
11078 This warning requires @option{-fanalyzer}, which enables it; use
11079 @option{-Wno-analyzer-use-after-free} to disable it.
11081 This diagnostic warns for paths through the code in which a
11082 pointer is used after a deallocator is called on it: either @code{free},
11083 or a deallocator referenced by attribute @code{malloc}.
11085 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
11087 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
11088 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
11089 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
11090 This warning requires @option{-fanalyzer}, which enables it; use
11091 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
11092 to disable it.
11094 This diagnostic warns for paths through the code in which a pointer
11095 is dereferenced that points to a variable in a stale stack frame.
11097 @opindex Wanalyzer-va-arg-type-mismatch
11098 @opindex Wno-analyzer-va-arg-type-mismatch
11099 @item -Wno-analyzer-va-arg-type-mismatch
11100 This warning requires @option{-fanalyzer}, which enables it; use
11101 @option{-Wno-analyzer-va-arg-type-mismatch}
11102 to disable it.
11104 This diagnostic warns for interprocedural paths through the code for which
11105 the analyzer detects an attempt to use @code{va_arg} to extract a value
11106 passed to a variadic call, but uses a type that does not match that of
11107 the expression passed to the call.
11109 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
11111 @opindex Wanalyzer-va-list-exhausted
11112 @opindex Wno-analyzer-va-list-exhausted
11113 @item -Wno-analyzer-va-list-exhausted
11114 This warning requires @option{-fanalyzer}, which enables it; use
11115 @option{-Wno-analyzer-va-list-exhausted}
11116 to disable it.
11118 This diagnostic warns for interprocedural paths through the code for which
11119 the analyzer detects an attempt to use @code{va_arg} to access the next
11120 value passed to a variadic call, but all of the values in the
11121 @code{va_list} have already been consumed.
11123 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
11125 @opindex Wanalyzer-va-list-leak
11126 @opindex Wno-analyzer-va-list-leak
11127 @item -Wno-analyzer-va-list-leak
11128 This warning requires @option{-fanalyzer}, which enables it; use
11129 @option{-Wno-analyzer-va-list-leak}
11130 to disable it.
11132 This diagnostic warns for interprocedural paths through the code for which
11133 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11134 on a @code{va_list} without a corresponding call to @code{va_end}.
11136 @opindex Wanalyzer-va-list-use-after-va-end
11137 @opindex Wno-analyzer-va-list-use-after-va-end
11138 @item -Wno-analyzer-va-list-use-after-va-end
11139 This warning requires @option{-fanalyzer}, which enables it; use
11140 @option{-Wno-analyzer-va-list-use-after-va-end}
11141 to disable it.
11143 This diagnostic warns for interprocedural paths through the code for which
11144 the analyzer detects an attempt to use a @code{va_list}  after
11145 @code{va_end} has been called on it.
11146 @code{va_list}.
11148 @opindex Wanalyzer-write-to-const
11149 @opindex Wno-analyzer-write-to-const
11150 @item -Wno-analyzer-write-to-const
11151 This warning requires @option{-fanalyzer}, which enables it; use
11152 @option{-Wno-analyzer-write-to-const}
11153 to disable it.
11155 This diagnostic warns for paths through the code in which the analyzer
11156 detects an attempt to write through a pointer to a @code{const} object.
11157 However, the analyzer does not prioritize detection of such paths, so
11158 false negatives are more likely relative to other warnings.
11160 @opindex Wanalyzer-write-to-string-literal
11161 @opindex Wno-analyzer-write-to-string-literal
11162 @item -Wno-analyzer-write-to-string-literal
11163 This warning requires @option{-fanalyzer}, which enables it; use
11164 @option{-Wno-analyzer-write-to-string-literal}
11165 to disable it.
11167 This diagnostic warns for paths through the code in which the analyzer
11168 detects an attempt to write through a pointer to a string literal.
11169 However, the analyzer does not prioritize detection of such paths, so
11170 false negatives are more likely relative to other warnings.
11172 @opindex Wanalyzer-use-of-uninitialized-value
11173 @opindex Wno-analyzer-use-of-uninitialized-value
11174 @item -Wno-analyzer-use-of-uninitialized-value
11175 This warning requires @option{-fanalyzer}, which enables it; use
11176 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11178 This diagnostic warns for paths through the code in which an uninitialized
11179 value is used.
11181 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11183 @end table
11185 The analyzer has hardcoded knowledge about the behavior of the following
11186 memory-management functions:
11188 @itemize @bullet
11189 @item @code{alloca}
11190 @item The built-in functions @code{__builtin_alloc},
11191 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11192 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11193 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11194 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11195 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11196 @item @code{calloc}
11197 @item @code{free}
11198 @item @code{malloc}
11199 @item @code{memset}
11200 @item @code{operator delete}
11201 @item @code{operator delete []}
11202 @item @code{operator new}
11203 @item @code{operator new []}
11204 @item @code{realloc}
11205 @item @code{strdup}
11206 @item @code{strndup}
11207 @end itemize
11209 @noindent
11210 of the following functions for working with file descriptors:
11212 @itemize @bullet
11213 @item @code{open}
11214 @item @code{close}
11215 @item @code{creat}
11216 @item @code{dup}, @code{dup2} and @code{dup3}
11217 @item @code{isatty}
11218 @item @code{pipe}, and @code{pipe2}
11219 @item @code{read}
11220 @item @code{write}
11221 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11222 @end itemize
11224 @noindent
11225 of the following functions for working with @code{<stdio.h>} streams:
11226 @itemize @bullet
11227 @item The built-in functions @code{__builtin_fprintf},
11228 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11229 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11230 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11231 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11232 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11233 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11234 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11235 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11236 @code{__builtin_vprintf}
11237 @item @code{fopen}
11238 @item @code{fclose}
11239 @item @code{ferror}
11240 @item @code{fgets}
11241 @item @code{fgets_unlocked}
11242 @item @code{fileno}
11243 @item @code{fread}
11244 @item @code{getc}
11245 @item @code{getchar}
11246 @item @code{fprintf}
11247 @item @code{printf}
11248 @item @code{fwrite}
11249 @end itemize
11251 @noindent
11252 and of the following functions:
11254 @itemize @bullet
11255 @item The built-in functions @code{__builtin_expect},
11256 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11257 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11258 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11259 @code{__builtin_va_start}
11260 @item The GNU extensions @code{error} and @code{error_at_line}
11261 @item @code{getpass}
11262 @item @code{longjmp}
11263 @item @code{putenv}
11264 @item @code{setjmp}
11265 @item @code{siglongjmp}
11266 @item @code{signal}
11267 @item @code{sigsetjmp}
11268 @item @code{strcat}
11269 @item @code{strchr}
11270 @item @code{strlen}
11271 @end itemize
11273 In addition, various functions with an @code{__analyzer_} prefix have
11274 special meaning to the analyzer, described in the GCC Internals manual.
11276 Pertinent parameters for controlling the exploration are:
11277 @itemize @bullet
11278 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11279 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11280 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11281 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11282 @end itemize
11284 The following options control the analyzer.
11286 @table @gcctabopt
11288 @opindex fanalyzer-call-summaries
11289 @opindex fno-analyzer-call-summaries
11290 @item -fanalyzer-call-summaries
11291 Simplify interprocedural analysis by computing the effect of certain calls,
11292 rather than exploring all paths through the function from callsite to each
11293 possible return.
11295 If enabled, call summaries are only used for functions with more than one
11296 call site, and that are sufficiently complicated (as per
11297 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11299 @opindex fanalyzer-checker
11300 @item -fanalyzer-checker=@var{name}
11301 Restrict the analyzer to run just the named checker, and enable it.
11303 @opindex fanalyzer-debug-text-art
11304 @opindex fno-analyzer-debug-text-art
11305 @item -fanalyzer-debug-text-art-headings
11306 This option is intended for analyzer developers.  If enabled,
11307 the analyzer will add extra annotations to any diagrams it generates.
11309 @opindex fanalyzer-feasibility
11310 @opindex fno-analyzer-feasibility
11311 @item -fno-analyzer-feasibility
11312 This option is intended for analyzer developers.
11314 By default the analyzer verifies that there is a feasible control flow path
11315 for each diagnostic it emits: that the conditions that hold are not mutually
11316 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11317 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11318 debugging issues in this code.
11320 @opindex fanalyzer-fine-grained
11321 @opindex fno-analyzer-fine-grained
11322 @item -fanalyzer-fine-grained
11323 This option is intended for analyzer developers.
11325 Internally the analyzer builds an ``exploded graph'' that combines
11326 control flow graphs with data flow information.
11328 By default, an edge in this graph can contain the effects of a run
11329 of multiple statements within a basic block.  With
11330 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11332 @opindex fanalyzer-show-duplicate-count
11333 @opindex fno-analyzer-show-duplicate-count
11334 @item -fanalyzer-show-duplicate-count
11335 This option is intended for analyzer developers: if multiple diagnostics
11336 have been detected as being duplicates of each other, it emits a note when
11337 reporting the best diagnostic, giving the number of additional diagnostics
11338 that were suppressed by the deduplication logic.
11340 @opindex fanalyzer-show-events-in-system-headers
11341 @opindex fno-analyzer-show-events-in-system-headers
11342 @item -fanalyzer-show-events-in-system-headers
11343 By default the analyzer emits simplified diagnostics paths by hiding
11344 events fully located within a system header.
11345 With @option{-fanalyzer-show-events-in-system-headers} such
11346 events are no longer suppressed.
11348 @opindex fanalyzer-state-merge
11349 @opindex fno-analyzer-state-merge
11350 @item -fno-analyzer-state-merge
11351 This option is intended for analyzer developers.
11353 By default the analyzer attempts to simplify analysis by merging
11354 sufficiently similar states at each program point as it builds its
11355 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11356 merging can be suppressed, for debugging state-handling issues.
11358 @opindex fanalyzer-state-purge
11359 @opindex fno-analyzer-state-purge
11360 @item -fno-analyzer-state-purge
11361 This option is intended for analyzer developers.
11363 By default the analyzer attempts to simplify analysis by purging
11364 aspects of state at a program point that appear to no longer be relevant
11365 e.g. the values of locals that aren't accessed later in the function
11366 and which aren't relevant to leak analysis.
11368 With @option{-fno-analyzer-state-purge} this purging of state can
11369 be suppressed, for debugging state-handling issues.
11371 @opindex fanalyzer-suppress-followups
11372 @opindex fno-analyzer-suppress-followups
11373 @item -fno-analyzer-suppress-followups
11374 This option is intended for analyzer developers.
11376 By default the analyzer will stop exploring an execution path after
11377 encountering certain diagnostics, in order to avoid potentially issuing a
11378 cascade of follow-up diagnostics.
11380 The diagnostics that terminate analysis along a path are:
11382 @itemize
11383 @item @option{-Wanalyzer-null-argument}
11384 @item @option{-Wanalyzer-null-dereference}
11385 @item @option{-Wanalyzer-use-after-free}
11386 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11387 @item @option{-Wanalyzer-use-of-uninitialized-value}
11388 @end itemize
11390 With @option{-fno-analyzer-suppress-followups} the analyzer will
11391 continue to explore such paths even after such diagnostics, which may
11392 be helpful for debugging issues in the analyzer, or for microbenchmarks
11393 for detecting undefined behavior.
11395 @opindex fanalyzer-transitivity
11396 @opindex fno-analyzer-transitivity
11397 @item -fanalyzer-transitivity
11398 This option enables transitivity of constraints within the analyzer.
11400 @opindex fanalyzer-undo-inlining
11401 @opindex fno-analyzer-undo-inlining
11402 @item -fno-analyzer-undo-inlining
11403 This option is intended for analyzer developers.
11405 @option{-fanalyzer} runs relatively late compared to other code analysis
11406 tools, and some optimizations have already been applied to the code.  In
11407 particular function inlining may have occurred, leading to the
11408 interprocedural execution paths emitted by the analyzer containing
11409 function frames that don't correspond to those in the original source
11410 code.
11412 By default the analyzer attempts to reconstruct the original function
11413 frames, and to emit events showing the inlined calls.
11415 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11416 the original frame information can be be disabled, which may be of help
11417 when debugging issues in the analyzer.
11419 @item -fanalyzer-verbose-edges
11420 This option is intended for analyzer developers.  It enables more
11421 verbose, lower-level detail in the descriptions of control flow
11422 within diagnostic paths.
11424 @item -fanalyzer-verbose-state-changes
11425 This option is intended for analyzer developers.  It enables more
11426 verbose, lower-level detail in the descriptions of events relating
11427 to state machines within diagnostic paths.
11429 @item -fanalyzer-verbosity=@var{level}
11430 This option controls the complexity of the control flow paths that are
11431 emitted for analyzer diagnostics.
11433 The @var{level} can be one of:
11435 @table @samp
11436 @item 0
11437 At this level, interprocedural call and return events are displayed,
11438 along with the most pertinent state-change events relating to
11439 a diagnostic.  For example, for a double-@code{free} diagnostic,
11440 both calls to @code{free} will be shown.
11442 @item 1
11443 As per the previous level, but also show events for the entry
11444 to each function.
11446 @item 2
11447 As per the previous level, but also show events relating to
11448 control flow that are significant to triggering the issue
11449 (e.g. ``true path taken'' at a conditional).
11451 This level is the default.
11453 @item 3
11454 As per the previous level, but show all control flow events, not
11455 just significant ones.
11457 @item 4
11458 This level is intended for analyzer developers; it adds various
11459 other events intended for debugging the analyzer.
11461 @end table
11463 @opindex fdump-analyzer
11464 @item -fdump-analyzer
11465 Dump internal details about what the analyzer is doing to
11466 @file{@var{file}.analyzer.txt}.
11467 @option{-fdump-analyzer-stderr} overrides this option.
11469 @opindex fdump-analyzer-stderr
11470 @item -fdump-analyzer-stderr
11471 Dump internal details about what the analyzer is doing to stderr.
11472 This option overrides @option{-fdump-analyzer}.
11474 @opindex fdump-analyzer-callgraph
11475 @item -fdump-analyzer-callgraph
11476 Dump a representation of the call graph suitable for viewing with
11477 GraphViz to @file{@var{file}.callgraph.dot}.
11479 @opindex fdump-analyzer-exploded-graph
11480 @item -fdump-analyzer-exploded-graph
11481 Dump a representation of the ``exploded graph'' suitable for viewing with
11482 GraphViz to @file{@var{file}.eg.dot}.
11483 Nodes are color-coded based on state-machine states to emphasize
11484 state changes.
11486 @opindex dump-analyzer-exploded-nodes
11487 @item -fdump-analyzer-exploded-nodes
11488 Emit diagnostics showing where nodes in the ``exploded graph'' are
11489 in relation to the program source.
11491 @opindex dump-analyzer-exploded-nodes-2
11492 @item -fdump-analyzer-exploded-nodes-2
11493 Dump a textual representation of the ``exploded graph'' to
11494 @file{@var{file}.eg.txt}.
11496 @opindex dump-analyzer-exploded-nodes-3
11497 @item -fdump-analyzer-exploded-nodes-3
11498 Dump a textual representation of the ``exploded graph'' to
11499 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11500 This is typically a large number of dump files.
11502 @opindex fdump-analyzer-exploded-paths
11503 @item -fdump-analyzer-exploded-paths
11504 Dump a textual representation of the ``exploded path'' for each
11505 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11507 @opindex dump-analyzer-feasibility
11508 @item -fdump-analyzer-feasibility
11509 Dump internal details about the analyzer's search for feasible paths.
11510 The details are written in a form suitable for viewing with GraphViz
11511 to filenames of the form @file{@var{file}.*.fg.dot},
11512 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11514 @opindex dump-analyzer-infinite-loop
11515 @item -fdump-analyzer-infinite-loop
11516 Dump internal details about the analyzer's search for infinite loops.
11517 The details are written in a form suitable for viewing with GraphViz
11518 to filenames of the form @file{@var{file}.*.infinite-loop.dot}.
11520 @opindex fdump-analyzer-json
11521 @item -fdump-analyzer-json
11522 Dump a compressed JSON representation of analyzer internals to
11523 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11524 to change.
11526 @opindex fdump-analyzer-state-purge
11527 @item -fdump-analyzer-state-purge
11528 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11529 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11530 graph with information on what state will be purged at each node.
11531 The graph is written to @file{@var{file}.state-purge.dot}.
11533 @opindex fdump-analyzer-supergraph
11534 @item -fdump-analyzer-supergraph
11535 Dump representations of the ``supergraph'' suitable for viewing with
11536 GraphViz to @file{@var{file}.supergraph.dot} and to
11537 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11538 control flow graphs in the program, with interprocedural edges for
11539 calls and returns.  The second dump contains annotations showing nodes
11540 in the ``exploded graph'' and diagnostics associated with them.
11542 @opindex fdump-analyzer-untracked
11543 @item -fdump-analyzer-untracked
11544 Emit custom warnings with internal details intended for analyzer developers.
11546 @end table
11548 @node Debugging Options
11549 @section Options for Debugging Your Program
11550 @cindex options, debugging
11551 @cindex debugging information options
11553 To tell GCC to emit extra information for use by a debugger, in almost 
11554 all cases you need only to add @option{-g} to your other options.  Some debug
11555 formats can co-exist (like DWARF with CTF) when each of them is enabled
11556 explicitly by adding the respective command line option to your other options.
11558 GCC allows you to use @option{-g} with
11559 @option{-O}.  The shortcuts taken by optimized code may occasionally
11560 be surprising: some variables you declared may not exist
11561 at all; flow of control may briefly move where you did not expect it;
11562 some statements may not be executed because they compute constant
11563 results or their values are already at hand; some statements may
11564 execute in different places because they have been moved out of loops.
11565 Nevertheless it is possible to debug optimized output.  This makes
11566 it reasonable to use the optimizer for programs that might have bugs.
11568 If you are not using some other optimization option, consider
11569 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11570 With no @option{-O} option at all, some compiler passes that collect
11571 information useful for debugging do not run at all, so that
11572 @option{-Og} may result in a better debugging experience.
11574 @table @gcctabopt
11575 @opindex g
11576 @item -g
11577 Produce debugging information in the operating system's native format
11578 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11579 information.
11581 On most systems that use stabs format, @option{-g} enables use of extra
11582 debugging information that only GDB can use; this extra information
11583 makes debugging work better in GDB but probably makes other debuggers
11584 crash or refuse to read the program.  If you want to control for certain whether
11585 to generate the extra information, use @option{-gvms} (see below).
11587 @opindex ggdb
11588 @item -ggdb
11589 Produce debugging information for use by GDB@.  This means to use the
11590 most expressive format available (DWARF, stabs, or the native format
11591 if neither of those are supported), including GDB extensions if at all
11592 possible.
11594 @opindex gdwarf
11595 @item -gdwarf
11596 @itemx -gdwarf-@var{version}
11597 Produce debugging information in DWARF format (if that is supported).
11598 The value of @var{version} may be either 2, 3, 4 or 5; the default
11599 version for most targets is 5 (with the exception of VxWorks, TPF and
11600 Darwin / macOS, which default to version 2, and AIX, which defaults
11601 to version 4).
11603 Note that with DWARF Version 2, some ports require and always
11604 use some non-conflicting DWARF 3 extensions in the unwind tables.
11606 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11607 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11609 GCC no longer supports DWARF Version 1, which is substantially
11610 different than Version 2 and later.  For historical reasons, some
11611 other DWARF-related options such as
11612 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11613 in their names, but apply to all currently-supported versions of DWARF.
11615 @opindex gbtf
11616 @item -gbtf
11617 Request BTF debug information.  BTF is the default debugging format for the
11618 eBPF target.  On other targets, like x86, BTF debug information can be
11619 generated along with DWARF debug information when both of the debug formats are
11620 enabled explicitly via their respective command line options.
11622 @opindex gctf
11623 @item -gctf
11624 @itemx -gctf@var{level}
11625 Request CTF debug information and use level to specify how much CTF debug
11626 information should be produced.  If @option{-gctf} is specified
11627 without a value for level, the default level of CTF debug information is 2.
11629 CTF debug information can be generated along with DWARF debug information when
11630 both of the debug formats are enabled explicitly via their respective command
11631 line options.
11633 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11634 negates @option{-gctf}.
11636 Level 1 produces CTF information for tracebacks only.  This includes callsite
11637 information, but does not include type information.
11639 Level 2 produces type information for entities (functions, data objects etc.)
11640 at file-scope or global-scope only.
11642 @opindex gvms
11643 @item -gvms
11644 Produce debugging information in Alpha/VMS debug format (if that is
11645 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11647 @item -gcodeview
11648 @opindex gcodeview
11649 Produce debugging information in CodeView debug format (if that is
11650 supported).  This is the format used by Microsoft Visual C++ on
11651 Windows.
11653 @item -g@var{level}
11654 @itemx -ggdb@var{level}
11655 @itemx -gvms@var{level}
11656 Request debugging information and also use @var{level} to specify how
11657 much information.  The default level is 2.
11659 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11660 @option{-g}.
11662 Level 1 produces minimal information, enough for making backtraces in
11663 parts of the program that you don't plan to debug.  This includes
11664 descriptions of functions and external variables, and line number
11665 tables, but no information about local variables.
11667 Level 3 includes extra information, such as all the macro definitions
11668 present in the program.  Some debuggers support macro expansion when
11669 you use @option{-g3}.
11671 If you use multiple @option{-g} options, with or without level numbers,
11672 the last such option is the one that is effective.
11674 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11675 confusion with @option{-gdwarf-@var{level}}.
11676 Instead use an additional @option{-g@var{level}} option to change the
11677 debug level for DWARF.
11679 @opindex feliminate-unused-debug-symbols
11680 @opindex fno-eliminate-unused-debug-symbols
11681 @item -fno-eliminate-unused-debug-symbols
11682 By default, no debug information is produced for symbols that are not actually
11683 used. Use this option if you want debug information for all symbols.
11685 @opindex femit-class-debug-always
11686 @item -femit-class-debug-always
11687 Instead of emitting debugging information for a C++ class in only one
11688 object file, emit it in all object files using the class.  This option
11689 should be used only with debuggers that are unable to handle the way GCC
11690 normally emits debugging information for classes because using this
11691 option increases the size of debugging information by as much as a
11692 factor of two.
11694 @opindex fmerge-debug-strings
11695 @opindex fno-merge-debug-strings
11696 @item -fno-merge-debug-strings
11697 Direct the linker to not merge together strings in the debugging
11698 information that are identical in different object files.  Merging is
11699 not supported by all assemblers or linkers.  Merging decreases the size
11700 of the debug information in the output file at the cost of increasing
11701 link processing time.  Merging is enabled by default.
11703 @opindex fdebug-prefix-map
11704 @item -fdebug-prefix-map=@var{old}=@var{new}
11705 When compiling files residing in directory @file{@var{old}}, record
11706 debugging information describing them as if the files resided in
11707 directory @file{@var{new}} instead.  This can be used to replace a
11708 build-time path with an install-time path in the debug info.  It can
11709 also be used to change an absolute path to a relative path by using
11710 @file{.} for @var{new}.  This can give more reproducible builds, which
11711 are location independent, but may require an extra command to tell GDB
11712 where to find the source files. See also @option{-ffile-prefix-map}
11713 and @option{-fcanon-prefix-map}.
11715 @opindex fvar-tracking
11716 @item -fvar-tracking
11717 Run variable tracking pass.  It computes where variables are stored at each
11718 position in code.  Better debugging information is then generated
11719 (if the debugging information format supports this information).
11721 It is enabled by default when compiling with optimization (@option{-Os},
11722 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11723 the debug info format supports it.
11725 @opindex fvar-tracking-assignments
11726 @opindex fno-var-tracking-assignments
11727 @item -fvar-tracking-assignments
11728 Annotate assignments to user variables early in the compilation and
11729 attempt to carry the annotations over throughout the compilation all the
11730 way to the end, in an attempt to improve debug information while
11731 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11733 It can be enabled even if var-tracking is disabled, in which case
11734 annotations are created and maintained, but discarded at the end.
11735 By default, this flag is enabled together with @option{-fvar-tracking},
11736 except when selective scheduling is enabled.
11738 @opindex gsplit-dwarf
11739 @item -gsplit-dwarf
11740 If DWARF debugging information is enabled, separate as much debugging
11741 information as possible into a separate output file with the extension
11742 @file{.dwo}.  This option allows the build system to avoid linking files with
11743 debug information.  To be useful, this option requires a debugger capable of
11744 reading @file{.dwo} files.
11746 @opindex gdwarf32
11747 @opindex gdwarf64
11748 @item -gdwarf32
11749 @itemx -gdwarf64
11750 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11751 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11752 DWARF format.  The default is target specific, on most targets it is
11753 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11754 can't support more than 2GiB of debug information in any of the DWARF
11755 debug information sections.  The 64-bit DWARF format allows larger debug
11756 information and might not be well supported by all consumers yet.
11758 @opindex gdescribe-dies
11759 @item -gdescribe-dies
11760 Add description attributes to some DWARF DIEs that have no name attribute,
11761 such as artificial variables, external references and call site
11762 parameter DIEs.
11764 @opindex gpubnames
11765 @item -gpubnames
11766 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11768 @opindex ggnu-pubnames
11769 @item -ggnu-pubnames
11770 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11771 suitable for conversion into a GDB@ index.  This option is only useful
11772 with a linker that can produce GDB@ index version 7.
11774 @opindex fdebug-types-section
11775 @opindex fno-debug-types-section
11776 @item -fdebug-types-section
11777 When using DWARF Version 4 or higher, type DIEs can be put into
11778 their own @code{.debug_types} section instead of making them part of the
11779 @code{.debug_info} section.  It is more efficient to put them in a separate
11780 comdat section since the linker can then remove duplicates.
11781 But not all DWARF consumers support @code{.debug_types} sections yet
11782 and on some objects @code{.debug_types} produces larger instead of smaller
11783 debugging information.
11785 @opindex grecord-gcc-switches
11786 @opindex gno-record-gcc-switches
11787 @item -grecord-gcc-switches
11788 @itemx -gno-record-gcc-switches
11789 This switch causes the command-line options used to invoke the
11790 compiler that may affect code generation to be appended to the
11791 DW_AT_producer attribute in DWARF debugging information.  The options
11792 are concatenated with spaces separating them from each other and from
11793 the compiler version.  
11794 It is enabled by default.
11795 See also @option{-frecord-gcc-switches} for another
11796 way of storing compiler options into the object file.  
11798 @opindex gstrict-dwarf
11799 @item -gstrict-dwarf
11800 Disallow using extensions of later DWARF standard version than selected
11801 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11802 DWARF extensions from later standard versions is allowed.
11804 @opindex gno-strict-dwarf
11805 @item -gno-strict-dwarf
11806 Allow using extensions of later DWARF standard version than selected with
11807 @option{-gdwarf-@var{version}}.
11809 @opindex gas-loc-support
11810 @item -gas-loc-support
11811 Inform the compiler that the assembler supports @code{.loc} directives.
11812 It may then use them for the assembler to generate DWARF2+ line number
11813 tables.
11815 This is generally desirable, because assembler-generated line-number
11816 tables are a lot more compact than those the compiler can generate
11817 itself.
11819 This option will be enabled by default if, at GCC configure time, the
11820 assembler was found to support such directives.
11822 @opindex gno-as-loc-support
11823 @item -gno-as-loc-support
11824 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11825 line number tables are to be generated.
11827 @opindex gas-locview-support
11828 @item -gas-locview-support
11829 Inform the compiler that the assembler supports @code{view} assignment
11830 and reset assertion checking in @code{.loc} directives.
11832 This option will be enabled by default if, at GCC configure time, the
11833 assembler was found to support them.
11835 @item -gno-as-locview-support
11836 Force GCC to assign view numbers internally, if
11837 @option{-gvariable-location-views} are explicitly requested.
11839 @opindex gcolumn-info
11840 @opindex gno-column-info
11841 @item -gcolumn-info
11842 @itemx -gno-column-info
11843 Emit location column information into DWARF debugging information, rather
11844 than just file and line.
11845 This option is enabled by default.
11847 @opindex gstatement-frontiers
11848 @opindex gno-statement-frontiers
11849 @item -gstatement-frontiers
11850 @itemx -gno-statement-frontiers
11851 This option causes GCC to create markers in the internal representation
11852 at the beginning of statements, and to keep them roughly in place
11853 throughout compilation, using them to guide the output of @code{is_stmt}
11854 markers in the line number table.  This is enabled by default when
11855 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11856 @dots{}), and outputting DWARF 2 debug information at the normal level.
11858 @opindex gvariable-location-views
11859 @opindex gvariable-location-views=incompat5
11860 @opindex gno-variable-location-views
11861 @item -gvariable-location-views
11862 @itemx -gvariable-location-views=incompat5
11863 @itemx -gno-variable-location-views
11864 Augment variable location lists with progressive view numbers implied
11865 from the line number table.  This enables debug information consumers to
11866 inspect state at certain points of the program, even if no instructions
11867 associated with the corresponding source locations are present at that
11868 point.  If the assembler lacks support for view numbers in line number
11869 tables, this will cause the compiler to emit the line number table,
11870 which generally makes them somewhat less compact.  The augmented line
11871 number tables and location lists are fully backward-compatible, so they
11872 can be consumed by debug information consumers that are not aware of
11873 these augmentations, but they won't derive any benefit from them either.
11875 This is enabled by default when outputting DWARF 2 debug information at
11876 the normal level, as long as there is assembler support,
11877 @option{-fvar-tracking-assignments} is enabled and
11878 @option{-gstrict-dwarf} is not.  When assembler support is not
11879 available, this may still be enabled, but it will force GCC to output
11880 internal line number tables, and if
11881 @option{-ginternal-reset-location-views} is not enabled, that will most
11882 certainly lead to silently mismatching location views.
11884 There is a proposed representation for view numbers that is not backward
11885 compatible with the location list format introduced in DWARF 5, that can
11886 be enabled with @option{-gvariable-location-views=incompat5}.  This
11887 option may be removed in the future, is only provided as a reference
11888 implementation of the proposed representation.  Debug information
11889 consumers are not expected to support this extended format, and they
11890 would be rendered unable to decode location lists using it.
11892 @opindex ginternal-reset-location-views
11893 @opindex gno-internal-reset-location-views
11894 @item -ginternal-reset-location-views
11895 @itemx -gno-internal-reset-location-views
11896 Attempt to determine location views that can be omitted from location
11897 view lists.  This requires the compiler to have very accurate insn
11898 length estimates, which isn't always the case, and it may cause
11899 incorrect view lists to be generated silently when using an assembler
11900 that does not support location view lists.  The GNU assembler will flag
11901 any such error as a @code{view number mismatch}.  This is only enabled
11902 on ports that define a reliable estimation function.
11904 @opindex ginline-points
11905 @opindex gno-inline-points
11906 @item -ginline-points
11907 @itemx -gno-inline-points
11908 Generate extended debug information for inlined functions.  Location
11909 view tracking markers are inserted at inlined entry points, so that
11910 address and view numbers can be computed and output in debug
11911 information.  This can be enabled independently of location views, in
11912 which case the view numbers won't be output, but it can only be enabled
11913 along with statement frontiers, and it is only enabled by default if
11914 location views are enabled.
11916 @opindex gz
11917 @item -gz@r{[}=@var{type}@r{]}
11918 Produce compressed debug sections in DWARF format, if that is supported.
11919 If @var{type} is not given, the default type depends on the capabilities
11920 of the assembler and linker used.  @var{type} may be one of
11921 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11922 compression in ELF gABI format).  If the linker doesn't support writing
11923 compressed debug sections, the option is rejected.  Otherwise, if the
11924 assembler does not support them, @option{-gz} is silently ignored when
11925 producing object files.
11927 @opindex femit-struct-debug-baseonly
11928 @item -femit-struct-debug-baseonly
11929 Emit debug information for struct-like types
11930 only when the base name of the compilation source file
11931 matches the base name of file in which the struct is defined.
11933 This option substantially reduces the size of debugging information,
11934 but at significant potential loss in type information to the debugger.
11935 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11936 See @option{-femit-struct-debug-detailed} for more detailed control.
11938 This option works only with DWARF debug output.
11940 @opindex femit-struct-debug-reduced
11941 @item -femit-struct-debug-reduced
11942 Emit debug information for struct-like types
11943 only when the base name of the compilation source file
11944 matches the base name of file in which the type is defined,
11945 unless the struct is a template or defined in a system header.
11947 This option significantly reduces the size of debugging information,
11948 with some potential loss in type information to the debugger.
11949 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11950 See @option{-femit-struct-debug-detailed} for more detailed control.
11952 This option works only with DWARF debug output.
11954 @opindex femit-struct-debug-detailed
11955 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11956 Specify the struct-like types
11957 for which the compiler generates debug information.
11958 The intent is to reduce duplicate struct debug information
11959 between different object files within the same program.
11961 This option is a detailed version of
11962 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11963 which serves for most needs.
11965 A specification has the syntax@*
11966 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11968 The optional first word limits the specification to
11969 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11970 A struct type is used directly when it is the type of a variable, member.
11971 Indirect uses arise through pointers to structs.
11972 That is, when use of an incomplete struct is valid, the use is indirect.
11973 An example is
11974 @samp{struct one direct; struct two * indirect;}.
11976 The optional second word limits the specification to
11977 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11978 Generic structs are a bit complicated to explain.
11979 For C++, these are non-explicit specializations of template classes,
11980 or non-template classes within the above.
11981 Other programming languages have generics,
11982 but @option{-femit-struct-debug-detailed} does not yet implement them.
11984 The third word specifies the source files for those
11985 structs for which the compiler should emit debug information.
11986 The values @samp{none} and @samp{any} have the normal meaning.
11987 The value @samp{base} means that
11988 the base of name of the file in which the type declaration appears
11989 must match the base of the name of the main compilation file.
11990 In practice, this means that when compiling @file{foo.c}, debug information
11991 is generated for types declared in that file and @file{foo.h},
11992 but not other header files.
11993 The value @samp{sys} means those types satisfying @samp{base}
11994 or declared in system or compiler headers.
11996 You may need to experiment to determine the best settings for your application.
11998 The default is @option{-femit-struct-debug-detailed=all}.
12000 This option works only with DWARF debug output.
12002 @opindex fdwarf2-cfi-asm
12003 @opindex fno-dwarf2-cfi-asm
12004 @item -fno-dwarf2-cfi-asm
12005 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
12006 instead of using GAS @code{.cfi_*} directives.
12008 @opindex feliminate-unused-debug-types
12009 @opindex fno-eliminate-unused-debug-types
12010 @item -fno-eliminate-unused-debug-types
12011 Normally, when producing DWARF output, GCC avoids producing debug symbol 
12012 output for types that are nowhere used in the source file being compiled.
12013 Sometimes it is useful to have GCC emit debugging
12014 information for all types declared in a compilation
12015 unit, regardless of whether or not they are actually used
12016 in that compilation unit, for example 
12017 if, in the debugger, you want to cast a value to a type that is
12018 not actually used in your program (but is declared).  More often,
12019 however, this results in a significant amount of wasted space.
12020 @end table
12022 @node Optimize Options
12023 @section Options That Control Optimization
12024 @cindex optimize options
12025 @cindex options, optimization
12027 These options control various sorts of optimizations.
12029 Without any optimization option, the compiler's goal is to reduce the
12030 cost of compilation and to make debugging produce the expected
12031 results.  Statements are independent: if you stop the program with a
12032 breakpoint between statements, you can then assign a new value to any
12033 variable or change the program counter to any other statement in the
12034 function and get exactly the results you expect from the source
12035 code.
12037 Turning on optimization flags makes the compiler attempt to improve
12038 the performance and/or code size at the expense of compilation time
12039 and possibly the ability to debug the program.
12041 The compiler performs optimization based on the knowledge it has of the
12042 program.  Compiling multiple files at once to a single output file mode allows
12043 the compiler to use information gained from all of the files when compiling
12044 each of them.
12046 Not all optimizations are controlled directly by a flag.  Only
12047 optimizations that have a flag are listed in this section.
12049 Most optimizations are completely disabled at @option{-O0} or if an
12050 @option{-O} level is not set on the command line, even if individual
12051 optimization flags are specified.  Similarly, @option{-Og} suppresses
12052 many optimization passes.
12054 Depending on the target and how GCC was configured, a slightly different
12055 set of optimizations may be enabled at each @option{-O} level than
12056 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
12057 to find out the exact set of optimizations that are enabled at each level.
12058 @xref{Overall Options}, for examples.
12060 @table @gcctabopt
12061 @opindex O
12062 @opindex O1
12063 @item -O
12064 @itemx -O1
12065 Optimize.  Optimizing compilation takes somewhat more time, and a lot
12066 more memory for a large function.
12068 With @option{-O}, the compiler tries to reduce code size and execution
12069 time, without performing any optimizations that take a great deal of
12070 compilation time.
12072 @c Note that in addition to the default_options_table list in opts.cc,
12073 @c several optimization flags default to true but control optimization
12074 @c passes that are explicitly disabled at -O0.
12076 @option{-O} turns on the following optimization flags:
12078 @c Please keep the following list alphabetized.
12079 @gccoptlist{-fauto-inc-dec
12080 -fbranch-count-reg
12081 -fcombine-stack-adjustments
12082 -fcompare-elim
12083 -fcprop-registers
12084 -fdce
12085 -fdefer-pop
12086 -fdelayed-branch
12087 -fdse
12088 -fforward-propagate
12089 -fguess-branch-probability
12090 -fif-conversion
12091 -fif-conversion2
12092 -finline-functions-called-once
12093 -fipa-modref
12094 -fipa-profile
12095 -fipa-pure-const
12096 -fipa-reference
12097 -fipa-reference-addressable
12098 -fmerge-constants
12099 -fmove-loop-invariants
12100 -fmove-loop-stores
12101 -fomit-frame-pointer
12102 -freorder-blocks
12103 -fshrink-wrap
12104 -fshrink-wrap-separate
12105 -fsplit-wide-types
12106 -fssa-backprop
12107 -fssa-phiopt
12108 -ftree-bit-ccp
12109 -ftree-ccp
12110 -ftree-ch
12111 -ftree-coalesce-vars
12112 -ftree-copy-prop
12113 -ftree-dce
12114 -ftree-dominator-opts
12115 -ftree-dse
12116 -ftree-forwprop
12117 -ftree-fre
12118 -ftree-phiprop
12119 -ftree-pta
12120 -ftree-scev-cprop
12121 -ftree-sink
12122 -ftree-slsr
12123 -ftree-sra
12124 -ftree-ter
12125 -funit-at-a-time}
12127 @opindex O2
12128 @item -O2
12129 Optimize even more.  GCC performs nearly all supported optimizations
12130 that do not involve a space-speed tradeoff.
12131 As compared to @option{-O}, this option increases both compilation time
12132 and the performance of the generated code.
12134 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12135 also turns on the following optimization flags:
12137 @c Please keep the following list alphabetized!
12138 @gccoptlist{-falign-functions  -falign-jumps
12139 -falign-labels  -falign-loops
12140 -fcaller-saves
12141 -fcode-hoisting
12142 -fcrossjumping
12143 -fcse-follow-jumps  -fcse-skip-blocks
12144 -fdelete-null-pointer-checks
12145 -fdevirtualize  -fdevirtualize-speculatively
12146 -fexpensive-optimizations
12147 -ffinite-loops
12148 -fgcse  -fgcse-lm
12149 -fhoist-adjacent-loads
12150 -finline-functions
12151 -finline-small-functions
12152 -findirect-inlining
12153 -fipa-bit-cp  -fipa-cp  -fipa-icf
12154 -fipa-ra  -fipa-sra  -fipa-vrp
12155 -fisolate-erroneous-paths-dereference
12156 -flra-remat
12157 -foptimize-sibling-calls
12158 -foptimize-strlen
12159 -fpartial-inlining
12160 -fpeephole2
12161 -freorder-blocks-algorithm=stc
12162 -freorder-blocks-and-partition  -freorder-functions
12163 -frerun-cse-after-loop
12164 -fschedule-insns  -fschedule-insns2
12165 -fsched-interblock  -fsched-spec
12166 -fstore-merging
12167 -fstrict-aliasing
12168 -fthread-jumps
12169 -ftree-builtin-call-dce
12170 -ftree-loop-vectorize
12171 -ftree-pre
12172 -ftree-slp-vectorize
12173 -ftree-switch-conversion  -ftree-tail-merge
12174 -ftree-vrp
12175 -fvect-cost-model=very-cheap}
12177 Please note the warning under @option{-fgcse} about
12178 invoking @option{-O2} on programs that use computed gotos.
12180 @opindex O3
12181 @item -O3
12182 Optimize yet more.  @option{-O3} turns on all optimizations specified
12183 by @option{-O2} and also turns on the following optimization flags:
12185 @c Please keep the following list alphabetized!
12186 @gccoptlist{-fgcse-after-reload
12187 -fipa-cp-clone
12188 -floop-interchange
12189 -floop-unroll-and-jam
12190 -fpeel-loops
12191 -fpredictive-commoning
12192 -fsplit-loops
12193 -fsplit-paths
12194 -ftree-loop-distribution
12195 -ftree-partial-pre
12196 -funswitch-loops
12197 -fvect-cost-model=dynamic
12198 -fversion-loops-for-strides}
12200 @opindex O0
12201 @item -O0
12202 Reduce compilation time and make debugging produce the expected
12203 results.  This is the default.
12205 @opindex Os
12206 @item -Os
12207 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12208 except those that often increase code size:
12210 @gccoptlist{-falign-functions  -falign-jumps
12211 -falign-labels  -falign-loops
12212 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12214 It also enables @option{-finline-functions}, causes the compiler to tune for
12215 code size rather than execution speed, and performs further optimizations
12216 designed to reduce code size.
12218 @opindex Ofast
12219 @item -Ofast
12220 Disregard strict standards compliance.  @option{-Ofast} enables all
12221 @option{-O3} optimizations.  It also enables optimizations that are not
12222 valid for all standard-compliant programs.
12223 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12224 and the Fortran-specific @option{-fstack-arrays}, unless
12225 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12226 It turns off @option{-fsemantic-interposition}.
12228 @opindex Og
12229 @item -Og
12230 Optimize debugging experience.  @option{-Og} should be the optimization
12231 level of choice for the standard edit-compile-debug cycle, offering
12232 a reasonable level of optimization while maintaining fast compilation
12233 and a good debugging experience.  It is a better choice than @option{-O0}
12234 for producing debuggable code because some compiler passes
12235 that collect debug information are disabled at @option{-O0}.
12237 Like @option{-O0}, @option{-Og} completely disables a number of 
12238 optimization passes so that individual options controlling them have
12239 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12240 optimization flags except for those that may interfere with debugging:
12242 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12243 -fdse  -fif-conversion  -fif-conversion2
12244 -finline-functions-called-once
12245 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12246 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12248 @opindex Oz
12249 @item -Oz
12250 Optimize aggressively for size rather than speed.  This may increase
12251 the number of instructions executed if those instructions require
12252 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12253 including enabling most @option{-O2} optimizations.
12255 @end table
12257 If you use multiple @option{-O} options, with or without level numbers,
12258 the last such option is the one that is effective.
12260 Options of the form @option{-f@var{flag}} specify machine-independent
12261 flags.  Most flags have both positive and negative forms; the negative
12262 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12263 below, only one of the forms is listed---the one you typically 
12264 use.  You can figure out the other form by either removing @samp{no-}
12265 or adding it.
12267 The following options control specific optimizations.  They are either
12268 activated by @option{-O} options or are related to ones that are.  You
12269 can use the following flags in the rare cases when ``fine-tuning'' of
12270 optimizations to be performed is desired.
12272 @table @gcctabopt
12273 @opindex fno-defer-pop
12274 @opindex fdefer-pop
12275 @item -fno-defer-pop
12276 For machines that must pop arguments after a function call, always pop 
12277 the arguments as soon as each function returns.  
12278 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12279 this allows the compiler to let arguments accumulate on the stack for several
12280 function calls and pop them all at once.
12282 @opindex fforward-propagate
12283 @item -fforward-propagate
12284 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12285 instructions and checks if the result can be simplified.  If loop unrolling
12286 is active, two passes are performed and the second is scheduled after
12287 loop unrolling.
12289 This option is enabled by default at optimization levels @option{-O1},
12290 @option{-O2}, @option{-O3}, @option{-Os}.
12292 @opindex ffp-contract
12293 @item -ffp-contract=@var{style}
12294 @option{-ffp-contract=off} disables floating-point expression contraction.
12295 @option{-ffp-contract=fast} enables floating-point expression contraction
12296 such as forming of fused multiply-add operations if the target has
12297 native support for them.
12298 @option{-ffp-contract=on} enables floating-point expression contraction
12299 if allowed by the language standard.  This is implemented for C and C++,
12300 where it enables contraction within one expression, but not across
12301 different statements.
12303 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12304 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12306 @opindex fomit-frame-pointer
12307 @item -fomit-frame-pointer
12308 Omit the frame pointer in functions that don't need one.  This avoids the
12309 instructions to save, set up and restore the frame pointer; on many targets
12310 it also makes an extra register available.
12312 On some targets this flag has no effect because the standard calling sequence
12313 always uses a frame pointer, so it cannot be omitted.
12315 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12316 is used in all functions.  Several targets always omit the frame pointer in
12317 leaf functions.
12319 Enabled by default at @option{-O1} and higher.
12321 @opindex foptimize-sibling-calls
12322 @item -foptimize-sibling-calls
12323 Optimize sibling and tail recursive calls.
12325 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12327 @opindex foptimize-strlen
12328 @item -foptimize-strlen
12329 Optimize various standard C string functions (e.g.@: @code{strlen},
12330 @code{strchr} or @code{strcpy}) and
12331 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12333 Enabled at levels @option{-O2}, @option{-O3}.
12335 @opindex fno-inline
12336 @opindex finline
12337 @item -fno-inline
12338 Do not expand any functions inline apart from those marked with
12339 the @code{always_inline} attribute.  This is the default when not
12340 optimizing.
12342 Single functions can be exempted from inlining by marking them
12343 with the @code{noinline} attribute.
12345 @opindex finline-small-functions
12346 @item -finline-small-functions
12347 Integrate functions into their callers when their body is smaller than expected
12348 function call code (so overall size of program gets smaller).  The compiler
12349 heuristically decides which functions are simple enough to be worth integrating
12350 in this way.  This inlining applies to all functions, even those not declared
12351 inline.
12353 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12355 @opindex findirect-inlining
12356 @item -findirect-inlining
12357 Inline also indirect calls that are discovered to be known at compile
12358 time thanks to previous inlining.  This option has any effect only
12359 when inlining itself is turned on by the @option{-finline-functions}
12360 or @option{-finline-small-functions} options.
12362 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12364 @opindex finline-functions
12365 @item -finline-functions
12366 Consider all functions for inlining, even if they are not declared inline.
12367 The compiler heuristically decides which functions are worth integrating
12368 in this way.
12370 If all calls to a given function are integrated, and the function is
12371 declared @code{static}, then the function is normally not output as
12372 assembler code in its own right.
12374 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12375 by @option{-fprofile-use} and @option{-fauto-profile}.
12377 @opindex finline-functions-called-once
12378 @item -finline-functions-called-once
12379 Consider all @code{static} functions called once for inlining into their
12380 caller even if they are not marked @code{inline}.  If a call to a given
12381 function is integrated, then the function is not output as assembler code
12382 in its own right.
12384 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12385 but not @option{-Og}.
12387 @opindex fearly-inlining
12388 @item -fearly-inlining
12389 Inline functions marked by @code{always_inline} and functions whose body seems
12390 smaller than the function call overhead early before doing
12391 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12392 makes profiling significantly cheaper and usually inlining faster on programs
12393 having large chains of nested wrapper functions.
12395 Enabled by default.
12397 @opindex fipa-sra
12398 @item -fipa-sra
12399 Perform interprocedural scalar replacement of aggregates, removal of
12400 unused parameters and replacement of parameters passed by reference
12401 by parameters passed by value.
12403 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12405 @opindex finline-limit
12406 @item -finline-limit=@var{n}
12407 By default, GCC limits the size of functions that can be inlined.  This flag
12408 allows coarse control of this limit.  @var{n} is the size of functions that
12409 can be inlined in number of pseudo instructions.
12411 Inlining is actually controlled by a number of parameters, which may be
12412 specified individually by using @option{--param @var{name}=@var{value}}.
12413 The @option{-finline-limit=@var{n}} option sets some of these parameters
12414 as follows:
12416 @table @gcctabopt
12417 @item max-inline-insns-single
12418 is set to @var{n}/2.
12419 @item max-inline-insns-auto
12420 is set to @var{n}/2.
12421 @end table
12423 See below for a documentation of the individual
12424 parameters controlling inlining and for the defaults of these parameters.
12426 @emph{Note:} there may be no value to @option{-finline-limit} that results
12427 in default behavior.
12429 @emph{Note:} pseudo instruction represents, in this particular context, an
12430 abstract measurement of function's size.  In no way does it represent a count
12431 of assembly instructions and as such its exact meaning might change from one
12432 release to an another.
12434 @opindex fno-keep-inline-dllexport
12435 @opindex fkeep-inline-dllexport
12436 @item -fno-keep-inline-dllexport
12437 This is a more fine-grained version of @option{-fkeep-inline-functions},
12438 which applies only to functions that are declared using the @code{dllexport}
12439 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12440 Functions}.
12442 @opindex fkeep-inline-functions
12443 @item -fkeep-inline-functions
12444 In C, emit @code{static} functions that are declared @code{inline}
12445 into the object file, even if the function has been inlined into all
12446 of its callers.  This switch does not affect functions using the
12447 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12448 inline functions into the object file.
12450 @opindex fkeep-static-functions
12451 @item -fkeep-static-functions
12452 Emit @code{static} functions into the object file, even if the function
12453 is never used.
12455 @opindex fkeep-static-consts
12456 @item -fkeep-static-consts
12457 Emit variables declared @code{static const} when optimization isn't turned
12458 on, even if the variables aren't referenced.
12460 GCC enables this option by default.  If you want to force the compiler to
12461 check if a variable is referenced, regardless of whether or not
12462 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12464 @opindex fmerge-constants
12465 @item -fmerge-constants
12466 Attempt to merge identical constants (string constants and floating-point
12467 constants) across compilation units.
12469 This option is the default for optimized compilation if the assembler and
12470 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12471 behavior.
12473 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12475 @opindex fmerge-all-constants
12476 @item -fmerge-all-constants
12477 Attempt to merge identical constants and identical variables.
12479 This option implies @option{-fmerge-constants}.  In addition to
12480 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12481 arrays or initialized constant variables with integral or floating-point
12482 types.  Languages like C or C++ require each variable, including multiple
12483 instances of the same variable in recursive calls, to have distinct locations,
12484 so using this option results in non-conforming
12485 behavior.
12487 @opindex fmodulo-sched
12488 @item -fmodulo-sched
12489 Perform swing modulo scheduling immediately before the first scheduling
12490 pass.  This pass looks at innermost loops and reorders their
12491 instructions by overlapping different iterations.
12493 @opindex fmodulo-sched-allow-regmoves
12494 @item -fmodulo-sched-allow-regmoves
12495 Perform more aggressive SMS-based modulo scheduling with register moves
12496 allowed.  By setting this flag certain anti-dependences edges are
12497 deleted, which triggers the generation of reg-moves based on the
12498 life-range analysis.  This option is effective only with
12499 @option{-fmodulo-sched} enabled.
12501 @opindex fno-branch-count-reg
12502 @opindex fbranch-count-reg
12503 @item -fno-branch-count-reg
12504 Disable the optimization pass that scans for opportunities to use 
12505 ``decrement and branch'' instructions on a count register instead of
12506 instruction sequences that decrement a register, compare it against zero, and
12507 then branch based upon the result.  This option is only meaningful on
12508 architectures that support such instructions, which include x86, PowerPC,
12509 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12510 doesn't remove the decrement and branch instructions from the generated
12511 instruction stream introduced by other optimization passes.
12513 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12514 except for @option{-Og}.
12516 @opindex fno-function-cse
12517 @opindex ffunction-cse
12518 @item -fno-function-cse
12519 Do not put function addresses in registers; make each instruction that
12520 calls a constant function contain the function's address explicitly.
12522 This option results in less efficient code, but some strange hacks
12523 that alter the assembler output may be confused by the optimizations
12524 performed when this option is not used.
12526 The default is @option{-ffunction-cse}
12528 @opindex fno-zero-initialized-in-bss
12529 @opindex fzero-initialized-in-bss
12530 @item -fno-zero-initialized-in-bss
12531 If the target supports a BSS section, GCC by default puts variables that
12532 are initialized to zero into BSS@.  This can save space in the resulting
12533 code.
12535 This option turns off this behavior because some programs explicitly
12536 rely on variables going to the data section---e.g., so that the
12537 resulting executable can find the beginning of that section and/or make
12538 assumptions based on that.
12540 The default is @option{-fzero-initialized-in-bss}.
12542 @opindex fthread-jumps
12543 @item -fthread-jumps
12544 Perform optimizations that check to see if a jump branches to a
12545 location where another comparison subsumed by the first is found.  If
12546 so, the first branch is redirected to either the destination of the
12547 second branch or a point immediately following it, depending on whether
12548 the condition is known to be true or false.
12550 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12552 @opindex fsplit-wide-types
12553 @item -fsplit-wide-types
12554 When using a type that occupies multiple registers, such as @code{long
12555 long} on a 32-bit system, split the registers apart and allocate them
12556 independently.  This normally generates better code for those types,
12557 but may make debugging more difficult.
12559 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12560 @option{-Os}.
12562 @opindex fsplit-wide-types-early
12563 @item -fsplit-wide-types-early
12564 Fully split wide types early, instead of very late.
12565 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12567 This is the default on some targets.
12569 @opindex fcse-follow-jumps
12570 @item -fcse-follow-jumps
12571 In common subexpression elimination (CSE), scan through jump instructions
12572 when the target of the jump is not reached by any other path.  For
12573 example, when CSE encounters an @code{if} statement with an
12574 @code{else} clause, CSE follows the jump when the condition
12575 tested is false.
12577 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12579 @opindex fcse-skip-blocks
12580 @item -fcse-skip-blocks
12581 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12582 follow jumps that conditionally skip over blocks.  When CSE
12583 encounters a simple @code{if} statement with no else clause,
12584 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12585 body of the @code{if}.
12587 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12589 @opindex frerun-cse-after-loop
12590 @item -frerun-cse-after-loop
12591 Re-run common subexpression elimination after loop optimizations are
12592 performed.
12594 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12596 @opindex fgcse
12597 @item -fgcse
12598 Perform a global common subexpression elimination pass.
12599 This pass also performs global constant and copy propagation.
12601 @emph{Note:} When compiling a program using computed gotos, a GCC
12602 extension, you may get better run-time performance if you disable
12603 the global common subexpression elimination pass by adding
12604 @option{-fno-gcse} to the command line.
12606 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12608 @opindex fgcse-lm
12609 @item -fgcse-lm
12610 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12611 attempts to move loads that are only killed by stores into themselves.  This
12612 allows a loop containing a load/store sequence to be changed to a load outside
12613 the loop, and a copy/store within the loop.
12615 Enabled by default when @option{-fgcse} is enabled.
12617 @opindex fgcse-sm
12618 @item -fgcse-sm
12619 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12620 global common subexpression elimination.  This pass attempts to move
12621 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12622 loops containing a load/store sequence can be changed to a load before
12623 the loop and a store after the loop.
12625 Not enabled at any optimization level.
12627 @opindex fgcse-las
12628 @item -fgcse-las
12629 When @option{-fgcse-las} is enabled, the global common subexpression
12630 elimination pass eliminates redundant loads that come after stores to the
12631 same memory location (both partial and full redundancies).
12633 Not enabled at any optimization level.
12635 @opindex fgcse-after-reload
12636 @item -fgcse-after-reload
12637 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12638 pass is performed after reload.  The purpose of this pass is to clean up
12639 redundant spilling.
12641 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12643 @opindex faggressive-loop-optimizations
12644 @item -faggressive-loop-optimizations
12645 This option tells the loop optimizer to use language constraints to
12646 derive bounds for the number of iterations of a loop.  This assumes that
12647 loop code does not invoke undefined behavior by for example causing signed
12648 integer overflows or out-of-bound array accesses.  The bounds for the
12649 number of iterations of a loop are used to guide loop unrolling and peeling
12650 and loop exit test optimizations.
12651 This option is enabled by default.
12653 @opindex funconstrained-commons
12654 @item -funconstrained-commons
12655 This option tells the compiler that variables declared in common blocks
12656 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12657 prevents certain optimizations that depend on knowing the array bounds.
12659 @opindex fcrossjumping
12660 @item -fcrossjumping
12661 Perform cross-jumping transformation.
12662 This transformation unifies equivalent code and saves code size.  The
12663 resulting code may or may not perform better than without cross-jumping.
12665 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12667 @opindex fauto-inc-dec
12668 @item -fauto-inc-dec
12669 Combine increments or decrements of addresses with memory accesses.
12670 This pass is always skipped on architectures that do not have
12671 instructions to support this.  Enabled by default at @option{-O1} and
12672 higher on architectures that support this.
12674 @opindex fdce
12675 @item -fdce
12676 Perform dead code elimination (DCE) on RTL@.
12677 Enabled by default at @option{-O1} and higher.
12679 @opindex fdse
12680 @item -fdse
12681 Perform dead store elimination (DSE) on RTL@.
12682 Enabled by default at @option{-O1} and higher.
12684 @opindex fif-conversion
12685 @item -fif-conversion
12686 Attempt to transform conditional jumps into branch-less equivalents.  This
12687 includes use of conditional moves, min, max, set flags and abs instructions, and
12688 some tricks doable by standard arithmetics.  The use of conditional execution
12689 on chips where it is available is controlled by @option{-fif-conversion2}.
12691 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12692 not with @option{-Og}.
12694 @opindex fif-conversion2
12695 @item -fif-conversion2
12696 Use conditional execution (where available) to transform conditional jumps into
12697 branch-less equivalents.
12699 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12700 not with @option{-Og}.
12702 @opindex fdeclone-ctor-dtor
12703 @item -fdeclone-ctor-dtor
12704 The C++ ABI requires multiple entry points for constructors and
12705 destructors: one for a base subobject, one for a complete object, and
12706 one for a virtual destructor that calls operator delete afterwards.
12707 For a hierarchy with virtual bases, the base and complete variants are
12708 clones, which means two copies of the function.  With this option, the
12709 base and complete variants are changed to be thunks that call a common
12710 implementation.
12712 Enabled by @option{-Os}.
12714 @opindex fdelete-null-pointer-checks
12715 @item -fdelete-null-pointer-checks
12716 Assume that programs cannot safely dereference null pointers, and that
12717 no code or data element resides at address zero.
12718 This option enables simple constant
12719 folding optimizations at all optimization levels.  In addition, other
12720 optimization passes in GCC use this flag to control global dataflow
12721 analyses that eliminate useless checks for null pointers; these assume
12722 that a memory access to address zero always results in a trap, so
12723 that if a pointer is checked after it has already been dereferenced,
12724 it cannot be null.
12726 Note however that in some environments this assumption is not true.
12727 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12728 for programs that depend on that behavior.
12730 This option is enabled by default on most targets.  On Nios II ELF, it
12731 defaults to off.  On AVR and MSP430, this option is completely disabled.
12733 Passes that use the dataflow information
12734 are enabled independently at different optimization levels.
12736 @opindex fdevirtualize
12737 @item -fdevirtualize
12738 Attempt to convert calls to virtual functions to direct calls.  This
12739 is done both within a procedure and interprocedurally as part of
12740 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12741 propagation (@option{-fipa-cp}).
12742 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12744 @opindex fdevirtualize-speculatively
12745 @item -fdevirtualize-speculatively
12746 Attempt to convert calls to virtual functions to speculative direct calls.
12747 Based on the analysis of the type inheritance graph, determine for a given call
12748 the set of likely targets. If the set is small, preferably of size 1, change
12749 the call into a conditional deciding between direct and indirect calls.  The
12750 speculative calls enable more optimizations, such as inlining.  When they seem
12751 useless after further optimization, they are converted back into original form.
12753 @opindex fdevirtualize-at-ltrans
12754 @item -fdevirtualize-at-ltrans
12755 Stream extra information needed for aggressive devirtualization when running
12756 the link-time optimizer in local transformation mode.  
12757 This option enables more devirtualization but
12758 significantly increases the size of streamed data. For this reason it is
12759 disabled by default.
12761 @opindex fexpensive-optimizations
12762 @item -fexpensive-optimizations
12763 Perform a number of minor optimizations that are relatively expensive.
12765 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12767 @opindex free
12768 @item -free
12769 Attempt to remove redundant extension instructions.  This is especially
12770 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12771 registers after writing to their lower 32-bit half.
12773 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
12774 levels @option{-O2}, @option{-O3}, @option{-Os}.
12776 @opindex fno-lifetime-dse
12777 @opindex flifetime-dse
12778 @item -fno-lifetime-dse
12779 In C++ the value of an object is only affected by changes within its
12780 lifetime: when the constructor begins, the object has an indeterminate
12781 value, and any changes during the lifetime of the object are dead when
12782 the object is destroyed.  Normally dead store elimination will take
12783 advantage of this; if your code relies on the value of the object
12784 storage persisting beyond the lifetime of the object, you can use this
12785 flag to disable this optimization.  To preserve stores before the
12786 constructor starts (e.g.@: because your operator new clears the object
12787 storage) but still treat the object as dead after the destructor, you
12788 can use @option{-flifetime-dse=1}.  The default behavior can be
12789 explicitly selected with @option{-flifetime-dse=2}.
12790 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12792 @opindex flive-range-shrinkage
12793 @item -flive-range-shrinkage
12794 Attempt to decrease register pressure through register live range
12795 shrinkage.  This is helpful for fast processors with small or moderate
12796 size register sets.
12798 @opindex fira-algorithm
12799 @item -fira-algorithm=@var{algorithm}
12800 Use the specified coloring algorithm for the integrated register
12801 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12802 specifies Chow's priority coloring, or @samp{CB}, which specifies
12803 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12804 for all architectures, but for those targets that do support it, it is
12805 the default because it generates better code.
12807 @opindex fira-region
12808 @item -fira-region=@var{region}
12809 Use specified regions for the integrated register allocator.  The
12810 @var{region} argument should be one of the following:
12812 @table @samp
12814 @item all
12815 Use all loops as register allocation regions.
12816 This can give the best results for machines with a small and/or
12817 irregular register set.
12819 @item mixed
12820 Use all loops except for loops with small register pressure 
12821 as the regions.  This value usually gives
12822 the best results in most cases and for most architectures,
12823 and is enabled by default when compiling with optimization for speed
12824 (@option{-O}, @option{-O2}, @dots{}).
12826 @item one
12827 Use all functions as a single region.  
12828 This typically results in the smallest code size, and is enabled by default for
12829 @option{-Os} or @option{-O0}.
12831 @end table
12833 @opindex fira-hoist-pressure
12834 @item -fira-hoist-pressure
12835 Use IRA to evaluate register pressure in the code hoisting pass for
12836 decisions to hoist expressions.  This option usually results in smaller
12837 code, but it can slow the compiler down.
12839 This option is enabled at level @option{-Os} for all targets.
12841 @opindex fira-loop-pressure
12842 @item -fira-loop-pressure
12843 Use IRA to evaluate register pressure in loops for decisions to move
12844 loop invariants.  This option usually results in generation
12845 of faster and smaller code on machines with large register files (>= 32
12846 registers), but it can slow the compiler down.
12848 This option is enabled at level @option{-O3} for some targets.
12850 @opindex fno-ira-share-save-slots
12851 @opindex fira-share-save-slots
12852 @item -fno-ira-share-save-slots
12853 Disable sharing of stack slots used for saving call-used hard
12854 registers living through a call.  Each hard register gets a
12855 separate stack slot, and as a result function stack frames are
12856 larger.
12858 @opindex fno-ira-share-spill-slots
12859 @opindex fira-share-spill-slots
12860 @item -fno-ira-share-spill-slots
12861 Disable sharing of stack slots allocated for pseudo-registers.  Each
12862 pseudo-register that does not get a hard register gets a separate
12863 stack slot, and as a result function stack frames are larger.
12865 @opindex flra-remat
12866 @item -flra-remat
12867 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12868 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12869 values if it is profitable.
12871 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12873 @opindex fdelayed-branch
12874 @item -fdelayed-branch
12875 If supported for the target machine, attempt to reorder instructions
12876 to exploit instruction slots available after delayed branch
12877 instructions.
12879 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12880 but not at @option{-Og}.
12882 @opindex fschedule-insns
12883 @item -fschedule-insns
12884 If supported for the target machine, attempt to reorder instructions to
12885 eliminate execution stalls due to required data being unavailable.  This
12886 helps machines that have slow floating point or memory load instructions
12887 by allowing other instructions to be issued until the result of the load
12888 or floating-point instruction is required.
12890 Enabled at levels @option{-O2}, @option{-O3}.
12892 @opindex fschedule-insns2
12893 @item -fschedule-insns2
12894 Similar to @option{-fschedule-insns}, but requests an additional pass of
12895 instruction scheduling after register allocation has been done.  This is
12896 especially useful on machines with a relatively small number of
12897 registers and where memory load instructions take more than one cycle.
12899 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12901 @opindex fno-sched-interblock
12902 @opindex fsched-interblock
12903 @item -fno-sched-interblock
12904 Disable instruction scheduling across basic blocks, which
12905 is normally enabled when scheduling before register allocation, i.e.@:
12906 with @option{-fschedule-insns} or at @option{-O2} or higher.
12908 @opindex fno-sched-spec
12909 @opindex fsched-spec
12910 @item -fno-sched-spec
12911 Disable speculative motion of non-load instructions, which
12912 is normally enabled when scheduling before register allocation, i.e.@:
12913 with @option{-fschedule-insns} or at @option{-O2} or higher.
12915 @opindex fsched-pressure
12916 @item -fsched-pressure
12917 Enable register pressure sensitive insn scheduling before register
12918 allocation.  This only makes sense when scheduling before register
12919 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12920 @option{-O2} or higher.  Usage of this option can improve the
12921 generated code and decrease its size by preventing register pressure
12922 increase above the number of available hard registers and subsequent
12923 spills in register allocation.
12925 @opindex fsched-spec-load
12926 @item -fsched-spec-load
12927 Allow speculative motion of some load instructions.  This only makes
12928 sense when scheduling before register allocation, i.e.@: with
12929 @option{-fschedule-insns} or at @option{-O2} or higher.
12931 @opindex fsched-spec-load-dangerous
12932 @item -fsched-spec-load-dangerous
12933 Allow speculative motion of more load instructions.  This only makes
12934 sense when scheduling before register allocation, i.e.@: with
12935 @option{-fschedule-insns} or at @option{-O2} or higher.
12937 @opindex fsched-stalled-insns
12938 @item -fsched-stalled-insns
12939 @itemx -fsched-stalled-insns=@var{n}
12940 Define how many insns (if any) can be moved prematurely from the queue
12941 of stalled insns into the ready list during the second scheduling pass.
12942 @option{-fno-sched-stalled-insns} means that no insns are moved
12943 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12944 on how many queued insns can be moved prematurely.
12945 @option{-fsched-stalled-insns} without a value is equivalent to
12946 @option{-fsched-stalled-insns=1}.
12948 @opindex fsched-stalled-insns-dep
12949 @item -fsched-stalled-insns-dep
12950 @itemx -fsched-stalled-insns-dep=@var{n}
12951 Define how many insn groups (cycles) are examined for a dependency
12952 on a stalled insn that is a candidate for premature removal from the queue
12953 of stalled insns.  This has an effect only during the second scheduling pass,
12954 and only if @option{-fsched-stalled-insns} is used.
12955 @option{-fno-sched-stalled-insns-dep} is equivalent to
12956 @option{-fsched-stalled-insns-dep=0}.
12957 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12958 @option{-fsched-stalled-insns-dep=1}.
12960 @opindex fsched2-use-superblocks
12961 @item -fsched2-use-superblocks
12962 When scheduling after register allocation, use superblock scheduling.
12963 This allows motion across basic block boundaries,
12964 resulting in faster schedules.  This option is experimental, as not all machine
12965 descriptions used by GCC model the CPU closely enough to avoid unreliable
12966 results from the algorithm.
12968 This only makes sense when scheduling after register allocation, i.e.@: with
12969 @option{-fschedule-insns2} or at @option{-O2} or higher.
12971 @opindex fsched-group-heuristic
12972 @item -fsched-group-heuristic
12973 Enable the group heuristic in the scheduler.  This heuristic favors
12974 the instruction that belongs to a schedule group.  This is enabled
12975 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12976 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12978 @opindex fsched-critical-path-heuristic
12979 @item -fsched-critical-path-heuristic
12980 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12981 instructions on the critical path.  This is enabled by default when
12982 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12983 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12985 @opindex fsched-spec-insn-heuristic
12986 @item -fsched-spec-insn-heuristic
12987 Enable the speculative instruction heuristic in the scheduler.  This
12988 heuristic favors speculative instructions with greater dependency weakness.
12989 This is enabled by default when scheduling is enabled, i.e.@:
12990 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12991 or at @option{-O2} or higher.
12993 @opindex fsched-rank-heuristic
12994 @item -fsched-rank-heuristic
12995 Enable the rank heuristic in the scheduler.  This heuristic favors
12996 the instruction belonging to a basic block with greater size or frequency.
12997 This is enabled by default when scheduling is enabled, i.e.@:
12998 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12999 at @option{-O2} or higher.
13001 @opindex fsched-last-insn-heuristic
13002 @item -fsched-last-insn-heuristic
13003 Enable the last-instruction heuristic in the scheduler.  This heuristic
13004 favors the instruction that is less dependent on the last instruction
13005 scheduled.  This is enabled by default when scheduling is enabled,
13006 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13007 at @option{-O2} or higher.
13009 @opindex fsched-dep-count-heuristic
13010 @item -fsched-dep-count-heuristic
13011 Enable the dependent-count heuristic in the scheduler.  This heuristic
13012 favors the instruction that has more instructions depending on it.
13013 This is enabled by default when scheduling is enabled, i.e.@:
13014 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
13015 at @option{-O2} or higher.
13017 @opindex freschedule-modulo-scheduled-loops
13018 @item -freschedule-modulo-scheduled-loops
13019 Modulo scheduling is performed before traditional scheduling.  If a loop
13020 is modulo scheduled, later scheduling passes may change its schedule.  
13021 Use this option to control that behavior.
13023 @opindex fselective-scheduling
13024 @item -fselective-scheduling
13025 Schedule instructions using selective scheduling algorithm.  Selective
13026 scheduling runs instead of the first scheduler pass.
13028 @opindex fselective-scheduling2
13029 @item -fselective-scheduling2
13030 Schedule instructions using selective scheduling algorithm.  Selective
13031 scheduling runs instead of the second scheduler pass.
13033 @opindex fsel-sched-pipelining
13034 @item -fsel-sched-pipelining
13035 Enable software pipelining of innermost loops during selective scheduling.
13036 This option has no effect unless one of @option{-fselective-scheduling} or
13037 @option{-fselective-scheduling2} is turned on.
13039 @opindex fsel-sched-pipelining-outer-loops
13040 @item -fsel-sched-pipelining-outer-loops
13041 When pipelining loops during selective scheduling, also pipeline outer loops.
13042 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
13044 @opindex fsemantic-interposition
13045 @item -fsemantic-interposition
13046 Some object formats, like ELF, allow interposing of symbols by the 
13047 dynamic linker.
13048 This means that for symbols exported from the DSO, the compiler cannot perform
13049 interprocedural propagation, inlining and other optimizations in anticipation
13050 that the function or variable in question may change. While this feature is
13051 useful, for example, to rewrite memory allocation functions by a debugging
13052 implementation, it is expensive in the terms of code quality.
13053 With @option{-fno-semantic-interposition} the compiler assumes that 
13054 if interposition happens for functions the overwriting function will have 
13055 precisely the same semantics (and side effects). 
13056 Similarly if interposition happens
13057 for variables, the constructor of the variable will be the same. The flag
13058 has no effect for functions explicitly declared inline 
13059 (where it is never allowed for interposition to change semantics) 
13060 and for symbols explicitly declared weak.
13062 @opindex fshrink-wrap
13063 @item -fshrink-wrap
13064 Emit function prologues only before parts of the function that need it,
13065 rather than at the top of the function.  This flag is enabled by default at
13066 @option{-O} and higher.
13068 @opindex fshrink-wrap-separate
13069 @item -fshrink-wrap-separate
13070 Shrink-wrap separate parts of the prologue and epilogue separately, so that
13071 those parts are only executed when needed.
13072 This option is on by default, but has no effect unless @option{-fshrink-wrap}
13073 is also turned on and the target supports this.
13075 @opindex fcaller-saves
13076 @item -fcaller-saves
13077 Enable allocation of values to registers that are clobbered by
13078 function calls, by emitting extra instructions to save and restore the
13079 registers around such calls.  Such allocation is done only when it
13080 seems to result in better code.
13082 This option is always enabled by default on certain machines, usually
13083 those which have no call-preserved registers to use instead.
13085 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13087 @opindex fcombine-stack-adjustments
13088 @item -fcombine-stack-adjustments
13089 Tracks stack adjustments (pushes and pops) and stack memory references
13090 and then tries to find ways to combine them.
13092 Enabled by default at @option{-O1} and higher.
13094 @opindex fipa-ra
13095 @item -fipa-ra
13096 Use caller save registers for allocation if those registers are not used by
13097 any called function.  In that case it is not necessary to save and restore
13098 them around calls.  This is only possible if called functions are part of
13099 same compilation unit as current function and they are compiled before it.
13101 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
13102 is disabled if generated code will be instrumented for profiling
13103 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
13104 exactly (this happens on targets that do not expose prologues
13105 and epilogues in RTL).
13107 @opindex fconserve-stack
13108 @item -fconserve-stack
13109 Attempt to minimize stack usage.  The compiler attempts to use less
13110 stack space, even if that makes the program slower.  This option
13111 implies setting the @option{large-stack-frame} parameter to 100
13112 and the @option{large-stack-frame-growth} parameter to 400.
13114 @opindex ftree-reassoc
13115 @item -ftree-reassoc
13116 Perform reassociation on trees.  This flag is enabled by default
13117 at @option{-O1} and higher.
13119 @opindex fcode-hoisting
13120 @item -fcode-hoisting
13121 Perform code hoisting.  Code hoisting tries to move the
13122 evaluation of expressions executed on all paths to the function exit
13123 as early as possible.  This is especially useful as a code size
13124 optimization, but it often helps for code speed as well.
13125 This flag is enabled by default at @option{-O2} and higher.
13127 @opindex ftree-pre
13128 @item -ftree-pre
13129 Perform partial redundancy elimination (PRE) on trees.  This flag is
13130 enabled by default at @option{-O2} and @option{-O3}.
13132 @opindex ftree-partial-pre
13133 @item -ftree-partial-pre
13134 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13135 enabled by default at @option{-O3}.
13137 @opindex ftree-forwprop
13138 @item -ftree-forwprop
13139 Perform forward propagation on trees.  This flag is enabled by default
13140 at @option{-O1} and higher.
13142 @opindex ftree-fre
13143 @item -ftree-fre
13144 Perform full redundancy elimination (FRE) on trees.  The difference
13145 between FRE and PRE is that FRE only considers expressions
13146 that are computed on all paths leading to the redundant computation.
13147 This analysis is faster than PRE, though it exposes fewer redundancies.
13148 This flag is enabled by default at @option{-O1} and higher.
13150 @opindex ftree-phiprop
13151 @item -ftree-phiprop
13152 Perform hoisting of loads from conditional pointers on trees.  This
13153 pass is enabled by default at @option{-O1} and higher.
13155 @opindex fhoist-adjacent-loads
13156 @item -fhoist-adjacent-loads
13157 Speculatively hoist loads from both branches of an if-then-else if the
13158 loads are from adjacent locations in the same structure and the target
13159 architecture has a conditional move instruction.  This flag is enabled
13160 by default at @option{-O2} and higher.
13162 @opindex ftree-copy-prop
13163 @item -ftree-copy-prop
13164 Perform copy propagation on trees.  This pass eliminates unnecessary
13165 copy operations.  This flag is enabled by default at @option{-O1} and
13166 higher.
13168 @opindex fipa-pure-const
13169 @item -fipa-pure-const
13170 Discover which functions are pure or constant.
13171 Enabled by default at @option{-O1} and higher.
13173 @opindex fipa-reference
13174 @item -fipa-reference
13175 Discover which static variables do not escape the
13176 compilation unit.
13177 Enabled by default at @option{-O1} and higher.
13179 @opindex fipa-reference-addressable
13180 @item -fipa-reference-addressable
13181 Discover read-only, write-only and non-addressable static variables.
13182 Enabled by default at @option{-O1} and higher.
13184 @opindex fipa-stack-alignment
13185 @item -fipa-stack-alignment
13186 Reduce stack alignment on call sites if possible.
13187 Enabled by default.
13189 @opindex fipa-pta
13190 @item -fipa-pta
13191 Perform interprocedural pointer analysis and interprocedural modification
13192 and reference analysis.  This option can cause excessive memory and
13193 compile-time usage on large compilation units.  It is not enabled by
13194 default at any optimization level.
13196 @opindex fipa-profile
13197 @item -fipa-profile
13198 Perform interprocedural profile propagation.  The functions called only from
13199 cold functions are marked as cold. Also functions executed once (such as
13200 @code{cold}, @code{noreturn}, static constructors or destructors) are
13201 identified. Cold functions and loop less parts of functions executed once are
13202 then optimized for size.
13203 Enabled by default at @option{-O1} and higher.
13205 @opindex fipa-modref
13206 @item -fipa-modref
13207 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13208 effects of functions (memory locations that are modified or referenced) and
13209 enables better optimization across the function call boundary.  This flag is
13210 enabled by default at @option{-O1} and higher.
13212 @opindex fipa-cp
13213 @item -fipa-cp
13214 Perform interprocedural constant propagation.
13215 This optimization analyzes the program to determine when values passed
13216 to functions are constants and then optimizes accordingly.
13217 This optimization can substantially increase performance
13218 if the application has constants passed to functions.
13219 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13220 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13222 @opindex fipa-cp-clone
13223 @item -fipa-cp-clone
13224 Perform function cloning to make interprocedural constant propagation stronger.
13225 When enabled, interprocedural constant propagation performs function cloning
13226 when externally visible function can be called with constant arguments.
13227 Because this optimization can create multiple copies of functions,
13228 it may significantly increase code size
13229 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13230 This flag is enabled by default at @option{-O3}.
13231 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13233 @opindex fipa-bit-cp
13234 @item -fipa-bit-cp
13235 When enabled, perform interprocedural bitwise constant
13236 propagation. This flag is enabled by default at @option{-O2} and
13237 by @option{-fprofile-use} and @option{-fauto-profile}.
13238 It requires that @option{-fipa-cp} is enabled.  
13240 @opindex fipa-vrp
13241 @item -fipa-vrp
13242 When enabled, perform interprocedural propagation of value
13243 ranges. This flag is enabled by default at @option{-O2}. It requires
13244 that @option{-fipa-cp} is enabled.
13246 @opindex fipa-icf
13247 @item -fipa-icf
13248 Perform Identical Code Folding for functions and read-only variables.
13249 The optimization reduces code size and may disturb unwind stacks by replacing
13250 a function by equivalent one with a different name. The optimization works
13251 more effectively with link-time optimization enabled.
13253 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13254 works on different levels and thus the optimizations are not same - there are
13255 equivalences that are found only by GCC and equivalences found only by Gold.
13257 This flag is enabled by default at @option{-O2} and @option{-Os}.
13259 @opindex flive-patching
13260 @item -flive-patching=@var{level}
13261 Control GCC's optimizations to produce output suitable for live-patching.
13263 If the compiler's optimization uses a function's body or information extracted
13264 from its body to optimize/change another function, the latter is called an
13265 impacted function of the former.  If a function is patched, its impacted
13266 functions should be patched too.
13268 The impacted functions are determined by the compiler's interprocedural
13269 optimizations.  For example, a caller is impacted when inlining a function
13270 into its caller,
13271 cloning a function and changing its caller to call this new clone,
13272 or extracting a function's pureness/constness information to optimize
13273 its direct or indirect callers, etc.
13275 Usually, the more IPA optimizations enabled, the larger the number of
13276 impacted functions for each function.  In order to control the number of
13277 impacted functions and more easily compute the list of impacted function,
13278 IPA optimizations can be partially enabled at two different levels.
13280 The @var{level} argument should be one of the following:
13282 @table @samp
13284 @item inline-clone
13286 Only enable inlining and cloning optimizations, which includes inlining,
13287 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13288 As a result, when patching a function, all its callers and its clones'
13289 callers are impacted, therefore need to be patched as well.
13291 @option{-flive-patching=inline-clone} disables the following optimization flags:
13292 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13293 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13294 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13295 -fipa-reference-addressable
13296 -fipa-stack-alignment -fipa-modref}
13298 @item inline-only-static
13300 Only enable inlining of static functions.
13301 As a result, when patching a static function, all its callers are impacted
13302 and so need to be patched as well.
13304 In addition to all the flags that @option{-flive-patching=inline-clone}
13305 disables,
13306 @option{-flive-patching=inline-only-static} disables the following additional
13307 optimization flags:
13308 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13310 @end table
13312 When @option{-flive-patching} is specified without any value, the default value
13313 is @var{inline-clone}.
13315 This flag is disabled by default.
13317 Note that @option{-flive-patching} is not supported with link-time optimization
13318 (@option{-flto}).
13320 @opindex fisolate-erroneous-paths-dereference
13321 @item -fisolate-erroneous-paths-dereference
13322 Detect paths that trigger erroneous or undefined behavior due to
13323 dereferencing a null pointer.  Isolate those paths from the main control
13324 flow and turn the statement with erroneous or undefined behavior into a trap.
13325 This flag is enabled by default at @option{-O2} and higher and depends on
13326 @option{-fdelete-null-pointer-checks} also being enabled.
13328 @opindex fisolate-erroneous-paths-attribute
13329 @item -fisolate-erroneous-paths-attribute
13330 Detect paths that trigger erroneous or undefined behavior due to a null value
13331 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13332 attribute.  Isolate those paths from the main control flow and turn the
13333 statement with erroneous or undefined behavior into a trap.  This is not
13334 currently enabled, but may be enabled by @option{-O2} in the future.
13336 @opindex ftree-sink
13337 @item -ftree-sink
13338 Perform forward store motion on trees.  This flag is
13339 enabled by default at @option{-O1} and higher.
13341 @opindex ftree-bit-ccp
13342 @item -ftree-bit-ccp
13343 Perform sparse conditional bit constant propagation on trees and propagate
13344 pointer alignment information.
13345 This pass only operates on local scalar variables and is enabled by default
13346 at @option{-O1} and higher, except for @option{-Og}.
13347 It requires that @option{-ftree-ccp} is enabled.
13349 @opindex ftree-ccp
13350 @item -ftree-ccp
13351 Perform sparse conditional constant propagation (CCP) on trees.  This
13352 pass only operates on local scalar variables and is enabled by default
13353 at @option{-O1} and higher.
13355 @opindex fssa-backprop
13356 @item -fssa-backprop
13357 Propagate information about uses of a value up the definition chain
13358 in order to simplify the definitions.  For example, this pass strips
13359 sign operations if the sign of a value never matters.  The flag is
13360 enabled by default at @option{-O1} and higher.
13362 @opindex fssa-phiopt
13363 @item -fssa-phiopt
13364 Perform pattern matching on SSA PHI nodes to optimize conditional
13365 code.  This pass is enabled by default at @option{-O1} and higher,
13366 except for @option{-Og}.
13368 @opindex ftree-switch-conversion
13369 @item -ftree-switch-conversion
13370 Perform conversion of simple initializations in a switch to
13371 initializations from a scalar array.  This flag is enabled by default
13372 at @option{-O2} and higher.
13374 @opindex ftree-tail-merge
13375 @item -ftree-tail-merge
13376 Look for identical code sequences.  When found, replace one with a jump to the
13377 other.  This optimization is known as tail merging or cross jumping.  This flag
13378 is enabled by default at @option{-O2} and higher.  The compilation time
13379 in this pass can
13380 be limited using @option{max-tail-merge-comparisons} parameter and
13381 @option{max-tail-merge-iterations} parameter.
13383 @opindex ftree-dce
13384 @item -ftree-dce
13385 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13386 default at @option{-O1} and higher.
13388 @opindex ftree-builtin-call-dce
13389 @item -ftree-builtin-call-dce
13390 Perform conditional dead code elimination (DCE) for calls to built-in functions
13391 that may set @code{errno} but are otherwise free of side effects.  This flag is
13392 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13393 specified.
13395 @opindex ffinite-loops
13396 @opindex fno-finite-loops
13397 @item -ffinite-loops
13398 Assume that a loop with an exit will eventually take the exit and not loop
13399 indefinitely.  This allows the compiler to remove loops that otherwise have
13400 no side-effects, not considering eventual endless looping as such.
13402 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13403 or higher.
13405 @opindex ftree-dominator-opts
13406 @item -ftree-dominator-opts
13407 Perform a variety of simple scalar cleanups (constant/copy
13408 propagation, redundancy elimination, range propagation and expression
13409 simplification) based on a dominator tree traversal.  This also
13410 performs jump threading (to reduce jumps to jumps). This flag is
13411 enabled by default at @option{-O1} and higher.
13413 @opindex ftree-dse
13414 @item -ftree-dse
13415 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13416 a memory location that is later overwritten by another store without
13417 any intervening loads.  In this case the earlier store can be deleted.  This
13418 flag is enabled by default at @option{-O1} and higher.
13420 @opindex ftree-ch
13421 @item -ftree-ch
13422 Perform loop header copying on trees.  This is beneficial since it increases
13423 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13424 is enabled by default at @option{-O1} and higher.  It is not enabled
13425 for @option{-Os}, since it usually increases code size.
13427 @opindex ftree-loop-optimize
13428 @item -ftree-loop-optimize
13429 Perform loop optimizations on trees.  This flag is enabled by default
13430 at @option{-O1} and higher.
13432 @opindex ftree-loop-linear
13433 @opindex floop-strip-mine
13434 @opindex floop-block
13435 @item -ftree-loop-linear
13436 @itemx -floop-strip-mine
13437 @itemx -floop-block
13438 Perform loop nest optimizations.  Same as
13439 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13440 to be configured with @option{--with-isl} to enable the Graphite loop
13441 transformation infrastructure.
13443 @opindex fgraphite-identity
13444 @item -fgraphite-identity
13445 Enable the identity transformation for graphite.  For every SCoP we generate
13446 the polyhedral representation and transform it back to gimple.  Using
13447 @option{-fgraphite-identity} we can check the costs or benefits of the
13448 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13449 are also performed by the code generator isl, like index splitting and
13450 dead code elimination in loops.
13452 @opindex floop-nest-optimize
13453 @item -floop-nest-optimize
13454 Enable the isl based loop nest optimizer.  This is a generic loop nest
13455 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13456 structure optimized for data-locality and parallelism.  This option
13457 is experimental.
13459 @opindex floop-parallelize-all
13460 @item -floop-parallelize-all
13461 Use the Graphite data dependence analysis to identify loops that can
13462 be parallelized.  Parallelize all the loops that can be analyzed to
13463 not contain loop carried dependences without checking that it is
13464 profitable to parallelize the loops.
13466 @opindex ftree-coalesce-vars
13467 @item -ftree-coalesce-vars
13468 While transforming the program out of the SSA representation, attempt to
13469 reduce copying by coalescing versions of different user-defined
13470 variables, instead of just compiler temporaries.  This may severely
13471 limit the ability to debug an optimized program compiled with
13472 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13473 prevents SSA coalescing of user variables.  This option is enabled by
13474 default if optimization is enabled, and it does very little otherwise.
13476 @opindex ftree-loop-if-convert
13477 @item -ftree-loop-if-convert
13478 Attempt to transform conditional jumps in the innermost loops to
13479 branch-less equivalents.  The intent is to remove control-flow from
13480 the innermost loops in order to improve the ability of the
13481 vectorization pass to handle these loops.  This is enabled by default
13482 if vectorization is enabled.
13484 @opindex ftree-loop-distribution
13485 @item -ftree-loop-distribution
13486 Perform loop distribution.  This flag can improve cache performance on
13487 big loop bodies and allow further loop optimizations, like
13488 parallelization or vectorization, to take place.  For example, the loop
13489 @smallexample
13490 DO I = 1, N
13491   A(I) = B(I) + C
13492   D(I) = E(I) * F
13493 ENDDO
13494 @end smallexample
13495 is transformed to
13496 @smallexample
13497 DO I = 1, N
13498    A(I) = B(I) + C
13499 ENDDO
13500 DO I = 1, N
13501    D(I) = E(I) * F
13502 ENDDO
13503 @end smallexample
13504 This flag is enabled by default at @option{-O3}.
13505 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13507 @opindex ftree-loop-distribute-patterns
13508 @item -ftree-loop-distribute-patterns
13509 Perform loop distribution of patterns that can be code generated with
13510 calls to a library.  This flag is enabled by default at @option{-O2} and
13511 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13513 This pass distributes the initialization loops and generates a call to
13514 memset zero.  For example, the loop
13515 @smallexample
13516 DO I = 1, N
13517   A(I) = 0
13518   B(I) = A(I) + I
13519 ENDDO
13520 @end smallexample
13521 is transformed to
13522 @smallexample
13523 DO I = 1, N
13524    A(I) = 0
13525 ENDDO
13526 DO I = 1, N
13527    B(I) = A(I) + I
13528 ENDDO
13529 @end smallexample
13530 and the initialization loop is transformed into a call to memset zero.
13531 This flag is enabled by default at @option{-O3}.
13532 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13534 @opindex floop-interchange
13535 @item -floop-interchange
13536 Perform loop interchange outside of graphite.  This flag can improve cache
13537 performance on loop nest and allow further loop optimizations, like
13538 vectorization, to take place.  For example, the loop
13539 @smallexample
13540 for (int i = 0; i < N; i++)
13541   for (int j = 0; j < N; j++)
13542     for (int k = 0; k < N; k++)
13543       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13544 @end smallexample
13545 is transformed to
13546 @smallexample
13547 for (int i = 0; i < N; i++)
13548   for (int k = 0; k < N; k++)
13549     for (int j = 0; j < N; j++)
13550       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13551 @end smallexample
13552 This flag is enabled by default at @option{-O3}.
13553 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13555 @opindex floop-unroll-and-jam
13556 @item -floop-unroll-and-jam
13557 Apply unroll and jam transformations on feasible loops.  In a loop
13558 nest this unrolls the outer loop by some factor and fuses the resulting
13559 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13560 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13562 @opindex ftree-loop-im
13563 @item -ftree-loop-im
13564 Perform loop invariant motion on trees.  This pass moves only invariants that
13565 are hard to handle at RTL level (function calls, operations that expand to
13566 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13567 operands of conditions that are invariant out of the loop, so that we can use
13568 just trivial invariantness analysis in loop unswitching.  The pass also includes
13569 store motion.
13571 @opindex ftree-loop-ivcanon
13572 @item -ftree-loop-ivcanon
13573 Create a canonical counter for number of iterations in loops for which
13574 determining number of iterations requires complicated analysis.  Later
13575 optimizations then may determine the number easily.  Useful especially
13576 in connection with unrolling.
13578 @opindex ftree-scev-cprop
13579 @item -ftree-scev-cprop
13580 Perform final value replacement.  If a variable is modified in a loop
13581 in such a way that its value when exiting the loop can be determined using
13582 only its initial value and the number of loop iterations, replace uses of
13583 the final value by such a computation, provided it is sufficiently cheap.
13584 This reduces data dependencies and may allow further simplifications.
13585 Enabled by default at @option{-O1} and higher.
13587 @opindex fivopts
13588 @item -fivopts
13589 Perform induction variable optimizations (strength reduction, induction
13590 variable merging and induction variable elimination) on trees.
13592 @opindex ftree-parallelize-loops
13593 @item -ftree-parallelize-loops=n
13594 Parallelize loops, i.e., split their iteration space to run in n threads.
13595 This is only possible for loops whose iterations are independent
13596 and can be arbitrarily reordered.  The optimization is only
13597 profitable on multiprocessor machines, for loops that are CPU-intensive,
13598 rather than constrained e.g.@: by memory bandwidth.  This option
13599 implies @option{-pthread}, and thus is only supported on targets
13600 that have support for @option{-pthread}.
13602 @opindex ftree-pta
13603 @item -ftree-pta
13604 Perform function-local points-to analysis on trees.  This flag is
13605 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13607 @opindex ftree-sra
13608 @item -ftree-sra
13609 Perform scalar replacement of aggregates.  This pass replaces structure
13610 references with scalars to prevent committing structures to memory too
13611 early.  This flag is enabled by default at @option{-O1} and higher,
13612 except for @option{-Og}.
13614 @opindex fstore-merging
13615 @item -fstore-merging
13616 Perform merging of narrow stores to consecutive memory addresses.  This pass
13617 merges contiguous stores of immediate values narrower than a word into fewer
13618 wider stores to reduce the number of instructions.  This is enabled by default
13619 at @option{-O2} and higher as well as @option{-Os}.
13621 @opindex ftree-ter
13622 @item -ftree-ter
13623 Perform temporary expression replacement during the SSA->normal phase.  Single
13624 use/single def temporaries are replaced at their use location with their
13625 defining expression.  This results in non-GIMPLE code, but gives the expanders
13626 much more complex trees to work on resulting in better RTL generation.  This is
13627 enabled by default at @option{-O1} and higher.
13629 @opindex ftree-slsr
13630 @item -ftree-slsr
13631 Perform straight-line strength reduction on trees.  This recognizes related
13632 expressions involving multiplications and replaces them by less expensive
13633 calculations when possible.  This is enabled by default at @option{-O1} and
13634 higher.
13636 @opindex ftree-vectorize
13637 @item -ftree-vectorize
13638 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13639 and @option{-ftree-slp-vectorize} if not explicitly specified.
13641 @opindex ftree-loop-vectorize
13642 @item -ftree-loop-vectorize
13643 Perform loop vectorization on trees. This flag is enabled by default at
13644 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13645 and @option{-fauto-profile}.
13647 @opindex ftree-slp-vectorize
13648 @item -ftree-slp-vectorize
13649 Perform basic block vectorization on trees. This flag is enabled by default at
13650 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13651 and @option{-fauto-profile}.
13653 @opindex ftrivial-auto-var-init
13654 @item -ftrivial-auto-var-init=@var{choice}
13655 Initialize automatic variables with either a pattern or with zeroes to increase
13656 the security and predictability of a program by preventing uninitialized memory
13657 disclosure and use.
13658 GCC still considers an automatic variable that doesn't have an explicit
13659 initializer as uninitialized, @option{-Wuninitialized} and
13660 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13661 warning messages on such automatic variables and the compiler will
13662 perform optimization as if the variable were uninitialized.
13663 With this option, GCC will also initialize any padding of automatic variables
13664 that have structure or union types to zeroes.
13665 However, the current implementation cannot initialize automatic variables that
13666 are declared between the controlling expression and the first case of a
13667 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13668 such cases.
13670 The three values of @var{choice} are:
13672 @itemize @bullet
13673 @item
13674 @samp{uninitialized} doesn't initialize any automatic variables.
13675 This is C and C++'s default.
13677 @item
13678 @samp{pattern} Initialize automatic variables with values which will likely
13679 transform logic bugs into crashes down the line, are easily recognized in a
13680 crash dump and without being values that programmers can rely on for useful
13681 program semantics.
13682 The current value is byte-repeatable pattern with byte "0xFE".
13683 The values used for pattern initialization might be changed in the future.
13685 @item
13686 @samp{zero} Initialize automatic variables with zeroes.
13687 @end itemize
13689 The default is @samp{uninitialized}.
13691 You can control this behavior for a specific variable by using the variable
13692 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13694 @opindex fvect-cost-model
13695 @item -fvect-cost-model=@var{model}
13696 Alter the cost model used for vectorization.  The @var{model} argument
13697 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13698 @samp{very-cheap}.
13699 With the @samp{unlimited} model the vectorized code-path is assumed
13700 to be profitable while with the @samp{dynamic} model a runtime check
13701 guards the vectorized code-path to enable it only for iteration
13702 counts that will likely execute faster than when executing the original
13703 scalar loop.  The @samp{cheap} model disables vectorization of
13704 loops where doing so would be cost prohibitive for example due to
13705 required runtime checks for data dependence or alignment but otherwise
13706 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13707 allows vectorization if the vector code would entirely replace the
13708 scalar code that is being vectorized.  For example, if each iteration
13709 of a vectorized loop would only be able to handle exactly four iterations
13710 of the scalar loop, the @samp{very-cheap} model would only allow
13711 vectorization if the scalar iteration count is known to be a multiple
13712 of four.
13714 The default cost model depends on other optimization flags and is
13715 either @samp{dynamic} or @samp{cheap}.
13717 @opindex fsimd-cost-model
13718 @item -fsimd-cost-model=@var{model}
13719 Alter the cost model used for vectorization of loops marked with the OpenMP
13720 simd directive.  The @var{model} argument should be one of
13721 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
13722 have the same meaning as described in @option{-fvect-cost-model} and by
13723 default a cost model defined with @option{-fvect-cost-model} is used.
13725 @opindex ftree-vrp
13726 @item -ftree-vrp
13727 Perform Value Range Propagation on trees.  This is similar to the
13728 constant propagation pass, but instead of values, ranges of values are
13729 propagated.  This allows the optimizers to remove unnecessary range
13730 checks like array bound checks and null pointer checks.  This is
13731 enabled by default at @option{-O2} and higher.  Null pointer check
13732 elimination is only done if @option{-fdelete-null-pointer-checks} is
13733 enabled.
13735 @opindex fsplit-paths
13736 @item -fsplit-paths
13737 Split paths leading to loop backedges.  This can improve dead code
13738 elimination and common subexpression elimination.  This is enabled by
13739 default at @option{-O3} and above.
13741 @opindex fsplit-ivs-in-unroller
13742 @item -fsplit-ivs-in-unroller
13743 Enables expression of values of induction variables in later iterations
13744 of the unrolled loop using the value in the first iteration.  This breaks
13745 long dependency chains, thus improving efficiency of the scheduling passes.
13747 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13748 same effect.  However, that is not reliable in cases where the loop body
13749 is more complicated than a single basic block.  It also does not work at all
13750 on some architectures due to restrictions in the CSE pass.
13752 This optimization is enabled by default.
13754 @opindex fvariable-expansion-in-unroller
13755 @item -fvariable-expansion-in-unroller
13756 With this option, the compiler creates multiple copies of some
13757 local variables when unrolling a loop, which can result in superior code.
13759 This optimization is enabled by default for PowerPC targets, but disabled
13760 by default otherwise.
13762 @opindex fpartial-inlining
13763 @item -fpartial-inlining
13764 Inline parts of functions.  This option has any effect only
13765 when inlining itself is turned on by the @option{-finline-functions}
13766 or @option{-finline-small-functions} options.
13768 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13770 @opindex fpredictive-commoning
13771 @item -fpredictive-commoning
13772 Perform predictive commoning optimization, i.e., reusing computations
13773 (especially memory loads and stores) performed in previous
13774 iterations of loops.
13776 This option is enabled at level @option{-O3}.
13777 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13779 @opindex fprefetch-loop-arrays
13780 @item -fprefetch-loop-arrays
13781 If supported by the target machine, generate instructions to prefetch
13782 memory to improve the performance of loops that access large arrays.
13784 This option may generate better or worse code; results are highly
13785 dependent on the structure of loops within the source code.
13787 Disabled at level @option{-Os}.
13789 @opindex fno-printf-return-value
13790 @opindex fprintf-return-value
13791 @item -fno-printf-return-value
13792 Do not substitute constants for known return value of formatted output
13793 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13794 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13795 transformation allows GCC to optimize or even eliminate branches based
13796 on the known return value of these functions called with arguments that
13797 are either constant, or whose values are known to be in a range that
13798 makes determining the exact return value possible.  For example, when
13799 @option{-fprintf-return-value} is in effect, both the branch and the
13800 body of the @code{if} statement (but not the call to @code{snprint})
13801 can be optimized away when @code{i} is a 32-bit or smaller integer
13802 because the return value is guaranteed to be at most 8.
13804 @smallexample
13805 char buf[9];
13806 if (snprintf (buf, "%08x", i) >= sizeof buf)
13807   @dots{}
13808 @end smallexample
13810 The @option{-fprintf-return-value} option relies on other optimizations
13811 and yields best results with @option{-O2} and above.  It works in tandem
13812 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13813 options.  The @option{-fprintf-return-value} option is enabled by default.
13815 @opindex fno-peephole
13816 @opindex fpeephole
13817 @opindex fno-peephole2
13818 @opindex fpeephole2
13819 @item -fno-peephole
13820 @itemx -fno-peephole2
13821 Disable any machine-specific peephole optimizations.  The difference
13822 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13823 are implemented in the compiler; some targets use one, some use the
13824 other, a few use both.
13826 @option{-fpeephole} is enabled by default.
13827 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13829 @opindex fno-guess-branch-probability
13830 @opindex fguess-branch-probability
13831 @item -fno-guess-branch-probability
13832 Do not guess branch probabilities using heuristics.
13834 GCC uses heuristics to guess branch probabilities if they are
13835 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13836 heuristics are based on the control flow graph.  If some branch probabilities
13837 are specified by @code{__builtin_expect}, then the heuristics are
13838 used to guess branch probabilities for the rest of the control flow graph,
13839 taking the @code{__builtin_expect} info into account.  The interactions
13840 between the heuristics and @code{__builtin_expect} can be complex, and in
13841 some cases, it may be useful to disable the heuristics so that the effects
13842 of @code{__builtin_expect} are easier to understand.
13844 It is also possible to specify expected probability of the expression
13845 with @code{__builtin_expect_with_probability} built-in function.
13847 The default is @option{-fguess-branch-probability} at levels
13848 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13850 @opindex freorder-blocks
13851 @item -freorder-blocks
13852 Reorder basic blocks in the compiled function in order to reduce number of
13853 taken branches and improve code locality.
13855 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13857 @opindex freorder-blocks-algorithm
13858 @item -freorder-blocks-algorithm=@var{algorithm}
13859 Use the specified algorithm for basic block reordering.  The
13860 @var{algorithm} argument can be @samp{simple}, which does not increase
13861 code size (except sometimes due to secondary effects like alignment),
13862 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13863 put all often executed code together, minimizing the number of branches
13864 executed by making extra copies of code.
13866 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13867 @samp{stc} at levels @option{-O2}, @option{-O3}.
13869 @opindex freorder-blocks-and-partition
13870 @item -freorder-blocks-and-partition
13871 In addition to reordering basic blocks in the compiled function, in order
13872 to reduce number of taken branches, partitions hot and cold basic blocks
13873 into separate sections of the assembly and @file{.o} files, to improve
13874 paging and cache locality performance.
13876 This optimization is automatically turned off in the presence of
13877 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13878 section attribute and on any architecture that does not support named
13879 sections.  When @option{-fsplit-stack} is used this option is not
13880 enabled by default (to avoid linker errors), but may be enabled
13881 explicitly (if using a working linker).
13883 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13885 @opindex freorder-functions
13886 @item -freorder-functions
13887 Reorder functions in the object file in order to
13888 improve code locality.  This is implemented by using special
13889 subsections @code{.text.hot} for most frequently executed functions and
13890 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13891 the linker so object file format must support named sections and linker must
13892 place them in a reasonable way.
13894 This option isn't effective unless you either provide profile feedback
13895 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13896 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13898 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13900 @opindex fstrict-aliasing
13901 @item -fstrict-aliasing
13902 Allow the compiler to assume the strictest aliasing rules applicable to
13903 the language being compiled.  For C (and C++), this activates
13904 optimizations based on the type of expressions.  In particular, an
13905 object of one type is assumed never to reside at the same address as an
13906 object of a different type, unless the types are almost the same.  For
13907 example, an @code{unsigned int} can alias an @code{int}, but not a
13908 @code{void*} or a @code{double}.  A character type may alias any other
13909 type.
13911 @anchor{Type-punning}Pay special attention to code like this:
13912 @smallexample
13913 union a_union @{
13914   int i;
13915   double d;
13918 int f() @{
13919   union a_union t;
13920   t.d = 3.0;
13921   return t.i;
13923 @end smallexample
13924 The practice of reading from a different union member than the one most
13925 recently written to (called ``type-punning'') is common.  Even with
13926 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13927 is accessed through the union type.  So, the code above works as
13928 expected.  @xref{Structures unions enumerations and bit-fields
13929 implementation}.  However, this code might not:
13930 @smallexample
13931 int f() @{
13932   union a_union t;
13933   int* ip;
13934   t.d = 3.0;
13935   ip = &t.i;
13936   return *ip;
13938 @end smallexample
13940 Similarly, access by taking the address, casting the resulting pointer
13941 and dereferencing the result has undefined behavior, even if the cast
13942 uses a union type, e.g.:
13943 @smallexample
13944 int f() @{
13945   double d = 3.0;
13946   return ((union a_union *) &d)->i;
13948 @end smallexample
13950 The @option{-fstrict-aliasing} option is enabled at levels
13951 @option{-O2}, @option{-O3}, @option{-Os}.
13953 @opindex fipa-strict-aliasing
13954 @item -fipa-strict-aliasing
13955 Controls whether rules of @option{-fstrict-aliasing} are applied across
13956 function boundaries.  Note that if multiple functions gets inlined into a
13957 single function the memory accesses are no longer considered to be crossing a
13958 function boundary.
13960 The @option{-fipa-strict-aliasing} option is enabled by default and is
13961 effective only in combination with @option{-fstrict-aliasing}.
13963 @opindex falign-functions
13964 @item -falign-functions
13965 @itemx -falign-functions=@var{n}
13966 @itemx -falign-functions=@var{n}:@var{m}
13967 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13968 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13969 Align the start of functions to the next power-of-two greater than or
13970 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13971 least the first @var{m} bytes of the function can be fetched by the CPU
13972 without crossing an @var{n}-byte alignment boundary.
13974 If @var{m} is not specified, it defaults to @var{n}.
13976 Examples: @option{-falign-functions=32} aligns functions to the next
13977 32-byte boundary, @option{-falign-functions=24} aligns to the next
13978 32-byte boundary only if this can be done by skipping 23 bytes or less,
13979 @option{-falign-functions=32:7} aligns to the next
13980 32-byte boundary only if this can be done by skipping 6 bytes or less.
13982 The second pair of @var{n2}:@var{m2} values allows you to specify
13983 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13984 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13985 otherwise aligns to the next 32-byte boundary if this can be done
13986 by skipping 2 bytes or less.
13987 If @var{m2} is not specified, it defaults to @var{n2}.
13989 Some assemblers only support this flag when @var{n} is a power of two;
13990 in that case, it is rounded up.
13992 @option{-fno-align-functions} and @option{-falign-functions=1} are
13993 equivalent and mean that functions are not aligned.
13995 If @var{n} is not specified or is zero, use a machine-dependent default.
13996 The maximum allowed @var{n} option value is 65536.
13998 Enabled at levels @option{-O2}, @option{-O3}.
14000 @item -flimit-function-alignment
14001 If this option is enabled, the compiler tries to avoid unnecessarily
14002 overaligning functions. It attempts to instruct the assembler to align
14003 by the amount specified by @option{-falign-functions}, but not to
14004 skip more bytes than the size of the function.
14006 @opindex falign-labels
14007 @item -falign-labels
14008 @itemx -falign-labels=@var{n}
14009 @itemx -falign-labels=@var{n}:@var{m}
14010 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
14011 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
14012 Align all branch targets to a power-of-two boundary.
14014 Parameters of this option are analogous to the @option{-falign-functions} option.
14015 @option{-fno-align-labels} and @option{-falign-labels=1} are
14016 equivalent and mean that labels are not aligned.
14018 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
14019 are greater than this value, then their values are used instead.
14021 If @var{n} is not specified or is zero, use a machine-dependent default
14022 which is very likely to be @samp{1}, meaning no alignment.
14023 The maximum allowed @var{n} option value is 65536.
14025 Enabled at levels @option{-O2}, @option{-O3}.
14027 @opindex falign-loops
14028 @item -falign-loops
14029 @itemx -falign-loops=@var{n}
14030 @itemx -falign-loops=@var{n}:@var{m}
14031 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
14032 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
14033 Align loops to a power-of-two boundary.  If the loops are executed
14034 many times, this makes up for any execution of the dummy padding
14035 instructions.
14037 If @option{-falign-labels} is greater than this value, then its value
14038 is used instead.
14040 Parameters of this option are analogous to the @option{-falign-functions} option.
14041 @option{-fno-align-loops} and @option{-falign-loops=1} are
14042 equivalent and mean that loops are not aligned.
14043 The maximum allowed @var{n} option value is 65536.
14045 If @var{n} is not specified or is zero, use a machine-dependent default.
14047 Enabled at levels @option{-O2}, @option{-O3}.
14049 @opindex falign-jumps
14050 @item -falign-jumps
14051 @itemx -falign-jumps=@var{n}
14052 @itemx -falign-jumps=@var{n}:@var{m}
14053 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
14054 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
14055 Align branch targets to a power-of-two boundary, for branch targets
14056 where the targets can only be reached by jumping.  In this case,
14057 no dummy operations need be executed.
14059 If @option{-falign-labels} is greater than this value, then its value
14060 is used instead.
14062 Parameters of this option are analogous to the @option{-falign-functions} option.
14063 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
14064 equivalent and mean that loops are not aligned.
14066 If @var{n} is not specified or is zero, use a machine-dependent default.
14067 The maximum allowed @var{n} option value is 65536.
14069 Enabled at levels @option{-O2}, @option{-O3}.
14071 @opindex fno-allocation-dce
14072 @item -fno-allocation-dce
14073 Do not remove unused C++ allocations in dead code elimination.
14075 @opindex fallow-store-data-races
14076 @item -fallow-store-data-races
14077 Allow the compiler to perform optimizations that may introduce new data races
14078 on stores, without proving that the variable cannot be concurrently accessed
14079 by other threads.  Does not affect optimization of local data.  It is safe to
14080 use this option if it is known that global data will not be accessed by
14081 multiple threads.
14083 Examples of optimizations enabled by @option{-fallow-store-data-races} include
14084 hoisting or if-conversions that may cause a value that was already in memory
14085 to be re-written with that same value.  Such re-writing is safe in a single
14086 threaded context but may be unsafe in a multi-threaded context.  Note that on
14087 some processors, if-conversions may be required in order to enable
14088 vectorization.
14090 Enabled at level @option{-Ofast}.
14092 @opindex funit-at-a-time
14093 @item -funit-at-a-time
14094 This option is left for compatibility reasons. @option{-funit-at-a-time}
14095 has no effect, while @option{-fno-unit-at-a-time} implies
14096 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
14098 Enabled by default.
14100 @opindex fno-toplevel-reorder
14101 @opindex ftoplevel-reorder
14102 @item -fno-toplevel-reorder
14103 Do not reorder top-level functions, variables, and @code{asm}
14104 statements.  Output them in the same order that they appear in the
14105 input file.  When this option is used, unreferenced static variables
14106 are not removed.  This option is intended to support existing code
14107 that relies on a particular ordering.  For new code, it is better to
14108 use attributes when possible.
14110 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14111 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14112 Additionally @option{-fno-toplevel-reorder} implies
14113 @option{-fno-section-anchors}.
14115 @opindex funreachable-traps
14116 @item -funreachable-traps
14117 With this option, the compiler turns calls to
14118 @code{__builtin_unreachable} into traps, instead of using them for
14119 optimization.  This also affects any such calls implicitly generated
14120 by the compiler.
14122 This option has the same effect as @option{-fsanitize=unreachable
14123 -fsanitize-trap=unreachable}, but does not affect the values of those
14124 options.  If @option{-fsanitize=unreachable} is enabled, that option
14125 takes priority over this one.
14127 This option is enabled by default at @option{-O0} and @option{-Og}.
14129 @opindex fweb
14130 @item -fweb
14131 Constructs webs as commonly used for register allocation purposes and assign
14132 each web individual pseudo register.  This allows the register allocation pass
14133 to operate on pseudos directly, but also strengthens several other optimization
14134 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14135 however, make debugging impossible, since variables no longer stay in a
14136 ``home register''.
14138 Enabled by default with @option{-funroll-loops}.
14140 @opindex fwhole-program
14141 @item -fwhole-program
14142 Assume that the current compilation unit represents the whole program being
14143 compiled.  All public functions and variables with the exception of @code{main}
14144 and those merged by attribute @code{externally_visible} become static functions
14145 and in effect are optimized more aggressively by interprocedural optimizers.
14147 With @option{-flto} this option has a limited use.  In most cases the
14148 precise list of symbols used or exported from the binary is known the
14149 resolution info passed to the link-time optimizer by the linker plugin.  It is
14150 still useful if no linker plugin is used or during incremental link step when
14151 final code is produced (with @option{-flto}
14152 @option{-flinker-output=nolto-rel}).
14154 @opindex flto
14155 @item -flto[=@var{n}]
14156 This option runs the standard link-time optimizer.  When invoked
14157 with source code, it generates GIMPLE (one of GCC's internal
14158 representations) and writes it to special ELF sections in the object
14159 file.  When the object files are linked together, all the function
14160 bodies are read from these ELF sections and instantiated as if they
14161 had been part of the same translation unit.
14163 To use the link-time optimizer, @option{-flto} and optimization
14164 options should be specified at compile time and during the final link.
14165 It is recommended that you compile all the files participating in the
14166 same link with the same options and also specify those options at
14167 link time.  
14168 For example:
14170 @smallexample
14171 gcc -c -O2 -flto foo.c
14172 gcc -c -O2 -flto bar.c
14173 gcc -o myprog -flto -O2 foo.o bar.o
14174 @end smallexample
14176 The first two invocations to GCC save a bytecode representation
14177 of GIMPLE into special ELF sections inside @file{foo.o} and
14178 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14179 @file{foo.o} and @file{bar.o}, merges the two files into a single
14180 internal image, and compiles the result as usual.  Since both
14181 @file{foo.o} and @file{bar.o} are merged into a single image, this
14182 causes all the interprocedural analyses and optimizations in GCC to
14183 work across the two files as if they were a single one.  This means,
14184 for example, that the inliner is able to inline functions in
14185 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14187 Another (simpler) way to enable link-time optimization is:
14189 @smallexample
14190 gcc -o myprog -flto -O2 foo.c bar.c
14191 @end smallexample
14193 The above generates bytecode for @file{foo.c} and @file{bar.c},
14194 merges them together into a single GIMPLE representation and optimizes
14195 them as usual to produce @file{myprog}.
14197 The important thing to keep in mind is that to enable link-time
14198 optimizations you need to use the GCC driver to perform the link step.
14199 GCC automatically performs link-time optimization if any of the
14200 objects involved were compiled with the @option{-flto} command-line option.  
14201 You can always override
14202 the automatic decision to do link-time optimization
14203 by passing @option{-fno-lto} to the link command.
14205 To make whole program optimization effective, it is necessary to make
14206 certain whole program assumptions.  The compiler needs to know
14207 what functions and variables can be accessed by libraries and runtime
14208 outside of the link-time optimized unit.  When supported by the linker,
14209 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14210 to the compiler about used and externally visible symbols.  When
14211 the linker plugin is not available, @option{-fwhole-program} should be
14212 used to allow the compiler to make these assumptions, which leads
14213 to more aggressive optimization decisions.
14215 When a file is compiled with @option{-flto} without
14216 @option{-fuse-linker-plugin}, the generated object file is larger than
14217 a regular object file because it contains GIMPLE bytecodes and the usual
14218 final code (see @option{-ffat-lto-objects}).  This means that
14219 object files with LTO information can be linked as normal object
14220 files; if @option{-fno-lto} is passed to the linker, no
14221 interprocedural optimizations are applied.  Note that when
14222 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14223 but you cannot perform a regular, non-LTO link on them.
14225 When producing the final binary, GCC only
14226 applies link-time optimizations to those files that contain bytecode.
14227 Therefore, you can mix and match object files and libraries with
14228 GIMPLE bytecodes and final object code.  GCC automatically selects
14229 which files to optimize in LTO mode and which files to link without
14230 further processing.
14232 Generally, options specified at link time override those
14233 specified at compile time, although in some cases GCC attempts to infer
14234 link-time options from the settings used to compile the input files.
14236 If you do not specify an optimization level option @option{-O} at
14237 link time, then GCC uses the highest optimization level 
14238 used when compiling the object files.  Note that it is generally 
14239 ineffective to specify an optimization level option only at link time and 
14240 not at compile time, for two reasons.  First, compiling without 
14241 optimization suppresses compiler passes that gather information 
14242 needed for effective optimization at link time.  Second, some early
14243 optimization passes can be performed only at compile time and 
14244 not at link time.
14246 There are some code generation flags preserved by GCC when
14247 generating bytecodes, as they need to be used during the final link.
14248 Currently, the following options and their settings are taken from
14249 the first object file that explicitly specifies them: 
14250 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14251 @option{-fgnu-tm} and all the @option{-m} target flags.
14253 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14254 @option{-fPIE} are combined based on the following scheme:
14256 @smallexample
14257 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14258 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14259 @option{-fpic/-fPIC} + (no option) = (no option)
14260 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14261 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14262 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14263 @end smallexample
14265 Certain ABI-changing flags are required to match in all compilation units,
14266 and trying to override this at link time with a conflicting value
14267 is ignored.  This includes options such as @option{-freg-struct-return}
14268 and @option{-fpcc-struct-return}. 
14270 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14271 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14272 are passed through to the link stage and merged conservatively for
14273 conflicting translation units.  Specifically
14274 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14275 precedence; and for example @option{-ffp-contract=off} takes precedence
14276 over @option{-ffp-contract=fast}.  You can override them at link time.
14278 Diagnostic options such as @option{-Wstringop-overflow} are passed
14279 through to the link stage and their setting matches that of the
14280 compile-step at function granularity.  Note that this matters only
14281 for diagnostics emitted during optimization.  Note that code
14282 transforms such as inlining can lead to warnings being enabled
14283 or disabled for regions if code not consistent with the setting
14284 at compile time.
14286 When you need to pass options to the assembler via @option{-Wa} or
14287 @option{-Xassembler} make sure to either compile such translation
14288 units with @option{-fno-lto} or consistently use the same assembler
14289 options on all translation units.  You can alternatively also
14290 specify assembler options at LTO link time.
14292 To enable debug info generation you need to supply @option{-g} at
14293 compile time.  If any of the input files at link time were built
14294 with debug info generation enabled the link will enable debug info
14295 generation as well.  Any elaborate debug info settings
14296 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14297 at the linker command line and mixing different settings in different
14298 translation units is discouraged.
14300 If LTO encounters objects with C linkage declared with incompatible
14301 types in separate translation units to be linked together (undefined
14302 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14303 issued.  The behavior is still undefined at run time.  Similar
14304 diagnostics may be raised for other languages.
14306 Another feature of LTO is that it is possible to apply interprocedural
14307 optimizations on files written in different languages:
14309 @smallexample
14310 gcc -c -flto foo.c
14311 g++ -c -flto bar.cc
14312 gfortran -c -flto baz.f90
14313 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14314 @end smallexample
14316 Notice that the final link is done with @command{g++} to get the C++
14317 runtime libraries and @option{-lgfortran} is added to get the Fortran
14318 runtime libraries.  In general, when mixing languages in LTO mode, you
14319 should use the same link command options as when mixing languages in a
14320 regular (non-LTO) compilation.
14322 If object files containing GIMPLE bytecode are stored in a library archive, say
14323 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14324 are using a linker with plugin support.  To create static libraries suitable
14325 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14326 and @command{ranlib}; 
14327 to show the symbols of object files with GIMPLE bytecode, use
14328 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14329 and @command{nm} have been compiled with plugin support.  At link time, use the
14330 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14331 the LTO optimization process:
14333 @smallexample
14334 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14335 @end smallexample
14337 With the linker plugin enabled, the linker extracts the needed
14338 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14339 to make them part of the aggregated GIMPLE image to be optimized.
14341 If you are not using a linker with plugin support and/or do not
14342 enable the linker plugin, then the objects inside @file{libfoo.a}
14343 are extracted and linked as usual, but they do not participate
14344 in the LTO optimization process.  In order to make a static library suitable
14345 for both LTO optimization and usual linkage, compile its object files with
14346 @option{-flto} @option{-ffat-lto-objects}.
14348 Link-time optimizations do not require the presence of the whole program to
14349 operate.  If the program does not require any symbols to be exported, it is
14350 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14351 the interprocedural optimizers to use more aggressive assumptions which may
14352 lead to improved optimization opportunities.
14353 Use of @option{-fwhole-program} is not needed when linker plugin is
14354 active (see @option{-fuse-linker-plugin}).
14356 The current implementation of LTO makes no
14357 attempt to generate bytecode that is portable between different
14358 types of hosts.  The bytecode files are versioned and there is a
14359 strict version check, so bytecode files generated in one version of
14360 GCC do not work with an older or newer version of GCC.
14362 Link-time optimization does not work well with generation of debugging
14363 information on systems other than those using a combination of ELF and
14364 DWARF.
14366 If you specify the optional @var{n}, the optimization and code
14367 generation done at link time is executed in parallel using @var{n}
14368 parallel jobs by utilizing an installed @command{make} program.  The
14369 environment variable @env{MAKE} may be used to override the program
14370 used.
14372 You can also specify @option{-flto=jobserver} to use GNU make's
14373 job server mode to determine the number of parallel jobs. This
14374 is useful when the Makefile calling GCC is already executing in parallel.
14375 You must prepend a @samp{+} to the command recipe in the parent Makefile
14376 for this to work.  This option likely only works if @env{MAKE} is
14377 GNU make.  Even without the option value, GCC tries to automatically
14378 detect a running GNU make's job server.
14380 Use @option{-flto=auto} to use GNU make's job server, if available,
14381 or otherwise fall back to autodetection of the number of CPU threads
14382 present in your system.
14384 @opindex flto-partition
14385 @item -flto-partition=@var{alg}
14386 Specify the partitioning algorithm used by the link-time optimizer.
14387 The value is either @samp{1to1} to specify a partitioning mirroring
14388 the original source files or @samp{balanced} to specify partitioning
14389 into equally sized chunks (whenever possible) or @samp{max} to create
14390 new partition for every symbol where possible.  Specifying @samp{none}
14391 as an algorithm disables partitioning and streaming completely. 
14392 The default value is @samp{balanced}. While @samp{1to1} can be used
14393 as an workaround for various code ordering issues, the @samp{max}
14394 partitioning is intended for internal testing only.
14395 The value @samp{one} specifies that exactly one partition should be
14396 used while the value @samp{none} bypasses partitioning and executes
14397 the link-time optimization step directly from the WPA phase.
14399 @opindex flto-compression-level
14400 @item -flto-compression-level=@var{n}
14401 This option specifies the level of compression used for intermediate
14402 language written to LTO object files, and is only meaningful in
14403 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14404 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14405 to 19 (maximum compression), while zlib supports values from 0 to 9.
14406 Values outside this range are clamped to either minimum or maximum
14407 of the supported values.  If the option is not given,
14408 a default balanced compression setting is used.
14410 @opindex fuse-linker-plugin
14411 @item -fuse-linker-plugin
14412 Enables the use of a linker plugin during link-time optimization.  This
14413 option relies on plugin support in the linker, which is available in gold
14414 or in GNU ld 2.21 or newer.
14416 This option enables the extraction of object files with GIMPLE bytecode out
14417 of library archives. This improves the quality of optimization by exposing
14418 more code to the link-time optimizer.  This information specifies what
14419 symbols can be accessed externally (by non-LTO object or during dynamic
14420 linking).  Resulting code quality improvements on binaries (and shared
14421 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14422 See @option{-flto} for a description of the effect of this flag and how to
14423 use it.
14425 This option is enabled by default when LTO support in GCC is enabled
14426 and GCC was configured for use with
14427 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14429 @opindex ffat-lto-objects
14430 @item -ffat-lto-objects
14431 Fat LTO objects are object files that contain both the intermediate language
14432 and the object code. This makes them usable for both LTO linking and normal
14433 linking. This option is effective only when compiling with @option{-flto}
14434 and is ignored at link time.
14436 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14437 requires the complete toolchain to be aware of LTO. It requires a linker with
14438 linker plugin support for basic functionality.  Additionally,
14439 @command{nm}, @command{ar} and @command{ranlib}
14440 need to support linker plugins to allow a full-featured build environment
14441 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14442 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14443 to these tools. With non fat LTO makefiles need to be modified to use them.
14445 Note that modern binutils provide plugin auto-load mechanism.
14446 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14447 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14448 @command{gcc-ranlib}).
14450 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14451 support.
14453 @opindex fcompare-elim
14454 @item -fcompare-elim
14455 After register allocation and post-register allocation instruction splitting,
14456 identify arithmetic instructions that compute processor flags similar to a
14457 comparison operation based on that arithmetic.  If possible, eliminate the
14458 explicit comparison operation.
14460 This pass only applies to certain targets that cannot explicitly represent
14461 the comparison operation before register allocation is complete.
14463 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14465 @opindex ffold-mem-offsets
14466 @item -ffold-mem-offsets
14467 @itemx -fno-fold-mem-offsets
14468 Try to eliminate add instructions by folding them in memory loads/stores.
14470 Enabled at levels @option{-O2}, @option{-O3}.
14472 @opindex fcprop-registers
14473 @item -fcprop-registers
14474 After register allocation and post-register allocation instruction splitting,
14475 perform a copy-propagation pass to try to reduce scheduling dependencies
14476 and occasionally eliminate the copy.
14478 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14480 @opindex fprofile-correction
14481 @item -fprofile-correction
14482 Profiles collected using an instrumented binary for multi-threaded programs may
14483 be inconsistent due to missed counter updates. When this option is specified,
14484 GCC uses heuristics to correct or smooth out such inconsistencies. By
14485 default, GCC emits an error message when an inconsistent profile is detected.
14487 This option is enabled by @option{-fauto-profile}.
14489 @opindex fprofile-partial-training
14490 @item -fprofile-partial-training
14491 With @code{-fprofile-use} all portions of programs not executed during train
14492 run are optimized agressively for size rather than speed.  In some cases it is
14493 not practical to train all possible hot paths in the program. (For
14494 example, program may contain functions specific for a given hardware and
14495 trianing may not cover all hardware configurations program is run on.)  With
14496 @code{-fprofile-partial-training} profile feedback will be ignored for all
14497 functions not executed during the train run leading them to be optimized as if
14498 they were compiled without profile feedback. This leads to better performance
14499 when train run is not representative but also leads to significantly bigger
14500 code.
14502 @opindex fprofile-use
14503 @item -fprofile-use
14504 @itemx -fprofile-use=@var{path}
14505 Enable profile feedback-directed optimizations, 
14506 and the following optimizations, many of which
14507 are generally profitable only with profile feedback available:
14509 @gccoptlist{-fbranch-probabilities  -fprofile-values
14510 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14511 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14512 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14513 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14514 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14515 -fprofile-reorder-functions}
14517 Before you can use this option, you must first generate profiling information.
14518 @xref{Instrumentation Options}, for information about the
14519 @option{-fprofile-generate} option.
14521 By default, GCC emits an error message if the feedback profiles do not
14522 match the source code.  This error can be turned into a warning by using
14523 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14524 optimized code.  Additionally, by default, GCC also emits a warning message if
14525 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14527 If @var{path} is specified, GCC looks at the @var{path} to find
14528 the profile feedback data files. See @option{-fprofile-dir}.
14530 @opindex fauto-profile
14531 @item -fauto-profile
14532 @itemx -fauto-profile=@var{path}
14533 Enable sampling-based feedback-directed optimizations, 
14534 and the following optimizations,
14535 many of which are generally profitable only with profile feedback available:
14537 @gccoptlist{-fbranch-probabilities  -fprofile-values
14538 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14539 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14540 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14541 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14542 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14543 -fprofile-correction}
14545 @var{path} is the name of a file containing AutoFDO profile information.
14546 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14548 Producing an AutoFDO profile data file requires running your program
14549 with the @command{perf} utility on a supported GNU/Linux target system.
14550 For more information, see @uref{https://perf.wiki.kernel.org/}.
14552 E.g.
14553 @smallexample
14554 perf record -e br_inst_retired:near_taken -b -o perf.data \
14555     -- your_program
14556 @end smallexample
14558 Then use the @command{create_gcov} tool to convert the raw profile data
14559 to a format that can be used by GCC.@  You must also supply the 
14560 unstripped binary for your program to this tool.  
14561 See @uref{https://github.com/google/autofdo}.
14563 E.g.
14564 @smallexample
14565 create_gcov --binary=your_program.unstripped --profile=perf.data \
14566     --gcov=profile.afdo
14567 @end smallexample
14568 @end table
14570 The following options control compiler behavior regarding floating-point 
14571 arithmetic.  These options trade off between speed and
14572 correctness.  All must be specifically enabled.
14574 @table @gcctabopt
14575 @opindex ffloat-store
14576 @item -ffloat-store
14577 Do not store floating-point variables in registers, and inhibit other
14578 options that might change whether a floating-point value is taken from a
14579 register or memory.
14581 @cindex floating-point precision
14582 This option prevents undesirable excess precision on machines such as
14583 the 68000 where the floating registers (of the 68881) keep more
14584 precision than a @code{double} is supposed to have.  Similarly for the
14585 x86 architecture.  For most programs, the excess precision does only
14586 good, but a few programs rely on the precise definition of IEEE floating
14587 point.  Use @option{-ffloat-store} for such programs, after modifying
14588 them to store all pertinent intermediate computations into variables.
14590 @opindex fexcess-precision
14591 @item -fexcess-precision=@var{style}
14592 This option allows further control over excess precision on machines
14593 where floating-point operations occur in a format with more precision or
14594 range than the IEEE standard and interchange floating-point types.  By
14595 default, @option{-fexcess-precision=fast} is in effect; this means that
14596 operations may be carried out in a wider precision than the types specified
14597 in the source if that would result in faster code, and it is unpredictable
14598 when rounding to the types specified in the source code takes place.
14599 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14600 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14601 both casts and assignments cause values to be rounded to their
14602 semantic types (whereas @option{-ffloat-store} only affects
14603 assignments).  This option is enabled by default for C or C++ if a strict
14604 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14605 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14606 regardless of whether a strict conformance option is used.
14608 @opindex mfpmath
14609 @option{-fexcess-precision=standard} is not implemented for languages
14610 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14611 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14612 semantics apply without excess precision, and in the latter, rounding
14613 is unpredictable.
14615 @opindex ffast-math
14616 @item -ffast-math
14617 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14618 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14619 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14620 @option{-fexcess-precision=fast}.
14622 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14624 This option is not turned on by any @option{-O} option besides
14625 @option{-Ofast} since it can result in incorrect output for programs
14626 that depend on an exact implementation of IEEE or ISO rules/specifications
14627 for math functions. It may, however, yield faster code for programs
14628 that do not require the guarantees of these specifications.
14630 @opindex fno-math-errno
14631 @opindex fmath-errno
14632 @item -fno-math-errno
14633 Do not set @code{errno} after calling math functions that are executed
14634 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14635 IEEE exceptions for math error handling may want to use this flag
14636 for speed while maintaining IEEE arithmetic compatibility.
14638 This option is not turned on by any @option{-O} option since
14639 it can result in incorrect output for programs that depend on
14640 an exact implementation of IEEE or ISO rules/specifications for
14641 math functions. It may, however, yield faster code for programs
14642 that do not require the guarantees of these specifications.
14644 The default is @option{-fmath-errno}.
14646 On Darwin systems, the math library never sets @code{errno}.  There is
14647 therefore no reason for the compiler to consider the possibility that
14648 it might, and @option{-fno-math-errno} is the default.
14650 @opindex funsafe-math-optimizations
14651 @item -funsafe-math-optimizations
14653 Allow optimizations for floating-point arithmetic that (a) assume
14654 that arguments and results are valid and (b) may violate IEEE or
14655 ANSI standards.  When used at link time, it may include libraries
14656 or startup files that change the default FPU control word or other
14657 similar optimizations.
14659 This option is not turned on by any @option{-O} option since
14660 it can result in incorrect output for programs that depend on
14661 an exact implementation of IEEE or ISO rules/specifications for
14662 math functions. It may, however, yield faster code for programs
14663 that do not require the guarantees of these specifications.
14664 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14665 @option{-fassociative-math} and @option{-freciprocal-math}.
14667 The default is @option{-fno-unsafe-math-optimizations}.
14669 @opindex fassociative-math
14670 @item -fassociative-math
14672 Allow re-association of operands in series of floating-point operations.
14673 This violates the ISO C and C++ language standard by possibly changing
14674 computation result.  NOTE: re-ordering may change the sign of zero as
14675 well as ignore NaNs and inhibit or create underflow or overflow (and
14676 thus cannot be used on code that relies on rounding behavior like
14677 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14678 and thus may not be used when ordered comparisons are required.
14679 This option requires that both @option{-fno-signed-zeros} and
14680 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14681 much sense with @option{-frounding-math}. For Fortran the option
14682 is automatically enabled when both @option{-fno-signed-zeros} and
14683 @option{-fno-trapping-math} are in effect.
14685 The default is @option{-fno-associative-math}.
14687 @opindex freciprocal-math
14688 @item -freciprocal-math
14690 Allow the reciprocal of a value to be used instead of dividing by
14691 the value if this enables optimizations.  For example @code{x / y}
14692 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14693 is subject to common subexpression elimination.  Note that this loses
14694 precision and increases the number of flops operating on the value.
14696 The default is @option{-fno-reciprocal-math}.
14698 @opindex ffinite-math-only
14699 @item -ffinite-math-only
14700 Allow optimizations for floating-point arithmetic that assume
14701 that arguments and results are not NaNs or +-Infs.
14703 This option is not turned on by any @option{-O} option since
14704 it can result in incorrect output for programs that depend on
14705 an exact implementation of IEEE or ISO rules/specifications for
14706 math functions. It may, however, yield faster code for programs
14707 that do not require the guarantees of these specifications.
14709 The default is @option{-fno-finite-math-only}.
14711 @opindex fno-signed-zeros
14712 @opindex fsigned-zeros
14713 @item -fno-signed-zeros
14714 Allow optimizations for floating-point arithmetic that ignore the
14715 signedness of zero.  IEEE arithmetic specifies the behavior of
14716 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14717 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14718 This option implies that the sign of a zero result isn't significant.
14720 The default is @option{-fsigned-zeros}.
14722 @opindex fno-trapping-math
14723 @opindex ftrapping-math
14724 @item -fno-trapping-math
14725 Compile code assuming that floating-point operations cannot generate
14726 user-visible traps.  These traps include division by zero, overflow,
14727 underflow, inexact result and invalid operation.  This option requires
14728 that @option{-fno-signaling-nans} be in effect.  Setting this option may
14729 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14731 This option should never be turned on by any @option{-O} option since
14732 it can result in incorrect output for programs that depend on
14733 an exact implementation of IEEE or ISO rules/specifications for
14734 math functions.
14736 The default is @option{-ftrapping-math}.
14738 Future versions of GCC may provide finer control of this setting
14739 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14740 will be used along with @option{-frounding-math} to specify the
14741 default state for @code{FENV_ACCESS}.
14743 @opindex frounding-math
14744 @item -frounding-math
14745 Disable transformations and optimizations that assume default floating-point
14746 rounding behavior.  This is round-to-zero for all floating point
14747 to integer conversions, and round-to-nearest for all other arithmetic
14748 truncations.  This option should be specified for programs that change
14749 the FP rounding mode dynamically, or that may be executed with a
14750 non-default rounding mode.  This option disables constant folding of
14751 floating-point expressions at compile time (which may be affected by
14752 rounding mode) and arithmetic transformations that are unsafe in the
14753 presence of sign-dependent rounding modes.
14755 The default is @option{-fno-rounding-math}.
14757 This option is experimental and does not currently guarantee to
14758 disable all GCC optimizations that are affected by rounding mode.
14759 Future versions of GCC may provide finer control of this setting
14760 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14761 will be used along with @option{-ftrapping-math} to specify the
14762 default state for @code{FENV_ACCESS}.
14764 @opindex fsignaling-nans
14765 @item -fsignaling-nans
14766 Compile code assuming that IEEE signaling NaNs may generate user-visible
14767 traps during floating-point operations.  Setting this option disables
14768 optimizations that may change the number of exceptions visible with
14769 signaling NaNs.  This option implies @option{-ftrapping-math}.
14771 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14772 be defined.
14774 The default is @option{-fno-signaling-nans}.
14776 This option is experimental and does not currently guarantee to
14777 disable all GCC optimizations that affect signaling NaN behavior.
14779 @opindex fno-fp-int-builtin-inexact
14780 @opindex ffp-int-builtin-inexact
14781 @item -fno-fp-int-builtin-inexact
14782 Do not allow the built-in functions @code{ceil}, @code{floor},
14783 @code{round} and @code{trunc}, and their @code{float} and @code{long
14784 double} variants, to generate code that raises the ``inexact''
14785 floating-point exception for noninteger arguments.  ISO C99 and C11
14786 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14787 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14788 ISO C23, does not allow these functions to do so.
14790 The default is @option{-ffp-int-builtin-inexact}, allowing the
14791 exception to be raised, unless C23 or a later C standard is selected.
14792 This option does nothing unless @option{-ftrapping-math} is in effect.
14794 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14795 generate a call to a library function then the ``inexact'' exception
14796 may be raised if the library implementation does not follow TS 18661.
14798 @opindex fsingle-precision-constant
14799 @item -fsingle-precision-constant
14800 Treat floating-point constants as single precision instead of
14801 implicitly converting them to double-precision constants.
14803 @opindex fcx-limited-range
14804 @item -fcx-limited-range
14805 When enabled, this option states that a range reduction step is not
14806 needed when performing complex division.  Also, there is no checking
14807 whether the result of a complex multiplication or division is @code{NaN
14808 + I*NaN}, with an attempt to rescue the situation in that case.  The
14809 default is @option{-fno-cx-limited-range}, but is enabled by
14810 @option{-ffast-math}.
14812 This option controls the default setting of the ISO C99
14813 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14814 all languages.
14816 @opindex fcx-fortran-rules
14817 @item -fcx-fortran-rules
14818 Complex multiplication and division follow Fortran rules.  Range
14819 reduction is done as part of complex division, but there is no checking
14820 whether the result of a complex multiplication or division is @code{NaN
14821 + I*NaN}, with an attempt to rescue the situation in that case.
14823 The default is @option{-fno-cx-fortran-rules}.
14825 @end table
14827 The following options control optimizations that may improve
14828 performance, but are not enabled by any @option{-O} options.  This
14829 section includes experimental options that may produce broken code.
14831 @table @gcctabopt
14832 @opindex fbranch-probabilities
14833 @item -fbranch-probabilities
14834 After running a program compiled with @option{-fprofile-arcs}
14835 (@pxref{Instrumentation Options}),
14836 you can compile it a second time using
14837 @option{-fbranch-probabilities}, to improve optimizations based on
14838 the number of times each branch was taken.  When a program
14839 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14840 counts to a file called @file{@var{sourcename}.gcda} for each source
14841 file.  The information in this data file is very dependent on the
14842 structure of the generated code, so you must use the same source code
14843 and the same optimization options for both compilations.
14844 See details about the file naming in @option{-fprofile-arcs}.
14846 With @option{-fbranch-probabilities}, GCC puts a
14847 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14848 These can be used to improve optimization.  Currently, they are only
14849 used in one place: in @file{reorg.cc}, instead of guessing which path a
14850 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14851 exactly determine which path is taken more often.
14853 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14855 @opindex fprofile-values
14856 @item -fprofile-values
14857 If combined with @option{-fprofile-arcs}, it adds code so that some
14858 data about values of expressions in the program is gathered.
14860 With @option{-fbranch-probabilities}, it reads back the data gathered
14861 from profiling values of expressions for usage in optimizations.
14863 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14864 @option{-fauto-profile}.
14866 @opindex fprofile-reorder-functions
14867 @item -fprofile-reorder-functions
14868 Function reordering based on profile instrumentation collects
14869 first time of execution of a function and orders these functions
14870 in ascending order.
14872 Enabled with @option{-fprofile-use}.
14874 @opindex fvpt
14875 @item -fvpt
14876 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14877 to add code to gather information about values of expressions.
14879 With @option{-fbranch-probabilities}, it reads back the data gathered
14880 and actually performs the optimizations based on them.
14881 Currently the optimizations include specialization of division operations
14882 using the knowledge about the value of the denominator.
14884 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14886 @opindex frename-registers
14887 @item -frename-registers
14888 Attempt to avoid false dependencies in scheduled code by making use
14889 of registers left over after register allocation.  This optimization
14890 most benefits processors with lots of registers.  Depending on the
14891 debug information format adopted by the target, however, it can
14892 make debugging impossible, since variables no longer stay in
14893 a ``home register''.
14895 Enabled by default with @option{-funroll-loops}.
14897 @opindex fschedule-fusion
14898 @item -fschedule-fusion
14899 Performs a target dependent pass over the instruction stream to schedule
14900 instructions of same type together because target machine can execute them
14901 more efficiently if they are adjacent to each other in the instruction flow.
14903 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14905 @opindex ftracer
14906 @item -ftracer
14907 Perform tail duplication to enlarge superblock size.  This transformation
14908 simplifies the control flow of the function allowing other optimizations to do
14909 a better job.
14911 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14913 @opindex funroll-loops
14914 @item -funroll-loops
14915 Unroll loops whose number of iterations can be determined at compile time or
14916 upon entry to the loop.  @option{-funroll-loops} implies
14917 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14918 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14919 a small constant number of iterations).  This option makes code larger, and may
14920 or may not make it run faster.
14922 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14924 @opindex funroll-all-loops
14925 @item -funroll-all-loops
14926 Unroll all loops, even if their number of iterations is uncertain when
14927 the loop is entered.  This usually makes programs run more slowly.
14928 @option{-funroll-all-loops} implies the same options as
14929 @option{-funroll-loops}.
14931 @opindex fpeel-loops
14932 @item -fpeel-loops
14933 Peels loops for which there is enough information that they do not
14934 roll much (from profile feedback or static analysis).  It also turns on
14935 complete loop peeling (i.e.@: complete removal of loops with small constant
14936 number of iterations).
14938 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14940 @opindex fmove-loop-invariants
14941 @item -fmove-loop-invariants
14942 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14943 at level @option{-O1} and higher, except for @option{-Og}.
14945 @opindex fmove-loop-stores
14946 @item -fmove-loop-stores
14947 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14948 moves invariant stores to after the end of the loop in exchange for
14949 carrying the stored value in a register across the iteration.
14950 Note for this option to have an effect @option{-ftree-loop-im} has to
14951 be enabled as well.  Enabled at level @option{-O1} and higher, except
14952 for @option{-Og}.
14954 @opindex fsplit-loops
14955 @item -fsplit-loops
14956 Split a loop into two if it contains a condition that's always true
14957 for one side of the iteration space and false for the other.
14959 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14961 @opindex funswitch-loops
14962 @item -funswitch-loops
14963 Move branches with loop invariant conditions out of the loop, with duplicates
14964 of the loop on both branches (modified according to result of the condition).
14966 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14968 @opindex fversion-loops-for-strides
14969 @item -fversion-loops-for-strides
14970 If a loop iterates over an array with a variable stride, create another
14971 version of the loop that assumes the stride is always one.  For example:
14973 @smallexample
14974 for (int i = 0; i < n; ++i)
14975   x[i * stride] = @dots{};
14976 @end smallexample
14978 becomes:
14980 @smallexample
14981 if (stride == 1)
14982   for (int i = 0; i < n; ++i)
14983     x[i] = @dots{};
14984 else
14985   for (int i = 0; i < n; ++i)
14986     x[i * stride] = @dots{};
14987 @end smallexample
14989 This is particularly useful for assumed-shape arrays in Fortran where
14990 (for example) it allows better vectorization assuming contiguous accesses.
14991 This flag is enabled by default at @option{-O3}.
14992 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14994 @opindex ffunction-sections
14995 @opindex fdata-sections
14996 @item -ffunction-sections
14997 @itemx -fdata-sections
14998 Place each function or data item into its own section in the output
14999 file if the target supports arbitrary sections.  The name of the
15000 function or the name of the data item determines the section's name
15001 in the output file.
15003 Use these options on systems where the linker can perform optimizations to
15004 improve locality of reference in the instruction space.  Most systems using the
15005 ELF object format have linkers with such optimizations.  On AIX, the linker
15006 rearranges sections (CSECTs) based on the call graph.  The performance impact
15007 varies.
15009 Together with a linker garbage collection (linker @option{--gc-sections}
15010 option) these options may lead to smaller statically-linked executables (after
15011 stripping).
15013 On ELF/DWARF systems these options do not degenerate the quality of the debug
15014 information.  There could be issues with other object files/debug info formats.
15016 Only use these options when there are significant benefits from doing so.  When
15017 you specify these options, the assembler and linker create larger object and
15018 executable files and are also slower.  These options affect code generation.
15019 They prevent optimizations by the compiler and assembler using relative
15020 locations inside a translation unit since the locations are unknown until
15021 link time.  An example of such an optimization is relaxing calls to short call
15022 instructions.
15024 @opindex fstdarg-opt
15025 @item -fstdarg-opt
15026 Optimize the prologue of variadic argument functions with respect to usage of
15027 those arguments.
15029 @opindex fsection-anchors
15030 @item -fsection-anchors
15031 Try to reduce the number of symbolic address calculations by using
15032 shared ``anchor'' symbols to address nearby objects.  This transformation
15033 can help to reduce the number of GOT entries and GOT accesses on some
15034 targets.
15036 For example, the implementation of the following function @code{foo}:
15038 @smallexample
15039 static int a, b, c;
15040 int foo (void) @{ return a + b + c; @}
15041 @end smallexample
15043 @noindent
15044 usually calculates the addresses of all three variables, but if you
15045 compile it with @option{-fsection-anchors}, it accesses the variables
15046 from a common anchor point instead.  The effect is similar to the
15047 following pseudocode (which isn't valid C):
15049 @smallexample
15050 int foo (void)
15052   register int *xr = &x;
15053   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
15055 @end smallexample
15057 Not all targets support this option.
15059 @opindex fzero-call-used-regs
15060 @item -fzero-call-used-regs=@var{choice}
15061 Zero call-used registers at function return to increase program
15062 security by either mitigating Return-Oriented Programming (ROP)
15063 attacks or preventing information leakage through registers.
15065 The possible values of @var{choice} are the same as for the
15066 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
15067 The default is @samp{skip}.
15069 You can control this behavior for a specific function by using the function
15070 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
15072 @opindex param
15073 @item --param @var{name}=@var{value}
15074 In some places, GCC uses various constants to control the amount of
15075 optimization that is done.  For example, GCC does not inline functions
15076 that contain more than a certain number of instructions.  You can
15077 control some of these constants on the command line using the
15078 @option{--param} option.
15080 The names of specific parameters, and the meaning of the values, are
15081 tied to the internals of the compiler, and are subject to change
15082 without notice in future releases.
15084 In order to get the minimal, maximal and default values of a parameter,
15085 use the @option{--help=param -Q} options.
15087 In each case, the @var{value} is an integer.  The following choices
15088 of @var{name} are recognized for all targets:
15090 @table @gcctabopt
15091 @item predictable-branch-outcome
15092 When branch is predicted to be taken with probability lower than this threshold
15093 (in percent), then it is considered well predictable.
15095 @item max-rtl-if-conversion-insns
15096 RTL if-conversion tries to remove conditional branches around a block and
15097 replace them with conditionally executed instructions.  This parameter
15098 gives the maximum number of instructions in a block which should be
15099 considered for if-conversion.  The compiler will
15100 also use other heuristics to decide whether if-conversion is likely to be
15101 profitable.
15103 @item max-rtl-if-conversion-predictable-cost
15104 RTL if-conversion will try to remove conditional branches around a block
15105 and replace them with conditionally executed instructions.  These parameters
15106 give the maximum permissible cost for the sequence that would be generated
15107 by if-conversion depending on whether the branch is statically determined
15108 to be predictable or not.  The units for this parameter are the same as
15109 those for the GCC internal seq_cost metric.  The compiler will try to
15110 provide a reasonable default for this parameter using the BRANCH_COST
15111 target macro.
15113 @item max-crossjump-edges
15114 The maximum number of incoming edges to consider for cross-jumping.
15115 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15116 the number of edges incoming to each block.  Increasing values mean
15117 more aggressive optimization, making the compilation time increase with
15118 probably small improvement in executable size.
15120 @item min-crossjump-insns
15121 The minimum number of instructions that must be matched at the end
15122 of two blocks before cross-jumping is performed on them.  This
15123 value is ignored in the case where all instructions in the block being
15124 cross-jumped from are matched.
15126 @item max-grow-copy-bb-insns
15127 The maximum code size expansion factor when copying basic blocks
15128 instead of jumping.  The expansion is relative to a jump instruction.
15130 @item max-goto-duplication-insns
15131 The maximum number of instructions to duplicate to a block that jumps
15132 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15133 passes, GCC factors computed gotos early in the compilation process,
15134 and unfactors them as late as possible.  Only computed jumps at the
15135 end of a basic blocks with no more than max-goto-duplication-insns are
15136 unfactored.
15138 @item max-delay-slot-insn-search
15139 The maximum number of instructions to consider when looking for an
15140 instruction to fill a delay slot.  If more than this arbitrary number of
15141 instructions are searched, the time savings from filling the delay slot
15142 are minimal, so stop searching.  Increasing values mean more
15143 aggressive optimization, making the compilation time increase with probably
15144 small improvement in execution time.
15146 @item max-delay-slot-live-search
15147 When trying to fill delay slots, the maximum number of instructions to
15148 consider when searching for a block with valid live register
15149 information.  Increasing this arbitrarily chosen value means more
15150 aggressive optimization, increasing the compilation time.  This parameter
15151 should be removed when the delay slot code is rewritten to maintain the
15152 control-flow graph.
15154 @item max-gcse-memory
15155 The approximate maximum amount of memory in @code{kB} that can be allocated in
15156 order to perform the global common subexpression elimination
15157 optimization.  If more memory than specified is required, the
15158 optimization is not done.
15160 @item max-gcse-insertion-ratio
15161 If the ratio of expression insertions to deletions is larger than this value
15162 for any expression, then RTL PRE inserts or removes the expression and thus
15163 leaves partially redundant computations in the instruction stream.
15165 @item max-pending-list-length
15166 The maximum number of pending dependencies scheduling allows
15167 before flushing the current state and starting over.  Large functions
15168 with few branches or calls can create excessively large lists which
15169 needlessly consume memory and resources.
15171 @item max-modulo-backtrack-attempts
15172 The maximum number of backtrack attempts the scheduler should make
15173 when modulo scheduling a loop.  Larger values can exponentially increase
15174 compilation time.
15176 @item max-inline-functions-called-once-loop-depth
15177 Maximal loop depth of a call considered by inline heuristics that tries to
15178 inline all functions called once.
15180 @item max-inline-functions-called-once-insns
15181 Maximal estimated size of functions produced while inlining functions called
15182 once.
15184 @item max-inline-insns-single
15185 Several parameters control the tree inliner used in GCC@.  This number sets the
15186 maximum number of instructions (counted in GCC's internal representation) in a
15187 single function that the tree inliner considers for inlining.  This only
15188 affects functions declared inline and methods implemented in a class
15189 declaration (C++). 
15192 @item max-inline-insns-auto
15193 When you use @option{-finline-functions} (included in @option{-O3}),
15194 a lot of functions that would otherwise not be considered for inlining
15195 by the compiler are investigated.  To those functions, a different
15196 (more restrictive) limit compared to functions declared inline can
15197 be applied (@option{--param max-inline-insns-auto}).
15199 @item max-inline-insns-small
15200 This is bound applied to calls which are considered relevant with
15201 @option{-finline-small-functions}.
15203 @item max-inline-insns-size
15204 This is bound applied to calls which are optimized for size. Small growth
15205 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15207 @item uninlined-function-insns
15208 Number of instructions accounted by inliner for function overhead such as
15209 function prologue and epilogue.
15211 @item uninlined-function-time
15212 Extra time accounted by inliner for function overhead such as time needed to
15213 execute function prologue and epilogue.
15215 @item inline-heuristics-hint-percent
15216 The scale (in percents) applied to @option{inline-insns-single},
15217 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15218 when inline heuristics hints that inlining is
15219 very profitable (will enable later optimizations).
15221 @item uninlined-thunk-insns
15222 @item uninlined-thunk-time
15223 Same as @option{--param uninlined-function-insns} and
15224 @option{--param uninlined-function-time} but applied to function thunks.
15226 @item inline-min-speedup
15227 When estimated performance improvement of caller + callee runtime exceeds this
15228 threshold (in percent), the function can be inlined regardless of the limit on
15229 @option{--param max-inline-insns-single} and @option{--param
15230 max-inline-insns-auto}.
15232 @item large-function-insns
15233 The limit specifying really large functions.  For functions larger than this
15234 limit after inlining, inlining is constrained by
15235 @option{--param large-function-growth}.  This parameter is useful primarily
15236 to avoid extreme compilation time caused by non-linear algorithms used by the
15237 back end.
15239 @item large-function-growth
15240 Specifies maximal growth of large function caused by inlining in percents.
15241 For example, parameter value 100 limits large function growth to 2.0 times
15242 the original size.
15244 @item large-unit-insns
15245 The limit specifying large translation unit.  Growth caused by inlining of
15246 units larger than this limit is limited by @option{--param inline-unit-growth}.
15247 For small units this might be too tight.
15248 For example, consider a unit consisting of function A
15249 that is inline and B that just calls A three times.  If B is small relative to
15250 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15251 large units consisting of small inlineable functions, however, the overall unit
15252 growth limit is needed to avoid exponential explosion of code size.  Thus for
15253 smaller units, the size is increased to @option{--param large-unit-insns}
15254 before applying @option{--param inline-unit-growth}.
15256 @item lazy-modules
15257 Maximum number of concurrently open C++ module files when lazy loading.
15259 @item inline-unit-growth
15260 Specifies maximal overall growth of the compilation unit caused by inlining.
15261 For example, parameter value 20 limits unit growth to 1.2 times the original
15262 size. Cold functions (either marked cold via an attribute or by profile
15263 feedback) are not accounted into the unit size.
15265 @item ipa-cp-unit-growth
15266 Specifies maximal overall growth of the compilation unit caused by
15267 interprocedural constant propagation.  For example, parameter value 10 limits
15268 unit growth to 1.1 times the original size.
15270 @item ipa-cp-large-unit-insns
15271 The size of translation unit that IPA-CP pass considers large.
15273 @item large-stack-frame
15274 The limit specifying large stack frames.  While inlining the algorithm is trying
15275 to not grow past this limit too much.
15277 @item large-stack-frame-growth
15278 Specifies maximal growth of large stack frames caused by inlining in percents.
15279 For example, parameter value 1000 limits large stack frame growth to 11 times
15280 the original size.
15282 @item max-inline-insns-recursive
15283 @itemx max-inline-insns-recursive-auto
15284 Specifies the maximum number of instructions an out-of-line copy of a
15285 self-recursive inline
15286 function can grow into by performing recursive inlining.
15288 @option{--param max-inline-insns-recursive} applies to functions
15289 declared inline.
15290 For functions not declared inline, recursive inlining
15291 happens only when @option{-finline-functions} (included in @option{-O3}) is
15292 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15294 @item max-inline-recursive-depth
15295 @itemx max-inline-recursive-depth-auto
15296 Specifies the maximum recursion depth used for recursive inlining.
15298 @option{--param max-inline-recursive-depth} applies to functions
15299 declared inline.  For functions not declared inline, recursive inlining
15300 happens only when @option{-finline-functions} (included in @option{-O3}) is
15301 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15303 @item min-inline-recursive-probability
15304 Recursive inlining is profitable only for function having deep recursion
15305 in average and can hurt for function having little recursion depth by
15306 increasing the prologue size or complexity of function body to other
15307 optimizers.
15309 When profile feedback is available (see @option{-fprofile-generate}) the actual
15310 recursion depth can be guessed from the probability that function recurses
15311 via a given call expression.  This parameter limits inlining only to call
15312 expressions whose probability exceeds the given threshold (in percents).
15314 @item early-inlining-insns
15315 Specify growth that the early inliner can make.  In effect it increases
15316 the amount of inlining for code having a large abstraction penalty.
15318 @item max-early-inliner-iterations
15319 Limit of iterations of the early inliner.  This basically bounds
15320 the number of nested indirect calls the early inliner can resolve.
15321 Deeper chains are still handled by late inlining.
15323 @item comdat-sharing-probability
15324 Probability (in percent) that C++ inline function with comdat visibility
15325 are shared across multiple compilation units.
15327 @item modref-max-bases
15328 @item modref-max-refs
15329 @item modref-max-accesses
15330 Specifies the maximal number of base pointers, references and accesses stored
15331 for a single function by mod/ref analysis.
15333 @item modref-max-tests
15334 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15335 memory locations using the mod/ref information.  This parameter ought to be
15336 bigger than @option{--param modref-max-bases} and @option{--param
15337 modref-max-refs}.
15339 @item modref-max-depth
15340 Specifies the maximum depth of DFS walk used by modref escape analysis.
15341 Setting to 0 disables the analysis completely.
15343 @item modref-max-escape-points
15344 Specifies the maximum number of escape points tracked by modref per SSA-name.
15346 @item modref-max-adjustments
15347 Specifies the maximum number the access range is enlarged during modref dataflow
15348 analysis.
15350 @item profile-func-internal-id
15351 A parameter to control whether to use function internal id in profile
15352 database lookup. If the value is 0, the compiler uses an id that
15353 is based on function assembler name and filename, which makes old profile
15354 data more tolerant to source changes such as function reordering etc.
15356 @item min-vect-loop-bound
15357 The minimum number of iterations under which loops are not vectorized
15358 when @option{-ftree-vectorize} is used.  The number of iterations after
15359 vectorization needs to be greater than the value specified by this option
15360 to allow vectorization.
15362 @item gcse-cost-distance-ratio
15363 Scaling factor in calculation of maximum distance an expression
15364 can be moved by GCSE optimizations.  This is currently supported only in the
15365 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15366 is with simple expressions, i.e., the expressions that have cost
15367 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15368 hoisting of simple expressions.
15370 @item gcse-unrestricted-cost
15371 Cost, roughly measured as the cost of a single typical machine
15372 instruction, at which GCSE optimizations do not constrain
15373 the distance an expression can travel.  This is currently
15374 supported only in the code hoisting pass.  The lesser the cost,
15375 the more aggressive code hoisting is.  Specifying 0 
15376 allows all expressions to travel unrestricted distances.
15378 @item max-hoist-depth
15379 The depth of search in the dominator tree for expressions to hoist.
15380 This is used to avoid quadratic behavior in hoisting algorithm.
15381 The value of 0 does not limit on the search, but may slow down compilation
15382 of huge functions.
15384 @item max-tail-merge-comparisons
15385 The maximum amount of similar bbs to compare a bb with.  This is used to
15386 avoid quadratic behavior in tree tail merging.
15388 @item max-tail-merge-iterations
15389 The maximum amount of iterations of the pass over the function.  This is used to
15390 limit compilation time in tree tail merging.
15392 @item store-merging-allow-unaligned
15393 Allow the store merging pass to introduce unaligned stores if it is legal to
15394 do so.
15396 @item max-stores-to-merge
15397 The maximum number of stores to attempt to merge into wider stores in the store
15398 merging pass.
15400 @item max-store-chains-to-track
15401 The maximum number of store chains to track at the same time in the attempt
15402 to merge them into wider stores in the store merging pass.
15404 @item max-stores-to-track
15405 The maximum number of stores to track at the same time in the attemt to
15406 to merge them into wider stores in the store merging pass.
15408 @item max-unrolled-insns
15409 The maximum number of instructions that a loop may have to be unrolled.
15410 If a loop is unrolled, this parameter also determines how many times
15411 the loop code is unrolled.
15413 @item max-average-unrolled-insns
15414 The maximum number of instructions biased by probabilities of their execution
15415 that a loop may have to be unrolled.  If a loop is unrolled,
15416 this parameter also determines how many times the loop code is unrolled.
15418 @item max-unroll-times
15419 The maximum number of unrollings of a single loop.
15421 @item max-peeled-insns
15422 The maximum number of instructions that a loop may have to be peeled.
15423 If a loop is peeled, this parameter also determines how many times
15424 the loop code is peeled.
15426 @item max-peel-times
15427 The maximum number of peelings of a single loop.
15429 @item max-peel-branches
15430 The maximum number of branches on the hot path through the peeled sequence.
15432 @item max-completely-peeled-insns
15433 The maximum number of insns of a completely peeled loop.
15435 @item max-completely-peel-times
15436 The maximum number of iterations of a loop to be suitable for complete peeling.
15438 @item max-completely-peel-loop-nest-depth
15439 The maximum depth of a loop nest suitable for complete peeling.
15441 @item max-unswitch-insns
15442 The maximum number of insns of an unswitched loop.
15444 @item max-unswitch-depth
15445 The maximum depth of a loop nest to be unswitched.
15447 @item lim-expensive
15448 The minimum cost of an expensive expression in the loop invariant motion.
15450 @item min-loop-cond-split-prob
15451 When FDO profile information is available, @option{min-loop-cond-split-prob}
15452 specifies minimum threshold for probability of semi-invariant condition
15453 statement to trigger loop split.
15455 @item iv-consider-all-candidates-bound
15456 Bound on number of candidates for induction variables, below which
15457 all candidates are considered for each use in induction variable
15458 optimizations.  If there are more candidates than this,
15459 only the most relevant ones are considered to avoid quadratic time complexity.
15461 @item iv-max-considered-uses
15462 The induction variable optimizations give up on loops that contain more
15463 induction variable uses.
15465 @item iv-always-prune-cand-set-bound
15466 If the number of candidates in the set is smaller than this value,
15467 always try to remove unnecessary ivs from the set
15468 when adding a new one.
15470 @item avg-loop-niter
15471 Average number of iterations of a loop.
15473 @item dse-max-object-size
15474 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15475 Larger values may result in larger compilation times.
15477 @item dse-max-alias-queries-per-store
15478 Maximum number of queries into the alias oracle per store.
15479 Larger values result in larger compilation times and may result in more
15480 removed dead stores.
15482 @item scev-max-expr-size
15483 Bound on size of expressions used in the scalar evolutions analyzer.
15484 Large expressions slow the analyzer.
15486 @item scev-max-expr-complexity
15487 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15488 Complex expressions slow the analyzer.
15490 @item max-tree-if-conversion-phi-args
15491 Maximum number of arguments in a PHI supported by TREE if conversion
15492 unless the loop is marked with simd pragma.
15494 @item vect-max-layout-candidates
15495 The maximum number of possible vector layouts (such as permutations)
15496 to consider when optimizing to-be-vectorized code.
15498 @item vect-max-version-for-alignment-checks
15499 The maximum number of run-time checks that can be performed when
15500 doing loop versioning for alignment in the vectorizer.
15502 @item vect-max-version-for-alias-checks
15503 The maximum number of run-time checks that can be performed when
15504 doing loop versioning for alias in the vectorizer.
15506 @item vect-max-peeling-for-alignment
15507 The maximum number of loop peels to enhance access alignment
15508 for vectorizer. Value -1 means no limit.
15510 @item max-iterations-to-track
15511 The maximum number of iterations of a loop the brute-force algorithm
15512 for analysis of the number of iterations of the loop tries to evaluate.
15514 @item hot-bb-count-fraction
15515 The denominator n of fraction 1/n of the maximal execution count of a
15516 basic block in the entire program that a basic block needs to at least
15517 have in order to be considered hot.  The default is 10000, which means
15518 that a basic block is considered hot if its execution count is greater
15519 than 1/10000 of the maximal execution count.  0 means that it is never
15520 considered hot.  Used in non-LTO mode.
15522 @item hot-bb-count-ws-permille
15523 The number of most executed permilles, ranging from 0 to 1000, of the
15524 profiled execution of the entire program to which the execution count
15525 of a basic block must be part of in order to be considered hot.  The
15526 default is 990, which means that a basic block is considered hot if
15527 its execution count contributes to the upper 990 permilles, or 99.0%,
15528 of the profiled execution of the entire program.  0 means that it is
15529 never considered hot.  Used in LTO mode.
15531 @item hot-bb-frequency-fraction
15532 The denominator n of fraction 1/n of the execution frequency of the
15533 entry block of a function that a basic block of this function needs
15534 to at least have in order to be considered hot.  The default is 1000,
15535 which means that a basic block is considered hot in a function if it
15536 is executed more frequently than 1/1000 of the frequency of the entry
15537 block of the function.  0 means that it is never considered hot.
15539 @item unlikely-bb-count-fraction
15540 The denominator n of fraction 1/n of the number of profiled runs of
15541 the entire program below which the execution count of a basic block
15542 must be in order for the basic block to be considered unlikely executed.
15543 The default is 20, which means that a basic block is considered unlikely
15544 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15545 the program.  0 means that it is always considered unlikely executed.
15547 @item max-predicted-iterations
15548 The maximum number of loop iterations we predict statically.  This is useful
15549 in cases where a function contains a single loop with known bound and
15550 another loop with unknown bound.
15551 The known number of iterations is predicted correctly, while
15552 the unknown number of iterations average to roughly 10.  This means that the
15553 loop without bounds appears artificially cold relative to the other one.
15555 @item builtin-expect-probability
15556 Control the probability of the expression having the specified value. This
15557 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15559 @item builtin-string-cmp-inline-length
15560 The maximum length of a constant string for a builtin string cmp call 
15561 eligible for inlining.
15563 @item align-threshold
15565 Select fraction of the maximal frequency of executions of a basic block in
15566 a function to align the basic block.
15568 @item align-loop-iterations
15570 A loop expected to iterate at least the selected number of iterations is
15571 aligned.
15573 @item tracer-dynamic-coverage
15574 @itemx tracer-dynamic-coverage-feedback
15576 This value is used to limit superblock formation once the given percentage of
15577 executed instructions is covered.  This limits unnecessary code size
15578 expansion.
15580 The @option{tracer-dynamic-coverage-feedback} parameter
15581 is used only when profile
15582 feedback is available.  The real profiles (as opposed to statically estimated
15583 ones) are much less balanced allowing the threshold to be larger value.
15585 @item tracer-max-code-growth
15586 Stop tail duplication once code growth has reached given percentage.  This is
15587 a rather artificial limit, as most of the duplicates are eliminated later in
15588 cross jumping, so it may be set to much higher values than is the desired code
15589 growth.
15591 @item tracer-min-branch-ratio
15593 Stop reverse growth when the reverse probability of best edge is less than this
15594 threshold (in percent).
15596 @item tracer-min-branch-probability
15597 @itemx tracer-min-branch-probability-feedback
15599 Stop forward growth if the best edge has probability lower than this
15600 threshold.
15602 Similarly to @option{tracer-dynamic-coverage} two parameters are
15603 provided.  @option{tracer-min-branch-probability-feedback} is used for
15604 compilation with profile feedback and @option{tracer-min-branch-probability}
15605 compilation without.  The value for compilation with profile feedback
15606 needs to be more conservative (higher) in order to make tracer
15607 effective.
15609 @item stack-clash-protection-guard-size
15610 Specify the size of the operating system provided stack guard as
15611 2 raised to @var{num} bytes.  Higher values may reduce the
15612 number of explicit probes, but a value larger than the operating system
15613 provided guard will leave code vulnerable to stack clash style attacks.
15615 @item stack-clash-protection-probe-interval
15616 Stack clash protection involves probing stack space as it is allocated.  This
15617 param controls the maximum distance between probes into the stack as 2 raised
15618 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15619 larger than the operating system provided guard will leave code vulnerable to
15620 stack clash style attacks.
15622 @item max-cse-path-length
15624 The maximum number of basic blocks on path that CSE considers.
15626 @item max-cse-insns
15627 The maximum number of instructions CSE processes before flushing.
15629 @item ggc-min-expand
15631 GCC uses a garbage collector to manage its own memory allocation.  This
15632 parameter specifies the minimum percentage by which the garbage
15633 collector's heap should be allowed to expand between collections.
15634 Tuning this may improve compilation speed; it has no effect on code
15635 generation.
15637 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15638 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15639 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15640 GCC is not able to calculate RAM on a particular platform, the lower
15641 bound of 30% is used.  Setting this parameter and
15642 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15643 every opportunity.  This is extremely slow, but can be useful for
15644 debugging.
15646 @item ggc-min-heapsize
15648 Minimum size of the garbage collector's heap before it begins bothering
15649 to collect garbage.  The first collection occurs after the heap expands
15650 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15651 tuning this may improve compilation speed, and has no effect on code
15652 generation.
15654 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15655 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15656 with a lower bound of 4096 (four megabytes) and an upper bound of
15657 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15658 particular platform, the lower bound is used.  Setting this parameter
15659 very large effectively disables garbage collection.  Setting this
15660 parameter and @option{ggc-min-expand} to zero causes a full collection
15661 to occur at every opportunity.
15663 @item max-reload-search-insns
15664 The maximum number of instruction reload should look backward for equivalent
15665 register.  Increasing values mean more aggressive optimization, making the
15666 compilation time increase with probably slightly better performance.
15668 @item max-cselib-memory-locations
15669 The maximum number of memory locations cselib should take into account.
15670 Increasing values mean more aggressive optimization, making the compilation time
15671 increase with probably slightly better performance.
15673 @item max-sched-ready-insns
15674 The maximum number of instructions ready to be issued the scheduler should
15675 consider at any given time during the first scheduling pass.  Increasing
15676 values mean more thorough searches, making the compilation time increase
15677 with probably little benefit.
15679 @item max-sched-region-blocks
15680 The maximum number of blocks in a region to be considered for
15681 interblock scheduling.
15683 @item max-pipeline-region-blocks
15684 The maximum number of blocks in a region to be considered for
15685 pipelining in the selective scheduler.
15687 @item max-sched-region-insns
15688 The maximum number of insns in a region to be considered for
15689 interblock scheduling.
15691 @item max-pipeline-region-insns
15692 The maximum number of insns in a region to be considered for
15693 pipelining in the selective scheduler.
15695 @item min-spec-prob
15696 The minimum probability (in percents) of reaching a source block
15697 for interblock speculative scheduling.
15699 @item max-sched-extend-regions-iters
15700 The maximum number of iterations through CFG to extend regions.
15701 A value of 0 disables region extensions.
15703 @item max-sched-insn-conflict-delay
15704 The maximum conflict delay for an insn to be considered for speculative motion.
15706 @item sched-spec-prob-cutoff
15707 The minimal probability of speculation success (in percents), so that
15708 speculative insns are scheduled.
15710 @item sched-state-edge-prob-cutoff
15711 The minimum probability an edge must have for the scheduler to save its
15712 state across it.
15714 @item sched-mem-true-dep-cost
15715 Minimal distance (in CPU cycles) between store and load targeting same
15716 memory locations.
15718 @item selsched-max-lookahead
15719 The maximum size of the lookahead window of selective scheduling.  It is a
15720 depth of search for available instructions.
15722 @item selsched-max-sched-times
15723 The maximum number of times that an instruction is scheduled during
15724 selective scheduling.  This is the limit on the number of iterations
15725 through which the instruction may be pipelined.
15727 @item selsched-insns-to-rename
15728 The maximum number of best instructions in the ready list that are considered
15729 for renaming in the selective scheduler.
15731 @item sms-min-sc
15732 The minimum value of stage count that swing modulo scheduler
15733 generates.
15735 @item max-last-value-rtl
15736 The maximum size measured as number of RTLs that can be recorded in an expression
15737 in combiner for a pseudo register as last known value of that register.
15739 @item max-combine-insns
15740 The maximum number of instructions the RTL combiner tries to combine.
15742 @item integer-share-limit
15743 Small integer constants can use a shared data structure, reducing the
15744 compiler's memory usage and increasing its speed.  This sets the maximum
15745 value of a shared integer constant.
15747 @item ssp-buffer-size
15748 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15749 protection when @option{-fstack-protector} is used.
15751 @item min-size-for-stack-sharing
15752 The minimum size of variables taking part in stack slot sharing when not
15753 optimizing.
15755 @item max-jump-thread-duplication-stmts
15756 Maximum number of statements allowed in a block that needs to be
15757 duplicated when threading jumps.
15759 @item max-jump-thread-paths
15760 The maximum number of paths to consider when searching for jump threading
15761 opportunities.  When arriving at a block, incoming edges are only considered
15762 if the number of paths to be searched so far multiplied by the number of
15763 incoming edges does not exhaust the specified maximum number of paths to
15764 consider.
15766 @item max-fields-for-field-sensitive
15767 Maximum number of fields in a structure treated in
15768 a field sensitive manner during pointer analysis.
15770 @item prefetch-latency
15771 Estimate on average number of instructions that are executed before
15772 prefetch finishes.  The distance prefetched ahead is proportional
15773 to this constant.  Increasing this number may also lead to less
15774 streams being prefetched (see @option{simultaneous-prefetches}).
15776 @item simultaneous-prefetches
15777 Maximum number of prefetches that can run at the same time.
15779 @item l1-cache-line-size
15780 The size of cache line in L1 data cache, in bytes.
15782 @item l1-cache-size
15783 The size of L1 data cache, in kilobytes.
15785 @item l2-cache-size
15786 The size of L2 data cache, in kilobytes.
15788 @item prefetch-dynamic-strides
15789 Whether the loop array prefetch pass should issue software prefetch hints
15790 for strides that are non-constant.  In some cases this may be
15791 beneficial, though the fact the stride is non-constant may make it
15792 hard to predict when there is clear benefit to issuing these hints.
15794 Set to 1 if the prefetch hints should be issued for non-constant
15795 strides.  Set to 0 if prefetch hints should be issued only for strides that
15796 are known to be constant and below @option{prefetch-minimum-stride}.
15798 @item prefetch-minimum-stride
15799 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15800 the stride is less than this threshold, prefetch hints will not be issued.
15802 This setting is useful for processors that have hardware prefetchers, in
15803 which case there may be conflicts between the hardware prefetchers and
15804 the software prefetchers.  If the hardware prefetchers have a maximum
15805 stride they can handle, it should be used here to improve the use of
15806 software prefetchers.
15808 A value of -1 means we don't have a threshold and therefore
15809 prefetch hints can be issued for any constant stride.
15811 This setting is only useful for strides that are known and constant.
15813 @item destructive-interference-size
15814 @item constructive-interference-size
15815 The values for the C++17 variables
15816 @code{std::hardware_destructive_interference_size} and
15817 @code{std::hardware_constructive_interference_size}.  The destructive
15818 interference size is the minimum recommended offset between two
15819 independent concurrently-accessed objects; the constructive
15820 interference size is the maximum recommended size of contiguous memory
15821 accessed together.  Typically both will be the size of an L1 cache
15822 line for the target, in bytes.  For a generic target covering a range of L1
15823 cache line sizes, typically the constructive interference size will be
15824 the small end of the range and the destructive size will be the large
15825 end.
15827 The destructive interference size is intended to be used for layout,
15828 and thus has ABI impact.  The default value is not expected to be
15829 stable, and on some targets varies with @option{-mtune}, so use of
15830 this variable in a context where ABI stability is important, such as
15831 the public interface of a library, is strongly discouraged; if it is
15832 used in that context, users can stabilize the value using this
15833 option.
15835 The constructive interference size is less sensitive, as it is
15836 typically only used in a @samp{static_assert} to make sure that a type
15837 fits within a cache line.
15839 See also @option{-Winterference-size}.
15841 @item loop-interchange-max-num-stmts
15842 The maximum number of stmts in a loop to be interchanged.
15844 @item loop-interchange-stride-ratio
15845 The minimum ratio between stride of two loops for interchange to be profitable.
15847 @item min-insn-to-prefetch-ratio
15848 The minimum ratio between the number of instructions and the
15849 number of prefetches to enable prefetching in a loop.
15851 @item prefetch-min-insn-to-mem-ratio
15852 The minimum ratio between the number of instructions and the
15853 number of memory references to enable prefetching in a loop.
15855 @item use-canonical-types
15856 Whether the compiler should use the ``canonical'' type system.
15857 Should always be 1, which uses a more efficient internal
15858 mechanism for comparing types in C++ and Objective-C++.  However, if
15859 bugs in the canonical type system are causing compilation failures,
15860 set this value to 0 to disable canonical types.
15862 @item switch-conversion-max-branch-ratio
15863 Switch initialization conversion refuses to create arrays that are
15864 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15865 branches in the switch.
15867 @item max-partial-antic-length
15868 Maximum length of the partial antic set computed during the tree
15869 partial redundancy elimination optimization (@option{-ftree-pre}) when
15870 optimizing at @option{-O3} and above.  For some sorts of source code
15871 the enhanced partial redundancy elimination optimization can run away,
15872 consuming all of the memory available on the host machine.  This
15873 parameter sets a limit on the length of the sets that are computed,
15874 which prevents the runaway behavior.  Setting a value of 0 for
15875 this parameter allows an unlimited set length.
15877 @item rpo-vn-max-loop-depth
15878 Maximum loop depth that is value-numbered optimistically.
15879 When the limit hits the innermost
15880 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15881 loop nest are value-numbered optimistically and the remaining ones not.
15883 @item sccvn-max-alias-queries-per-access
15884 Maximum number of alias-oracle queries we perform when looking for
15885 redundancies for loads and stores.  If this limit is hit the search
15886 is aborted and the load or store is not considered redundant.  The
15887 number of queries is algorithmically limited to the number of
15888 stores on all paths from the load to the function entry.
15890 @item ira-max-loops-num
15891 IRA uses regional register allocation by default.  If a function
15892 contains more loops than the number given by this parameter, only at most
15893 the given number of the most frequently-executed loops form regions
15894 for regional register allocation.
15896 @item ira-max-conflict-table-size 
15897 Although IRA uses a sophisticated algorithm to compress the conflict
15898 table, the table can still require excessive amounts of memory for
15899 huge functions.  If the conflict table for a function could be more
15900 than the size in MB given by this parameter, the register allocator
15901 instead uses a faster, simpler, and lower-quality
15902 algorithm that does not require building a pseudo-register conflict table.  
15904 @item ira-loop-reserved-regs
15905 IRA can be used to evaluate more accurate register pressure in loops
15906 for decisions to move loop invariants (see @option{-O3}).  The number
15907 of available registers reserved for some other purposes is given
15908 by this parameter.  Default of the parameter
15909 is the best found from numerous experiments.
15911 @item ira-consider-dup-in-all-alts
15912 Make IRA to consider matching constraint (duplicated operand number)
15913 heavily in all available alternatives for preferred register class.
15914 If it is set as zero, it means IRA only respects the matching
15915 constraint when it's in the only available alternative with an
15916 appropriate register class.  Otherwise, it means IRA will check all
15917 available alternatives for preferred register class even if it has
15918 found some choice with an appropriate register class and respect the
15919 found qualified matching constraint.
15921 @item ira-simple-lra-insn-threshold
15922 Approximate function insn number in 1K units triggering simple local RA.
15924 @item lra-inheritance-ebb-probability-cutoff
15925 LRA tries to reuse values reloaded in registers in subsequent insns.
15926 This optimization is called inheritance.  EBB is used as a region to
15927 do this optimization.  The parameter defines a minimal fall-through
15928 edge probability in percentage used to add BB to inheritance EBB in
15929 LRA.  The default value was chosen
15930 from numerous runs of SPEC2000 on x86-64.
15932 @item loop-invariant-max-bbs-in-loop
15933 Loop invariant motion can be very expensive, both in compilation time and
15934 in amount of needed compile-time memory, with very large loops.  Loops
15935 with more basic blocks than this parameter won't have loop invariant
15936 motion optimization performed on them.
15938 @item loop-max-datarefs-for-datadeps
15939 Building data dependencies is expensive for very large loops.  This
15940 parameter limits the number of data references in loops that are
15941 considered for data dependence analysis.  These large loops are no
15942 handled by the optimizations using loop data dependencies.
15944 @item max-vartrack-size
15945 Sets a maximum number of hash table slots to use during variable
15946 tracking dataflow analysis of any function.  If this limit is exceeded
15947 with variable tracking at assignments enabled, analysis for that
15948 function is retried without it, after removing all debug insns from
15949 the function.  If the limit is exceeded even without debug insns, var
15950 tracking analysis is completely disabled for the function.  Setting
15951 the parameter to zero makes it unlimited.
15953 @item max-vartrack-expr-depth
15954 Sets a maximum number of recursion levels when attempting to map
15955 variable names or debug temporaries to value expressions.  This trades
15956 compilation time for more complete debug information.  If this is set too
15957 low, value expressions that are available and could be represented in
15958 debug information may end up not being used; setting this higher may
15959 enable the compiler to find more complex debug expressions, but compile
15960 time and memory use may grow.
15962 @item max-debug-marker-count
15963 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15964 markers) to avoid complexity explosion at inlining or expanding to RTL.
15965 If a function has more such gimple stmts than the set limit, such stmts
15966 will be dropped from the inlined copy of a function, and from its RTL
15967 expansion.
15969 @item min-nondebug-insn-uid
15970 Use uids starting at this parameter for nondebug insns.  The range below
15971 the parameter is reserved exclusively for debug insns created by
15972 @option{-fvar-tracking-assignments}, but debug insns may get
15973 (non-overlapping) uids above it if the reserved range is exhausted.
15975 @item ipa-sra-deref-prob-threshold
15976 IPA-SRA replaces a pointer which is known not be NULL with one or more
15977 new parameters only when the probability (in percent, relative to
15978 function entry) of it being dereferenced is higher than this parameter.
15980 @item ipa-sra-ptr-growth-factor
15981 IPA-SRA replaces a pointer to an aggregate with one or more new
15982 parameters only when their cumulative size is less or equal to
15983 @option{ipa-sra-ptr-growth-factor} times the size of the original
15984 pointer parameter.
15986 @item ipa-sra-ptrwrap-growth-factor
15987 Additional maximum allowed growth of total size of new parameters
15988 that ipa-sra replaces a pointer to an aggregate with,
15989 if it points to a local variable that the caller only writes to and
15990 passes it as an argument to other functions.
15992 @item ipa-sra-max-replacements
15993 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15994 consequence, it is also the maximum number of replacements of a formal
15995 parameter.
15997 @item sra-max-scalarization-size-Ospeed
15998 @itemx sra-max-scalarization-size-Osize
15999 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
16000 replace scalar parts of aggregates with uses of independent scalar
16001 variables.  These parameters control the maximum size, in storage units,
16002 of aggregate which is considered for replacement when compiling for
16003 speed
16004 (@option{sra-max-scalarization-size-Ospeed}) or size
16005 (@option{sra-max-scalarization-size-Osize}) respectively.
16007 @item sra-max-propagations
16008 The maximum number of artificial accesses that Scalar Replacement of
16009 Aggregates (SRA) will track, per one local variable, in order to
16010 facilitate copy propagation.
16012 @item tm-max-aggregate-size
16013 When making copies of thread-local variables in a transaction, this
16014 parameter specifies the size in bytes after which variables are
16015 saved with the logging functions as opposed to save/restore code
16016 sequence pairs.  This option only applies when using
16017 @option{-fgnu-tm}.
16019 @item graphite-max-nb-scop-params
16020 To avoid exponential effects in the Graphite loop transforms, the
16021 number of parameters in a Static Control Part (SCoP) is bounded.
16022 A value of zero can be used to lift
16023 the bound.  A variable whose value is unknown at compilation time and
16024 defined outside a SCoP is a parameter of the SCoP.
16026 @item hardcfr-max-blocks
16027 Disable @option{-fharden-control-flow-redundancy} for functions with a
16028 larger number of blocks than the specified value.  Zero removes any
16029 limit.
16031 @item hardcfr-max-inline-blocks
16032 Force @option{-fharden-control-flow-redundancy} to use out-of-line
16033 checking for functions with a larger number of basic blocks than the
16034 specified value.
16036 @item loop-block-tile-size
16037 Loop blocking or strip mining transforms, enabled with
16038 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
16039 loop in the loop nest by a given number of iterations.  The strip
16040 length can be changed using the @option{loop-block-tile-size}
16041 parameter.
16043 @item ipa-jump-function-lookups
16044 Specifies number of statements visited during jump function offset discovery.
16046 @item ipa-cp-value-list-size
16047 IPA-CP attempts to track all possible values and types passed to a function's
16048 parameter in order to propagate them and perform devirtualization.
16049 @option{ipa-cp-value-list-size} is the maximum number of values and types it
16050 stores per one formal parameter of a function.
16052 @item ipa-cp-eval-threshold
16053 IPA-CP calculates its own score of cloning profitability heuristics
16054 and performs those cloning opportunities with scores that exceed
16055 @option{ipa-cp-eval-threshold}.
16057 @item ipa-cp-max-recursive-depth
16058 Maximum depth of recursive cloning for self-recursive function.
16060 @item ipa-cp-min-recursive-probability
16061 Recursive cloning only when the probability of call being executed exceeds
16062 the parameter.
16064 @item ipa-cp-profile-count-base
16065 When using @option{-fprofile-use} option, IPA-CP will consider the measured
16066 execution count of a call graph edge at this percentage position in their
16067 histogram as the basis for its heuristics calculation.
16069 @item ipa-cp-recursive-freq-factor
16070 The number of times interprocedural copy propagation expects recursive
16071 functions to call themselves.
16073 @item ipa-cp-recursion-penalty
16074 Percentage penalty the recursive functions will receive when they
16075 are evaluated for cloning.
16077 @item ipa-cp-single-call-penalty
16078 Percentage penalty functions containing a single call to another
16079 function will receive when they are evaluated for cloning.
16081 @item ipa-max-agg-items
16082 IPA-CP is also capable to propagate a number of scalar values passed
16083 in an aggregate. @option{ipa-max-agg-items} controls the maximum
16084 number of such values per one parameter.
16086 @item ipa-cp-loop-hint-bonus
16087 When IPA-CP determines that a cloning candidate would make the number
16088 of iterations of a loop known, it adds a bonus of
16089 @option{ipa-cp-loop-hint-bonus} to the profitability score of
16090 the candidate.
16092 @item ipa-max-loop-predicates
16093 The maximum number of different predicates IPA will use to describe when
16094 loops in a function have known properties.
16096 @item ipa-max-aa-steps
16097 During its analysis of function bodies, IPA-CP employs alias analysis
16098 in order to track values pointed to by function parameters.  In order
16099 not spend too much time analyzing huge functions, it gives up and
16100 consider all memory clobbered after examining
16101 @option{ipa-max-aa-steps} statements modifying memory.
16103 @item ipa-max-switch-predicate-bounds
16104 Maximal number of boundary endpoints of case ranges of switch statement.
16105 For switch exceeding this limit, IPA-CP will not construct cloning cost
16106 predicate, which is used to estimate cloning benefit, for default case
16107 of the switch statement.
16109 @item ipa-max-param-expr-ops
16110 IPA-CP will analyze conditional statement that references some function
16111 parameter to estimate benefit for cloning upon certain constant value.
16112 But if number of operations in a parameter expression exceeds
16113 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
16114 one, and is not handled by IPA analysis.
16116 @item lto-partitions
16117 Specify desired number of partitions produced during WHOPR compilation.
16118 The number of partitions should exceed the number of CPUs used for compilation.
16120 @item lto-min-partition
16121 Size of minimal partition for WHOPR (in estimated instructions).
16122 This prevents expenses of splitting very small programs into too many
16123 partitions.
16125 @item lto-max-partition
16126 Size of max partition for WHOPR (in estimated instructions).
16127 to provide an upper bound for individual size of partition.
16128 Meant to be used only with balanced partitioning.
16130 @item lto-max-streaming-parallelism
16131 Maximal number of parallel processes used for LTO streaming.
16133 @item cxx-max-namespaces-for-diagnostic-help
16134 The maximum number of namespaces to consult for suggestions when C++
16135 name lookup fails for an identifier.
16137 @item sink-frequency-threshold
16138 The maximum relative execution frequency (in percents) of the target block
16139 relative to a statement's original block to allow statement sinking of a
16140 statement.  Larger numbers result in more aggressive statement sinking.
16141 A small positive adjustment is applied for
16142 statements with memory operands as those are even more profitable so sink.
16144 @item max-stores-to-sink
16145 The maximum number of conditional store pairs that can be sunk.  Set to 0
16146 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16147 (@option{-ftree-loop-if-convert}) is disabled.
16149 @item case-values-threshold
16150 The smallest number of different values for which it is best to use a
16151 jump-table instead of a tree of conditional branches.  If the value is
16152 0, use the default for the machine.
16154 @item jump-table-max-growth-ratio-for-size
16155 The maximum code size growth ratio when expanding
16156 into a jump table (in percent).  The parameter is used when
16157 optimizing for size.
16159 @item jump-table-max-growth-ratio-for-speed
16160 The maximum code size growth ratio when expanding
16161 into a jump table (in percent).  The parameter is used when
16162 optimizing for speed.
16164 @item tree-reassoc-width
16165 Set the maximum number of instructions executed in parallel in
16166 reassociated tree. This parameter overrides target dependent
16167 heuristics used by default if has non zero value.
16169 @item sched-pressure-algorithm
16170 Choose between the two available implementations of
16171 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16172 and is the more likely to prevent instructions from being reordered.
16173 Algorithm 2 was designed to be a compromise between the relatively
16174 conservative approach taken by algorithm 1 and the rather aggressive
16175 approach taken by the default scheduler.  It relies more heavily on
16176 having a regular register file and accurate register pressure classes.
16177 See @file{haifa-sched.cc} in the GCC sources for more details.
16179 The default choice depends on the target.
16181 @item max-slsr-cand-scan
16182 Set the maximum number of existing candidates that are considered when
16183 seeking a basis for a new straight-line strength reduction candidate.
16185 @item asan-globals
16186 Enable buffer overflow detection for global objects.  This kind
16187 of protection is enabled by default if you are using
16188 @option{-fsanitize=address} option.
16189 To disable global objects protection use @option{--param asan-globals=0}.
16191 @item asan-stack
16192 Enable buffer overflow detection for stack objects.  This kind of
16193 protection is enabled by default when using @option{-fsanitize=address}.
16194 To disable stack protection use @option{--param asan-stack=0} option.
16196 @item asan-instrument-reads
16197 Enable buffer overflow detection for memory reads.  This kind of
16198 protection is enabled by default when using @option{-fsanitize=address}.
16199 To disable memory reads protection use
16200 @option{--param asan-instrument-reads=0}.
16202 @item asan-instrument-writes
16203 Enable buffer overflow detection for memory writes.  This kind of
16204 protection is enabled by default when using @option{-fsanitize=address}.
16205 To disable memory writes protection use
16206 @option{--param asan-instrument-writes=0} option.
16208 @item asan-memintrin
16209 Enable detection for built-in functions.  This kind of protection
16210 is enabled by default when using @option{-fsanitize=address}.
16211 To disable built-in functions protection use
16212 @option{--param asan-memintrin=0}.
16214 @item asan-use-after-return
16215 Enable detection of use-after-return.  This kind of protection
16216 is enabled by default when using the @option{-fsanitize=address} option.
16217 To disable it use @option{--param asan-use-after-return=0}.
16219 Note: By default the check is disabled at run time.  To enable it,
16220 add @code{detect_stack_use_after_return=1} to the environment variable
16221 @env{ASAN_OPTIONS}.
16223 @item asan-instrumentation-with-call-threshold
16224 If number of memory accesses in function being instrumented
16225 is greater or equal to this number, use callbacks instead of inline checks.
16226 E.g. to disable inline code use
16227 @option{--param asan-instrumentation-with-call-threshold=0}.
16229 @item asan-kernel-mem-intrinsic-prefix
16230 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16231 with @samp{__asan_} or @samp{__hwasan_}
16232 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16233 respectively.
16235 @item hwasan-instrument-stack
16236 Enable hwasan instrumentation of statically sized stack-allocated variables.
16237 This kind of instrumentation is enabled by default when using
16238 @option{-fsanitize=hwaddress} and disabled by default when using
16239 @option{-fsanitize=kernel-hwaddress}.
16240 To disable stack instrumentation use
16241 @option{--param hwasan-instrument-stack=0}, and to enable it use
16242 @option{--param hwasan-instrument-stack=1}.
16244 @item hwasan-random-frame-tag
16245 When using stack instrumentation, decide tags for stack variables using a
16246 deterministic sequence beginning at a random tag for each frame.  With this
16247 parameter unset tags are chosen using the same sequence but beginning from 1.
16248 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16249 for @option{-fsanitize=kernel-hwaddress}.
16250 To disable it use @option{--param hwasan-random-frame-tag=0}.
16252 @item hwasan-instrument-allocas
16253 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16254 This kind of instrumentation is enabled by default when using
16255 @option{-fsanitize=hwaddress} and disabled by default when using
16256 @option{-fsanitize=kernel-hwaddress}.
16257 To disable instrumentation of such variables use
16258 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16259 @option{--param hwasan-instrument-allocas=1}.
16261 @item hwasan-instrument-reads
16262 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16263 default for both @option{-fsanitize=hwaddress} and
16264 @option{-fsanitize=kernel-hwaddress}.
16265 To disable checking memory reads use
16266 @option{--param hwasan-instrument-reads=0}.
16268 @item hwasan-instrument-writes
16269 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16270 default for both @option{-fsanitize=hwaddress} and
16271 @option{-fsanitize=kernel-hwaddress}.
16272 To disable checking memory writes use
16273 @option{--param hwasan-instrument-writes=0}.
16275 @item hwasan-instrument-mem-intrinsics
16276 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16277 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16278 and @option{-fsanitize=kernel-hwaddress}.
16279 To disable instrumentation of builtin functions use
16280 @option{--param hwasan-instrument-mem-intrinsics=0}.
16282 @item use-after-scope-direct-emission-threshold
16283 If the size of a local variable in bytes is smaller or equal to this
16284 number, directly poison (or unpoison) shadow memory instead of using
16285 run-time callbacks.
16287 @item tsan-distinguish-volatile
16288 Emit special instrumentation for accesses to volatiles.
16290 @item tsan-instrument-func-entry-exit
16291 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16293 @item max-fsm-thread-path-insns
16294 Maximum number of instructions to copy when duplicating blocks on a
16295 finite state automaton jump thread path.
16297 @item threader-debug
16298 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16300 @item parloops-chunk-size
16301 Chunk size of omp schedule for loops parallelized by parloops.
16303 @item parloops-schedule
16304 Schedule type of omp schedule for loops parallelized by parloops (static,
16305 dynamic, guided, auto, runtime).
16307 @item parloops-min-per-thread
16308 The minimum number of iterations per thread of an innermost parallelized
16309 loop for which the parallelized variant is preferred over the single threaded
16310 one.  Note that for a parallelized loop nest the
16311 minimum number of iterations of the outermost loop per thread is two.
16313 @item max-ssa-name-query-depth
16314 Maximum depth of recursion when querying properties of SSA names in things
16315 like fold routines.  One level of recursion corresponds to following a
16316 use-def chain.
16318 @item max-speculative-devirt-maydefs
16319 The maximum number of may-defs we analyze when looking for a must-def
16320 specifying the dynamic type of an object that invokes a virtual call
16321 we may be able to devirtualize speculatively.
16323 @item ranger-debug
16324 Specifies the type of debug output to be issued for ranges.
16326 @item unroll-jam-min-percent
16327 The minimum percentage of memory references that must be optimized
16328 away for the unroll-and-jam transformation to be considered profitable.
16330 @item unroll-jam-max-unroll
16331 The maximum number of times the outer loop should be unrolled by
16332 the unroll-and-jam transformation.
16334 @item max-rtl-if-conversion-unpredictable-cost
16335 Maximum permissible cost for the sequence that would be generated
16336 by the RTL if-conversion pass for a branch that is considered unpredictable.
16338 @item max-variable-expansions-in-unroller
16339 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16340 of times that an individual variable will be expanded during loop unrolling.
16342 @item partial-inlining-entry-probability
16343 Maximum probability of the entry BB of split region
16344 (in percent relative to entry BB of the function)
16345 to make partial inlining happen.
16347 @item max-tracked-strlens
16348 Maximum number of strings for which strlen optimization pass will
16349 track string lengths.
16351 @item gcse-after-reload-partial-fraction
16352 The threshold ratio for performing partial redundancy
16353 elimination after reload.
16355 @item gcse-after-reload-critical-fraction
16356 The threshold ratio of critical edges execution count that
16357 permit performing redundancy elimination after reload.
16359 @item max-loop-header-insns
16360 The maximum number of insns in loop header duplicated
16361 by the copy loop headers pass.
16363 @item vect-epilogues-nomask
16364 Enable loop epilogue vectorization using smaller vector size.
16366 @item vect-partial-vector-usage
16367 Controls when the loop vectorizer considers using partial vector loads
16368 and stores as an alternative to falling back to scalar code.  0 stops
16369 the vectorizer from ever using partial vector loads and stores.  1 allows
16370 partial vector loads and stores if vectorization removes the need for the
16371 code to iterate.  2 allows partial vector loads and stores in all loops.
16372 The parameter only has an effect on targets that support partial
16373 vector loads and stores.
16375 @item vect-inner-loop-cost-factor
16376 The maximum factor which the loop vectorizer applies to the cost of statements
16377 in an inner loop relative to the loop being vectorized.  The factor applied
16378 is the maximum of the estimated number of iterations of the inner loop and
16379 this parameter.  The default value of this parameter is 50.
16381 @item vect-induction-float
16382 Enable loop vectorization of floating point inductions.
16384 @item vrp-sparse-threshold
16385 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16387 @item vrp-switch-limit
16388 Maximum number of outgoing edges in a switch before VRP will not process it.
16390 @item vrp-vector-threshold
16391 Maximum number of basic blocks for VRP to use a basic cache vector.
16393 @item avoid-fma-max-bits
16394 Maximum number of bits for which we avoid creating FMAs.
16396 @item sms-loop-average-count-threshold
16397 A threshold on the average loop count considered by the swing modulo scheduler.
16399 @item sms-dfa-history
16400 The number of cycles the swing modulo scheduler considers when checking
16401 conflicts using DFA.
16403 @item graphite-allow-codegen-errors
16404 Whether codegen errors should be ICEs when @option{-fchecking}.
16406 @item sms-max-ii-factor
16407 A factor for tuning the upper bound that swing modulo scheduler
16408 uses for scheduling a loop.
16410 @item lra-max-considered-reload-pseudos
16411 The max number of reload pseudos which are considered during
16412 spilling a non-reload pseudo.
16414 @item max-pow-sqrt-depth
16415 Maximum depth of sqrt chains to use when synthesizing exponentiation
16416 by a real constant.
16418 @item max-dse-active-local-stores
16419 Maximum number of active local stores in RTL dead store elimination.
16421 @item asan-instrument-allocas
16422 Enable asan allocas/VLAs protection.
16424 @item max-iterations-computation-cost
16425 Bound on the cost of an expression to compute the number of iterations.
16427 @item max-isl-operations
16428 Maximum number of isl operations, 0 means unlimited.
16430 @item graphite-max-arrays-per-scop
16431 Maximum number of arrays per scop.
16433 @item max-vartrack-reverse-op-size
16434 Max. size of loc list for which reverse ops should be added.
16436 @item fsm-scale-path-stmts
16437 Scale factor to apply to the number of statements in a threading path
16438 crossing a loop backedge when comparing to
16439 @option{--param=max-jump-thread-duplication-stmts}.
16441 @item uninit-control-dep-attempts
16442 Maximum number of nested calls to search for control dependencies
16443 during uninitialized variable analysis.
16445 @item uninit-max-chain-len
16446 Maximum number of predicates anded for each predicate ored in the normalized
16447 predicate chain.
16449 @item uninit-max-num-chains
16450 Maximum number of predicates ored in the normalized predicate chain.
16452 @item sched-autopref-queue-depth
16453 Hardware autoprefetcher scheduler model control flag.
16454 Number of lookahead cycles the model looks into; at '
16455 ' only enable instruction sorting heuristic.
16457 @item loop-versioning-max-inner-insns
16458 The maximum number of instructions that an inner loop can have
16459 before the loop versioning pass considers it too big to copy.
16461 @item loop-versioning-max-outer-insns
16462 The maximum number of instructions that an outer loop can have
16463 before the loop versioning pass considers it too big to copy,
16464 discounting any instructions in inner loops that directly benefit
16465 from versioning.
16467 @item ssa-name-def-chain-limit
16468 The maximum number of SSA_NAME assignments to follow in determining
16469 a property of a variable such as its value.  This limits the number
16470 of iterations or recursive calls GCC performs when optimizing certain
16471 statements or when determining their validity prior to issuing
16472 diagnostics.
16474 @item store-merging-max-size
16475 Maximum size of a single store merging region in bytes.
16477 @item hash-table-verification-limit
16478 The number of elements for which hash table verification is done
16479 for each searched element.
16481 @item max-find-base-term-values
16482 Maximum number of VALUEs handled during a single find_base_term call.
16484 @item analyzer-max-enodes-per-program-point
16485 The maximum number of exploded nodes per program point within
16486 the analyzer, before terminating analysis of that point.
16488 @item analyzer-max-constraints
16489 The maximum number of constraints per state.
16491 @item analyzer-min-snodes-for-call-summary
16492 The minimum number of supernodes within a function for the
16493 analyzer to consider summarizing its effects at call sites.
16495 @item analyzer-max-enodes-for-full-dump
16496 The maximum depth of exploded nodes that should appear in a dot dump
16497 before switching to a less verbose format.
16499 @item analyzer-max-recursion-depth
16500 The maximum number of times a callsite can appear in a call stack
16501 within the analyzer, before terminating analysis of a call that would
16502 recurse deeper.
16504 @item analyzer-max-svalue-depth
16505 The maximum depth of a symbolic value, before approximating
16506 the value as unknown.
16508 @item analyzer-max-infeasible-edges
16509 The maximum number of infeasible edges to reject before declaring
16510 a diagnostic as infeasible.
16512 @item gimple-fe-computed-hot-bb-threshold
16513 The number of executions of a basic block which is considered hot.
16514 The parameter is used only in GIMPLE FE.
16516 @item analyzer-bb-explosion-factor
16517 The maximum number of 'after supernode' exploded nodes within the analyzer
16518 per supernode, before terminating analysis.
16520 @item analyzer-text-art-string-ellipsis-threshold
16521 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16523 @item analyzer-text-art-ideal-canvas-width
16524 The ideal width in characters of text art diagrams generated by the analyzer.
16526 @item analyzer-text-art-string-ellipsis-head-len
16527 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16529 @item analyzer-text-art-string-ellipsis-tail-len
16530 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16532 @item ranger-logical-depth
16533 Maximum depth of logical expression evaluation ranger will look through
16534 when evaluating outgoing edge ranges.
16536 @item ranger-recompute-depth
16537 Maximum depth of instruction chains to consider for recomputation
16538 in the outgoing range calculator.
16540 @item relation-block-limit
16541 Maximum number of relations the oracle will register in a basic block.
16543 @item min-pagesize
16544 Minimum page size for warning purposes.
16546 @item openacc-kernels
16547 Specify mode of OpenACC `kernels' constructs handling.
16548 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16549 constructs are decomposed into parts, a sequence of compute
16550 constructs, each then handled individually.
16551 This is work in progress.
16552 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16553 constructs are handled by the @samp{parloops} pass, en bloc.
16554 This is the current default.
16556 @item openacc-privatization
16557 Control whether the @option{-fopt-info-omp-note} and applicable
16558 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16559 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16560 This is the current default.
16561 With @option{--param=openacc-privatization=noisy}, do diagnose.
16563 @end table
16565 The following choices of @var{name} are available on AArch64 targets:
16567 @table @gcctabopt
16568 @item aarch64-sve-compare-costs
16569 When vectorizing for SVE, consider using ``unpacked'' vectors for
16570 smaller elements and use the cost model to pick the cheapest approach.
16571 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16573 Using unpacked vectors includes storing smaller elements in larger
16574 containers and accessing elements with extending loads and truncating
16575 stores.
16577 @item aarch64-float-recp-precision
16578 The number of Newton iterations for calculating the reciprocal for float type.
16579 The precision of division is proportional to this param when division
16580 approximation is enabled.  The default value is 1.
16582 @item aarch64-double-recp-precision
16583 The number of Newton iterations for calculating the reciprocal for double type.
16584 The precision of division is propotional to this param when division
16585 approximation is enabled.  The default value is 2.
16587 @item aarch64-autovec-preference
16588 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16589 0 to 4, inclusive.
16590 @table @samp
16591 @item 0
16592 Use the default heuristics.
16593 @item 1
16594 Use only Advanced SIMD for auto-vectorization.
16595 @item 2
16596 Use only SVE for auto-vectorization.
16597 @item 3
16598 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16599 deemed equal.
16600 @item 4
16601 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16602 @end table
16603 The default value is 0.
16605 @item aarch64-ldp-policy
16606 Fine-grained policy for load pairs.
16607 With @option{--param=aarch64-ldp-policy=default}, use the policy of the
16608 tuning structure.  This is the current default.
16609 With @option{--param=aarch64-ldp-policy=always}, emit ldp regardless
16610 of alignment.
16611 With @option{--param=aarch64-ldp-policy=never}, do not emit ldp.
16612 With @option{--param=aarch64-ldp-policy=aligned}, emit ldp only if the
16613 source pointer is aligned to at least double the alignment of the type.
16615 @item aarch64-stp-policy
16616 Fine-grained policy for store pairs.
16617 With @option{--param=aarch64-stp-policy=default}, use the policy of the
16618 tuning structure.  This is the current default.
16619 With @option{--param=aarch64-stp-policy=always}, emit stp regardless
16620 of alignment.
16621 With @option{--param=aarch64-stp-policy=never}, do not emit stp.
16622 With @option{--param=aarch64-stp-policy=aligned}, emit stp only if the
16623 source pointer is aligned to at least double the alignment of the type.
16625 @item aarch64-loop-vect-issue-rate-niters
16626 The tuning for some AArch64 CPUs tries to take both latencies and issue
16627 rates into account when deciding whether a loop should be vectorized
16628 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16629 If this parameter is set to @var{n}, GCC will not use this heuristic
16630 for loops that are known to execute in fewer than @var{n} Advanced
16631 SIMD iterations.
16633 @item aarch64-vect-unroll-limit
16634 The vectorizer will use available tuning information to determine whether it
16635 would be beneficial to unroll the main vectorized loop and by how much.  This
16636 parameter set's the upper bound of how much the vectorizer will unroll the main
16637 loop.  The default value is four.
16639 @end table
16641 The following choices of @var{name} are available on i386 and x86_64 targets:
16643 @table @gcctabopt
16644 @item x86-stlf-window-ninsns
16645 Instructions number above which STFL stall penalty can be compensated.
16647 @item x86-stv-max-visits
16648 The maximum number of use and def visits when discovering a STV chain before
16649 the discovery is aborted.
16651 @end table
16653 @end table
16655 @node Instrumentation Options
16656 @section Program Instrumentation Options
16657 @cindex instrumentation options
16658 @cindex program instrumentation options
16659 @cindex run-time error checking options
16660 @cindex profiling options
16661 @cindex options, program instrumentation
16662 @cindex options, run-time error checking
16663 @cindex options, profiling
16665 GCC supports a number of command-line options that control adding
16666 run-time instrumentation to the code it normally generates.  
16667 For example, one purpose of instrumentation is collect profiling
16668 statistics for use in finding program hot spots, code coverage
16669 analysis, or profile-guided optimizations.
16670 Another class of program instrumentation is adding run-time checking 
16671 to detect programming errors like invalid pointer
16672 dereferences or out-of-bounds array accesses, as well as deliberately
16673 hostile attacks such as stack smashing or C++ vtable hijacking.
16674 There is also a general hook which can be used to implement other
16675 forms of tracing or function-level instrumentation for debug or
16676 program analysis purposes.
16678 @table @gcctabopt
16679 @cindex @command{prof}
16680 @cindex @command{gprof}
16681 @opindex p
16682 @opindex pg
16683 @item -p
16684 @itemx -pg
16685 Generate extra code to write profile information suitable for the
16686 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16687 (for @option{-pg}).  You must use this option when compiling
16688 the source files you want data about, and you must also use it when
16689 linking.
16691 You can use the function attribute @code{no_instrument_function} to
16692 suppress profiling of individual functions when compiling with these options.
16693 @xref{Common Function Attributes}.
16695 @opindex fprofile-arcs
16696 @item -fprofile-arcs
16697 Add code so that program flow @dfn{arcs} are instrumented.  During
16698 execution the program records how many times each branch and call is
16699 executed and how many times it is taken or returns.  On targets that support
16700 constructors with priority support, profiling properly handles constructors,
16701 destructors and C++ constructors (and destructors) of classes which are used
16702 as a type of a global variable.
16704 When the compiled
16705 program exits it saves this data to a file called
16706 @file{@var{auxname}.gcda} for each source file.  The data may be used for
16707 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16708 test coverage analysis (@option{-ftest-coverage}).  Each object file's
16709 @var{auxname} is generated from the name of the output file, if
16710 explicitly specified and it is not the final executable, otherwise it is
16711 the basename of the source file.  In both cases any suffix is removed
16712 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16713 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16715 Note that if a command line directly links source files, the corresponding
16716 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16717 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16718 @file{binary-b.gcda} files.
16720 @xref{Cross-profiling}.
16722 @cindex @command{gcov}
16723 @opindex coverage
16724 @item --coverage
16726 This option is used to compile and link code instrumented for coverage
16727 analysis.  The option is a synonym for @option{-fprofile-arcs}
16728 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16729 linking).  See the documentation for those options for more details.
16731 @itemize
16733 @item
16734 Compile the source files with @option{-fprofile-arcs} plus optimization
16735 and code generation options.  For test coverage analysis, use the
16736 additional @option{-ftest-coverage} option.  You do not need to profile
16737 every source file in a program.
16739 @item
16740 Compile the source files additionally with @option{-fprofile-abs-path}
16741 to create absolute path names in the @file{.gcno} files.  This allows
16742 @command{gcov} to find the correct sources in projects where compilations
16743 occur with different working directories.
16745 @item
16746 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16747 (the latter implies the former).
16749 @item
16750 Run the program on a representative workload to generate the arc profile
16751 information.  This may be repeated any number of times.  You can run
16752 concurrent instances of your program, and provided that the file system
16753 supports locking, the data files will be correctly updated.  Unless
16754 a strict ISO C dialect option is in effect, @code{fork} calls are
16755 detected and correctly handled without double counting.
16757 Moreover, an object file can be recompiled multiple times
16758 and the corresponding @file{.gcda} file merges as long as
16759 the source file and the compiler options are unchanged.
16761 @item
16762 For profile-directed optimizations, compile the source files again with
16763 the same optimization and code generation options plus
16764 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16765 Control Optimization}).
16767 @item
16768 For test coverage analysis, use @command{gcov} to produce human readable
16769 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
16770 @command{gcov} documentation for further information.
16772 @end itemize
16774 With @option{-fprofile-arcs}, for each function of your program GCC
16775 creates a program flow graph, then finds a spanning tree for the graph.
16776 Only arcs that are not on the spanning tree have to be instrumented: the
16777 compiler adds code to count the number of times that these arcs are
16778 executed.  When an arc is the only exit or only entrance to a block, the
16779 instrumentation code can be added to the block; otherwise, a new basic
16780 block must be created to hold the instrumentation code.
16782 @need 2000
16783 @opindex ftest-coverage
16784 @item -ftest-coverage
16785 Produce a notes file that the @command{gcov} code-coverage utility
16786 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16787 show program coverage.  Each source file's note file is called
16788 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
16789 above for a description of @var{auxname} and instructions on how to
16790 generate test coverage data.  Coverage data matches the source files
16791 more closely if you do not optimize.
16793 @opindex fprofile-abs-path
16794 @item -fprofile-abs-path
16795 Automatically convert relative source file names to absolute path names
16796 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
16797 sources in projects where compilations occur with different working
16798 directories.
16800 @opindex fprofile-dir
16801 @item -fprofile-dir=@var{path}
16803 Set the directory to search for the profile data files in to @var{path}.
16804 This option affects only the profile data generated by
16805 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16806 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16807 and its related options.  Both absolute and relative paths can be used.
16808 By default, GCC uses the current directory as @var{path}, thus the
16809 profile data file appears in the same directory as the object file.
16810 In order to prevent the file name clashing, if the object file name is
16811 not an absolute path, we mangle the absolute path of the
16812 @file{@var{sourcename}.gcda} file and use it as the file name of a
16813 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
16814 See similar option @option{-fprofile-note}.
16816 When an executable is run in a massive parallel environment, it is recommended
16817 to save profile to different folders.  That can be done with variables
16818 in @var{path} that are exported during run-time:
16820 @table @gcctabopt
16822 @item %p
16823 process ID.
16825 @item %q@{VAR@}
16826 value of environment variable @var{VAR}
16828 @end table
16830 @opindex fprofile-generate
16831 @item -fprofile-generate
16832 @itemx -fprofile-generate=@var{path}
16834 Enable options usually used for instrumenting application to produce
16835 profile useful for later recompilation with profile feedback based
16836 optimization.  You must use @option{-fprofile-generate} both when
16837 compiling and when linking your program.
16839 The following options are enabled:
16840 @option{-fprofile-arcs}, @option{-fprofile-values},
16841 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16843 If @var{path} is specified, GCC looks at the @var{path} to find
16844 the profile feedback data files. See @option{-fprofile-dir}.
16846 To optimize the program based on the collected profile information, use
16847 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16849 @opindex fprofile-info-section
16850 @item -fprofile-info-section
16851 @itemx -fprofile-info-section=@var{name}
16853 Register the profile information in the specified section instead of using a
16854 constructor/destructor.  The section name is @var{name} if it is specified,
16855 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16856 profile information generated by @option{-fprofile-arcs} is placed in the
16857 specified section for each translation unit.  This option disables the profile
16858 information registration through a constructor and it disables the profile
16859 information processing through a destructor.  This option is not intended to be
16860 used in hosted environments such as GNU/Linux.  It targets freestanding
16861 environments (for example embedded systems) with limited resources which do not
16862 support constructors/destructors or the C library file I/O.
16864 The linker could collect the input sections in a continuous memory block and
16865 define start and end symbols.  A GNU linker script example which defines a
16866 linker output section follows:
16868 @smallexample
16869   .gcov_info      :
16870   @{
16871     PROVIDE (__gcov_info_start = .);
16872     KEEP (*(.gcov_info))
16873     PROVIDE (__gcov_info_end = .);
16874   @}
16875 @end smallexample
16877 The program could dump the profiling information registered in this linker set
16878 for example like this:
16880 @smallexample
16881 #include <gcov.h>
16882 #include <stdio.h>
16883 #include <stdlib.h>
16885 extern const struct gcov_info *const __gcov_info_start[];
16886 extern const struct gcov_info *const __gcov_info_end[];
16888 static void
16889 dump (const void *d, unsigned n, void *arg)
16891   const unsigned char *c = d;
16893   for (unsigned i = 0; i < n; ++i)
16894     printf ("%02x", c[i]);
16897 static void
16898 filename (const char *f, void *arg)
16900   __gcov_filename_to_gcfn (f, dump, arg );
16903 static void *
16904 allocate (unsigned length, void *arg)
16906   return malloc (length);
16909 static void
16910 dump_gcov_info (void)
16912   const struct gcov_info *const *info = __gcov_info_start;
16913   const struct gcov_info *const *end = __gcov_info_end;
16915   /* Obfuscate variable to prevent compiler optimizations.  */
16916   __asm__ ("" : "+r" (info));
16918   while (info != end)
16919   @{
16920     void *arg = NULL;
16921     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16922     putchar ('\n');
16923     ++info;
16924   @}
16928 main (void)
16930   dump_gcov_info ();
16931   return 0;
16933 @end smallexample
16935 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16936 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16937 @code{__gcov_info_to_gcda} functions and merge the profile information into
16938 @file{.gcda} files on the host filesystem.
16940 @opindex fprofile-note
16941 @item -fprofile-note=@var{path}
16943 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16944 location.  If you combine the option with multiple source files,
16945 the @file{.gcno} file will be overwritten.
16947 @opindex fprofile-prefix-path
16948 @item -fprofile-prefix-path=@var{path}
16950 This option can be used in combination with
16951 @option{profile-generate=}@var{profile_dir} and
16952 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16953 directory of built source tree.  By default @var{profile_dir} will contain
16954 files with mangled absolute paths of all object files in the built project.
16955 This is not desirable when directory used to build the instrumented binary
16956 differs from the directory used to build the binary optimized with profile
16957 feedback because the profile data will not be found during the optimized build.
16958 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16959 pointing to the base directory of the build can be used to strip the irrelevant
16960 part of the path and keep all file names relative to the main build directory.
16962 @opindex fprofile-prefix-map
16963 @item -fprofile-prefix-map=@var{old}=@var{new}
16964 When compiling files residing in directory @file{@var{old}}, record
16965 profiling information (with @option{--coverage})
16966 describing them as if the files resided in
16967 directory @file{@var{new}} instead.
16968 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
16970 @opindex fprofile-update
16971 @item -fprofile-update=@var{method}
16973 Alter the update method for an application instrumented for profile
16974 feedback based optimization.  The @var{method} argument should be one of
16975 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16976 The first one is useful for single-threaded applications,
16977 while the second one prevents profile corruption by emitting thread-safe code.
16979 @strong{Warning:} When an application does not properly join all threads
16980 (or creates an detached thread), a profile file can be still corrupted.
16982 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16983 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16984 automatically selects @samp{prefer-atomic} when @option{-pthread}
16985 is present in the command line, otherwise the default method is @samp{single}.
16987 If @samp{atomic} is selected, then the profile information is updated using
16988 atomic operations on a best-effort basis.  Ideally, the profile information is
16989 updated through atomic operations in hardware.  If the target platform does not
16990 support the required atomic operations in hardware, however, @file{libatomic}
16991 is available, then the profile information is updated through calls to
16992 @file{libatomic}.  If the target platform neither supports the required atomic
16993 operations in hardware nor @file{libatomic}, then the profile information is
16994 not atomically updated and a warning is issued.  In this case, the obtained
16995 profiling information may be corrupt for multi-threaded applications.
16997 For performance reasons, if 64-bit counters are used for the profiling
16998 information and the target platform only supports 32-bit atomic operations in
16999 hardware, then the performance critical profiling updates are done using two
17000 32-bit atomic operations for each counter update.  If a signal interrupts these
17001 two operations updating a counter, then the profiling information may be in an
17002 inconsistent state.
17004 @opindex fprofile-filter-files
17005 @item -fprofile-filter-files=@var{regex}
17007 Instrument only functions from files whose name matches
17008 any of the regular expressions (separated by semi-colons).
17010 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
17011 only @file{main.c} and all C files starting with 'module'.
17013 @opindex fprofile-exclude-files
17014 @item -fprofile-exclude-files=@var{regex}
17016 Instrument only functions from files whose name does not match
17017 any of the regular expressions (separated by semi-colons).
17019 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
17020 of all files that are located in the @file{/usr/} folder.
17022 @opindex fprofile-reproducible
17023 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
17024 Control level of reproducibility of profile gathered by
17025 @code{-fprofile-generate}.  This makes it possible to rebuild program
17026 with same outcome which is useful, for example, for distribution
17027 packages.
17029 With @option{-fprofile-reproducible=serial} the profile gathered by
17030 @option{-fprofile-generate} is reproducible provided the trained program
17031 behaves the same at each invocation of the train run, it is not
17032 multi-threaded and profile data streaming is always done in the same
17033 order.  Note that profile streaming happens at the end of program run but
17034 also before @code{fork} function is invoked.
17036 Note that it is quite common that execution counts of some part of
17037 programs depends, for example, on length of temporary file names or
17038 memory space randomization (that may affect hash-table collision rate).
17039 Such non-reproducible part of programs may be annotated by
17040 @code{no_instrument_function} function attribute. @command{gcov-dump} with
17041 @option{-l} can be used to dump gathered data and verify that they are
17042 indeed reproducible.
17044 With @option{-fprofile-reproducible=parallel-runs} collected profile
17045 stays reproducible regardless the order of streaming of the data into
17046 gcda files.  This setting makes it possible to run multiple instances of
17047 instrumented program in parallel (such as with @code{make -j}). This
17048 reduces quality of gathered data, in particular of indirect call
17049 profiling.
17051 @opindex fsanitize=address
17052 @item -fsanitize=address
17053 Enable AddressSanitizer, a fast memory error detector.
17054 Memory access instructions are instrumented to detect
17055 out-of-bounds and use-after-free bugs.
17056 The option enables @option{-fsanitize-address-use-after-scope}.
17057 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
17058 more details.  The run-time behavior can be influenced using the
17059 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
17060 the available options are shown at startup of the instrumented program.  See
17061 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
17062 for a list of supported options.
17063 The option cannot be combined with @option{-fsanitize=thread} or
17064 @option{-fsanitize=hwaddress}.  Note that the only target
17065 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
17067 To get more accurate stack traces, it is possible to use options such as
17068 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
17069 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
17070 optimizing sibling and tail recursive calls; this option is implicit for
17071 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
17072 disables Identical Code Folding for functions).  Since multiple runs of the
17073 program may yield backtraces with different addresses due to ASLR (Address
17074 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
17075 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
17077 @opindex fsanitize=kernel-address
17078 @item -fsanitize=kernel-address
17079 Enable AddressSanitizer for Linux kernel.
17080 See @uref{https://github.com/google/kernel-sanitizers} for more details.
17082 @opindex fsanitize=hwaddress
17083 @item -fsanitize=hwaddress
17084 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
17085 ignore the top byte of a pointer to allow the detection of memory errors with
17086 a low memory overhead.
17087 Memory access instructions are instrumented to detect out-of-bounds and
17088 use-after-free bugs.
17089 The option enables @option{-fsanitize-address-use-after-scope}.
17091 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
17092 for more details.  The run-time behavior can be influenced using the
17093 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
17094 the available options are shown at startup of the instrumented program.
17095 The option cannot be combined with @option{-fsanitize=thread} or
17096 @option{-fsanitize=address}, and is currently only available on AArch64.
17098 @opindex fsanitize=kernel-hwaddress
17099 @item -fsanitize=kernel-hwaddress
17100 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
17101 Similar to @option{-fsanitize=kernel-address} but using an alternate
17102 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
17103 instrumentation differences necessary for compiling the Linux kernel.
17104 These differences are to avoid hwasan library initialization calls and to
17105 account for the stack pointer having a different value in its top byte.
17107 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
17108 Instrumenting the stack and alloca calls are not on by default but are still
17109 possible by specifying the command-line options
17110 @option{--param hwasan-instrument-stack=1} and
17111 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
17112 tag is not implemented for kernel instrumentation.
17114 @opindex fsanitize=pointer-compare
17115 @item -fsanitize=pointer-compare
17116 Instrument comparison operation (<, <=, >, >=) with pointer operands.
17117 The option must be combined with either @option{-fsanitize=kernel-address} or
17118 @option{-fsanitize=address}
17119 The option cannot be combined with @option{-fsanitize=thread}.
17120 Note: By default the check is disabled at run time.  To enable it,
17121 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17122 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17123 invalid operation only when both pointers are non-null.
17125 @opindex fsanitize=pointer-subtract
17126 @item -fsanitize=pointer-subtract
17127 Instrument subtraction with pointer operands.
17128 The option must be combined with either @option{-fsanitize=kernel-address} or
17129 @option{-fsanitize=address}
17130 The option cannot be combined with @option{-fsanitize=thread}.
17131 Note: By default the check is disabled at run time.  To enable it,
17132 add @code{detect_invalid_pointer_pairs=2} to the environment variable
17133 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
17134 invalid operation only when both pointers are non-null.
17136 @opindex fsanitize=shadow-call-stack
17137 @item -fsanitize=shadow-call-stack
17138 Enable ShadowCallStack, a security enhancement mechanism used to protect
17139 programs against return address overwrites (e.g. stack buffer overflows.)
17140 It works by saving a function's return address to a separately allocated
17141 shadow call stack in the function prologue and restoring the return address
17142 from the shadow call stack in the function epilogue.  Instrumentation only
17143 occurs in functions that need to save the return address to the stack.
17145 Currently it only supports the aarch64 platform.  It is specifically
17146 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
17147 For the user space programs, runtime support is not currently provided
17148 in libc and libgcc.  Users who want to use this feature in user space need
17149 to provide their own support for the runtime.  It should be noted that
17150 this may cause the ABI rules to be broken.
17152 On aarch64, the instrumentation makes use of the platform register @code{x18}.
17153 This generally means that any code that may run on the same thread as code
17154 compiled with ShadowCallStack must be compiled with the flag
17155 @option{-ffixed-x18}, otherwise functions compiled without
17156 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
17157 stack pointer.
17159 Also, because there is no userspace runtime support, code compiled with
17160 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
17161 to turn off exceptions.
17163 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
17164 details.
17166 @opindex fsanitize=thread
17167 @item -fsanitize=thread
17168 Enable ThreadSanitizer, a fast data race detector.
17169 Memory access instructions are instrumented to detect
17170 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17171 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17172 environment variable; see
17173 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17174 supported options.
17175 The option cannot be combined with @option{-fsanitize=address},
17176 @option{-fsanitize=leak}.
17178 Note that sanitized atomic builtins cannot throw exceptions when
17179 operating on invalid memory addresses with non-call exceptions
17180 (@option{-fnon-call-exceptions}).
17182 @opindex fsanitize=leak
17183 @item -fsanitize=leak
17184 Enable LeakSanitizer, a memory leak detector.
17185 This option only matters for linking of executables.
17186 The executable is linked against a library that overrides @code{malloc}
17187 and other allocator functions.  See
17188 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17189 details.  The run-time behavior can be influenced using the
17190 @env{LSAN_OPTIONS} environment variable.
17191 The option cannot be combined with @option{-fsanitize=thread}.
17193 @opindex fsanitize=undefined
17194 @item -fsanitize=undefined
17195 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17196 Various computations are instrumented to detect undefined behavior
17197 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17198 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17200 @table @gcctabopt
17202 @opindex fsanitize=shift
17203 @item -fsanitize=shift
17204 This option enables checking that the result of a shift operation is
17205 not undefined.  Note that what exactly is considered undefined differs
17206 slightly between C and C++, as well as between ISO C90 and C99, etc.
17207 This option has two suboptions, @option{-fsanitize=shift-base} and
17208 @option{-fsanitize=shift-exponent}.
17210 @opindex fsanitize=shift-exponent
17211 @item -fsanitize=shift-exponent
17212 This option enables checking that the second argument of a shift operation
17213 is not negative and is smaller than the precision of the promoted first
17214 argument.
17216 @opindex fsanitize=shift-base
17217 @item -fsanitize=shift-base
17218 If the second argument of a shift operation is within range, check that the
17219 result of a shift operation is not undefined.  Note that what exactly is
17220 considered undefined differs slightly between C and C++, as well as between
17221 ISO C90 and C99, etc.
17223 @opindex fsanitize=integer-divide-by-zero
17224 @item -fsanitize=integer-divide-by-zero
17225 Detect integer division by zero.
17227 @opindex fsanitize=unreachable
17228 @item -fsanitize=unreachable
17229 With this option, the compiler turns the @code{__builtin_unreachable}
17230 call into a diagnostics message call instead.  When reaching the
17231 @code{__builtin_unreachable} call, the behavior is undefined.
17233 @opindex fsanitize=vla-bound
17234 @item -fsanitize=vla-bound
17235 This option instructs the compiler to check that the size of a variable
17236 length array is positive.
17238 @opindex fsanitize=null
17239 @item -fsanitize=null
17240 This option enables pointer checking.  Particularly, the application
17241 built with this option turned on will issue an error message when it
17242 tries to dereference a NULL pointer, or if a reference (possibly an
17243 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17244 on an object pointed by a NULL pointer.
17246 @opindex fsanitize=return
17247 @item -fsanitize=return
17248 This option enables return statement checking.  Programs
17249 built with this option turned on will issue an error message
17250 when the end of a non-void function is reached without actually
17251 returning a value.  This option works in C++ only.
17253 @opindex fsanitize=signed-integer-overflow
17254 @item -fsanitize=signed-integer-overflow
17255 This option enables signed integer overflow checking.  We check that
17256 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17257 does not overflow in the signed arithmetics.  This also detects
17258 @code{INT_MIN / -1} signed division.  Note, integer promotion
17259 rules must be taken into account.  That is, the following is not an
17260 overflow:
17261 @smallexample
17262 signed char a = SCHAR_MAX;
17263 a++;
17264 @end smallexample
17266 @opindex fsanitize=bounds
17267 @item -fsanitize=bounds
17268 This option enables instrumentation of array bounds.  Various out of bounds
17269 accesses are detected.  Flexible array members, flexible array member-like
17270 arrays, and initializers of variables with static storage are not
17271 instrumented, with the exception of flexible array member-like arrays
17272 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17273 options or @code{strict_flex_array} attributes say they shouldn't be treated
17274 like flexible array member-like arrays.
17276 @opindex fsanitize=bounds-strict
17277 @item -fsanitize=bounds-strict
17278 This option enables strict instrumentation of array bounds.  Most out of bounds
17279 accesses are detected, including flexible array member-like arrays.
17280 Initializers of variables with static storage are not instrumented.
17282 @opindex fsanitize=alignment
17283 @item -fsanitize=alignment
17285 This option enables checking of alignment of pointers when they are
17286 dereferenced, or when a reference is bound to insufficiently aligned target,
17287 or when a method or constructor is invoked on insufficiently aligned object.
17289 @opindex fsanitize=object-size
17290 @item -fsanitize=object-size
17291 This option enables instrumentation of memory references using the
17292 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17293 pointer accesses are detected.
17295 @opindex fsanitize=float-divide-by-zero
17296 @item -fsanitize=float-divide-by-zero
17297 Detect floating-point division by zero.  Unlike other similar options,
17298 @option{-fsanitize=float-divide-by-zero} is not enabled by
17299 @option{-fsanitize=undefined}, since floating-point division by zero can
17300 be a legitimate way of obtaining infinities and NaNs.
17302 @opindex fsanitize=float-cast-overflow
17303 @item -fsanitize=float-cast-overflow
17304 This option enables floating-point type to integer conversion checking.
17305 We check that the result of the conversion does not overflow.
17306 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17307 not enabled by @option{-fsanitize=undefined}.
17308 This option does not work well with @code{FE_INVALID} exceptions enabled.
17310 @opindex fsanitize=nonnull-attribute
17311 @item -fsanitize=nonnull-attribute
17313 This option enables instrumentation of calls, checking whether null values
17314 are not passed to arguments marked as requiring a non-null value by the
17315 @code{nonnull} function attribute.
17317 @opindex fsanitize=returns-nonnull-attribute
17318 @item -fsanitize=returns-nonnull-attribute
17320 This option enables instrumentation of return statements in functions
17321 marked with @code{returns_nonnull} function attribute, to detect returning
17322 of null values from such functions.
17324 @opindex fsanitize=bool
17325 @item -fsanitize=bool
17327 This option enables instrumentation of loads from bool.  If a value other
17328 than 0/1 is loaded, a run-time error is issued.
17330 @opindex fsanitize=enum
17331 @item -fsanitize=enum
17333 This option enables instrumentation of loads from an enum type.  If
17334 a value outside the range of values for the enum type is loaded,
17335 a run-time error is issued.
17337 @opindex fsanitize=vptr
17338 @item -fsanitize=vptr
17340 This option enables instrumentation of C++ member function calls, member
17341 accesses and some conversions between pointers to base and derived classes,
17342 to verify the referenced object has the correct dynamic type.
17344 @opindex fsanitize=pointer-overflow
17345 @item -fsanitize=pointer-overflow
17347 This option enables instrumentation of pointer arithmetics.  If the pointer
17348 arithmetics overflows, a run-time error is issued.
17350 @opindex fsanitize=builtin
17351 @item -fsanitize=builtin
17353 This option enables instrumentation of arguments to selected builtin
17354 functions.  If an invalid value is passed to such arguments, a run-time
17355 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17356 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17357 by this option.
17359 @end table
17361 Note that sanitizers tend to increase the rate of false positive
17362 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17363 We recommend against combining @option{-Werror} and [the use of]
17364 sanitizers.
17366 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17367 @option{-fsanitize=undefined} gives a diagnostic message.
17368 This currently works only for the C family of languages.
17370 @opindex fno-sanitize=all
17371 @item -fno-sanitize=all
17373 This option disables all previously enabled sanitizers.
17374 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17375 together.
17377 @opindex fasan-shadow-offset
17378 @item -fasan-shadow-offset=@var{number}
17379 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17380 It is useful for experimenting with different shadow memory layouts in
17381 Kernel AddressSanitizer.
17383 @opindex fsanitize-sections
17384 @item -fsanitize-sections=@var{s1},@var{s2},...
17385 Sanitize global variables in selected user-defined sections.  @var{si} may
17386 contain wildcards.
17388 @opindex fsanitize-recover
17389 @opindex fno-sanitize-recover
17390 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17391 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17392 mentioned in comma-separated list of @var{opts}.  Enabling this option
17393 for a sanitizer component causes it to attempt to continue
17394 running the program as if no error happened.  This means multiple
17395 runtime errors can be reported in a single program run, and the exit
17396 code of the program may indicate success even when errors
17397 have been reported.  The @option{-fno-sanitize-recover=} option
17398 can be used to alter
17399 this behavior: only the first detected error is reported
17400 and program then exits with a non-zero exit code.
17402 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17403 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17404 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17405 @option{-fsanitize=bounds-strict},
17406 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17407 For these sanitizers error recovery is turned on by default,
17408 except @option{-fsanitize=address}, for which this feature is experimental.
17409 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17410 accepted, the former enables recovery for all sanitizers that support it,
17411 the latter disables recovery for all sanitizers that support it.
17413 Even if a recovery mode is turned on the compiler side, it needs to be also
17414 enabled on the runtime library side, otherwise the failures are still fatal.
17415 The runtime library defaults to @code{halt_on_error=0} for
17416 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17417 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17418 setting the @code{halt_on_error} flag in the corresponding environment variable.
17420 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17421 equivalent to specifying an @var{opts} list of:
17423 @smallexample
17424 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17425 @end smallexample
17427 @opindex fsanitize-address-use-after-scope
17428 @item -fsanitize-address-use-after-scope
17429 Enable sanitization of local variables to detect use-after-scope bugs.
17430 The option sets @option{-fstack-reuse} to @samp{none}.
17432 @opindex fsanitize-trap
17433 @opindex fno-sanitize-trap
17434 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17435 The @option{-fsanitize-trap=} option instructs the compiler to
17436 report for sanitizers mentioned in comma-separated list of @var{opts}
17437 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17438 library routine.  If this option is enabled for certain sanitizer,
17439 it takes precedence over the @option{-fsanitizer-recover=} for that
17440 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17441 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17443 The advantage of this is that the @code{libubsan} library is not needed
17444 and is not linked in, so this is usable even in freestanding environments.
17446 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17447 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17448 @option{-fsanitize=float-divide-by-zero} and
17449 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17450 specified, which enables it for @code{undefined} suboptions,
17451 @option{-fsanitize=float-cast-overflow},
17452 @option{-fsanitize=float-divide-by-zero} and
17453 @option{-fsanitize=bounds-strict}.
17454 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17455 and @code{-fsanitize=vptr} is enabled on the command line, the
17456 instrumentation is silently ignored as the instrumentation always needs
17457 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17459 @opindex fsanitize-undefined-trap-on-error
17460 @item -fsanitize-undefined-trap-on-error
17461 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17462 equivalent of @option{-fsanitize-trap=all}.
17464 @opindex fsanitize-coverage=trace-pc
17465 @item -fsanitize-coverage=trace-pc
17466 Enable coverage-guided fuzzing code instrumentation.
17467 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17469 @opindex fsanitize-coverage=trace-cmp
17470 @item -fsanitize-coverage=trace-cmp
17471 Enable dataflow guided fuzzing code instrumentation.
17472 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17473 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17474 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17475 variable or @code{__sanitizer_cov_trace_const_cmp1},
17476 @code{__sanitizer_cov_trace_const_cmp2},
17477 @code{__sanitizer_cov_trace_const_cmp4} or
17478 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17479 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17480 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17481 @code{__sanitizer_cov_trace_switch} for switch statements.
17483 @opindex fcf-protection
17484 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17485 Enable code instrumentation of control-flow transfers to increase
17486 program security by checking that target addresses of control-flow
17487 transfer instructions (such as indirect function call, function return,
17488 indirect jump) are valid.  This prevents diverting the flow of control
17489 to an unexpected target.  This is intended to protect against such
17490 threats as Return-oriented Programming (ROP), and similarly
17491 call/jmp-oriented programming (COP/JOP).
17493 The value @code{branch} tells the compiler to implement checking of
17494 validity of control-flow transfer at the point of indirect branch
17495 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17496 implements checking of validity at the point of returning from a
17497 function.  The value @code{full} is an alias for specifying both
17498 @code{branch} and @code{return}. The value @code{none} turns off
17499 instrumentation.
17501 The value @code{check} is used for the final link with link-time
17502 optimization (LTO).  An error is issued if LTO object files are
17503 compiled with different @option{-fcf-protection} values.  The
17504 value @code{check} is ignored at the compile time.
17506 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17507 used.  The first bit of @code{__CET__} is set to 1 for the value
17508 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17509 the @code{return}.
17511 You can also use the @code{nocf_check} attribute to identify
17512 which functions and calls should be skipped from instrumentation
17513 (@pxref{Function Attributes}).
17515 Currently the x86 GNU/Linux target provides an implementation based
17516 on Intel Control-flow Enforcement Technology (CET) which works for
17517 i686 processor or newer.
17519 @opindex fharden-compares
17520 @item -fharden-compares
17521 For every logical test that survives gimple optimizations and is
17522 @emph{not} the condition in a conditional branch (for example,
17523 conditions tested for conditional moves, or to store in boolean
17524 variables), emit extra code to compute and verify the reversed
17525 condition, and to call @code{__builtin_trap} if the results do not
17526 match.  Use with @samp{-fharden-conditional-branches} to cover all
17527 conditionals.
17529 @opindex fharden-conditional-branches
17530 @item -fharden-conditional-branches
17531 For every non-vectorized conditional branch that survives gimple
17532 optimizations, emit extra code to compute and verify the reversed
17533 condition, and to call @code{__builtin_trap} if the result is
17534 unexpected.  Use with @samp{-fharden-compares} to cover all
17535 conditionals.
17537 @opindex fharden-control-flow-redundancy
17538 @item -fharden-control-flow-redundancy
17539 Emit extra code to set booleans when entering basic blocks, and to
17540 verify and trap, at function exits, when the booleans do not form an
17541 execution path that is compatible with the control flow graph.
17543 Verification takes place before returns, before mandatory tail calls
17544 (see below) and, optionally, before escaping exceptions with
17545 @option{-fhardcfr-check-exceptions}, before returning calls with
17546 @option{-fhardcfr-check-returning-calls}, and before noreturn calls with
17547 @option{-fhardcfr-check-noreturn-calls}).  Tuning options
17548 @option{--param hardcfr-max-blocks} and @option{--param
17549 hardcfr-max-inline-blocks} are available.
17551 Tail call optimization takes place too late to affect control flow
17552 redundancy, but calls annotated as mandatory tail calls by language
17553 front-ends, and any calls marked early enough as potential tail calls
17554 would also have verification issued before the call, but these
17555 possibilities are merely theoretical, as these conditions can only be
17556 met when using custom compiler plugins.
17558 @opindex fhardcfr-skip-leaf
17559 @item -fhardcfr-skip-leaf
17560 Disable @option{-fharden-control-flow-redundancy} in leaf functions.
17562 @opindex fhardcfr-check-exceptions
17563 @opindex fno-hardcfr-check-exceptions
17564 @item -fhardcfr-check-exceptions
17565 When @option{-fharden-control-flow-redundancy} is active, check the
17566 recorded execution path against the control flow graph at exception
17567 escape points, as if the function body was wrapped with a cleanup
17568 handler that performed the check and reraised.  This option is enabled
17569 by default; use @option{-fno-hardcfr-check-exceptions} to disable it.
17571 @opindex fhardcfr-check-returning-calls
17572 @opindex fno-hardcfr-check-returning-calls
17573 @item -fhardcfr-check-returning-calls
17574 When @option{-fharden-control-flow-redundancy} is active, check the
17575 recorded execution path against the control flow graph before any
17576 function call immediately followed by a return of its result, if any, so
17577 as to not prevent tail-call optimization, whether or not it is
17578 ultimately optimized to a tail call.
17580 This option is enabled by default whenever sibling call optimizations
17581 are enabled (see @option{-foptimize-sibling-calls}), but it can be
17582 enabled (or disabled, using its negated form) explicitly, regardless of
17583 the optimizations.
17585 @opindex fhardcfr-check-noreturn-calls
17586 @item -fhardcfr-check-noreturn-calls=@r{[}always@r{|}no-xthrow@r{|}nothrow@r{|}never@r{]}
17587 When @option{-fharden-control-flow-redundancy} is active, check the
17588 recorded execution path against the control flow graph before
17589 @code{noreturn} calls, either all of them (@option{always}), those that
17590 aren't expected to return control to the caller through an exception
17591 (@option{no-xthrow}, the default), those that may not return control to
17592 the caller through an exception either (@option{nothrow}), or none of
17593 them (@option{never}).
17595 Checking before a @code{noreturn} function that may return control to
17596 the caller through an exception may cause checking to be performed more
17597 than once, if the exception is caught in the caller, whether by a
17598 handler or a cleanup.  When @option{-fhardcfr-check-exceptions} is also
17599 enabled, the compiler will avoid associating a @code{noreturn} call with
17600 the implicitly-added cleanup handler, since it would be redundant with
17601 the check performed before the call, but other handlers or cleanups in
17602 the function, if activated, will modify the recorded execution path and
17603 check it again when another checkpoint is hit.  The checkpoint may even
17604 be another @code{noreturn} call, so checking may end up performed
17605 multiple times.
17607 Various optimizers may cause calls to be marked as @code{noreturn}
17608 and/or @code{nothrow}, even in the absence of the corresponding
17609 attributes, which may affect the placement of checks before calls, as
17610 well as the addition of implicit cleanup handlers for them.  This
17611 unpredictability, and the fact that raising and reraising exceptions
17612 frequently amounts to implicitly calling @code{noreturn} functions, have
17613 made @option{no-xthrow} the default setting for this option: it excludes
17614 from the @code{noreturn} treatment only internal functions used to
17615 (re)raise exceptions, that are not affected by these optimizations.
17617 @opindex fstack-protector
17618 @item -fstack-protector
17619 Emit extra code to check for buffer overflows, such as stack smashing
17620 attacks.  This is done by adding a guard variable to functions with
17621 vulnerable objects.  This includes functions that call @code{alloca}, and
17622 functions with buffers larger than or equal to 8 bytes.  The guards are
17623 initialized when a function is entered and then checked when the function
17624 exits.  If a guard check fails, an error message is printed and the program
17625 exits.  Only variables that are actually allocated on the stack are
17626 considered, optimized away variables or variables allocated in registers
17627 don't count.
17629 @opindex fstack-protector-all
17630 @item -fstack-protector-all
17631 Like @option{-fstack-protector} except that all functions are protected.
17633 @opindex fstack-protector-strong
17634 @item -fstack-protector-strong
17635 Like @option{-fstack-protector} but includes additional functions to
17636 be protected --- those that have local array definitions, or have
17637 references to local frame addresses.  Only variables that are actually
17638 allocated on the stack are considered, optimized away variables or variables
17639 allocated in registers don't count.
17641 @opindex fstack-protector-explicit
17642 @item -fstack-protector-explicit
17643 Like @option{-fstack-protector} but only protects those functions which
17644 have the @code{stack_protect} attribute.
17646 @opindex fstack-check
17647 @item -fstack-check
17648 Generate code to verify that you do not go beyond the boundary of the
17649 stack.  You should specify this flag if you are running in an
17650 environment with multiple threads, but you only rarely need to specify it in
17651 a single-threaded environment since stack overflow is automatically
17652 detected on nearly all systems if there is only one stack.
17654 Note that this switch does not actually cause checking to be done; the
17655 operating system or the language runtime must do that.  The switch causes
17656 generation of code to ensure that they see the stack being extended.
17658 You can additionally specify a string parameter: @samp{no} means no
17659 checking, @samp{generic} means force the use of old-style checking,
17660 @samp{specific} means use the best checking method and is equivalent
17661 to bare @option{-fstack-check}.
17663 Old-style checking is a generic mechanism that requires no specific
17664 target support in the compiler but comes with the following drawbacks:
17666 @enumerate
17667 @item
17668 Modified allocation strategy for large objects: they are always
17669 allocated dynamically if their size exceeds a fixed threshold.  Note this
17670 may change the semantics of some code.
17672 @item
17673 Fixed limit on the size of the static frame of functions: when it is
17674 topped by a particular function, stack checking is not reliable and
17675 a warning is issued by the compiler.
17677 @item
17678 Inefficiency: because of both the modified allocation strategy and the
17679 generic implementation, code performance is hampered.
17680 @end enumerate
17682 Note that old-style stack checking is also the fallback method for
17683 @samp{specific} if no target support has been added in the compiler.
17685 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17686 and stack overflows.  @samp{specific} is an excellent choice when compiling
17687 Ada code.  It is not generally sufficient to protect against stack-clash
17688 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
17690 @opindex fstack-clash-protection
17691 @item -fstack-clash-protection
17692 Generate code to prevent stack clash style attacks.  When this option is
17693 enabled, the compiler will only allocate one page of stack space at a time
17694 and each page is accessed immediately after allocation.  Thus, it prevents
17695 allocations from jumping over any stack guard page provided by the
17696 operating system.
17698 Most targets do not fully support stack clash protection.  However, on
17699 those targets @option{-fstack-clash-protection} will protect dynamic stack
17700 allocations.  @option{-fstack-clash-protection} may also provide limited
17701 protection for static stack allocations if the target supports
17702 @option{-fstack-check=specific}.
17704 @opindex fstack-limit-register
17705 @opindex fstack-limit-symbol
17706 @opindex fno-stack-limit
17707 @item -fstack-limit-register=@var{reg}
17708 @itemx -fstack-limit-symbol=@var{sym}
17709 @itemx -fno-stack-limit
17710 Generate code to ensure that the stack does not grow beyond a certain value,
17711 either the value of a register or the address of a symbol.  If a larger
17712 stack is required, a signal is raised at run time.  For most targets,
17713 the signal is raised before the stack overruns the boundary, so
17714 it is possible to catch the signal without taking special precautions.
17716 For instance, if the stack starts at absolute address @samp{0x80000000}
17717 and grows downwards, you can use the flags
17718 @option{-fstack-limit-symbol=__stack_limit} and
17719 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17720 of 128KB@.  Note that this may only work with the GNU linker.
17722 You can locally override stack limit checking by using the
17723 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17725 @opindex fsplit-stack
17726 @item -fsplit-stack
17727 Generate code to automatically split the stack before it overflows.
17728 The resulting program has a discontiguous stack which can only
17729 overflow if the program is unable to allocate any more memory.  This
17730 is most useful when running threaded programs, as it is no longer
17731 necessary to calculate a good stack size to use for each thread.  This
17732 is currently only implemented for the x86 targets running
17733 GNU/Linux.
17735 When code compiled with @option{-fsplit-stack} calls code compiled
17736 without @option{-fsplit-stack}, there may not be much stack space
17737 available for the latter code to run.  If compiling all code,
17738 including library code, with @option{-fsplit-stack} is not an option,
17739 then the linker can fix up these calls so that the code compiled
17740 without @option{-fsplit-stack} always has a large stack.  Support for
17741 this is implemented in the gold linker in GNU binutils release 2.21
17742 and later.
17744 @opindex fvtable-verify
17745 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17746 This option is only available when compiling C++ code.
17747 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17748 feature that verifies at run time, for every virtual call, that
17749 the vtable pointer through which the call is made is valid for the type of
17750 the object, and has not been corrupted or overwritten.  If an invalid vtable
17751 pointer is detected at run time, an error is reported and execution of the
17752 program is immediately halted.
17754 This option causes run-time data structures to be built at program startup,
17755 which are used for verifying the vtable pointers.  
17756 The options @samp{std} and @samp{preinit}
17757 control the timing of when these data structures are built.  In both cases the
17758 data structures are built before execution reaches @code{main}.  Using
17759 @option{-fvtable-verify=std} causes the data structures to be built after
17760 shared libraries have been loaded and initialized.
17761 @option{-fvtable-verify=preinit} causes them to be built before shared
17762 libraries have been loaded and initialized.
17764 If this option appears multiple times in the command line with different
17765 values specified, @samp{none} takes highest priority over both @samp{std} and
17766 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17768 @opindex fvtv-debug
17769 @item -fvtv-debug
17770 When used in conjunction with @option{-fvtable-verify=std} or 
17771 @option{-fvtable-verify=preinit}, causes debug versions of the 
17772 runtime functions for the vtable verification feature to be called.  
17773 This flag also causes the compiler to log information about which 
17774 vtable pointers it finds for each class.
17775 This information is written to a file named @file{vtv_set_ptr_data.log} 
17776 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
17777 if that is defined or the current working directory otherwise.
17779 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
17780 file, be sure to delete any existing one.
17782 @opindex fvtv-counts
17783 @item -fvtv-counts
17784 This is a debugging flag.  When used in conjunction with
17785 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17786 causes the compiler to keep track of the total number of virtual calls
17787 it encounters and the number of verifications it inserts.  It also
17788 counts the number of calls to certain run-time library functions
17789 that it inserts and logs this information for each compilation unit.
17790 The compiler writes this information to a file named
17791 @file{vtv_count_data.log} in the directory named by the environment
17792 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17793 directory otherwise.  It also counts the size of the vtable pointer sets
17794 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17795 in the same directory.
17797 Note:  This feature @emph{appends} data to the log files.  To get fresh log
17798 files, be sure to delete any existing ones.
17800 @opindex finstrument-functions
17801 @item -finstrument-functions
17802 Generate instrumentation calls for entry and exit to functions.  Just
17803 after function entry and just before function exit, the following
17804 profiling functions are called with the address of the current
17805 function and its call site.  (On some platforms,
17806 @code{__builtin_return_address} does not work beyond the current
17807 function, so the call site information may not be available to the
17808 profiling functions otherwise.)
17810 @smallexample
17811 void __cyg_profile_func_enter (void *this_fn,
17812                                void *call_site);
17813 void __cyg_profile_func_exit  (void *this_fn,
17814                                void *call_site);
17815 @end smallexample
17817 The first argument is the address of the start of the current function,
17818 which may be looked up exactly in the symbol table.
17820 This instrumentation is also done for functions expanded inline in other
17821 functions.  The profiling calls indicate where, conceptually, the
17822 inline function is entered and exited.  This means that addressable
17823 versions of such functions must be available.  If all your uses of a
17824 function are expanded inline, this may mean an additional expansion of
17825 code size.  If you use @code{extern inline} in your C code, an
17826 addressable version of such functions must be provided.  (This is
17827 normally the case anyway, but if you get lucky and the optimizer always
17828 expands the functions inline, you might have gotten away without
17829 providing static copies.)
17831 A function may be given the attribute @code{no_instrument_function}, in
17832 which case this instrumentation is not done.  This can be used, for
17833 example, for the profiling functions listed above, high-priority
17834 interrupt routines, and any functions from which the profiling functions
17835 cannot safely be called (perhaps signal handlers, if the profiling
17836 routines generate output or allocate memory).
17837 @xref{Common Function Attributes}.
17839 @opindex finstrument-functions-once
17840 @item -finstrument-functions-once
17841 This is similar to @option{-finstrument-functions}, but the profiling
17842 functions are called only once per instrumented function, i.e. the first
17843 profiling function is called after the first entry into the instrumented
17844 function and the second profiling function is called before the exit
17845 corresponding to this first entry.
17847 The definition of @code{once} for the purpose of this option is a little
17848 vague because the implementation is not protected against data races.
17849 As a result, the implementation only guarantees that the profiling
17850 functions are called at @emph{least} once per process and at @emph{most}
17851 once per thread, but the calls are always paired, that is to say, if a
17852 thread calls the first function, then it will call the second function,
17853 unless it never reaches the exit of the instrumented function.
17855 @opindex finstrument-functions-exclude-file-list
17856 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17858 Set the list of functions that are excluded from instrumentation (see
17859 the description of @option{-finstrument-functions}).  If the file that
17860 contains a function definition matches with one of @var{file}, then
17861 that function is not instrumented.  The match is done on substrings:
17862 if the @var{file} parameter is a substring of the file name, it is
17863 considered to be a match.
17865 For example:
17867 @smallexample
17868 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17869 @end smallexample
17871 @noindent
17872 excludes any inline function defined in files whose pathnames
17873 contain @file{/bits/stl} or @file{include/sys}.
17875 If, for some reason, you want to include letter @samp{,} in one of
17876 @var{sym}, write @samp{\,}. For example,
17877 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17878 (note the single quote surrounding the option).
17880 @opindex finstrument-functions-exclude-function-list
17881 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17883 This is similar to @option{-finstrument-functions-exclude-file-list},
17884 but this option sets the list of function names to be excluded from
17885 instrumentation.  The function name to be matched is its user-visible
17886 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17887 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17888 match is done on substrings: if the @var{sym} parameter is a substring
17889 of the function name, it is considered to be a match.  For C99 and C++
17890 extended identifiers, the function name must be given in UTF-8, not
17891 using universal character names.
17893 @opindex fpatchable-function-entry
17894 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17895 Generate @var{N} NOPs right at the beginning
17896 of each function, with the function entry point before the @var{M}th NOP.
17897 If @var{M} is omitted, it defaults to @code{0} so the
17898 function entry points to the address just at the first NOP.
17899 The NOP instructions reserve extra space which can be used to patch in
17900 any desired instrumentation at run time, provided that the code segment
17901 is writable.  The amount of space is controllable indirectly via
17902 the number of NOPs; the NOP instruction used corresponds to the instruction
17903 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
17904 is target-specific and may also depend on the architecture variant and/or
17905 other compilation options.
17907 For run-time identification, the starting addresses of these areas,
17908 which correspond to their respective function entries minus @var{M},
17909 are additionally collected in the @code{__patchable_function_entries}
17910 section of the resulting binary.
17912 Note that the value of @code{__attribute__ ((patchable_function_entry
17913 (N,M)))} takes precedence over command-line option
17914 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
17915 the area size or to remove it completely on a single function.
17916 If @code{N=0}, no pad location is recorded.
17918 The NOP instructions are inserted at---and maybe before, depending on
17919 @var{M}---the function entry address, even before the prologue.  On
17920 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17921 the local entry point is this function entry address.
17923 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
17924 ELFv2 ABI, for a function with dual entry points, the supported values
17925 for @var{M} are 0, 2, 6 and 14.
17926 @end table
17929 @node Preprocessor Options
17930 @section Options Controlling the Preprocessor
17931 @cindex preprocessor options
17932 @cindex options, preprocessor
17934 These options control the C preprocessor, which is run on each C source
17935 file before actual compilation.
17937 If you use the @option{-E} option, nothing is done except preprocessing.
17938 Some of these options make sense only together with @option{-E} because
17939 they cause the preprocessor output to be unsuitable for actual
17940 compilation.
17942 In addition to the options listed here, there are a number of options 
17943 to control search paths for include files documented in 
17944 @ref{Directory Options}.  
17945 Options to control preprocessor diagnostics are listed in 
17946 @ref{Warning Options}.
17948 @table @gcctabopt
17949 @include cppopts.texi
17951 @opindex Wp
17952 @item -Wp,@var{option}
17953 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17954 and pass @var{option} directly through to the preprocessor.  If
17955 @var{option} contains commas, it is split into multiple options at the
17956 commas.  However, many options are modified, translated or interpreted
17957 by the compiler driver before being passed to the preprocessor, and
17958 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17959 interface is undocumented and subject to change, so whenever possible
17960 you should avoid using @option{-Wp} and let the driver handle the
17961 options instead.
17963 @opindex Xpreprocessor
17964 @item -Xpreprocessor @var{option}
17965 Pass @var{option} as an option to the preprocessor.  You can use this to
17966 supply system-specific preprocessor options that GCC does not 
17967 recognize.
17969 If you want to pass an option that takes an argument, you must use
17970 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17972 @opindex no-integrated-cpp
17973 @item -no-integrated-cpp
17974 Perform preprocessing as a separate pass before compilation.
17975 By default, GCC performs preprocessing as an integrated part of
17976 input tokenization and parsing.
17977 If this option is provided, the appropriate language front end
17978 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17979 and Objective-C, respectively) is instead invoked twice,
17980 once for preprocessing only and once for actual compilation
17981 of the preprocessed input.
17982 This option may be useful in conjunction with the @option{-B} or
17983 @option{-wrapper} options to specify an alternate preprocessor or
17984 perform additional processing of the program source between
17985 normal preprocessing and compilation.
17987 @opindex flarge-source-files
17988 @item -flarge-source-files
17989 Adjust GCC to expect large source files, at the expense of slower
17990 compilation and higher memory usage.
17992 Specifically, GCC normally tracks both column numbers and line numbers
17993 within source files and it normally prints both of these numbers in
17994 diagnostics.  However, once it has processed a certain number of source
17995 lines, it stops tracking column numbers and only tracks line numbers.
17996 This means that diagnostics for later lines do not include column numbers.
17997 It also means that options like @option{-Wmisleading-indentation} cease to work
17998 at that point, although the compiler prints a note if this happens.
17999 Passing @option{-flarge-source-files} significantly increases the number
18000 of source lines that GCC can process before it stops tracking columns.
18002 @end table
18004 @node Assembler Options
18005 @section Passing Options to the Assembler
18007 @c prevent bad page break with this line
18008 You can pass options to the assembler.
18010 @table @gcctabopt
18011 @opindex Wa
18012 @item -Wa,@var{option}
18013 Pass @var{option} as an option to the assembler.  If @var{option}
18014 contains commas, it is split into multiple options at the commas.
18016 @opindex Xassembler
18017 @item -Xassembler @var{option}
18018 Pass @var{option} as an option to the assembler.  You can use this to
18019 supply system-specific assembler options that GCC does not
18020 recognize.
18022 If you want to pass an option that takes an argument, you must use
18023 @option{-Xassembler} twice, once for the option and once for the argument.
18025 @end table
18027 @node Link Options
18028 @section Options for Linking
18029 @cindex link options
18030 @cindex options, linking
18032 These options come into play when the compiler links object files into
18033 an executable output file.  They are meaningless if the compiler is
18034 not doing a link step.
18036 @table @gcctabopt
18037 @cindex file names
18038 @item @var{object-file-name}
18039 A file name that does not end in a special recognized suffix is
18040 considered to name an object file or library.  (Object files are
18041 distinguished from libraries by the linker according to the file
18042 contents.)  If linking is done, these object files are used as input
18043 to the linker.
18045 @opindex c
18046 @opindex S
18047 @opindex E
18048 @item -c
18049 @itemx -S
18050 @itemx -E
18051 If any of these options is used, then the linker is not run, and
18052 object file names should not be used as arguments.  @xref{Overall
18053 Options}.
18055 @opindex flinker-output
18056 @item -flinker-output=@var{type}
18057 This option controls code generation of the link-time optimizer.  By
18058 default the linker output is automatically determined by the linker
18059 plugin.  For debugging the compiler and if incremental linking with a 
18060 non-LTO object file is desired, it may be useful to control the type
18061 manually.
18063 If @var{type} is @samp{exec}, code generation produces a static
18064 binary. In this case @option{-fpic} and @option{-fpie} are both
18065 disabled.
18067 If @var{type} is @samp{dyn}, code generation produces a shared
18068 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
18069 but not enabled automatically.  This allows to build shared libraries
18070 without position-independent code on architectures where this is
18071 possible, i.e.@: on x86.
18073 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
18074 executable. This results in similar optimizations as @samp{exec}
18075 except that @option{-fpie} is not disabled if specified at compilation
18076 time.
18078 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
18079 done.  The sections containing intermediate code for link-time optimization are
18080 merged, pre-optimized, and output to the resulting object file. In addition, if
18081 @option{-ffat-lto-objects} is specified, binary code is produced for future
18082 non-LTO linking. The object file produced by incremental linking is smaller
18083 than a static library produced from the same object files.  At link time the
18084 result of incremental linking also loads faster than a static
18085 library assuming that the majority of objects in the library are used.
18087 Finally @samp{nolto-rel} configures the compiler for incremental linking where
18088 code generation is forced, a final binary is produced, and the intermediate
18089 code for later link-time optimization is stripped. When multiple object files
18090 are linked together the resulting code is better optimized than with
18091 link-time optimizations disabled (for example, cross-module inlining 
18092 happens), but most of benefits of whole program optimizations are lost. 
18094 During the incremental link (by @option{-r}) the linker plugin defaults to
18095 @option{rel}. With current interfaces to GNU Binutils it is however not
18096 possible to incrementally link LTO objects and non-LTO objects into a single
18097 mixed object file.  If any of object files in incremental link cannot
18098 be used for link-time optimization, the linker plugin issues a warning and
18099 uses @samp{nolto-rel}. To maintain whole program optimization, it is
18100 recommended to link such objects into static library instead. Alternatively it
18101 is possible to use H.J. Lu's binutils with support for mixed objects.
18103 @opindex fuse-ld=bfd
18104 @item -fuse-ld=bfd
18105 Use the @command{bfd} linker instead of the default linker.
18107 @opindex fuse-ld=gold
18108 @item -fuse-ld=gold
18109 Use the @command{gold} linker instead of the default linker.
18111 @opindex fuse-ld=lld
18112 @item -fuse-ld=lld
18113 Use the LLVM @command{lld} linker instead of the default linker.
18115 @opindex fuse-ld=mold
18116 @item -fuse-ld=mold
18117 Use the Modern Linker (@command{mold}) instead of the default linker.
18119 @cindex Libraries
18120 @opindex l
18121 @item -l@var{library}
18122 @itemx -l @var{library}
18123 Search the library named @var{library} when linking.  (The second
18124 alternative with the library as a separate argument is only for
18125 POSIX compliance and is not recommended.)
18127 The @option{-l} option is passed directly to the linker by GCC.  Refer
18128 to your linker documentation for exact details.  The general
18129 description below applies to the GNU linker.  
18131 The linker searches a standard list of directories for the library.
18132 The directories searched include several standard system directories
18133 plus any that you specify with @option{-L}.
18135 Static libraries are archives of object files, and have file names
18136 like @file{lib@var{library}.a}.  Some targets also support shared
18137 libraries, which typically have names like @file{lib@var{library}.so}.
18138 If both static and shared libraries are found, the linker gives
18139 preference to linking with the shared library unless the
18140 @option{-static} option is used.
18142 It makes a difference where in the command you write this option; the
18143 linker searches and processes libraries and object files in the order they
18144 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
18145 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
18146 to functions in @samp{z}, those functions may not be loaded.
18148 @opindex lobjc
18149 @item -lobjc
18150 You need this special case of the @option{-l} option in order to
18151 link an Objective-C or Objective-C++ program.
18153 @opindex nostartfiles
18154 @item -nostartfiles
18155 Do not use the standard system startup files when linking.
18156 The standard system libraries are used normally, unless @option{-nostdlib},
18157 @option{-nolibc}, or @option{-nodefaultlibs} is used.
18159 @opindex nodefaultlibs
18160 @item -nodefaultlibs
18161 Do not use the standard system libraries when linking.
18162 Only the libraries you specify are passed to the linker, and options
18163 specifying linkage of the system libraries, such as @option{-static-libgcc}
18164 or @option{-shared-libgcc}, are ignored.  
18165 The standard startup files are used normally, unless @option{-nostartfiles}
18166 is used.  
18168 The compiler may generate calls to @code{memcmp},
18169 @code{memset}, @code{memcpy} and @code{memmove}.
18170 These entries are usually resolved by entries in
18171 libc.  These entry points should be supplied through some other
18172 mechanism when this option is specified.
18174 @opindex nolibc
18175 @item -nolibc
18176 Do not use the C library or system libraries tightly coupled with it when
18177 linking.  Still link with the startup files, @file{libgcc} or toolchain
18178 provided language support libraries such as @file{libgnat}, @file{libgfortran}
18179 or @file{libstdc++} unless options preventing their inclusion are used as
18180 well.  This typically removes @option{-lc} from the link command line, as well
18181 as system libraries that normally go with it and become meaningless when
18182 absence of a C library is assumed, for example @option{-lpthread} or
18183 @option{-lm} in some configurations.  This is intended for bare-board
18184 targets when there is indeed no C library available.
18186 @opindex nostdlib
18187 @item -nostdlib
18188 Do not use the standard system startup files or libraries when linking.
18189 No startup files and only the libraries you specify are passed to
18190 the linker, and options specifying linkage of the system libraries, such as
18191 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
18193 The compiler may generate calls to @code{memcmp}, @code{memset},
18194 @code{memcpy} and @code{memmove}.
18195 These entries are usually resolved by entries in
18196 libc.  These entry points should be supplied through some other
18197 mechanism when this option is specified.
18199 @cindex @option{-lgcc}, use with @option{-nostdlib}
18200 @cindex @option{-nostdlib} and unresolved references
18201 @cindex unresolved references and @option{-nostdlib}
18202 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
18203 @cindex @option{-nodefaultlibs} and unresolved references
18204 @cindex unresolved references and @option{-nodefaultlibs}
18205 One of the standard libraries bypassed by @option{-nostdlib} and
18206 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
18207 which GCC uses to overcome shortcomings of particular machines, or special
18208 needs for some languages.
18209 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
18210 Collection (GCC) Internals},
18211 for more discussion of @file{libgcc.a}.)
18212 In most cases, you need @file{libgcc.a} even when you want to avoid
18213 other standard libraries.  In other words, when you specify @option{-nostdlib}
18214 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
18215 This ensures that you have no unresolved references to internal GCC
18216 library subroutines.
18217 (An example of such an internal subroutine is @code{__main}, used to ensure C++
18218 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
18219 GNU Compiler Collection (GCC) Internals}.)
18221 @opindex nostdlib++
18222 @item -nostdlib++
18223 Do not implicitly link with standard C++ libraries.
18225 @opindex e
18226 @opindex entry
18227 @item -e @var{entry}
18228 @itemx --entry=@var{entry}
18230 Specify that the program entry point is @var{entry}.  The argument is
18231 interpreted by the linker; the GNU linker accepts either a symbol name
18232 or an address.
18234 @opindex pie
18235 @item -pie
18236 Produce a dynamically linked position independent executable on targets
18237 that support it.  For predictable results, you must also specify the same
18238 set of options used for compilation (@option{-fpie}, @option{-fPIE},
18239 or model suboptions) when you specify this linker option.
18241 @opindex no-pie
18242 @item -no-pie
18243 Don't produce a dynamically linked position independent executable.
18245 @opindex static-pie
18246 @item -static-pie
18247 Produce a static position independent executable on targets that support
18248 it.  A static position independent executable is similar to a static
18249 executable, but can be loaded at any address without a dynamic linker.
18250 For predictable results, you must also specify the same set of options
18251 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18252 suboptions) when you specify this linker option.
18254 @opindex pthread
18255 @item -pthread
18256 Link with the POSIX threads library.  This option is supported on 
18257 GNU/Linux targets, most other Unix derivatives, and also on 
18258 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18259 flags for the preprocessor, so it should be used consistently for both
18260 compilation and linking.
18262 @opindex r
18263 @item -r
18264 Produce a relocatable object as output.  This is also known as partial
18265 linking.
18267 @opindex rdynamic
18268 @item -rdynamic
18269 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18270 that support it. This instructs the linker to add all symbols, not
18271 only used ones, to the dynamic symbol table. This option is needed
18272 for some uses of @code{dlopen} or to allow obtaining backtraces
18273 from within a program.
18275 @opindex s
18276 @item -s
18277 Remove all symbol table and relocation information from the executable.
18279 @opindex static
18280 @item -static
18281 On systems that support dynamic linking, this overrides @option{-pie}
18282 and prevents linking with the shared libraries.  On other systems, this
18283 option has no effect.
18285 @opindex shared
18286 @item -shared
18287 Produce a shared object which can then be linked with other objects to
18288 form an executable.  Not all systems support this option.  For predictable
18289 results, you must also specify the same set of options used for compilation
18290 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18291 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18292 needs to build supplementary stub code for constructors to work.  On
18293 multi-libbed systems, @samp{gcc -shared} must select the correct support
18294 libraries to link against.  Failing to supply the correct flags may lead
18295 to subtle defects.  Supplying them in cases where they are not necessary
18296 is innocuous.  @option{-shared} suppresses the addition of startup code
18297 to alter the floating-point environment as done with @option{-ffast-math},
18298 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18300 @opindex shared-libgcc
18301 @opindex static-libgcc
18302 @item -shared-libgcc
18303 @itemx -static-libgcc
18304 On systems that provide @file{libgcc} as a shared library, these options
18305 force the use of either the shared or static version, respectively.
18306 If no shared version of @file{libgcc} was built when the compiler was
18307 configured, these options have no effect.
18309 There are several situations in which an application should use the
18310 shared @file{libgcc} instead of the static version.  The most common
18311 of these is when the application wishes to throw and catch exceptions
18312 across different shared libraries.  In that case, each of the libraries
18313 as well as the application itself should use the shared @file{libgcc}.
18315 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18316 whenever you build a shared library or a main executable, because C++
18317 programs typically use exceptions, so this is the right thing to do.
18319 If, instead, you use the GCC driver to create shared libraries, you may
18320 find that they are not always linked with the shared @file{libgcc}.
18321 If GCC finds, at its configuration time, that you have a non-GNU linker
18322 or a GNU linker that does not support option @option{--eh-frame-hdr},
18323 it links the shared version of @file{libgcc} into shared libraries
18324 by default.  Otherwise, it takes advantage of the linker and optimizes
18325 away the linking with the shared version of @file{libgcc}, linking with
18326 the static version of libgcc by default.  This allows exceptions to
18327 propagate through such shared libraries, without incurring relocation
18328 costs at library load time.
18330 However, if a library or main executable is supposed to throw or catch
18331 exceptions, you must link it using the G++ driver, or using the option
18332 @option{-shared-libgcc}, such that it is linked with the shared
18333 @file{libgcc}.
18335 @opindex static-libasan
18336 @item -static-libasan
18337 When the @option{-fsanitize=address} option is used to link a program,
18338 the GCC driver automatically links against @option{libasan}.  If
18339 @file{libasan} is available as a shared library, and the @option{-static}
18340 option is not used, then this links against the shared version of
18341 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18342 driver to link @file{libasan} statically, without necessarily linking
18343 other libraries statically.
18345 @opindex static-libtsan
18346 @item -static-libtsan
18347 When the @option{-fsanitize=thread} option is used to link a program,
18348 the GCC driver automatically links against @option{libtsan}.  If
18349 @file{libtsan} is available as a shared library, and the @option{-static}
18350 option is not used, then this links against the shared version of
18351 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18352 driver to link @file{libtsan} statically, without necessarily linking
18353 other libraries statically.
18355 @opindex static-liblsan
18356 @item -static-liblsan
18357 When the @option{-fsanitize=leak} option is used to link a program,
18358 the GCC driver automatically links against @option{liblsan}.  If
18359 @file{liblsan} is available as a shared library, and the @option{-static}
18360 option is not used, then this links against the shared version of
18361 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18362 driver to link @file{liblsan} statically, without necessarily linking
18363 other libraries statically.
18365 @opindex static-libubsan
18366 @item -static-libubsan
18367 When the @option{-fsanitize=undefined} option is used to link a program,
18368 the GCC driver automatically links against @option{libubsan}.  If
18369 @file{libubsan} is available as a shared library, and the @option{-static}
18370 option is not used, then this links against the shared version of
18371 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18372 driver to link @file{libubsan} statically, without necessarily linking
18373 other libraries statically.
18375 @opindex static-libstdc++
18376 @item -static-libstdc++
18377 When the @command{g++} program is used to link a C++ program, it
18378 normally automatically links against @option{libstdc++}.  If
18379 @file{libstdc++} is available as a shared library, and the
18380 @option{-static} option is not used, then this links against the
18381 shared version of @file{libstdc++}.  That is normally fine.  However, it
18382 is sometimes useful to freeze the version of @file{libstdc++} used by
18383 the program without going all the way to a fully static link.  The
18384 @option{-static-libstdc++} option directs the @command{g++} driver to
18385 link @file{libstdc++} statically, without necessarily linking other
18386 libraries statically.
18388 @opindex symbolic
18389 @item -symbolic
18390 Bind references to global symbols when building a shared object.  Warn
18391 about any unresolved references (unless overridden by the link editor
18392 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18393 this option.
18395 @opindex T
18396 @cindex linker script
18397 @item -T @var{script}
18398 Use @var{script} as the linker script.  This option is supported by most
18399 systems using the GNU linker.  On some targets, such as bare-board
18400 targets without an operating system, the @option{-T} option may be required
18401 when linking to avoid references to undefined symbols.
18403 @opindex Xlinker
18404 @item -Xlinker @var{option}
18405 Pass @var{option} as an option to the linker.  You can use this to
18406 supply system-specific linker options that GCC does not recognize.
18408 If you want to pass an option that takes a separate argument, you must use
18409 @option{-Xlinker} twice, once for the option and once for the argument.
18410 For example, to pass @option{-assert definitions}, you must write
18411 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18412 @option{-Xlinker "-assert definitions"}, because this passes the entire
18413 string as a single argument, which is not what the linker expects.
18415 When using the GNU linker, it is usually more convenient to pass
18416 arguments to linker options using the @option{@var{option}=@var{value}}
18417 syntax than as separate arguments.  For example, you can specify
18418 @option{-Xlinker -Map=output.map} rather than
18419 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18420 this syntax for command-line options.
18422 @opindex Wl
18423 @item -Wl,@var{option}
18424 Pass @var{option} as an option to the linker.  If @var{option} contains
18425 commas, it is split into multiple options at the commas.  You can use this
18426 syntax to pass an argument to the option.
18427 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18428 linker.  When using the GNU linker, you can also get the same effect with
18429 @option{-Wl,-Map=output.map}.
18431 @opindex u
18432 @item -u @var{symbol}
18433 Pretend the symbol @var{symbol} is undefined, to force linking of
18434 library modules to define it.  You can use @option{-u} multiple times with
18435 different symbols to force loading of additional library modules.
18437 @opindex z
18438 @item -z @var{keyword}
18439 @option{-z} is passed directly on to the linker along with the keyword
18440 @var{keyword}. See the section in the documentation of your linker for
18441 permitted values and their meanings.
18442 @end table
18444 @node Directory Options
18445 @section Options for Directory Search
18446 @cindex directory options
18447 @cindex options, directory search
18448 @cindex search path
18450 These options specify directories to search for header files, for
18451 libraries and for parts of the compiler:
18453 @table @gcctabopt
18454 @include cppdiropts.texi
18456 @opindex iplugindir=
18457 @item -iplugindir=@var{dir}
18458 Set the directory to search for plugins that are passed
18459 by @option{-fplugin=@var{name}} instead of
18460 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18461 to be used by the user, but only passed by the driver.
18463 @opindex L
18464 @item -L@var{dir}
18465 Add directory @var{dir} to the list of directories to be searched
18466 for @option{-l}.
18468 @opindex B
18469 @item -B@var{prefix}
18470 This option specifies where to find the executables, libraries,
18471 include files, and data files of the compiler itself.
18473 The compiler driver program runs one or more of the subprograms
18474 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18475 @var{prefix} as a prefix for each program it tries to run, both with and
18476 without @samp{@var{machine}/@var{version}/} for the corresponding target
18477 machine and compiler version.
18479 For each subprogram to be run, the compiler driver first tries the
18480 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18481 is not specified, the driver tries two standard prefixes, 
18482 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18483 those results in a file name that is found, the unmodified program
18484 name is searched for using the directories specified in your
18485 @env{PATH} environment variable.
18487 The compiler checks to see if the path provided by @option{-B}
18488 refers to a directory, and if necessary it adds a directory
18489 separator character at the end of the path.
18491 @option{-B} prefixes that effectively specify directory names also apply
18492 to libraries in the linker, because the compiler translates these
18493 options into @option{-L} options for the linker.  They also apply to
18494 include files in the preprocessor, because the compiler translates these
18495 options into @option{-isystem} options for the preprocessor.  In this case,
18496 the compiler appends @samp{include} to the prefix.
18498 The runtime support file @file{libgcc.a} can also be searched for using
18499 the @option{-B} prefix, if needed.  If it is not found there, the two
18500 standard prefixes above are tried, and that is all.  The file is left
18501 out of the link if it is not found by those means.
18503 Another way to specify a prefix much like the @option{-B} prefix is to use
18504 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18505 Variables}.
18507 As a special kludge, if the path provided by @option{-B} is
18508 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18509 9, then it is replaced by @file{[dir/]include}.  This is to help
18510 with boot-strapping the compiler.
18512 @opindex no-canonical-prefixes
18513 @item -no-canonical-prefixes
18514 Do not expand any symbolic links, resolve references to @samp{/../}
18515 or @samp{/./}, or make the path absolute when generating a relative
18516 prefix.
18518 @opindex sysroot
18519 @item --sysroot=@var{dir}
18520 Use @var{dir} as the logical root directory for headers and libraries.
18521 For example, if the compiler normally searches for headers in
18522 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18523 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18525 If you use both this option and the @option{-isysroot} option, then
18526 the @option{--sysroot} option applies to libraries, but the
18527 @option{-isysroot} option applies to header files.
18529 The GNU linker (beginning with version 2.16) has the necessary support
18530 for this option.  If your linker does not support this option, the
18531 header file aspect of @option{--sysroot} still works, but the
18532 library aspect does not.
18534 @opindex no-sysroot-suffix
18535 @item --no-sysroot-suffix
18536 For some targets, a suffix is added to the root directory specified
18537 with @option{--sysroot}, depending on the other options used, so that
18538 headers may for example be found in
18539 @file{@var{dir}/@var{suffix}/usr/include} instead of
18540 @file{@var{dir}/usr/include}.  This option disables the addition of
18541 such a suffix.
18543 @end table
18545 @node Code Gen Options
18546 @section Options for Code Generation Conventions
18547 @cindex code generation conventions
18548 @cindex options, code generation
18549 @cindex run-time options
18551 These machine-independent options control the interface conventions
18552 used in code generation.
18554 Most of them have both positive and negative forms; the negative form
18555 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
18556 one of the forms is listed---the one that is not the default.  You
18557 can figure out the other form by either removing @samp{no-} or adding
18560 @table @gcctabopt
18561 @opindex fstack_reuse
18562 @item -fstack-reuse=@var{reuse-level}
18563 This option controls stack space reuse for user declared local/auto variables
18564 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
18565 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18566 local variables and temporaries, @samp{named_vars} enables the reuse only for
18567 user defined local variables with names, and @samp{none} disables stack reuse
18568 completely. The default value is @samp{all}. The option is needed when the
18569 program extends the lifetime of a scoped local variable or a compiler generated
18570 temporary beyond the end point defined by the language.  When a lifetime of
18571 a variable ends, and if the variable lives in memory, the optimizing compiler
18572 has the freedom to reuse its stack space with other temporaries or scoped
18573 local variables whose live range does not overlap with it. Legacy code extending
18574 local lifetime is likely to break with the stack reuse optimization.
18576 For example,
18578 @smallexample
18579    int *p;
18580    @{
18581      int local1;
18583      p = &local1;
18584      local1 = 10;
18585      ....
18586    @}
18587    @{
18588       int local2;
18589       local2 = 20;
18590       ...
18591    @}
18593    if (*p == 10)  // out of scope use of local1
18594      @{
18596      @}
18597 @end smallexample
18599 Another example:
18600 @smallexample
18602    struct A
18603    @{
18604        A(int k) : i(k), j(k) @{ @}
18605        int i;
18606        int j;
18607    @};
18609    A *ap;
18611    void foo(const A& ar)
18612    @{
18613       ap = &ar;
18614    @}
18616    void bar()
18617    @{
18618       foo(A(10)); // temp object's lifetime ends when foo returns
18620       @{
18621         A a(20);
18622         ....
18623       @}
18624       ap->i+= 10;  // ap references out of scope temp whose space
18625                    // is reused with a. What is the value of ap->i?
18626    @}
18628 @end smallexample
18630 The lifetime of a compiler generated temporary is well defined by the C++
18631 standard. When a lifetime of a temporary ends, and if the temporary lives
18632 in memory, the optimizing compiler has the freedom to reuse its stack
18633 space with other temporaries or scoped local variables whose live range
18634 does not overlap with it. However some of the legacy code relies on
18635 the behavior of older compilers in which temporaries' stack space is
18636 not reused, the aggressive stack reuse can lead to runtime errors. This
18637 option is used to control the temporary stack reuse optimization.
18639 @opindex ftrapv
18640 @item -ftrapv
18641 This option generates traps for signed overflow on addition, subtraction,
18642 multiplication operations.
18643 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18644 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18645 @option{-fwrapv} being effective.  Note that only active options override, so
18646 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18647 results in @option{-ftrapv} being effective.
18649 @opindex fwrapv
18650 @item -fwrapv
18651 This option instructs the compiler to assume that signed arithmetic
18652 overflow of addition, subtraction and multiplication wraps around
18653 using twos-complement representation.  This flag enables some optimizations
18654 and disables others.
18655 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18656 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18657 @option{-fwrapv} being effective.  Note that only active options override, so
18658 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18659 results in @option{-ftrapv} being effective.
18661 @opindex fwrapv-pointer
18662 @item -fwrapv-pointer
18663 This option instructs the compiler to assume that pointer arithmetic
18664 overflow on addition and subtraction wraps around using twos-complement
18665 representation.  This flag disables some optimizations which assume
18666 pointer overflow is invalid.
18668 @opindex fstrict-overflow
18669 @item -fstrict-overflow
18670 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18671 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18673 @opindex fexceptions
18674 @item -fexceptions
18675 Enable exception handling.  Generates extra code needed to propagate
18676 exceptions.  For some targets, this implies GCC generates frame
18677 unwind information for all functions, which can produce significant data
18678 size overhead, although it does not affect execution.  If you do not
18679 specify this option, GCC enables it by default for languages like
18680 C++ that normally require exception handling, and disables it for
18681 languages like C that do not normally require it.  However, you may need
18682 to enable this option when compiling C code that needs to interoperate
18683 properly with exception handlers written in C++.  You may also wish to
18684 disable this option if you are compiling older C++ programs that don't
18685 use exception handling.
18687 @opindex fnon-call-exceptions
18688 @item -fnon-call-exceptions
18689 Generate code that allows trapping instructions to throw exceptions.
18690 Note that this requires platform-specific runtime support that does
18691 not exist everywhere.  Moreover, it only allows @emph{trapping}
18692 instructions to throw exceptions, i.e.@: memory references or floating-point
18693 instructions.  It does not allow exceptions to be thrown from
18694 arbitrary signal handlers such as @code{SIGALRM}.  This enables
18695 @option{-fexceptions}.
18697 @opindex fdelete-dead-exceptions
18698 @item -fdelete-dead-exceptions
18699 Consider that instructions that may throw exceptions but don't otherwise
18700 contribute to the execution of the program can be optimized away.
18701 This does not affect calls to functions except those with the
18702 @code{pure} or @code{const} attributes.
18703 This option is enabled by default for the Ada and C++ compilers, as permitted by
18704 the language specifications.
18705 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18707 @opindex funwind-tables
18708 @item -funwind-tables
18709 Similar to @option{-fexceptions}, except that it just generates any needed
18710 static data, but does not affect the generated code in any other way.
18711 You normally do not need to enable this option; instead, a language processor
18712 that needs this handling enables it on your behalf.
18714 @opindex fasynchronous-unwind-tables
18715 @item -fasynchronous-unwind-tables
18716 Generate unwind table in DWARF format, if supported by target machine.  The
18717 table is exact at each instruction boundary, so it can be used for stack
18718 unwinding from asynchronous events (such as debugger or garbage collector).
18720 @opindex fno-gnu-unique
18721 @opindex fgnu-unique
18722 @item -fno-gnu-unique
18723 On systems with recent GNU assembler and C library, the C++ compiler
18724 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18725 of template static data members and static local variables in inline
18726 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18727 is necessary to avoid problems with a library used by two different
18728 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18729 therefore disagreeing with the other one about the binding of the
18730 symbol.  But this causes @code{dlclose} to be ignored for affected
18731 DSOs; if your program relies on reinitialization of a DSO via
18732 @code{dlclose} and @code{dlopen}, you can use
18733 @option{-fno-gnu-unique}.
18735 @opindex fpcc-struct-return
18736 @item -fpcc-struct-return
18737 Return ``short'' @code{struct} and @code{union} values in memory like
18738 longer ones, rather than in registers.  This convention is less
18739 efficient, but it has the advantage of allowing intercallability between
18740 GCC-compiled files and files compiled with other compilers, particularly
18741 the Portable C Compiler (pcc).
18743 The precise convention for returning structures in memory depends
18744 on the target configuration macros.
18746 Short structures and unions are those whose size and alignment match
18747 that of some integer type.
18749 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18750 switch is not binary compatible with code compiled with the
18751 @option{-freg-struct-return} switch.
18752 Use it to conform to a non-default application binary interface.
18754 @opindex freg-struct-return
18755 @item -freg-struct-return
18756 Return @code{struct} and @code{union} values in registers when possible.
18757 This is more efficient for small structures than
18758 @option{-fpcc-struct-return}.
18760 If you specify neither @option{-fpcc-struct-return} nor
18761 @option{-freg-struct-return}, GCC defaults to whichever convention is
18762 standard for the target.  If there is no standard convention, GCC
18763 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18764 the principal compiler.  In those cases, we can choose the standard, and
18765 we chose the more efficient register return alternative.
18767 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18768 switch is not binary compatible with code compiled with the
18769 @option{-fpcc-struct-return} switch.
18770 Use it to conform to a non-default application binary interface.
18772 @opindex fshort-enums
18773 @item -fshort-enums
18774 Allocate to an @code{enum} type only as many bytes as it needs for the
18775 declared range of possible values.  Specifically, the @code{enum} type
18776 is equivalent to the smallest integer type that has enough room.
18777 This option has no effect for an enumeration type with a fixed underlying
18778 type.
18780 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18781 code that is not binary compatible with code generated without that switch.
18782 Use it to conform to a non-default application binary interface.
18784 @opindex fshort-wchar
18785 @item -fshort-wchar
18786 Override the underlying type for @code{wchar_t} to be @code{short
18787 unsigned int} instead of the default for the target.  This option is
18788 useful for building programs to run under WINE@.
18790 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18791 code that is not binary compatible with code generated without that switch.
18792 Use it to conform to a non-default application binary interface.
18794 @opindex fcommon
18795 @opindex fno-common
18796 @cindex tentative definitions
18797 @item -fcommon
18798 In C code, this option controls the placement of global variables
18799 defined without an initializer, known as @dfn{tentative definitions}
18800 in the C standard.  Tentative definitions are distinct from declarations
18801 of a variable with the @code{extern} keyword, which do not allocate storage.
18803 The default is @option{-fno-common}, which specifies that the compiler places
18804 uninitialized global variables in the BSS section of the object file.
18805 This inhibits the merging of tentative definitions by the linker so you get a
18806 multiple-definition error if the same variable is accidentally defined in more
18807 than one compilation unit.
18809 The @option{-fcommon} places uninitialized global variables in a common block.
18810 This allows the linker to resolve all tentative definitions of the same variable
18811 in different compilation units to the same object, or to a non-tentative
18812 definition.  This behavior is inconsistent with C++, and on many targets implies
18813 a speed and code size penalty on global variable references.  It is mainly
18814 useful to enable legacy code to link without errors.
18816 @opindex fno-ident
18817 @opindex fident
18818 @item -fno-ident
18819 Ignore the @code{#ident} directive.
18821 @opindex finhibit-size-directive
18822 @item -finhibit-size-directive
18823 Don't output a @code{.size} assembler directive, or anything else that
18824 would cause trouble if the function is split in the middle, and the
18825 two halves are placed at locations far apart in memory.  This option is
18826 used when compiling @file{crtstuff.c}; you should not need to use it
18827 for anything else.
18829 @opindex fverbose-asm
18830 @item -fverbose-asm
18831 Put extra commentary information in the generated assembly code to
18832 make it more readable.  This option is generally only of use to those
18833 who actually need to read the generated assembly code (perhaps while
18834 debugging the compiler itself).
18836 @option{-fno-verbose-asm}, the default, causes the
18837 extra information to be omitted and is useful when comparing two assembler
18838 files.
18840 The added comments include:
18842 @itemize @bullet
18844 @item
18845 information on the compiler version and command-line options,
18847 @item
18848 the source code lines associated with the assembly instructions,
18849 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18851 @item
18852 hints on which high-level expressions correspond to
18853 the various assembly instruction operands.
18855 @end itemize
18857 For example, given this C source file:
18859 @smallexample
18860 int test (int n)
18862   int i;
18863   int total = 0;
18865   for (i = 0; i < n; i++)
18866     total += i * i;
18868   return total;
18870 @end smallexample
18872 compiling to (x86_64) assembly via @option{-S} and emitting the result
18873 direct to stdout via @option{-o} @option{-}
18875 @smallexample
18876 gcc -S test.c -fverbose-asm -Os -o -
18877 @end smallexample
18879 gives output similar to this:
18881 @smallexample
18882         .file   "test.c"
18883 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18884   [...snip...]
18885 # options passed:
18886   [...snip...]
18888         .text
18889         .globl  test
18890         .type   test, @@function
18891 test:
18892 .LFB0:
18893         .cfi_startproc
18894 # test.c:4:   int total = 0;
18895         xorl    %eax, %eax      # <retval>
18896 # test.c:6:   for (i = 0; i < n; i++)
18897         xorl    %edx, %edx      # i
18898 .L2:
18899 # test.c:6:   for (i = 0; i < n; i++)
18900         cmpl    %edi, %edx      # n, i
18901         jge     .L5     #,
18902 # test.c:7:     total += i * i;
18903         movl    %edx, %ecx      # i, tmp92
18904         imull   %edx, %ecx      # i, tmp92
18905 # test.c:6:   for (i = 0; i < n; i++)
18906         incl    %edx    # i
18907 # test.c:7:     total += i * i;
18908         addl    %ecx, %eax      # tmp92, <retval>
18909         jmp     .L2     #
18910 .L5:
18911 # test.c:10: @}
18912         ret
18913         .cfi_endproc
18914 .LFE0:
18915         .size   test, .-test
18916         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
18917         .section        .note.GNU-stack,"",@@progbits
18918 @end smallexample
18920 The comments are intended for humans rather than machines and hence the
18921 precise format of the comments is subject to change.
18923 @opindex frecord-gcc-switches
18924 @item -frecord-gcc-switches
18925 This switch causes the command line used to invoke the
18926 compiler to be recorded into the object file that is being created.
18927 This switch is only implemented on some targets and the exact format
18928 of the recording is target and binary file format dependent, but it
18929 usually takes the form of a section containing ASCII text.  This
18930 switch is related to the @option{-fverbose-asm} switch, but that
18931 switch only records information in the assembler output file as
18932 comments, so it never reaches the object file.
18933 See also @option{-grecord-gcc-switches} for another
18934 way of storing compiler options into the object file.
18936 @opindex fpic
18937 @cindex global offset table
18938 @cindex PIC
18939 @item -fpic
18940 Generate position-independent code (PIC) suitable for use in a shared
18941 library, if supported for the target machine.  Such code accesses all
18942 constant addresses through a global offset table (GOT)@.  The dynamic
18943 loader resolves the GOT entries when the program starts (the dynamic
18944 loader is not part of GCC; it is part of the operating system).  If
18945 the GOT size for the linked executable exceeds a machine-specific
18946 maximum size, you get an error message from the linker indicating that
18947 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18948 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18949 on the m68k and RS/6000.  The x86 has no such limit.)
18951 Position-independent code requires special support, and therefore works
18952 only on certain machines.  For the x86, GCC supports PIC for System V
18953 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18954 position-independent.
18956 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18957 are defined to 1.
18959 @opindex fPIC
18960 @item -fPIC
18961 If supported for the target machine, emit position-independent code,
18962 suitable for dynamic linking and avoiding any limit on the size of the
18963 global offset table.  This option makes a difference on AArch64, m68k,
18964 PowerPC and SPARC@.
18966 Position-independent code requires special support, and therefore works
18967 only on certain machines.
18969 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18970 are defined to 2.
18972 @opindex fpie
18973 @opindex fPIE
18974 @item -fpie
18975 @itemx -fPIE
18976 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18977 generated position-independent code can be only linked into executables.
18978 Usually these options are used to compile code that will be linked using
18979 the @option{-pie} GCC option.
18981 @option{-fpie} and @option{-fPIE} both define the macros
18982 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18983 for @option{-fpie} and 2 for @option{-fPIE}.
18985 @opindex fno-plt
18986 @opindex fplt
18987 @item -fno-plt
18988 Do not use the PLT for external function calls in position-independent code.
18989 Instead, load the callee address at call sites from the GOT and branch to it.
18990 This leads to more efficient code by eliminating PLT stubs and exposing
18991 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18992 PLT stubs expect the GOT pointer in a specific register, this gives more
18993 register allocation freedom to the compiler.
18994 Lazy binding requires use of the PLT; 
18995 with @option{-fno-plt} all external symbols are resolved at load time.
18997 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18998 through the PLT for specific external functions.
19000 In position-dependent code, a few targets also convert calls to
19001 functions that are marked to not use the PLT to use the GOT instead.
19003 @opindex fno-jump-tables
19004 @opindex fjump-tables
19005 @item -fno-jump-tables
19006 Do not use jump tables for switch statements even where it would be
19007 more efficient than other code generation strategies.  This option is
19008 of use in conjunction with @option{-fpic} or @option{-fPIC} for
19009 building code that forms part of a dynamic linker and cannot
19010 reference the address of a jump table.  On some targets, jump tables
19011 do not require a GOT and this option is not needed.
19013 @opindex fno-bit-tests
19014 @opindex fbit-tests
19015 @item -fno-bit-tests
19016 Do not use bit tests for switch statements even where it would be
19017 more efficient than other code generation strategies.
19019 @opindex ffixed
19020 @item -ffixed-@var{reg}
19021 Treat the register named @var{reg} as a fixed register; generated code
19022 should never refer to it (except perhaps as a stack pointer, frame
19023 pointer or in some other fixed role).
19025 @var{reg} must be the name of a register.  The register names accepted
19026 are machine-specific and are defined in the @code{REGISTER_NAMES}
19027 macro in the machine description macro file.
19029 This flag does not have a negative form, because it specifies a
19030 three-way choice.
19032 @opindex fcall-used
19033 @item -fcall-used-@var{reg}
19034 Treat the register named @var{reg} as an allocable register that is
19035 clobbered by function calls.  It may be allocated for temporaries or
19036 variables that do not live across a call.  Functions compiled this way
19037 do not save and restore the register @var{reg}.
19039 It is an error to use this flag with the frame pointer or stack pointer.
19040 Use of this flag for other registers that have fixed pervasive roles in
19041 the machine's execution model produces disastrous results.
19043 This flag does not have a negative form, because it specifies a
19044 three-way choice.
19046 @opindex fcall-saved
19047 @item -fcall-saved-@var{reg}
19048 Treat the register named @var{reg} as an allocable register saved by
19049 functions.  It may be allocated even for temporaries or variables that
19050 live across a call.  Functions compiled this way save and restore
19051 the register @var{reg} if they use it.
19053 It is an error to use this flag with the frame pointer or stack pointer.
19054 Use of this flag for other registers that have fixed pervasive roles in
19055 the machine's execution model produces disastrous results.
19057 A different sort of disaster results from the use of this flag for
19058 a register in which function values may be returned.
19060 This flag does not have a negative form, because it specifies a
19061 three-way choice.
19063 @opindex fpack-struct
19064 @item -fpack-struct[=@var{n}]
19065 Without a value specified, pack all structure members together without
19066 holes.  When a value is specified (which must be a small power of two), pack
19067 structure members according to this value, representing the maximum
19068 alignment (that is, objects with default alignment requirements larger than
19069 this are output potentially unaligned at the next fitting location.
19071 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
19072 code that is not binary compatible with code generated without that switch.
19073 Additionally, it makes the code suboptimal.
19074 Use it to conform to a non-default application binary interface.
19076 @opindex fleading-underscore
19077 @item -fleading-underscore
19078 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19079 change the way C symbols are represented in the object file.  One use
19080 is to help link with legacy assembly code.
19082 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19083 generate code that is not binary compatible with code generated without that
19084 switch.  Use it to conform to a non-default application binary interface.
19085 Not all targets provide complete support for this switch.
19087 @opindex ftls-model
19088 @item -ftls-model=@var{model}
19089 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19090 The @var{model} argument should be one of @samp{global-dynamic},
19091 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
19092 Note that the choice is subject to optimization: the compiler may use
19093 a more efficient model for symbols not visible outside of the translation
19094 unit, or if @option{-fpic} is not given on the command line.
19096 The default without @option{-fpic} is @samp{initial-exec}; with
19097 @option{-fpic} the default is @samp{global-dynamic}.
19099 @opindex ftrampolines
19100 @item -ftrampolines
19101 For targets that normally need trampolines for nested functions, always
19102 generate them instead of using descriptors.  Otherwise, for targets that
19103 do not need them, like for example HP-PA or IA-64, do nothing.
19105 A trampoline is a small piece of code that is created at run time on the
19106 stack when the address of a nested function is taken, and is used to call
19107 the nested function indirectly.  Therefore, it requires the stack to be
19108 made executable in order for the program to work properly.
19110 @option{-fno-trampolines} is enabled by default on a language by language
19111 basis to let the compiler avoid generating them, if it computes that this
19112 is safe, and replace them with descriptors.  Descriptors are made up of data
19113 only, but the generated code must be prepared to deal with them.  As of this
19114 writing, @option{-fno-trampolines} is enabled by default only for Ada.
19116 Moreover, code compiled with @option{-ftrampolines} and code compiled with
19117 @option{-fno-trampolines} are not binary compatible if nested functions are
19118 present.  This option must therefore be used on a program-wide basis and be
19119 manipulated with extreme care.
19121 For languages other than Ada, the @code{-ftrampolines} and
19122 @code{-fno-trampolines} options currently have no effect, and
19123 trampolines are always generated on platforms that need them
19124 for nested functions.
19126 @opindex ftrampoline-impl
19127 @item -ftrampoline-impl=@r{[}stack@r{|}heap@r{]}
19128 By default, trampolines are generated on stack.  However, certain platforms
19129 (such as the Apple M1) do not permit an executable stack.  Compiling with
19130 @option{-ftrampoline-impl=heap} generate calls to
19131 @code{__builtin_nested_func_ptr_created} and
19132 @code{__builtin_nested_func_ptr_deleted} in order to allocate and
19133 deallocate trampoline space on the executable heap.  These functions are
19134 implemented in libgcc, and will only be provided on specific targets:
19135 x86_64 Darwin, x86_64 and aarch64 Linux.  @emph{PLEASE NOTE}: Heap
19136 trampolines are @emph{not} guaranteed to be correctly deallocated if you
19137 @code{setjmp}, instantiate nested functions, and then @code{longjmp} back
19138 to a state prior to having allocated those nested functions.
19140 @opindex fvisibility
19141 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
19142 Set the default ELF image symbol visibility to the specified option---all
19143 symbols are marked with this unless overridden within the code.
19144 Using this feature can very substantially improve linking and
19145 load times of shared object libraries, produce more optimized
19146 code, provide near-perfect API export and prevent symbol clashes.
19147 It is @strong{strongly} recommended that you use this in any shared objects
19148 you distribute.
19150 Despite the nomenclature, @samp{default} always means public; i.e.,
19151 available to be linked against from outside the shared object.
19152 @samp{protected} and @samp{internal} are pretty useless in real-world
19153 usage so the only other commonly used option is @samp{hidden}.
19154 The default if @option{-fvisibility} isn't specified is
19155 @samp{default}, i.e., make every symbol public.
19157 A good explanation of the benefits offered by ensuring ELF
19158 symbols have the correct visibility is given by ``How To Write
19159 Shared Libraries'' by Ulrich Drepper (which can be found at
19160 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
19161 solution made possible by this option to marking things hidden when
19162 the default is public is to make the default hidden and mark things
19163 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
19164 and @code{__attribute__ ((visibility("default")))} instead of
19165 @code{__declspec(dllexport)} you get almost identical semantics with
19166 identical syntax.  This is a great boon to those working with
19167 cross-platform projects.
19169 For those adding visibility support to existing code, you may find
19170 @code{#pragma GCC visibility} of use.  This works by you enclosing
19171 the declarations you wish to set visibility for with (for example)
19172 @code{#pragma GCC visibility push(hidden)} and
19173 @code{#pragma GCC visibility pop}.
19174 Bear in mind that symbol visibility should be viewed @strong{as
19175 part of the API interface contract} and thus all new code should
19176 always specify visibility when it is not the default; i.e., declarations
19177 only for use within the local DSO should @strong{always} be marked explicitly
19178 as hidden as so to avoid PLT indirection overheads---making this
19179 abundantly clear also aids readability and self-documentation of the code.
19180 Note that due to ISO C++ specification requirements, @code{operator new} and
19181 @code{operator delete} must always be of default visibility.
19183 Be aware that headers from outside your project, in particular system
19184 headers and headers from any other library you use, may not be
19185 expecting to be compiled with visibility other than the default.  You
19186 may need to explicitly say @code{#pragma GCC visibility push(default)}
19187 before including any such headers.
19189 @code{extern} declarations are not affected by @option{-fvisibility}, so
19190 a lot of code can be recompiled with @option{-fvisibility=hidden} with
19191 no modifications.  However, this means that calls to @code{extern}
19192 functions with no explicit visibility use the PLT, so it is more
19193 effective to use @code{__attribute ((visibility))} and/or
19194 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
19195 declarations should be treated as hidden.
19197 Note that @option{-fvisibility} does affect C++ vague linkage
19198 entities. This means that, for instance, an exception class that is
19199 be thrown between DSOs must be explicitly marked with default
19200 visibility so that the @samp{type_info} nodes are unified between
19201 the DSOs.
19203 An overview of these techniques, their benefits and how to use them
19204 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
19206 @opindex fstrict-volatile-bitfields
19207 @item -fstrict-volatile-bitfields
19208 This option should be used if accesses to volatile bit-fields (or other
19209 structure fields, although the compiler usually honors those types
19210 anyway) should use a single access of the width of the
19211 field's type, aligned to a natural alignment if possible.  For
19212 example, targets with memory-mapped peripheral registers might require
19213 all such accesses to be 16 bits wide; with this flag you can
19214 declare all peripheral bit-fields as @code{unsigned short} (assuming short
19215 is 16 bits on these targets) to force GCC to use 16-bit accesses
19216 instead of, perhaps, a more efficient 32-bit access.
19218 If this option is disabled, the compiler uses the most efficient
19219 instruction.  In the previous example, that might be a 32-bit load
19220 instruction, even though that accesses bytes that do not contain
19221 any portion of the bit-field, or memory-mapped registers unrelated to
19222 the one being updated.
19224 In some cases, such as when the @code{packed} attribute is applied to a 
19225 structure field, it may not be possible to access the field with a single
19226 read or write that is correctly aligned for the target machine.  In this
19227 case GCC falls back to generating multiple accesses rather than code that 
19228 will fault or truncate the result at run time.
19230 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
19231 not allowed to touch non bit-field members.  It is therefore recommended
19232 to define all bits of the field's type as bit-field members.
19234 The default value of this option is determined by the application binary
19235 interface for the target processor.
19237 @opindex fsync-libcalls
19238 @item -fsync-libcalls
19239 This option controls whether any out-of-line instance of the @code{__sync}
19240 family of functions may be used to implement the C++11 @code{__atomic}
19241 family of functions.
19243 The default value of this option is enabled, thus the only useful form
19244 of the option is @option{-fno-sync-libcalls}.  This option is used in
19245 the implementation of the @file{libatomic} runtime library.
19247 @end table
19249 @node Developer Options
19250 @section GCC Developer Options
19251 @cindex developer options
19252 @cindex debugging GCC
19253 @cindex debug dump options
19254 @cindex dump options
19255 @cindex compilation statistics
19257 This section describes command-line options that are primarily of
19258 interest to GCC developers, including options to support compiler
19259 testing and investigation of compiler bugs and compile-time
19260 performance problems.  This includes options that produce debug dumps
19261 at various points in the compilation; that print statistics such as
19262 memory use and execution time; and that print information about GCC's
19263 configuration, such as where it searches for libraries.  You should
19264 rarely need to use any of these options for ordinary compilation and
19265 linking tasks.
19267 Many developer options that cause GCC to dump output to a file take an
19268 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19269 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19270 error.
19272 If @samp{=@var{filename}} is omitted, a default dump file name is
19273 constructed by concatenating the base dump file name, a pass number,
19274 phase letter, and pass name.  The base dump file name is the name of
19275 output file produced by the compiler if explicitly specified and not
19276 an executable; otherwise it is the source file name.
19277 The pass number is determined by the order passes are registered with
19278 the compiler's pass manager. 
19279 This is generally the same as the order of execution, but passes
19280 registered by plugins, target-specific passes, or passes that are
19281 otherwise registered late are numbered higher than the pass named
19282 @samp{final}, even if they are executed earlier.  The phase letter is
19283 one of @samp{i} (inter-procedural analysis), @samp{l}
19284 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19285 The files are created in the directory of the output file. 
19287 @table @gcctabopt
19289 @opindex fcallgraph-info
19290 @item -fcallgraph-info
19291 @itemx -fcallgraph-info=@var{MARKERS}
19292 Makes the compiler output callgraph information for the program, on a
19293 per-object-file basis.  The information is generated in the common VCG
19294 format.  It can be decorated with additional, per-node and/or per-edge
19295 information, if a list of comma-separated markers is additionally
19296 specified.  When the @code{su} marker is specified, the callgraph is
19297 decorated with stack usage information; it is equivalent to
19298 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19299 callgraph is decorated with information about dynamically allocated
19300 objects.
19302 When compiling with @option{-flto}, no callgraph information is output
19303 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19304 may generate multiple callgraph information files next to intermediate
19305 LTO output files.
19307 @opindex d
19308 @opindex fdump-rtl-@var{pass}
19309 @item -d@var{letters}
19310 @itemx -fdump-rtl-@var{pass}
19311 @itemx -fdump-rtl-@var{pass}=@var{filename}
19312 Says to make debugging dumps during compilation at times specified by
19313 @var{letters}.  This is used for debugging the RTL-based passes of the
19314 compiler.
19316 Some @option{-d@var{letters}} switches have different meaning when
19317 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19318 for information about preprocessor-specific dump options.
19320 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19321 @option{-d} option @var{letters}.  Here are the possible
19322 letters for use in @var{pass} and @var{letters}, and their meanings:
19324 @table @gcctabopt
19326 @opindex fdump-rtl-alignments
19327 @item -fdump-rtl-alignments
19328 Dump after branch alignments have been computed.
19330 @opindex fdump-rtl-asmcons
19331 @item -fdump-rtl-asmcons
19332 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19334 @opindex fdump-rtl-auto_inc_dec
19335 @item -fdump-rtl-auto_inc_dec
19336 Dump after auto-inc-dec discovery.  This pass is only run on
19337 architectures that have auto inc or auto dec instructions.
19339 @opindex fdump-rtl-barriers
19340 @item -fdump-rtl-barriers
19341 Dump after cleaning up the barrier instructions.
19343 @opindex fdump-rtl-bbpart
19344 @item -fdump-rtl-bbpart
19345 Dump after partitioning hot and cold basic blocks.
19347 @opindex fdump-rtl-bbro
19348 @item -fdump-rtl-bbro
19349 Dump after block reordering.
19351 @opindex fdump-rtl-btl2
19352 @opindex fdump-rtl-btl2
19353 @item -fdump-rtl-btl1
19354 @itemx -fdump-rtl-btl2
19355 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19356 after the two branch
19357 target load optimization passes.
19359 @opindex fdump-rtl-bypass
19360 @item -fdump-rtl-bypass
19361 Dump after jump bypassing and control flow optimizations.
19363 @opindex fdump-rtl-combine
19364 @item -fdump-rtl-combine
19365 Dump after the RTL instruction combination pass.
19367 @opindex fdump-rtl-compgotos
19368 @item -fdump-rtl-compgotos
19369 Dump after duplicating the computed gotos.
19371 @opindex fdump-rtl-ce1
19372 @opindex fdump-rtl-ce2
19373 @opindex fdump-rtl-ce3
19374 @item -fdump-rtl-ce1
19375 @itemx -fdump-rtl-ce2
19376 @itemx -fdump-rtl-ce3
19377 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19378 @option{-fdump-rtl-ce3} enable dumping after the three
19379 if conversion passes.
19381 @opindex fdump-rtl-cprop_hardreg
19382 @item -fdump-rtl-cprop_hardreg
19383 Dump after hard register copy propagation.
19385 @opindex fdump-rtl-csa
19386 @item -fdump-rtl-csa
19387 Dump after combining stack adjustments.
19389 @opindex fdump-rtl-cse1
19390 @opindex fdump-rtl-cse2
19391 @item -fdump-rtl-cse1
19392 @itemx -fdump-rtl-cse2
19393 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19394 the two common subexpression elimination passes.
19396 @opindex fdump-rtl-dce
19397 @item -fdump-rtl-dce
19398 Dump after the standalone dead code elimination passes.
19400 @opindex fdump-rtl-dbr
19401 @item -fdump-rtl-dbr
19402 Dump after delayed branch scheduling.
19404 @opindex fdump-rtl-dce1
19405 @opindex fdump-rtl-dce2
19406 @item -fdump-rtl-dce1
19407 @itemx -fdump-rtl-dce2
19408 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19409 the two dead store elimination passes.
19411 @opindex fdump-rtl-eh
19412 @item -fdump-rtl-eh
19413 Dump after finalization of EH handling code.
19415 @opindex fdump-rtl-eh_ranges
19416 @item -fdump-rtl-eh_ranges
19417 Dump after conversion of EH handling range regions.
19419 @opindex fdump-rtl-expand
19420 @item -fdump-rtl-expand
19421 Dump after RTL generation.
19423 @opindex fdump-rtl-fwprop1
19424 @opindex fdump-rtl-fwprop2
19425 @item -fdump-rtl-fwprop1
19426 @itemx -fdump-rtl-fwprop2
19427 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19428 dumping after the two forward propagation passes.
19430 @opindex fdump-rtl-gcse1
19431 @opindex fdump-rtl-gcse2
19432 @item -fdump-rtl-gcse1
19433 @itemx -fdump-rtl-gcse2
19434 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19435 after global common subexpression elimination.
19437 @opindex fdump-rtl-init-regs
19438 @item -fdump-rtl-init-regs
19439 Dump after the initialization of the registers.
19441 @opindex fdump-rtl-initvals
19442 @item -fdump-rtl-initvals
19443 Dump after the computation of the initial value sets.
19445 @opindex fdump-rtl-into_cfglayout
19446 @item -fdump-rtl-into_cfglayout
19447 Dump after converting to cfglayout mode.
19449 @opindex fdump-rtl-ira
19450 @item -fdump-rtl-ira
19451 Dump after iterated register allocation.
19453 @opindex fdump-rtl-jump
19454 @item -fdump-rtl-jump
19455 Dump after the second jump optimization.
19457 @opindex fdump-rtl-loop2
19458 @item -fdump-rtl-loop2
19459 @option{-fdump-rtl-loop2} enables dumping after the rtl
19460 loop optimization passes.
19462 @opindex fdump-rtl-mach
19463 @item -fdump-rtl-mach
19464 Dump after performing the machine dependent reorganization pass, if that
19465 pass exists.
19467 @opindex fdump-rtl-mode_sw
19468 @item -fdump-rtl-mode_sw
19469 Dump after removing redundant mode switches.
19471 @opindex fdump-rtl-rnreg
19472 @item -fdump-rtl-rnreg
19473 Dump after register renumbering.
19475 @opindex fdump-rtl-outof_cfglayout
19476 @item -fdump-rtl-outof_cfglayout
19477 Dump after converting from cfglayout mode.
19479 @opindex fdump-rtl-peephole2
19480 @item -fdump-rtl-peephole2
19481 Dump after the peephole pass.
19483 @opindex fdump-rtl-postreload
19484 @item -fdump-rtl-postreload
19485 Dump after post-reload optimizations.
19487 @opindex fdump-rtl-pro_and_epilogue
19488 @item -fdump-rtl-pro_and_epilogue
19489 Dump after generating the function prologues and epilogues.
19491 @opindex fdump-rtl-sched1
19492 @opindex fdump-rtl-sched2
19493 @item -fdump-rtl-sched1
19494 @itemx -fdump-rtl-sched2
19495 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19496 after the basic block scheduling passes.
19498 @opindex fdump-rtl-ree
19499 @item -fdump-rtl-ree
19500 Dump after sign/zero extension elimination.
19502 @opindex fdump-rtl-seqabstr
19503 @item -fdump-rtl-seqabstr
19504 Dump after common sequence discovery.
19506 @opindex fdump-rtl-shorten
19507 @item -fdump-rtl-shorten
19508 Dump after shortening branches.
19510 @opindex fdump-rtl-sibling
19511 @item -fdump-rtl-sibling
19512 Dump after sibling call optimizations.
19514 @opindex fdump-rtl-split1
19515 @opindex fdump-rtl-split2
19516 @opindex fdump-rtl-split3
19517 @opindex fdump-rtl-split4
19518 @opindex fdump-rtl-split5
19519 @item -fdump-rtl-split1
19520 @itemx -fdump-rtl-split2
19521 @itemx -fdump-rtl-split3
19522 @itemx -fdump-rtl-split4
19523 @itemx -fdump-rtl-split5
19524 These options enable dumping after five rounds of
19525 instruction splitting.
19527 @opindex fdump-rtl-sms
19528 @item -fdump-rtl-sms
19529 Dump after modulo scheduling.  This pass is only run on some
19530 architectures.
19532 @opindex fdump-rtl-stack
19533 @item -fdump-rtl-stack
19534 Dump after conversion from GCC's ``flat register file'' registers to the
19535 x87's stack-like registers.  This pass is only run on x86 variants.
19537 @opindex fdump-rtl-subreg1
19538 @opindex fdump-rtl-subreg2
19539 @item -fdump-rtl-subreg1
19540 @itemx -fdump-rtl-subreg2
19541 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19542 the two subreg expansion passes.
19544 @opindex fdump-rtl-unshare
19545 @item -fdump-rtl-unshare
19546 Dump after all rtl has been unshared.
19548 @opindex fdump-rtl-vartrack
19549 @item -fdump-rtl-vartrack
19550 Dump after variable tracking.
19552 @opindex fdump-rtl-vregs
19553 @item -fdump-rtl-vregs
19554 Dump after converting virtual registers to hard registers.
19556 @opindex fdump-rtl-web
19557 @item -fdump-rtl-web
19558 Dump after live range splitting.
19560 @opindex fdump-rtl-regclass
19561 @opindex fdump-rtl-subregs_of_mode_init
19562 @opindex fdump-rtl-subregs_of_mode_finish
19563 @opindex fdump-rtl-dfinit
19564 @opindex fdump-rtl-dfinish
19565 @item -fdump-rtl-regclass
19566 @itemx -fdump-rtl-subregs_of_mode_init
19567 @itemx -fdump-rtl-subregs_of_mode_finish
19568 @itemx -fdump-rtl-dfinit
19569 @itemx -fdump-rtl-dfinish
19570 These dumps are defined but always produce empty files.
19572 @opindex da
19573 @opindex fdump-rtl-all
19574 @item -da
19575 @itemx -fdump-rtl-all
19576 Produce all the dumps listed above.
19578 @opindex dA
19579 @item -dA
19580 Annotate the assembler output with miscellaneous debugging information.
19582 @opindex dD
19583 @item -dD
19584 Dump all macro definitions, at the end of preprocessing, in addition to
19585 normal output.
19587 @opindex dH
19588 @item -dH
19589 Produce a core dump whenever an error occurs.
19591 @opindex dp
19592 @item -dp
19593 Annotate the assembler output with a comment indicating which
19594 pattern and alternative is used.  The length and cost of each instruction are
19595 also printed.
19597 @opindex dP
19598 @item -dP
19599 Dump the RTL in the assembler output as a comment before each instruction.
19600 Also turns on @option{-dp} annotation.
19602 @opindex dx
19603 @item -dx
19604 Just generate RTL for a function instead of compiling it.  Usually used
19605 with @option{-fdump-rtl-expand}.
19606 @end table
19608 @opindex fdump-debug
19609 @item -fdump-debug
19610 Dump debugging information generated during the debug
19611 generation phase.
19613 @opindex fdump-earlydebug
19614 @item -fdump-earlydebug
19615 Dump debugging information generated during the early debug
19616 generation phase.
19618 @opindex fdump-noaddr
19619 @item -fdump-noaddr
19620 When doing debugging dumps, suppress address output.  This makes it more
19621 feasible to use diff on debugging dumps for compiler invocations with
19622 different compiler binaries and/or different
19623 text / bss / data / heap / stack / dso start locations.
19625 @opindex freport-bug
19626 @item -freport-bug
19627 Collect and dump debug information into a temporary file if an
19628 internal compiler error (ICE) occurs.
19630 @opindex fdump-unnumbered
19631 @item -fdump-unnumbered
19632 When doing debugging dumps, suppress instruction numbers and address output.
19633 This makes it more feasible to use diff on debugging dumps for compiler
19634 invocations with different options, in particular with and without
19635 @option{-g}.
19637 @opindex fdump-unnumbered-links
19638 @item -fdump-unnumbered-links
19639 When doing debugging dumps (see @option{-d} option above), suppress
19640 instruction numbers for the links to the previous and next instructions
19641 in a sequence.
19643 @opindex fdump-ipa
19644 @item -fdump-ipa-@var{switch}
19645 @itemx -fdump-ipa-@var{switch}-@var{options}
19646 Control the dumping at various stages of inter-procedural analysis
19647 language tree to a file.  The file name is generated by appending a
19648 switch specific suffix to the source file name, and the file is created
19649 in the same directory as the output file.  The following dumps are
19650 possible:
19652 @table @samp
19653 @item all
19654 Enables all inter-procedural analysis dumps.
19656 @item cgraph
19657 Dumps information about call-graph optimization, unused function removal,
19658 and inlining decisions.
19660 @item inline
19661 Dump after function inlining.
19663 @end table
19665 Additionally, the options @option{-optimized}, @option{-missed},
19666 @option{-note}, and @option{-all} can be provided, with the same meaning
19667 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19669 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19670 information on callsites that were inlined, along with callsites
19671 that were not inlined.
19673 By default, the dump will contain messages about successful
19674 optimizations (equivalent to @option{-optimized}) together with
19675 low-level details about the analysis.
19677 @opindex fdump-lang
19678 @item -fdump-lang
19679 Dump language-specific information.  The file name is made by appending
19680 @file{.lang} to the source file name.
19682 @opindex fdump-lang-all
19683 @opindex fdump-lang
19684 @item -fdump-lang-all
19685 @itemx -fdump-lang-@var{switch}
19686 @itemx -fdump-lang-@var{switch}-@var{options}
19687 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19688 Control the dumping of language-specific information.  The @var{options}
19689 and @var{filename} portions behave as described in the
19690 @option{-fdump-tree} option.  The following @var{switch} values are
19691 accepted:
19693 @table @samp
19694 @item all
19696 Enable all language-specific dumps.
19698 @item class
19699 Dump class hierarchy information.  Virtual table information is emitted
19700 unless '@option{slim}' is specified.  This option is applicable to C++ only.
19702 @item module
19703 Dump module information.  Options @option{lineno} (locations),
19704 @option{graph} (reachability), @option{blocks} (clusters),
19705 @option{uid} (serialization), @option{alias} (mergeable),
19706 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19707 (macros) may provide additional information.  This option is
19708 applicable to C++ only.
19710 @item raw
19711 Dump the raw internal tree data.  This option is applicable to C++ only.
19713 @end table
19715 @opindex fdump-passes
19716 @item -fdump-passes
19717 Print on @file{stderr} the list of optimization passes that are turned
19718 on and off by the current command-line options.
19720 @opindex fdump-statistics
19721 @item -fdump-statistics-@var{option}
19722 Enable and control dumping of pass statistics in a separate file.  The
19723 file name is generated by appending a suffix ending in
19724 @samp{.statistics} to the source file name, and the file is created in
19725 the same directory as the output file.  If the @samp{-@var{option}}
19726 form is used, @samp{-stats} causes counters to be summed over the
19727 whole compilation unit while @samp{-details} dumps every event as
19728 the passes generate them.  The default with no option is to sum
19729 counters for each function compiled.
19731 @opindex fdump-tree-all
19732 @opindex fdump-tree
19733 @item -fdump-tree-all
19734 @itemx -fdump-tree-@var{switch}
19735 @itemx -fdump-tree-@var{switch}-@var{options}
19736 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19737 Control the dumping at various stages of processing the intermediate
19738 language tree to a file.  If the @samp{-@var{options}}
19739 form is used, @var{options} is a list of @samp{-} separated options
19740 which control the details of the dump.  Not all options are applicable
19741 to all dumps; those that are not meaningful are ignored.  The
19742 following options are available
19744 @table @samp
19745 @item address
19746 Print the address of each node.  Usually this is not meaningful as it
19747 changes according to the environment and source file.  Its primary use
19748 is for tying up a dump file with a debug environment.
19749 @item asmname
19750 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19751 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
19752 use working backward from mangled names in the assembly file.
19753 @item slim
19754 When dumping front-end intermediate representations, inhibit dumping
19755 of members of a scope or body of a function merely because that scope
19756 has been reached.  Only dump such items when they are directly reachable
19757 by some other path.
19759 When dumping pretty-printed trees, this option inhibits dumping the
19760 bodies of control structures.
19762 When dumping RTL, print the RTL in slim (condensed) form instead of
19763 the default LISP-like representation.
19764 @item raw
19765 Print a raw representation of the tree.  By default, trees are
19766 pretty-printed into a C-like representation.
19767 @item details
19768 Enable more detailed dumps (not honored by every dump option). Also
19769 include information from the optimization passes.
19770 @item stats
19771 Enable dumping various statistics about the pass (not honored by every dump
19772 option).
19773 @item blocks
19774 Enable showing basic block boundaries (disabled in raw dumps).
19775 @item graph
19776 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19777 dump a representation of the control flow graph suitable for viewing with
19778 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
19779 the file is pretty-printed as a subgraph, so that GraphViz can render them
19780 all in a single plot.
19782 This option currently only works for RTL dumps, and the RTL is always
19783 dumped in slim form.
19784 @item vops
19785 Enable showing virtual operands for every statement.
19786 @item lineno
19787 Enable showing line numbers for statements.
19788 @item uid
19789 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19790 @item verbose
19791 Enable showing the tree dump for each statement.
19792 @item eh
19793 Enable showing the EH region number holding each statement.
19794 @item scev
19795 Enable showing scalar evolution analysis details.
19796 @item optimized
19797 Enable showing optimization information (only available in certain
19798 passes).
19799 @item missed
19800 Enable showing missed optimization information (only available in certain
19801 passes).
19802 @item note
19803 Enable other detailed optimization information (only available in
19804 certain passes).
19805 @item all
19806 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19807 and @option{lineno}.
19808 @item optall
19809 Turn on all optimization options, i.e., @option{optimized},
19810 @option{missed}, and @option{note}.
19811 @end table
19813 To determine what tree dumps are available or find the dump for a pass
19814 of interest follow the steps below.
19816 @enumerate
19817 @item
19818 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19819 look for a code that corresponds to the pass you are interested in.
19820 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19821 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19822 The number at the end distinguishes distinct invocations of the same pass.
19823 @item
19824 To enable the creation of the dump file, append the pass code to
19825 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
19826 to enable the dump from the Early Value Range Propagation pass, invoke
19827 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
19828 specify the name of the dump file.  If you don't specify one, GCC
19829 creates as described below.
19830 @item
19831 Find the pass dump in a file whose name is composed of three components
19832 separated by a period: the name of the source file GCC was invoked to
19833 compile, a numeric suffix indicating the pass number followed by the
19834 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19835 and finally the pass code.  For example, the Early VRP pass dump might
19836 be in a file named @file{myfile.c.038t.evrp} in the current working
19837 directory.  Note that the numeric codes are not stable and may change
19838 from one version of GCC to another.
19839 @end enumerate
19841 @opindex fopt-info
19842 @item -fopt-info
19843 @itemx -fopt-info-@var{options}
19844 @itemx -fopt-info-@var{options}=@var{filename}
19845 Controls optimization dumps from various optimization passes. If the
19846 @samp{-@var{options}} form is used, @var{options} is a list of
19847 @samp{-} separated option keywords to select the dump details and
19848 optimizations.  
19850 The @var{options} can be divided into three groups:
19851 @enumerate
19852 @item
19853 options describing what kinds of messages should be emitted,
19854 @item
19855 options describing the verbosity of the dump, and
19856 @item
19857 options describing which optimizations should be included.
19858 @end enumerate
19859 The options from each group can be freely mixed as they are
19860 non-overlapping. However, in case of any conflicts,
19861 the later options override the earlier options on the command
19862 line. 
19864 The following options control which kinds of messages should be emitted:
19866 @table @samp
19867 @item optimized
19868 Print information when an optimization is successfully applied. It is
19869 up to a pass to decide which information is relevant. For example, the
19870 vectorizer passes print the source location of loops which are
19871 successfully vectorized.
19872 @item missed
19873 Print information about missed optimizations. Individual passes
19874 control which information to include in the output. 
19875 @item note
19876 Print verbose information about optimizations, such as certain
19877 transformations, more detailed messages about decisions etc.
19878 @item all
19879 Print detailed optimization information. This includes
19880 @samp{optimized}, @samp{missed}, and @samp{note}.
19881 @end table
19883 The following option controls the dump verbosity:
19885 @table @samp
19886 @item internals
19887 By default, only ``high-level'' messages are emitted. This option enables
19888 additional, more detailed, messages, which are likely to only be of interest
19889 to GCC developers.
19890 @end table
19892 One or more of the following option keywords can be used to describe a
19893 group of optimizations:
19895 @table @samp
19896 @item ipa
19897 Enable dumps from all interprocedural optimizations.
19898 @item loop
19899 Enable dumps from all loop optimizations.
19900 @item inline
19901 Enable dumps from all inlining optimizations.
19902 @item omp
19903 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19904 @item vec
19905 Enable dumps from all vectorization optimizations.
19906 @item optall
19907 Enable dumps from all optimizations. This is a superset of
19908 the optimization groups listed above.
19909 @end table
19911 If @var{options} is
19912 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19913 about successful optimizations from all the passes, omitting messages
19914 that are treated as ``internals''.
19916 If the @var{filename} is provided, then the dumps from all the
19917 applicable optimizations are concatenated into the @var{filename}.
19918 Otherwise the dump is output onto @file{stderr}. Though multiple
19919 @option{-fopt-info} options are accepted, only one of them can include
19920 a @var{filename}. If other filenames are provided then all but the
19921 first such option are ignored.
19923 Note that the output @var{filename} is overwritten
19924 in case of multiple translation units. If a combined output from
19925 multiple translation units is desired, @file{stderr} should be used
19926 instead.
19928 In the following example, the optimization info is output to
19929 @file{stderr}:
19931 @smallexample
19932 gcc -O3 -fopt-info
19933 @end smallexample
19935 This example:
19936 @smallexample
19937 gcc -O3 -fopt-info-missed=missed.all
19938 @end smallexample
19940 @noindent
19941 outputs missed optimization report from all the passes into
19942 @file{missed.all}, and this one:
19944 @smallexample
19945 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19946 @end smallexample
19948 @noindent
19949 prints information about missed optimization opportunities from
19950 vectorization passes on @file{stderr}.  
19951 Note that @option{-fopt-info-vec-missed} is equivalent to 
19952 @option{-fopt-info-missed-vec}.  The order of the optimization group
19953 names and message types listed after @option{-fopt-info} does not matter.
19955 As another example,
19956 @smallexample
19957 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19958 @end smallexample
19960 @noindent
19961 outputs information about missed optimizations as well as
19962 optimized locations from all the inlining passes into
19963 @file{inline.txt}.
19965 Finally, consider:
19967 @smallexample
19968 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19969 @end smallexample
19971 @noindent
19972 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19973 in conflict since only one output file is allowed. In this case, only
19974 the first option takes effect and the subsequent options are
19975 ignored. Thus only @file{vec.miss} is produced which contains
19976 dumps from the vectorizer about missed opportunities.
19978 @opindex fsave-optimization-record
19979 @item -fsave-optimization-record
19980 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19981 were performed, for those optimizations that support @option{-fopt-info}.
19983 This option is experimental and the format of the data within the
19984 compressed JSON file is subject to change.
19986 It is roughly equivalent to a machine-readable version of
19987 @option{-fopt-info-all}, as a collection of messages with source file,
19988 line number and column number, with the following additional data for
19989 each message:
19991 @itemize @bullet
19993 @item
19994 the execution count of the code being optimized, along with metadata about
19995 whether this was from actual profile data, or just an estimate, allowing
19996 consumers to prioritize messages by code hotness,
19998 @item
19999 the function name of the code being optimized, where applicable,
20001 @item
20002 the ``inlining chain'' for the code being optimized, so that when
20003 a function is inlined into several different places (which might
20004 themselves be inlined), the reader can distinguish between the copies,
20006 @item
20007 objects identifying those parts of the message that refer to expressions,
20008 statements or symbol-table nodes, which of these categories they are, and,
20009 when available, their source code location,
20011 @item
20012 the GCC pass that emitted the message, and
20014 @item
20015 the location in GCC's own code from which the message was emitted
20017 @end itemize
20019 Additionally, some messages are logically nested within other
20020 messages, reflecting implementation details of the optimization
20021 passes.
20023 @opindex fsched-verbose
20024 @item -fsched-verbose=@var{n}
20025 On targets that use instruction scheduling, this option controls the
20026 amount of debugging output the scheduler prints to the dump files.
20028 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
20029 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
20030 For @var{n} greater than one, it also output basic block probabilities,
20031 detailed ready list information and unit/insn info.  For @var{n} greater
20032 than two, it includes RTL at abort point, control-flow and regions info.
20033 And for @var{n} over four, @option{-fsched-verbose} also includes
20034 dependence info.
20038 @opindex fdisable-
20039 @opindex fenable-
20040 @item -fenable-@var{kind}-@var{pass}
20041 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
20043 This is a set of options that are used to explicitly disable/enable
20044 optimization passes.  These options are intended for use for debugging GCC.
20045 Compiler users should use regular options for enabling/disabling
20046 passes instead.
20048 @table @gcctabopt
20050 @item -fdisable-ipa-@var{pass}
20051 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
20052 statically invoked in the compiler multiple times, the pass name should be
20053 appended with a sequential number starting from 1.
20055 @item -fdisable-rtl-@var{pass}
20056 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
20057 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20058 statically invoked in the compiler multiple times, the pass name should be
20059 appended with a sequential number starting from 1.  @var{range-list} is a 
20060 comma-separated list of function ranges or assembler names.  Each range is a number
20061 pair separated by a colon.  The range is inclusive in both ends.  If the range
20062 is trivial, the number pair can be simplified as a single number.  If the
20063 function's call graph node's @var{uid} falls within one of the specified ranges,
20064 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
20065 function header of a dump file, and the pass names can be dumped by using
20066 option @option{-fdump-passes}.
20068 @item -fdisable-tree-@var{pass}
20069 @itemx -fdisable-tree-@var{pass}=@var{range-list}
20070 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
20071 option arguments.
20073 @item -fenable-ipa-@var{pass}
20074 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
20075 statically invoked in the compiler multiple times, the pass name should be
20076 appended with a sequential number starting from 1.
20078 @item -fenable-rtl-@var{pass}
20079 @itemx -fenable-rtl-@var{pass}=@var{range-list}
20080 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
20081 description and examples.
20083 @item -fenable-tree-@var{pass}
20084 @itemx -fenable-tree-@var{pass}=@var{range-list}
20085 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
20086 of option arguments.
20088 @end table
20090 Here are some examples showing uses of these options.
20092 @smallexample
20094 # disable ccp1 for all functions
20095    -fdisable-tree-ccp1
20096 # disable complete unroll for function whose cgraph node uid is 1
20097    -fenable-tree-cunroll=1
20098 # disable gcse2 for functions at the following ranges [1,1],
20099 # [300,400], and [400,1000]
20100 # disable gcse2 for functions foo and foo2
20101    -fdisable-rtl-gcse2=foo,foo2
20102 # disable early inlining
20103    -fdisable-tree-einline
20104 # disable ipa inlining
20105    -fdisable-ipa-inline
20106 # enable tree full unroll
20107    -fenable-tree-unroll
20109 @end smallexample
20111 @opindex fchecking
20112 @opindex fno-checking
20113 @item -fchecking
20114 @itemx -fchecking=@var{n}
20115 Enable internal consistency checking.  The default depends on
20116 the compiler configuration.  @option{-fchecking=2} enables further
20117 internal consistency checking that might affect code generation.
20119 @opindex frandom-seed
20120 @item -frandom-seed=@var{string}
20121 This option provides a seed that GCC uses in place of
20122 random numbers in generating certain symbol names
20123 that have to be different in every compiled file.  It is also used to
20124 place unique stamps in coverage data files and the object files that
20125 produce them.  You can use the @option{-frandom-seed} option to produce
20126 reproducibly identical object files.
20128 The @var{string} can either be a number (decimal, octal or hex) or an
20129 arbitrary string (in which case it's converted to a number by
20130 computing CRC32).
20132 The @var{string} should be different for every file you compile.
20134 @opindex save-temps
20135 @item -save-temps
20136 Store the usual ``temporary'' intermediate files permanently; name them
20137 as auxiliary output files, as specified described under
20138 @option{-dumpbase} and @option{-dumpdir}.
20140 When used in combination with the @option{-x} command-line option,
20141 @option{-save-temps} is sensible enough to avoid overwriting an
20142 input source file with the same extension as an intermediate file.
20143 The corresponding intermediate file may be obtained by renaming the
20144 source file before using @option{-save-temps}.
20146 @opindex save-temps=cwd
20147 @item -save-temps=cwd
20148 Equivalent to @option{-save-temps -dumpdir ./}.
20150 @opindex save-temps=obj
20151 @item -save-temps=obj
20152 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
20153 @file{outdir/} is the directory of the output file specified after the
20154 @option{-o} option, including any directory separators.  If the
20155 @option{-o} option is not used, the @option{-save-temps=obj} switch
20156 behaves like @option{-save-temps=cwd}.
20158 @opindex time
20159 @item -time@r{[}=@var{file}@r{]}
20160 Report the CPU time taken by each subprocess in the compilation
20161 sequence.  For C source files, this is the compiler proper and assembler
20162 (plus the linker if linking is done).
20164 Without the specification of an output file, the output looks like this:
20166 @smallexample
20167 # cc1 0.12 0.01
20168 # as 0.00 0.01
20169 @end smallexample
20171 The first number on each line is the ``user time'', that is time spent
20172 executing the program itself.  The second number is ``system time'',
20173 time spent executing operating system routines on behalf of the program.
20174 Both numbers are in seconds.
20176 With the specification of an output file, the output is appended to the
20177 named file, and it looks like this:
20179 @smallexample
20180 0.12 0.01 cc1 @var{options}
20181 0.00 0.01 as @var{options}
20182 @end smallexample
20184 The ``user time'' and the ``system time'' are moved before the program
20185 name, and the options passed to the program are displayed, so that one
20186 can later tell what file was being compiled, and with which options.
20188 @opindex fdump-final-insns
20189 @item -fdump-final-insns@r{[}=@var{file}@r{]}
20190 Dump the final internal representation (RTL) to @var{file}.  If the
20191 optional argument is omitted (or if @var{file} is @code{.}), the name
20192 of the dump file is determined by appending @code{.gkd} to the
20193 dump base name, see @option{-dumpbase}.
20195 @opindex fcompare-debug
20196 @opindex fno-compare-debug
20197 @item -fcompare-debug@r{[}=@var{opts}@r{]}
20198 If no error occurs during compilation, run the compiler a second time,
20199 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
20200 passed to the second compilation.  Dump the final internal
20201 representation in both compilations, and print an error if they differ.
20203 If the equal sign is omitted, the default @option{-gtoggle} is used.
20205 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
20206 and nonzero, implicitly enables @option{-fcompare-debug}.  If
20207 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
20208 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
20209 is used.
20211 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
20212 is equivalent to @option{-fno-compare-debug}, which disables the dumping
20213 of the final representation and the second compilation, preventing even
20214 @env{GCC_COMPARE_DEBUG} from taking effect.
20216 To verify full coverage during @option{-fcompare-debug} testing, set
20217 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
20218 which GCC rejects as an invalid option in any actual compilation
20219 (rather than preprocessing, assembly or linking).  To get just a
20220 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
20221 not overridden} will do.
20223 @opindex fcompare-debug-second
20224 @item -fcompare-debug-second
20225 This option is implicitly passed to the compiler for the second
20226 compilation requested by @option{-fcompare-debug}, along with options to
20227 silence warnings, and omitting other options that would cause the compiler
20228 to produce output to files or to standard output as a side effect.  Dump
20229 files and preserved temporary files are renamed so as to contain the
20230 @code{.gk} additional extension during the second compilation, to avoid
20231 overwriting those generated by the first.
20233 When this option is passed to the compiler driver, it causes the
20234 @emph{first} compilation to be skipped, which makes it useful for little
20235 other than debugging the compiler proper.
20237 @opindex gtoggle
20238 @item -gtoggle
20239 Turn off generation of debug info, if leaving out this option
20240 generates it, or turn it on at level 2 otherwise.  The position of this
20241 argument in the command line does not matter; it takes effect after all
20242 other options are processed, and it does so only once, no matter how
20243 many times it is given.  This is mainly intended to be used with
20244 @option{-fcompare-debug}.
20246 @opindex fvar-tracking-assignments-toggle
20247 @opindex fno-var-tracking-assignments-toggle
20248 @item -fvar-tracking-assignments-toggle
20249 Toggle @option{-fvar-tracking-assignments}, in the same way that
20250 @option{-gtoggle} toggles @option{-g}.
20252 @opindex Q
20253 @item -Q
20254 Makes the compiler print out each function name as it is compiled, and
20255 print some statistics about each pass when it finishes.
20257 @opindex ftime-report
20258 @item -ftime-report
20259 Makes the compiler print some statistics to stderr about the time consumed
20260 by each pass when it finishes.
20262 If SARIF output of diagnostics was requested via
20263 @option{-fdiagnostics-format=sarif-file} or
20264 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20265 information is instead emitted in JSON form as part of SARIF output.  The
20266 precise format of this JSON data is subject to change, and the values may
20267 not exactly match those emitted to stderr due to being written out at a
20268 slightly different place within the compiler.
20270 @opindex ftime-report-details
20271 @item -ftime-report-details
20272 Record the time consumed by infrastructure parts separately for each pass.
20274 @opindex fira-verbose
20275 @item -fira-verbose=@var{n}
20276 Control the verbosity of the dump file for the integrated register allocator.
20277 The default value is 5.  If the value @var{n} is greater or equal to 10,
20278 the dump output is sent to stderr using the same format as @var{n} minus 10.
20280 @opindex flto-report
20281 @item -flto-report
20282 Prints a report with internal details on the workings of the link-time
20283 optimizer.  The contents of this report vary from version to version.
20284 It is meant to be useful to GCC developers when processing object
20285 files in LTO mode (via @option{-flto}).
20287 Disabled by default.
20289 @opindex flto-report-wpa
20290 @item -flto-report-wpa
20291 Like @option{-flto-report}, but only print for the WPA phase of link-time
20292 optimization.
20294 @opindex fmem-report
20295 @item -fmem-report
20296 Makes the compiler print some statistics about permanent memory
20297 allocation when it finishes.
20299 @opindex fmem-report-wpa
20300 @item -fmem-report-wpa
20301 Makes the compiler print some statistics about permanent memory
20302 allocation for the WPA phase only.
20304 @opindex fpre-ipa-mem-report
20305 @opindex fpost-ipa-mem-report
20306 @item -fpre-ipa-mem-report
20307 @item -fpost-ipa-mem-report
20308 Makes the compiler print some statistics about permanent memory
20309 allocation before or after interprocedural optimization.
20311 @opindex fmultiflags
20312 @item -fmultiflags
20313 This option enables multilib-aware @code{TFLAGS} to be used to build
20314 target libraries with options different from those the compiler is
20315 configured to use by default, through the use of specs (@xref{Spec
20316 Files}) set up by compiler internals, by the target, or by builders at
20317 configure time.
20319 Like @code{TFLAGS}, this allows the target libraries to be built for
20320 portable baseline environments, while the compiler defaults to more
20321 demanding ones.  That's useful because users can easily override the
20322 defaults the compiler is configured to use to build their own programs,
20323 if the defaults are not ideal for their target environment, whereas
20324 rebuilding the runtime libraries is usually not as easy or desirable.
20326 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20327 selected for different multilibs.  The way to accomplish that is to
20328 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20329 @samp{--with-specs=%@{fmultiflags:...@}}.
20331 This option is discarded by the driver once it's done processing driver
20332 self spec.
20334 It is also useful to check that @code{TFLAGS} are being used to build
20335 all target libraries, by configuring a non-bootstrap compiler
20336 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20337 the compiler and target libraries.
20339 @opindex fprofile-report
20340 @item -fprofile-report
20341 Makes the compiler print some statistics about consistency of the
20342 (estimated) profile and effect of individual passes.
20344 @opindex fstack-usage
20345 @item -fstack-usage
20346 Makes the compiler output stack usage information for the program, on a
20347 per-function basis.  The filename for the dump is made by appending
20348 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20349 the output file, if explicitly specified and it is not an executable,
20350 otherwise it is the basename of the source file.  An entry is made up
20351 of three fields:
20353 @itemize
20354 @item
20355 The name of the function.
20356 @item
20357 A number of bytes.
20358 @item
20359 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20360 @end itemize
20362 The qualifier @code{static} means that the function manipulates the stack
20363 statically: a fixed number of bytes are allocated for the frame on function
20364 entry and released on function exit; no stack adjustments are otherwise made
20365 in the function.  The second field is this fixed number of bytes.
20367 The qualifier @code{dynamic} means that the function manipulates the stack
20368 dynamically: in addition to the static allocation described above, stack
20369 adjustments are made in the body of the function, for example to push/pop
20370 arguments around function calls.  If the qualifier @code{bounded} is also
20371 present, the amount of these adjustments is bounded at compile time and
20372 the second field is an upper bound of the total amount of stack used by
20373 the function.  If it is not present, the amount of these adjustments is
20374 not bounded at compile time and the second field only represents the
20375 bounded part.
20377 @opindex fstats
20378 @item -fstats
20379 Emit statistics about front-end processing at the end of the compilation.
20380 This option is supported only by the C++ front end, and
20381 the information is generally only useful to the G++ development team.
20383 @opindex fdbg-cnt-list
20384 @item -fdbg-cnt-list
20385 Print the name and the counter upper bound for all debug counters.
20388 @opindex fdbg-cnt
20389 @item -fdbg-cnt=@var{counter-value-list}
20390 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20391 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20392 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20393 the name of the counter and list of closed intervals.
20394 The @var{lower_bound} is optional and is zero
20395 initialized if not set.
20396 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20397 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20398 eleventh invocation.
20399 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20401 @opindex print-file-name
20402 @item -print-file-name=@var{library}
20403 Print the full absolute name of the library file @var{library} that
20404 would be used when linking---and don't do anything else.  With this
20405 option, GCC does not compile or link anything; it just prints the
20406 file name.
20408 @opindex print-multi-directory
20409 @item -print-multi-directory
20410 Print the directory name corresponding to the multilib selected by any
20411 other switches present in the command line.  This directory is supposed
20412 to exist in @env{GCC_EXEC_PREFIX}.
20414 @opindex print-multi-lib
20415 @item -print-multi-lib
20416 Print the mapping from multilib directory names to compiler switches
20417 that enable them.  The directory name is separated from the switches by
20418 @samp{;}, and each switch starts with an @samp{@@} instead of the
20419 @samp{-}, without spaces between multiple switches.  This is supposed to
20420 ease shell processing.
20422 @opindex print-multi-os-directory
20423 @item -print-multi-os-directory
20424 Print the path to OS libraries for the selected
20425 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20426 present in the @file{lib} subdirectory and no multilibs are used, this is
20427 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20428 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20429 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20430 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20432 @opindex print-multiarch
20433 @item -print-multiarch
20434 Print the path to OS libraries for the selected multiarch,
20435 relative to some @file{lib} subdirectory.
20437 @opindex print-prog-name
20438 @item -print-prog-name=@var{program}
20439 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20441 @opindex print-libgcc-file-name
20442 @item -print-libgcc-file-name
20443 Same as @option{-print-file-name=libgcc.a}.
20445 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20446 but you do want to link with @file{libgcc.a}.  You can do:
20448 @smallexample
20449 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20450 @end smallexample
20452 @opindex print-search-dirs
20453 @item -print-search-dirs
20454 Print the name of the configured installation directory and a list of
20455 program and library directories @command{gcc} searches---and don't do anything else.
20457 This is useful when @command{gcc} prints the error message
20458 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20459 To resolve this you either need to put @file{cpp0} and the other compiler
20460 components where @command{gcc} expects to find them, or you can set the environment
20461 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20462 Don't forget the trailing @samp{/}.
20463 @xref{Environment Variables}.
20465 @opindex print-sysroot
20466 @item -print-sysroot
20467 Print the target sysroot directory that is used during
20468 compilation.  This is the target sysroot specified either at configure
20469 time or using the @option{--sysroot} option, possibly with an extra
20470 suffix that depends on compilation options.  If no target sysroot is
20471 specified, the option prints nothing.
20473 @opindex print-sysroot-headers-suffix
20474 @item -print-sysroot-headers-suffix
20475 Print the suffix added to the target sysroot when searching for
20476 headers, or give an error if the compiler is not configured with such
20477 a suffix---and don't do anything else.
20479 @opindex dumpmachine
20480 @item -dumpmachine
20481 Print the compiler's target machine (for example,
20482 @samp{i686-pc-linux-gnu})---and don't do anything else.
20484 @opindex dumpversion
20485 @item -dumpversion
20486 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20487 anything else.  This is the compiler version used in filesystem paths and
20488 specs. Depending on how the compiler has been configured it can be just
20489 a single number (major version), two numbers separated by a dot (major and
20490 minor version) or three numbers separated by dots (major, minor and patchlevel
20491 version).
20493 @opindex dumpfullversion
20494 @item -dumpfullversion
20495 Print the full compiler version---and don't do anything else. The output is
20496 always three numbers separated by dots, major, minor and patchlevel version.
20498 @opindex dumpspecs
20499 @item -dumpspecs
20500 Print the compiler's built-in specs---and don't do anything else.  (This
20501 is used when GCC itself is being built.)  @xref{Spec Files}.
20502 @end table
20504 @node Submodel Options
20505 @section Machine-Dependent Options
20506 @cindex submodel options
20507 @cindex specifying hardware config
20508 @cindex hardware models and configurations, specifying
20509 @cindex target-dependent options
20510 @cindex machine-dependent options
20512 Each target machine supported by GCC can have its own options---for
20513 example, to allow you to compile for a particular processor variant or
20514 ABI, or to control optimizations specific to that machine.  By
20515 convention, the names of machine-specific options start with
20516 @samp{-m}.
20518 Some configurations of the compiler also support additional target-specific
20519 options, usually for compatibility with other compilers on the same
20520 platform.
20522 @c This list is ordered alphanumerically by subsection name.
20523 @c It should be the same order and spelling as these options are listed
20524 @c in Machine Dependent Options
20526 @menu
20527 * AArch64 Options::
20528 * Adapteva Epiphany Options::
20529 * AMD GCN Options::
20530 * ARC Options::
20531 * ARM Options::
20532 * AVR Options::
20533 * Blackfin Options::
20534 * C6X Options::
20535 * CRIS Options::
20536 * C-SKY Options::
20537 * Darwin Options::
20538 * DEC Alpha Options::
20539 * eBPF Options::
20540 * FR30 Options::
20541 * FT32 Options::
20542 * FRV Options::
20543 * GNU/Linux Options::
20544 * H8/300 Options::
20545 * HPPA Options::
20546 * IA-64 Options::
20547 * LM32 Options::
20548 * LoongArch Options::
20549 * M32C Options::
20550 * M32R/D Options::
20551 * M680x0 Options::
20552 * MCore Options::
20553 * MicroBlaze Options::
20554 * MIPS Options::
20555 * MMIX Options::
20556 * MN10300 Options::
20557 * Moxie Options::
20558 * MSP430 Options::
20559 * NDS32 Options::
20560 * Nios II Options::
20561 * Nvidia PTX Options::
20562 * OpenRISC Options::
20563 * PDP-11 Options::
20564 * PowerPC Options::
20565 * PRU Options::
20566 * RISC-V Options::
20567 * RL78 Options::
20568 * RS/6000 and PowerPC Options::
20569 * RX Options::
20570 * S/390 and zSeries Options::
20571 * SH Options::
20572 * Solaris 2 Options::
20573 * SPARC Options::
20574 * System V Options::
20575 * V850 Options::
20576 * VAX Options::
20577 * Visium Options::
20578 * VMS Options::
20579 * VxWorks Options::
20580 * x86 Options::
20581 * x86 Windows Options::
20582 * Xstormy16 Options::
20583 * Xtensa Options::
20584 * zSeries Options::
20585 @end menu
20587 @node AArch64 Options
20588 @subsection AArch64 Options
20589 @cindex AArch64 Options
20591 These options are defined for AArch64 implementations:
20593 @table @gcctabopt
20595 @opindex mabi
20596 @item -mabi=@var{name}
20597 Generate code for the specified data model.  Permissible values
20598 are @samp{ilp32} for SysV-like data model where int, long int and pointers
20599 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
20600 but long int and pointers are 64 bits.
20602 The default depends on the specific target configuration.  Note that
20603 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
20604 entire program with the same ABI, and link with a compatible set of libraries.
20606 @opindex mbig-endian
20607 @item -mbig-endian
20608 Generate big-endian code.  This is the default when GCC is configured for an
20609 @samp{aarch64_be-*-*} target.
20611 @opindex mgeneral-regs-only
20612 @item -mgeneral-regs-only
20613 Generate code which uses only the general-purpose registers.  This will prevent
20614 the compiler from using floating-point and Advanced SIMD registers but will not
20615 impose any restrictions on the assembler.
20617 @opindex mlittle-endian
20618 @item -mlittle-endian
20619 Generate little-endian code.  This is the default when GCC is configured for an
20620 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
20622 @opindex mcmodel=tiny
20623 @item -mcmodel=tiny
20624 Generate code for the tiny code model.  The program and its statically defined
20625 symbols must be within 1MB of each other.  Programs can be statically or
20626 dynamically linked.
20628 @opindex mcmodel=small
20629 @item -mcmodel=small
20630 Generate code for the small code model.  The program and its statically defined
20631 symbols must be within 4GB of each other.  Programs can be statically or
20632 dynamically linked.  This is the default code model.
20634 @opindex mcmodel=large
20635 @item -mcmodel=large
20636 Generate code for the large code model.  This makes no assumptions about
20637 addresses and sizes of sections.  Programs can be statically linked only.  The
20638 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20639 @option{-fpic} and @option{-fPIC}.
20641 @item -mtp=@var{name}
20642 @opindex mtp
20643 Specify the system register to use as a thread pointer.  The valid values
20644 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
20645 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
20646 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
20647 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
20648 code intended to interoperate with the same value of this option to avoid
20649 accessing a different thread pointer from the wrong exception level.
20651 @opindex mstrict-align
20652 @opindex mno-strict-align
20653 @item -mstrict-align
20654 @itemx -mno-strict-align
20655 Avoid or allow generating memory accesses that may not be aligned on a natural
20656 object boundary as described in the architecture specification.
20658 @opindex momit-leaf-frame-pointer
20659 @opindex mno-omit-leaf-frame-pointer
20660 @item -momit-leaf-frame-pointer
20661 @itemx -mno-omit-leaf-frame-pointer
20662 Omit or keep the frame pointer in leaf functions.  The former behavior is the
20663 default.
20665 @opindex mstack-protector-guard
20666 @opindex mstack-protector-guard-reg
20667 @opindex mstack-protector-guard-offset
20668 @item -mstack-protector-guard=@var{guard}
20669 @itemx -mstack-protector-guard-reg=@var{reg}
20670 @itemx -mstack-protector-guard-offset=@var{offset}
20671 Generate stack protection code using canary at @var{guard}.  Supported
20672 locations are @samp{global} for a global canary or @samp{sysreg} for a
20673 canary in an appropriate system register.
20675 With the latter choice the options
20676 @option{-mstack-protector-guard-reg=@var{reg}} and
20677 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20678 which system register to use as base register for reading the canary,
20679 and from what offset from that base register. There is no default
20680 register or offset as this is entirely for use within the Linux
20681 kernel.
20683 @opindex mtls-dialect=desc
20684 @item -mtls-dialect=desc
20685 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20686 of TLS variables.  This is the default.
20688 @opindex mtls-dialect=traditional
20689 @item -mtls-dialect=traditional
20690 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20691 of TLS variables.
20693 @opindex mtls-size
20694 @item -mtls-size=@var{size}
20695 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
20696 This option requires binutils 2.26 or newer.
20698 @opindex mfix-cortex-a53-835769
20699 @opindex mno-fix-cortex-a53-835769
20700 @item -mfix-cortex-a53-835769
20701 @itemx -mno-fix-cortex-a53-835769
20702 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20703 This involves inserting a NOP instruction between memory instructions and
20704 64-bit integer multiply-accumulate instructions.
20706 @opindex mfix-cortex-a53-843419
20707 @opindex mno-fix-cortex-a53-843419
20708 @item -mfix-cortex-a53-843419
20709 @itemx -mno-fix-cortex-a53-843419
20710 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20711 This erratum workaround is made at link time and this will only pass the
20712 corresponding flag to the linker.
20714 @opindex mlow-precision-recip-sqrt
20715 @opindex mno-low-precision-recip-sqrt
20716 @item -mlow-precision-recip-sqrt
20717 @itemx -mno-low-precision-recip-sqrt
20718 Enable or disable the reciprocal square root approximation.
20719 This option only has an effect if @option{-ffast-math} or
20720 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20721 precision of reciprocal square root results to about 16 bits for
20722 single precision and to 32 bits for double precision.
20724 @opindex mlow-precision-sqrt
20725 @opindex mno-low-precision-sqrt
20726 @item -mlow-precision-sqrt
20727 @itemx -mno-low-precision-sqrt
20728 Enable or disable the square root approximation.
20729 This option only has an effect if @option{-ffast-math} or
20730 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20731 precision of square root results to about 16 bits for
20732 single precision and to 32 bits for double precision.
20733 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20735 @opindex mlow-precision-div
20736 @opindex mno-low-precision-div
20737 @item -mlow-precision-div
20738 @itemx -mno-low-precision-div
20739 Enable or disable the division approximation.
20740 This option only has an effect if @option{-ffast-math} or
20741 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20742 precision of division results to about 16 bits for
20743 single precision and to 32 bits for double precision.
20745 @item -mtrack-speculation
20746 @itemx -mno-track-speculation
20747 Enable or disable generation of additional code to track speculative
20748 execution through conditional branches.  The tracking state can then
20749 be used by the compiler when expanding calls to
20750 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20751 sequence to be generated.
20753 @item -moutline-atomics
20754 @itemx -mno-outline-atomics
20755 Enable or disable calls to out-of-line helpers to implement atomic operations.
20756 These helpers will, at runtime, determine if the LSE instructions from
20757 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20758 instructions that are present in the base ARMv8.0 ISA.
20760 This option is only applicable when compiling for the base ARMv8.0
20761 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
20762 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20763 used directly.  The same applies when using @option{-mcpu=} when the
20764 selected cpu supports the @samp{lse} feature.
20765 This option is on by default.
20767 @opindex march
20768 @item -march=@var{name}
20769 Specify the name of the target architecture and, optionally, one or
20770 more feature modifiers.  This option has the form
20771 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20773 The table below summarizes the permissible values for @var{arch}
20774 and the features that they enable by default:
20776 @multitable @columnfractions 0.20 0.20 0.60
20777 @headitem @var{arch} value @tab Architecture @tab Includes by default
20778 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20779 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20780 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20781 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20782 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20783 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20784 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20785 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20786 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20787 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20788 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20789 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20790 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20791 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20792 @end multitable
20794 The value @samp{native} is available on native AArch64 GNU/Linux and
20795 causes the compiler to pick the architecture of the host system.  This
20796 option has no effect if the compiler is unable to recognize the
20797 architecture of the host system,
20799 The permissible values for @var{feature} are listed in the sub-section
20800 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20801 Feature Modifiers}.  Where conflicting feature modifiers are
20802 specified, the right-most feature is used.
20804 GCC uses @var{name} to determine what kind of instructions it can emit
20805 when generating assembly code.  If @option{-march} is specified
20806 without either of @option{-mtune} or @option{-mcpu} also being
20807 specified, the code is tuned to perform well across a range of target
20808 processors implementing the target architecture.
20810 @opindex mtune
20811 @item -mtune=@var{name}
20812 Specify the name of the target processor for which GCC should tune the
20813 performance of the code.  Permissible values for this option are:
20814 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20815 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20816 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20817 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20818 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20819 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20820 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20821 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20822 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20823 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
20824 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20825 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20826 @samp{octeontx2f95mm},
20827 @samp{a64fx},
20828 @samp{thunderx}, @samp{thunderxt88},
20829 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20830 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20831 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20832 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20833 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20834 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20835 @samp{cortex-x3}, @samp{cortex-x4}, @samp{cortex-a510}, @samp{cortex-a520},
20836 @samp{cortex-a710}, @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1},
20837 @samp{ampere1a}, and @samp{native}.
20839 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20840 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20841 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20842 should tune for a big.LITTLE system.
20844 The value @samp{neoverse-512tvb} specifies that GCC should tune
20845 for Neoverse cores that (a) implement SVE and (b) have a total vector
20846 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
20847 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20848 instructions a cycle and that can execute an equivalent number of SVE
20849 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20850 This is more general than tuning for a specific core like Neoverse V1
20851 but is more specific than the default tuning described below.
20853 Additionally on native AArch64 GNU/Linux systems the value
20854 @samp{native} tunes performance to the host system.  This option has no effect
20855 if the compiler is unable to recognize the processor of the host system.
20857 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20858 are specified, the code is tuned to perform well across a range
20859 of target processors.
20861 This option cannot be suffixed by feature modifiers.
20863 @opindex mcpu
20864 @item -mcpu=@var{name}
20865 Specify the name of the target processor, optionally suffixed by one
20866 or more feature modifiers.  This option has the form
20867 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20868 the permissible values for @var{cpu} are the same as those available
20869 for @option{-mtune}.  The permissible values for @var{feature} are
20870 documented in the sub-section on
20871 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20872 Feature Modifiers}.  Where conflicting feature modifiers are
20873 specified, the right-most feature is used.
20875 GCC uses @var{name} to determine what kind of instructions it can emit when
20876 generating assembly code (as if by @option{-march}) and to determine
20877 the target processor for which to tune for performance (as if
20878 by @option{-mtune}).  Where this option is used in conjunction
20879 with @option{-march} or @option{-mtune}, those options take precedence
20880 over the appropriate part of this option.
20882 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20883 to a specific core, but instead refers to all Neoverse cores that
20884 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20885 a cycle.  Unless overridden by @option{-march},
20886 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20887 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20888 these properties.  Unless overridden by @option{-mtune},
20889 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20890 @option{-mtune=neoverse-512tvb}.
20892 @opindex moverride
20893 @item -moverride=@var{string}
20894 Override tuning decisions made by the back-end in response to a
20895 @option{-mtune=} switch.  The syntax, semantics, and accepted values
20896 for @var{string} in this option are not guaranteed to be consistent
20897 across releases.
20899 This option is only intended to be useful when developing GCC.
20901 @opindex mverbose-cost-dump
20902 @item -mverbose-cost-dump
20903 Enable verbose cost model dumping in the debug dump files.  This option is
20904 provided for use in debugging the compiler.
20906 @opindex mpc-relative-literal-loads
20907 @opindex mno-pc-relative-literal-loads
20908 @item -mpc-relative-literal-loads
20909 @itemx -mno-pc-relative-literal-loads
20910 Enable or disable PC-relative literal loads.  With this option literal pools are
20911 accessed using a single instruction and emitted after each function.  This
20912 limits the maximum size of functions to 1MB.  This is enabled by default for
20913 @option{-mcmodel=tiny}.
20915 @opindex msign-return-address
20916 @item -msign-return-address=@var{scope}
20917 Select the function scope on which return address signing will be applied.
20918 Permissible values are @samp{none}, which disables return address signing,
20919 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20920 functions, and @samp{all}, which enables pointer signing for all functions.  The
20921 default value is @samp{none}. This option has been deprecated by
20922 -mbranch-protection.
20924 @opindex mbranch-protection
20925 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20926 Select the branch protection features to use.
20927 @samp{none} is the default and turns off all types of branch protection.
20928 @samp{standard} turns on all types of branch protection features.  If a feature
20929 has additional tuning options, then @samp{standard} sets it to its standard
20930 level.
20931 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20932 level: signing functions that save the return address to memory (non-leaf
20933 functions will practically always do this) using the a-key.  The optional
20934 argument @samp{leaf} can be used to extend the signing to include leaf
20935 functions.  The optional argument @samp{b-key} can be used to sign the functions
20936 with the B-key instead of the A-key.
20937 @samp{bti} turns on branch target identification mechanism.
20939 @opindex mharden-sls
20940 @item -mharden-sls=@var{opts}
20941 Enable compiler hardening against straight line speculation (SLS).
20942 @var{opts} is a comma-separated list of the following options:
20943 @table @samp
20944 @item retbr
20945 @item blr
20946 @end table
20947 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20948 @samp{-mharden-sls=none} disables all SLS hardening.
20950 @opindex msve-vector-bits
20951 @item -msve-vector-bits=@var{bits}
20952 Specify the number of bits in an SVE vector register.  This option only has
20953 an effect when SVE is enabled.
20955 GCC supports two forms of SVE code generation: ``vector-length
20956 agnostic'' output that works with any size of vector register and
20957 ``vector-length specific'' output that allows GCC to make assumptions
20958 about the vector length when it is useful for optimization reasons.
20959 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20960 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20961 Specifying @samp{scalable} selects vector-length agnostic
20962 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
20963 agnostic output for big-endian targets.  All other values generate
20964 vector-length specific code.  The behavior of these values may change
20965 in future releases and no value except @samp{scalable} should be
20966 relied on for producing code that is portable across different
20967 hardware SVE vector lengths.
20969 The default is @samp{-msve-vector-bits=scalable}, which produces
20970 vector-length agnostic code.
20971 @end table
20973 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20974 @anchor{aarch64-feature-modifiers}
20975 @cindex @option{-march} feature modifiers
20976 @cindex @option{-mcpu} feature modifiers
20977 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20978 the following and their inverses @option{no@var{feature}}:
20980 @table @samp
20981 @item crc
20982 Enable CRC extension.  This is on by default for
20983 @option{-march=armv8.1-a}.
20984 @item crypto
20985 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
20986 instructions.
20987 @item fp
20988 Enable floating-point instructions.  This is on by default for all possible
20989 values for options @option{-march} and @option{-mcpu}.
20990 @item simd
20991 Enable Advanced SIMD instructions.  This also enables floating-point
20992 instructions.  This is on by default for all possible values for options
20993 @option{-march} and @option{-mcpu}.
20994 @item sve
20995 Enable Scalable Vector Extension instructions.  This also enables Advanced
20996 SIMD and floating-point instructions.
20997 @item lse
20998 Enable Large System Extension instructions.  This is on by default for
20999 @option{-march=armv8.1-a}.
21000 @item rdma
21001 Enable Round Double Multiply Accumulate instructions.  This is on by default
21002 for @option{-march=armv8.1-a}.
21003 @item fp16
21004 Enable FP16 extension.  This also enables floating-point instructions.
21005 @item fp16fml
21006 Enable FP16 fmla extension.  This also enables FP16 extensions and
21007 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.
21009 @item rcpc
21010 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
21011 load-acquire atomic semantics, and passes it on to the assembler, enabling
21012 inline asm statements to use instructions from the RCpc extension.
21013 @item dotprod
21014 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
21015 @item aes
21016 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
21017 SIMD instructions.
21018 @item sha2
21019 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
21020 @item sha3
21021 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
21022 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
21023 @item sm4
21024 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
21025 Use of this option with architectures prior to Armv8.2-A is not supported.
21026 @item profile
21027 Enable the Statistical Profiling extension.  This option is only to enable the
21028 extension at the assembler level and does not affect code generation.
21029 @item rng
21030 Enable the Armv8.5-a Random Number instructions.  This option is only to
21031 enable the extension at the assembler level and does not affect code
21032 generation.
21033 @item memtag
21034 Enable the Armv8.5-a Memory Tagging Extensions.
21035 Use of this option with architectures prior to Armv8.5-A is not supported.
21036 @item sb
21037 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
21038 enable the extension at the assembler level and does not affect code
21039 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21040 @item ssbs
21041 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
21042 is only to enable the extension at the assembler level and does not affect code
21043 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
21044 @item predres
21045 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
21046 This option is only to enable the extension at the assembler level and does
21047 not affect code generation.  This option is enabled by default for
21048 @option{-march=armv8.5-a}.
21049 @item sve2
21050 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
21051 instructions.
21052 @item sve2-bitperm
21053 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
21054 @item sve2-sm4
21055 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
21056 @item sve2-aes
21057 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
21058 @item sve2-sha3
21059 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
21060 @item tme
21061 Enable the Transactional Memory Extension.
21062 @item i8mm
21063 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
21064 Advanced SIMD and floating-point instructions.  This option is enabled by
21065 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21066 prior to Armv8.2-A is not supported.
21067 @item f32mm
21068 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
21069 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21070 not supported.
21071 @item f64mm
21072 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
21073 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
21074 not supported.
21075 @item bf16
21076 Enable brain half-precision floating-point instructions.  This also enables
21077 Advanced SIMD and floating-point instructions.  This option is enabled by
21078 default for @option{-march=armv8.6-a}.  Use of this option with architectures
21079 prior to Armv8.2-A is not supported.
21080 @item ls64
21081 Enable the 64-byte atomic load and store instructions for accelerators.
21082 This option is enabled by default for @option{-march=armv8.7-a}.
21083 @item mops
21084 Enable the instructions to accelerate memory operations like @code{memcpy},
21085 @code{memmove}, @code{memset}.  This option is enabled by default for
21086 @option{-march=armv8.8-a}
21087 @item flagm
21088 Enable the Flag Manipulation instructions Extension.
21089 @item pauth
21090 Enable the Pointer Authentication Extension.
21091 @item cssc
21092 Enable the Common Short Sequence Compression instructions.
21094 @end table
21096 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
21097 which implies @option{fp}.
21098 Conversely, @option{nofp} implies @option{nosimd}, which implies
21099 @option{nocrypto}, @option{noaes} and @option{nosha2}.
21101 @node Adapteva Epiphany Options
21102 @subsection Adapteva Epiphany Options
21104 These @samp{-m} options are defined for Adapteva Epiphany:
21106 @table @gcctabopt
21107 @opindex mhalf-reg-file
21108 @item -mhalf-reg-file
21109 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
21110 That allows code to run on hardware variants that lack these registers.
21112 @opindex mprefer-short-insn-regs
21113 @item -mprefer-short-insn-regs
21114 Preferentially allocate registers that allow short instruction generation.
21115 This can result in increased instruction count, so this may either reduce or
21116 increase overall code size.
21118 @opindex mbranch-cost
21119 @item -mbranch-cost=@var{num}
21120 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21121 This cost is only a heuristic and is not guaranteed to produce
21122 consistent results across releases.
21124 @opindex mcmove
21125 @item -mcmove
21126 Enable the generation of conditional moves.
21128 @opindex mnops
21129 @item -mnops=@var{num}
21130 Emit @var{num} NOPs before every other generated instruction.
21132 @opindex mno-soft-cmpsf
21133 @opindex msoft-cmpsf
21134 @item -mno-soft-cmpsf
21135 For single-precision floating-point comparisons, emit an @code{fsub} instruction
21136 and test the flags.  This is faster than a software comparison, but can
21137 get incorrect results in the presence of NaNs, or when two different small
21138 numbers are compared such that their difference is calculated as zero.
21139 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
21140 software comparisons.
21142 @opindex mstack-offset
21143 @item -mstack-offset=@var{num}
21144 Set the offset between the top of the stack and the stack pointer.
21145 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
21146 can be used by leaf functions without stack allocation.
21147 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
21148 Note also that this option changes the ABI; compiling a program with a
21149 different stack offset than the libraries have been compiled with
21150 generally does not work.
21151 This option can be useful if you want to evaluate if a different stack
21152 offset would give you better code, but to actually use a different stack
21153 offset to build working programs, it is recommended to configure the
21154 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
21156 @opindex mno-round-nearest
21157 @opindex mround-nearest
21158 @item -mno-round-nearest
21159 Make the scheduler assume that the rounding mode has been set to
21160 truncating.  The default is @option{-mround-nearest}.
21162 @opindex mlong-calls
21163 @item -mlong-calls
21164 If not otherwise specified by an attribute, assume all calls might be beyond
21165 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
21166 function address into a register before performing a (otherwise direct) call.
21167 This is the default.
21169 @opindex short-calls
21170 @item -mshort-calls
21171 If not otherwise specified by an attribute, assume all direct calls are
21172 in the range of the @code{b} / @code{bl} instructions, so use these instructions
21173 for direct calls.  The default is @option{-mlong-calls}.
21175 @opindex msmall16
21176 @item -msmall16
21177 Assume addresses can be loaded as 16-bit unsigned values.  This does not
21178 apply to function addresses for which @option{-mlong-calls} semantics
21179 are in effect.
21181 @opindex mfp-mode
21182 @item -mfp-mode=@var{mode}
21183 Set the prevailing mode of the floating-point unit.
21184 This determines the floating-point mode that is provided and expected
21185 at function call and return time.  Making this mode match the mode you
21186 predominantly need at function start can make your programs smaller and
21187 faster by avoiding unnecessary mode switches.
21189 @var{mode} can be set to one the following values:
21191 @table @samp
21192 @item caller
21193 Any mode at function entry is valid, and retained or restored when
21194 the function returns, and when it calls other functions.
21195 This mode is useful for compiling libraries or other compilation units
21196 you might want to incorporate into different programs with different
21197 prevailing FPU modes, and the convenience of being able to use a single
21198 object file outweighs the size and speed overhead for any extra
21199 mode switching that might be needed, compared with what would be needed
21200 with a more specific choice of prevailing FPU mode.
21202 @item truncate
21203 This is the mode used for floating-point calculations with
21204 truncating (i.e.@: round towards zero) rounding mode.  That includes
21205 conversion from floating point to integer.
21207 @item round-nearest
21208 This is the mode used for floating-point calculations with
21209 round-to-nearest-or-even rounding mode.
21211 @item int
21212 This is the mode used to perform integer calculations in the FPU, e.g.@:
21213 integer multiply, or integer multiply-and-accumulate.
21214 @end table
21216 The default is @option{-mfp-mode=caller}
21218 @opindex mno-split-lohi
21219 @opindex msplit-lohi
21220 @opindex mno-postinc
21221 @opindex mpostinc
21222 @opindex mno-postmodify
21223 @opindex mpostmodify
21224 @item -mno-split-lohi
21225 @itemx -mno-postinc
21226 @itemx -mno-postmodify
21227 Code generation tweaks that disable, respectively, splitting of 32-bit
21228 loads, generation of post-increment addresses, and generation of
21229 post-modify addresses.  The defaults are @option{msplit-lohi},
21230 @option{-mpost-inc}, and @option{-mpost-modify}.
21232 @opindex mno-vect-double
21233 @opindex mvect-double
21234 @item -mnovect-double
21235 Change the preferred SIMD mode to SImode.  The default is
21236 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
21238 @opindex max-vect-align
21239 @item -max-vect-align=@var{num}
21240 The maximum alignment for SIMD vector mode types.
21241 @var{num} may be 4 or 8.  The default is 8.
21242 Note that this is an ABI change, even though many library function
21243 interfaces are unaffected if they don't use SIMD vector modes
21244 in places that affect size and/or alignment of relevant types.
21246 @opindex msplit-vecmove-early
21247 @item -msplit-vecmove-early
21248 Split vector moves into single word moves before reload.  In theory this
21249 can give better register allocation, but so far the reverse seems to be
21250 generally the case.
21252 @opindex m1reg-
21253 @item -m1reg-@var{reg}
21254 Specify a register to hold the constant @minus{}1, which makes loading small negative
21255 constants and certain bitmasks faster.
21256 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
21257 which specify use of that register as a fixed register,
21258 and @samp{none}, which means that no register is used for this
21259 purpose.  The default is @option{-m1reg-none}.
21261 @end table
21263 @node AMD GCN Options
21264 @subsection AMD GCN Options
21265 @cindex AMD GCN Options
21267 These options are defined specifically for the AMD GCN port.
21269 @table @gcctabopt
21271 @opindex march
21272 @opindex mtune
21273 @item -march=@var{gpu}
21274 @itemx -mtune=@var{gpu}
21275 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21278 @table @samp
21279 @item fiji
21280 Compile for GCN3 Fiji devices (gfx803).  Support deprecated; availablility
21281 depends on how GCC has been configured, see @option{--with-arch} and
21282 @option{--with-multilib-list}.
21284 @item gfx900
21285 Compile for GCN5 Vega 10 devices (gfx900).
21287 @item gfx906
21288 Compile for GCN5 Vega 20 devices (gfx906).
21290 @item gfx908
21291 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21293 @item gfx90a
21294 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21296 @end table
21298 @opindex msram-ecc
21299 @item -msram-ecc=on
21300 @itemx -msram-ecc=off
21301 @itemx -msram-ecc=any
21302 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21303 disabled, or either mode.  This feature can be enabled per-process on some
21304 devices.  The compiled code must match the device mode. The default is
21305 @samp{any}, for devices that support it.
21307 @opindex mstack-size
21308 @item -mstack-size=@var{bytes}
21309 Specify how many @var{bytes} of stack space will be requested for each GPU
21310 thread (wave-front).  Beware that there may be many threads and limited memory
21311 available.  The size of the stack allocation may also have an impact on
21312 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21313 1MB otherwise.
21315 @opindex mxnack
21316 @item -mxnack=on
21317 @itemx -mxnack=off
21318 @itemx -mxnack=any
21319 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21320 or either mode.  Some devices always require XNACK and some allow the user to
21321 configure XNACK.  The compiled code must match the device mode.
21322 @c The default is @samp{-mxnack=any}.
21323 At present this option is a placeholder for support that is not yet implemented.
21325 @end table
21327 @node ARC Options
21328 @subsection ARC Options
21329 @cindex ARC options
21331 The following options control the architecture variant for which code
21332 is being compiled:
21334 @c architecture variants
21335 @table @gcctabopt
21337 @opindex mbarrel-shifter
21338 @item -mbarrel-shifter
21339 Generate instructions supported by barrel shifter.  This is the default
21340 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21342 @opindex mjli-always
21343 @item -mjli-always
21344 Force to call a function using jli_s instruction.  This option is
21345 valid only for ARCv2 architecture.
21347 @opindex mcpu
21348 @item -mcpu=@var{cpu}
21349 Set architecture type, register usage, and instruction scheduling
21350 parameters for @var{cpu}.  There are also shortcut alias options
21351 available for backward compatibility and convenience.  Supported
21352 values for @var{cpu} are
21354 @table @samp
21355 @opindex mA6
21356 @opindex mARC600
21357 @item arc600
21358 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21360 @opindex mARC601
21361 @item arc601
21362 Compile for ARC601.  Alias: @option{-mARC601}.
21364 @opindex mA7
21365 @opindex mARC700
21366 @item arc700
21367 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21368 This is the default when configured with @option{--with-cpu=arc700}@.
21370 @item arcem
21371 Compile for ARC EM.
21373 @item archs
21374 Compile for ARC HS.
21376 @item em
21377 Compile for ARC EM CPU with no hardware extensions.
21379 @item em4
21380 Compile for ARC EM4 CPU.
21382 @item em4_dmips
21383 Compile for ARC EM4 DMIPS CPU.
21385 @item em4_fpus
21386 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21387 extension.
21389 @item em4_fpuda
21390 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21391 double assist instructions.
21393 @item hs
21394 Compile for ARC HS CPU with no hardware extensions except the atomic
21395 instructions.
21397 @item hs34
21398 Compile for ARC HS34 CPU.
21400 @item hs38
21401 Compile for ARC HS38 CPU.
21403 @item hs38_linux
21404 Compile for ARC HS38 CPU with all hardware extensions on.
21406 @item hs4x
21407 Compile for ARC HS4x CPU.
21409 @item hs4xd
21410 Compile for ARC HS4xD CPU.
21412 @item hs4x_rel31
21413 Compile for ARC HS4x CPU release 3.10a.
21415 @item arc600_norm
21416 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21418 @item arc600_mul32x16
21419 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21420 instructions enabled.
21422 @item arc600_mul64
21423 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21424 instructions enabled.
21426 @item arc601_norm
21427 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21429 @item arc601_mul32x16
21430 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21431 instructions enabled.
21433 @item arc601_mul64
21434 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21435 instructions enabled.
21437 @item nps400
21438 Compile for ARC 700 on NPS400 chip.
21440 @item em_mini
21441 Compile for ARC EM minimalist configuration featuring reduced register
21442 set.
21444 @end table
21446 @opindex mdpfp
21447 @opindex mdpfp-compact
21448 @item -mdpfp
21449 @itemx -mdpfp-compact
21450 Generate double-precision FPX instructions, tuned for the compact
21451 implementation.
21453 @opindex mdpfp-fast
21454 @item -mdpfp-fast
21455 Generate double-precision FPX instructions, tuned for the fast
21456 implementation.
21458 @opindex mno-dpfp-lrsr
21459 @item -mno-dpfp-lrsr
21460 Disable @code{lr} and @code{sr} instructions from using FPX extension
21461 aux registers.
21463 @opindex mea
21464 @item -mea
21465 Generate extended arithmetic instructions.  Currently only
21466 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
21467 supported.  Only valid for @option{-mcpu=ARC700}.
21469 @opindex mno-mpy
21470 @opindex mmpy
21471 @item -mno-mpy
21472 Do not generate @code{mpy}-family instructions for ARC700.  This option is
21473 deprecated.
21475 @opindex mmul32x16
21476 @item -mmul32x16
21477 Generate 32x16-bit multiply and multiply-accumulate instructions.
21479 @opindex mmul64
21480 @item -mmul64
21481 Generate @code{mul64} and @code{mulu64} instructions.  
21482 Only valid for @option{-mcpu=ARC600}.
21484 @opindex mnorm
21485 @item -mnorm
21486 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
21487 is in effect.
21489 @opindex mspfp
21490 @opindex mspfp-compact
21491 @item -mspfp
21492 @itemx -mspfp-compact
21493 Generate single-precision FPX instructions, tuned for the compact
21494 implementation.
21496 @opindex mspfp-fast
21497 @item -mspfp-fast
21498 Generate single-precision FPX instructions, tuned for the fast
21499 implementation.
21501 @opindex msimd
21502 @item -msimd
21503 Enable generation of ARC SIMD instructions via target-specific
21504 builtins.  Only valid for @option{-mcpu=ARC700}.
21506 @opindex msoft-float
21507 @item -msoft-float
21508 This option ignored; it is provided for compatibility purposes only.
21509 Software floating-point code is emitted by default, and this default
21510 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21511 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21512 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21514 @opindex mswap
21515 @item -mswap
21516 Generate @code{swap} instructions.
21518 @opindex matomic
21519 @item -matomic
21520 This enables use of the locked load/store conditional extension to implement
21521 atomic memory built-in functions.  Not available for ARC 6xx or ARC
21522 EM cores.
21524 @opindex mdiv-rem
21525 @item -mdiv-rem
21526 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21528 @opindex mcode-density
21529 @item -mcode-density
21530 Enable code density instructions for ARC EM.  
21531 This option is on by default for ARC HS.
21533 @opindex mll64
21534 @item -mll64
21535 Enable double load/store operations for ARC HS cores.
21537 @opindex mtp-regno
21538 @item -mtp-regno=@var{regno}
21539 Specify thread pointer register number.
21541 @opindex mmpy-option
21542 @item -mmpy-option=@var{multo}
21543 Compile ARCv2 code with a multiplier design option.  You can specify 
21544 the option using either a string or numeric value for @var{multo}.  
21545 @samp{wlh1} is the default value.  The recognized values are:
21547 @table @samp
21548 @item 0
21549 @itemx none
21550 No multiplier available.
21552 @item 1
21553 @itemx w
21554 16x16 multiplier, fully pipelined.
21555 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
21557 @item 2
21558 @itemx wlh1
21559 32x32 multiplier, fully
21560 pipelined (1 stage).  The following instructions are additionally
21561 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21563 @item 3
21564 @itemx wlh2
21565 32x32 multiplier, fully pipelined
21566 (2 stages).  The following instructions are additionally enabled: @code{mpy},
21567 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21569 @item 4
21570 @itemx wlh3
21571 Two 16x16 multipliers, blocking,
21572 sequential.  The following instructions are additionally enabled: @code{mpy},
21573 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21575 @item 5
21576 @itemx wlh4
21577 One 16x16 multiplier, blocking,
21578 sequential.  The following instructions are additionally enabled: @code{mpy},
21579 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21581 @item 6
21582 @itemx wlh5
21583 One 32x4 multiplier, blocking,
21584 sequential.  The following instructions are additionally enabled: @code{mpy},
21585 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21587 @item 7
21588 @itemx plus_dmpy
21589 ARC HS SIMD support.
21591 @item 8
21592 @itemx plus_macd
21593 ARC HS SIMD support.
21595 @item 9
21596 @itemx plus_qmacw
21597 ARC HS SIMD support.
21599 @end table
21601 This option is only available for ARCv2 cores@.
21603 @opindex mfpu
21604 @item -mfpu=@var{fpu}
21605 Enables support for specific floating-point hardware extensions for ARCv2
21606 cores.  Supported values for @var{fpu} are:
21608 @table @samp
21610 @item fpus
21611 Enables support for single-precision floating-point hardware
21612 extensions@.
21614 @item fpud
21615 Enables support for double-precision floating-point hardware
21616 extensions.  The single-precision floating-point extension is also
21617 enabled.  Not available for ARC EM@.
21619 @item fpuda
21620 Enables support for double-precision floating-point hardware
21621 extensions using double-precision assist instructions.  The single-precision
21622 floating-point extension is also enabled.  This option is
21623 only available for ARC EM@.
21625 @item fpuda_div
21626 Enables support for double-precision floating-point hardware
21627 extensions using double-precision assist instructions.
21628 The single-precision floating-point, square-root, and divide 
21629 extensions are also enabled.  This option is
21630 only available for ARC EM@.
21632 @item fpuda_fma
21633 Enables support for double-precision floating-point hardware
21634 extensions using double-precision assist instructions.
21635 The single-precision floating-point and fused multiply and add 
21636 hardware extensions are also enabled.  This option is
21637 only available for ARC EM@.
21639 @item fpuda_all
21640 Enables support for double-precision floating-point hardware
21641 extensions using double-precision assist instructions.
21642 All single-precision floating-point hardware extensions are also
21643 enabled.  This option is only available for ARC EM@.
21645 @item fpus_div
21646 Enables support for single-precision floating-point, square-root and divide 
21647 hardware extensions@.
21649 @item fpud_div
21650 Enables support for double-precision floating-point, square-root and divide 
21651 hardware extensions.  This option
21652 includes option @samp{fpus_div}. Not available for ARC EM@.
21654 @item fpus_fma
21655 Enables support for single-precision floating-point and 
21656 fused multiply and add hardware extensions@.
21658 @item fpud_fma
21659 Enables support for double-precision floating-point and 
21660 fused multiply and add hardware extensions.  This option
21661 includes option @samp{fpus_fma}.  Not available for ARC EM@.
21663 @item fpus_all
21664 Enables support for all single-precision floating-point hardware
21665 extensions@.
21667 @item fpud_all
21668 Enables support for all single- and double-precision floating-point
21669 hardware extensions.  Not available for ARC EM@.
21671 @end table
21673 @opindex mirq-ctrl-saved
21674 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21675 Specifies general-purposes registers that the processor automatically
21676 saves/restores on interrupt entry and exit.  @var{register-range} is
21677 specified as two registers separated by a dash.  The register range
21678 always starts with @code{r0}, the upper limit is @code{fp} register.
21679 @var{blink} and @var{lp_count} are optional.  This option is only
21680 valid for ARC EM and ARC HS cores.
21682 @opindex mrgf-banked-regs
21683 @item -mrgf-banked-regs=@var{number}
21684 Specifies the number of registers replicated in second register bank
21685 on entry to fast interrupt.  Fast interrupts are interrupts with the
21686 highest priority level P0.  These interrupts save only PC and STATUS32
21687 registers to avoid memory transactions during interrupt entry and exit
21688 sequences.  Use this option when you are using fast interrupts in an
21689 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
21691 @opindex mlpc-width
21692 @item -mlpc-width=@var{width}
21693 Specify the width of the @code{lp_count} register.  Valid values for
21694 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
21695 fixed to 32 bits.  If the width is less than 32, the compiler does not
21696 attempt to transform loops in your program to use the zero-delay loop
21697 mechanism unless it is known that the @code{lp_count} register can
21698 hold the required loop-counter value.  Depending on the width
21699 specified, the compiler and run-time library might continue to use the
21700 loop mechanism for various needs.  This option defines macro
21701 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21703 @opindex mrf16
21704 @item -mrf16
21705 This option instructs the compiler to generate code for a 16-entry
21706 register file.  This option defines the @code{__ARC_RF16__}
21707 preprocessor macro.
21709 @opindex mbranch-index
21710 @item -mbranch-index
21711 Enable use of @code{bi} or @code{bih} instructions to implement jump
21712 tables.
21714 @end table
21716 The following options are passed through to the assembler, and also
21717 define preprocessor macro symbols.
21719 @c Flags used by the assembler, but for which we define preprocessor
21720 @c macro symbols as well.
21721 @table @gcctabopt
21722 @opindex mdsp-packa
21723 @item -mdsp-packa
21724 Passed down to the assembler to enable the DSP Pack A extensions.
21725 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
21726 deprecated.
21728 @opindex mdvbf
21729 @item -mdvbf
21730 Passed down to the assembler to enable the dual Viterbi butterfly
21731 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
21732 option is deprecated.
21734 @c ARC700 4.10 extension instruction
21735 @opindex mlock
21736 @item -mlock
21737 Passed down to the assembler to enable the locked load/store
21738 conditional extension.  Also sets the preprocessor symbol
21739 @code{__Xlock}.
21741 @opindex mmac-d16
21742 @item -mmac-d16
21743 Passed down to the assembler.  Also sets the preprocessor symbol
21744 @code{__Xxmac_d16}.  This option is deprecated.
21746 @opindex mmac-24
21747 @item -mmac-24
21748 Passed down to the assembler.  Also sets the preprocessor symbol
21749 @code{__Xxmac_24}.  This option is deprecated.
21751 @c ARC700 4.10 extension instruction
21752 @opindex mrtsc
21753 @item -mrtsc
21754 Passed down to the assembler to enable the 64-bit time-stamp counter
21755 extension instruction.  Also sets the preprocessor symbol
21756 @code{__Xrtsc}.  This option is deprecated.
21758 @c ARC700 4.10 extension instruction
21759 @opindex mswape
21760 @item -mswape
21761 Passed down to the assembler to enable the swap byte ordering
21762 extension instruction.  Also sets the preprocessor symbol
21763 @code{__Xswape}.
21765 @opindex mtelephony
21766 @item -mtelephony
21767 Passed down to the assembler to enable dual- and single-operand
21768 instructions for telephony.  Also sets the preprocessor symbol
21769 @code{__Xtelephony}.  This option is deprecated.
21771 @opindex mxy
21772 @item -mxy
21773 Passed down to the assembler to enable the XY memory extension.  Also
21774 sets the preprocessor symbol @code{__Xxy}.
21776 @end table
21778 The following options control how the assembly code is annotated:
21780 @c Assembly annotation options
21781 @table @gcctabopt
21782 @opindex misize
21783 @item -misize
21784 Annotate assembler instructions with estimated addresses.
21786 @opindex mannotate-align
21787 @item -mannotate-align
21788 Does nothing.  Preserved for backward compatibility.
21790 @end table
21792 The following options are passed through to the linker:
21794 @c options passed through to the linker
21795 @table @gcctabopt
21796 @opindex marclinux
21797 @item -marclinux
21798 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21799 This option is enabled by default in tool chains built for
21800 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21801 when profiling is not requested.
21803 @opindex marclinux_prof
21804 @item -marclinux_prof
21805 Passed through to the linker, to specify use of the
21806 @code{arclinux_prof} emulation.  This option is enabled by default in
21807 tool chains built for @w{@code{arc-linux-uclibc}} and
21808 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21810 @end table
21812 The following options control the semantics of generated code:
21814 @c semantically relevant code generation options
21815 @table @gcctabopt
21816 @opindex mlong-calls
21817 @item -mlong-calls
21818 Generate calls as register indirect calls, thus providing access
21819 to the full 32-bit address range.
21821 @opindex mmedium-calls
21822 @item -mmedium-calls
21823 Don't use less than 25-bit addressing range for calls, which is the
21824 offset available for an unconditional branch-and-link
21825 instruction.  Conditional execution of function calls is suppressed, to
21826 allow use of the 25-bit range, rather than the 21-bit range with
21827 conditional branch-and-link.  This is the default for tool chains built
21828 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21830 @opindex G
21831 @item -G @var{num}
21832 Put definitions of externally-visible data in a small data section if
21833 that data is no bigger than @var{num} bytes.  The default value of
21834 @var{num} is 4 for any ARC configuration, or 8 when we have double
21835 load/store operations.
21837 @opindex mno-sdata
21838 @opindex msdata
21839 @item -mno-sdata
21840 Do not generate sdata references.  This is the default for tool chains
21841 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21842 targets.
21844 @opindex mvolatile-cache
21845 @item -mvolatile-cache
21846 Use ordinarily cached memory accesses for volatile references.  This is the
21847 default.
21849 @opindex mno-volatile-cache
21850 @opindex mvolatile-cache
21851 @item -mno-volatile-cache
21852 Enable cache bypass for volatile references.
21854 @end table
21856 The following options fine tune code generation:
21857 @c code generation tuning options
21858 @table @gcctabopt
21859 @opindex malign-call
21860 @item -malign-call
21861 Does nothing.  Preserved for backward compatibility.
21863 @opindex mauto-modify-reg
21864 @item -mauto-modify-reg
21865 Enable the use of pre/post modify with register displacement.
21867 @opindex mbbit-peephole
21868 @item -mbbit-peephole
21869 Does nothing.  Preserved for backward compatibility.
21871 @opindex mno-brcc
21872 @item -mno-brcc
21873 This option disables a target-specific pass in @file{arc_reorg} to
21874 generate compare-and-branch (@code{br@var{cc}}) instructions.  
21875 It has no effect on
21876 generation of these instructions driven by the combiner pass.
21878 @opindex mcase-vector-pcrel
21879 @item -mcase-vector-pcrel
21880 Use PC-relative switch case tables to enable case table shortening.
21881 This is the default for @option{-Os}.
21883 @opindex mcompact-casesi
21884 @item -mcompact-casesi
21885 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
21886 and only available for ARCv1 cores.  This option is deprecated.
21888 @opindex mno-cond-exec
21889 @item -mno-cond-exec
21890 Disable the ARCompact-specific pass to generate conditional 
21891 execution instructions.
21893 Due to delay slot scheduling and interactions between operand numbers,
21894 literal sizes, instruction lengths, and the support for conditional execution,
21895 the target-independent pass to generate conditional execution is often lacking,
21896 so the ARC port has kept a special pass around that tries to find more
21897 conditional execution generation opportunities after register allocation,
21898 branch shortening, and delay slot scheduling have been done.  This pass
21899 generally, but not always, improves performance and code size, at the cost of
21900 extra compilation time, which is why there is an option to switch it off.
21901 If you have a problem with call instructions exceeding their allowable
21902 offset range because they are conditionalized, you should consider using
21903 @option{-mmedium-calls} instead.
21905 @opindex mearly-cbranchsi
21906 @item -mearly-cbranchsi
21907 Enable pre-reload use of the @code{cbranchsi} pattern.
21909 @opindex mexpand-adddi
21910 @item -mexpand-adddi
21911 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21912 @code{add.f}, @code{adc} etc.  This option is deprecated.
21914 @opindex mindexed-loads
21915 @item -mindexed-loads
21916 Enable the use of indexed loads.  This can be problematic because some
21917 optimizers then assume that indexed stores exist, which is not
21918 the case.
21920 @opindex mlra
21921 @item -mlra
21922 Enable Local Register Allocation.  This is still experimental for ARC,
21923 so by default the compiler uses standard reload
21924 (i.e.@: @option{-mno-lra}).
21926 @opindex mlra-priority-none
21927 @item -mlra-priority-none
21928 Don't indicate any priority for target registers.
21930 @opindex mlra-priority-compact
21931 @item -mlra-priority-compact
21932 Indicate target register priority for r0..r3 / r12..r15.
21934 @opindex mlra-priority-noncompact
21935 @item -mlra-priority-noncompact
21936 Reduce target register priority for r0..r3 / r12..r15.
21938 @opindex mmillicode
21939 @item -mmillicode
21940 When optimizing for size (using @option{-Os}), prologues and epilogues
21941 that have to save or restore a large number of registers are often
21942 shortened by using call to a special function in libgcc; this is
21943 referred to as a @emph{millicode} call.  As these calls can pose
21944 performance issues, and/or cause linking issues when linking in a
21945 nonstandard way, this option is provided to turn on or off millicode
21946 call generation.
21948 @opindex mcode-density-frame
21949 @item -mcode-density-frame
21950 This option enable the compiler to emit @code{enter} and @code{leave}
21951 instructions.  These instructions are only valid for CPUs with
21952 code-density feature.
21954 @opindex mmixed-code
21955 @item -mmixed-code
21956 Does nothing.  Preserved for backward compatibility.
21958 @opindex mq-class
21959 @item -mq-class
21960 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
21961 This is the default for @option{-Os}.
21963 @opindex mRcq
21964 @item -mRcq
21965 Does nothing.  Preserved for backward compatibility.
21967 @opindex mRcw
21968 @item -mRcw
21969 Does nothing.  Preserved for backward compatibility.
21971 @opindex msize-level
21972 @item -msize-level=@var{level}
21973 Fine-tune size optimization with regards to instruction lengths and alignment.
21974 The recognized values for @var{level} are:
21975 @table @samp
21976 @item 0
21977 No size optimization.  This level is deprecated and treated like @samp{1}.
21979 @item 1
21980 Short instructions are used opportunistically.
21982 @item 2
21983 In addition, alignment of loops and of code after barriers are dropped.
21985 @item 3
21986 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21988 @end table
21990 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
21991 the behavior when this is not set is equivalent to level @samp{1}.
21993 @opindex mtune
21994 @item -mtune=@var{cpu}
21995 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21996 by @option{-mcpu=}.
21998 Supported values for @var{cpu} are
22000 @table @samp
22001 @item ARC600
22002 Tune for ARC600 CPU.
22004 @item ARC601
22005 Tune for ARC601 CPU.
22007 @item ARC700
22008 Tune for ARC700 CPU with standard multiplier block.
22010 @item ARC700-xmac
22011 Tune for ARC700 CPU with XMAC block.
22013 @item ARC725D
22014 Tune for ARC725D CPU.
22016 @item ARC750D
22017 Tune for ARC750D CPU.
22019 @item core3
22020 Tune for ARCv2 core3 type CPU.  This option enable usage of
22021 @code{dbnz} instruction.
22023 @item release31a
22024 Tune for ARC4x release 3.10a.
22026 @end table
22028 @opindex mmultcost
22029 @item -mmultcost=@var{num}
22030 Cost to assume for a multiply instruction, with @samp{4} being equal to a
22031 normal instruction.
22033 @opindex munalign-prob-threshold
22034 @item -munalign-prob-threshold=@var{probability}
22035 Does nothing.  Preserved for backward compatibility.
22037 @end table
22039 The following options are maintained for backward compatibility, but
22040 are now deprecated and will be removed in a future release:
22042 @c Deprecated options
22043 @table @gcctabopt
22045 @opindex margonaut
22046 @item -margonaut
22047 Obsolete FPX.
22049 @opindex mbig-endian
22050 @opindex EB
22051 @item -mbig-endian
22052 @itemx -EB
22053 Compile code for big-endian targets.  Use of these options is now
22054 deprecated.  Big-endian code is supported by configuring GCC to build
22055 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
22056 for which big endian is the default.
22058 @opindex mlittle-endian
22059 @opindex EL
22060 @item -mlittle-endian
22061 @itemx -EL
22062 Compile code for little-endian targets.  Use of these options is now
22063 deprecated.  Little-endian code is supported by configuring GCC to build 
22064 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
22065 for which little endian is the default.
22067 @opindex mbarrel_shifter
22068 @item -mbarrel_shifter
22069 Replaced by @option{-mbarrel-shifter}.
22071 @opindex mdpfp_compact
22072 @item -mdpfp_compact
22073 Replaced by @option{-mdpfp-compact}.
22075 @opindex mdpfp_fast
22076 @item -mdpfp_fast
22077 Replaced by @option{-mdpfp-fast}.
22079 @opindex mdsp_packa
22080 @item -mdsp_packa
22081 Replaced by @option{-mdsp-packa}.
22083 @opindex mEA
22084 @item -mEA
22085 Replaced by @option{-mea}.
22087 @opindex mmac_24
22088 @item -mmac_24
22089 Replaced by @option{-mmac-24}.
22091 @opindex mmac_d16
22092 @item -mmac_d16
22093 Replaced by @option{-mmac-d16}.
22095 @opindex mspfp_compact
22096 @item -mspfp_compact
22097 Replaced by @option{-mspfp-compact}.
22099 @opindex mspfp_fast
22100 @item -mspfp_fast
22101 Replaced by @option{-mspfp-fast}.
22103 @opindex mtune
22104 @item -mtune=@var{cpu}
22105 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
22106 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
22107 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
22109 @opindex multcost
22110 @item -multcost=@var{num}
22111 Replaced by @option{-mmultcost}.
22113 @end table
22115 @node ARM Options
22116 @subsection ARM Options
22117 @cindex ARM options
22119 These @samp{-m} options are defined for the ARM port:
22121 @table @gcctabopt
22122 @opindex mabi
22123 @item -mabi=@var{name}
22124 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
22125 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
22127 @opindex mapcs-frame
22128 @item -mapcs-frame
22129 Generate a stack frame that is compliant with the ARM Procedure Call
22130 Standard for all functions, even if this is not strictly necessary for
22131 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
22132 with this option causes the stack frames not to be generated for
22133 leaf functions.  The default is @option{-mno-apcs-frame}.
22134 This option is deprecated.
22136 @opindex mapcs
22137 @item -mapcs
22138 This is a synonym for @option{-mapcs-frame} and is deprecated.
22140 @ignore
22141 @c not currently implemented
22142 @opindex mapcs-stack-check
22143 @item -mapcs-stack-check
22144 Generate code to check the amount of stack space available upon entry to
22145 every function (that actually uses some stack space).  If there is
22146 insufficient space available then either the function
22147 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
22148 called, depending upon the amount of stack space required.  The runtime
22149 system is required to provide these functions.  The default is
22150 @option{-mno-apcs-stack-check}, since this produces smaller code.
22152 @c not currently implemented
22153 @opindex mapcs-reentrant
22154 @item -mapcs-reentrant
22155 Generate reentrant, position-independent code.  The default is
22156 @option{-mno-apcs-reentrant}.
22157 @end ignore
22159 @opindex mthumb-interwork
22160 @item -mthumb-interwork
22161 Generate code that supports calling between the ARM and Thumb
22162 instruction sets.  Without this option, on pre-v5 architectures, the
22163 two instruction sets cannot be reliably used inside one program.  The
22164 default is @option{-mno-thumb-interwork}, since slightly larger code
22165 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
22166 configurations this option is meaningless.
22168 @opindex mno-sched-prolog
22169 @opindex msched-prolog
22170 @item -mno-sched-prolog
22171 Prevent the reordering of instructions in the function prologue, or the
22172 merging of those instruction with the instructions in the function's
22173 body.  This means that all functions start with a recognizable set
22174 of instructions (or in fact one of a choice from a small set of
22175 different function prologues), and this information can be used to
22176 locate the start of functions inside an executable piece of code.  The
22177 default is @option{-msched-prolog}.
22179 @opindex mfloat-abi
22180 @item -mfloat-abi=@var{name}
22181 Specifies which floating-point ABI to use.  Permissible values
22182 are: @samp{soft}, @samp{softfp} and @samp{hard}.
22184 Specifying @samp{soft} causes GCC to generate output containing
22185 library calls for floating-point operations.
22186 @samp{softfp} allows the generation of code using hardware floating-point
22187 instructions, but still uses the soft-float calling conventions.
22188 @samp{hard} allows generation of floating-point instructions
22189 and uses FPU-specific calling conventions.
22191 The default depends on the specific target configuration.  Note that
22192 the hard-float and soft-float ABIs are not link-compatible; you must
22193 compile your entire program with the same ABI, and link with a
22194 compatible set of libraries.
22196 @opindex mgeneral-regs-only
22197 @item -mgeneral-regs-only
22198 Generate code which uses only the general-purpose registers.  This will prevent
22199 the compiler from using floating-point and Advanced SIMD registers but will not
22200 impose any restrictions on the assembler.
22202 @opindex mlittle-endian
22203 @item -mlittle-endian
22204 Generate code for a processor running in little-endian mode.  This is
22205 the default for all standard configurations.
22207 @opindex mbig-endian
22208 @item -mbig-endian
22209 Generate code for a processor running in big-endian mode; the default is
22210 to compile code for a little-endian processor.
22212 @opindex mbe8
22213 @item -mbe8
22214 @itemx -mbe32
22215 When linking a big-endian image select between BE8 and BE32 formats.
22216 The option has no effect for little-endian images and is ignored.  The
22217 default is dependent on the selected target architecture.  For ARMv6
22218 and later architectures the default is BE8, for older architectures
22219 the default is BE32.  BE32 format has been deprecated by ARM.
22221 @opindex march
22222 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
22223 This specifies the name of the target ARM architecture.  GCC uses this
22224 name to determine what kind of instructions it can emit when generating
22225 assembly code.  This option can be used in conjunction with or instead
22226 of the @option{-mcpu=} option.
22228 Permissible names are:
22229 @samp{armv4t},
22230 @samp{armv5t}, @samp{armv5te},
22231 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
22232 @samp{armv6z}, @samp{armv6zk},
22233 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
22234 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
22235 @samp{armv8.4-a},
22236 @samp{armv8.5-a},
22237 @samp{armv8.6-a},
22238 @samp{armv9-a},
22239 @samp{armv7-r},
22240 @samp{armv8-r},
22241 @samp{armv6-m}, @samp{armv6s-m},
22242 @samp{armv7-m}, @samp{armv7e-m},
22243 @samp{armv8-m.base}, @samp{armv8-m.main},
22244 @samp{armv8.1-m.main},
22245 @samp{armv9-a},
22246 @samp{iwmmxt} and @samp{iwmmxt2}.
22248 Additionally, the following architectures, which lack support for the
22249 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
22251 Many of the architectures support extensions.  These can be added by
22252 appending @samp{+@var{extension}} to the architecture name.  Extension
22253 options are processed in order and capabilities accumulate.  An extension
22254 will also enable any necessary base extensions
22255 upon which it depends.  For example, the @samp{+crypto} extension
22256 will always enable the @samp{+simd} extension.  The exception to the
22257 additive construction is for extensions that are prefixed with
22258 @samp{+no@dots{}}: these extensions disable the specified option and
22259 any other extensions that may depend on the presence of that
22260 extension.
22262 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
22263 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22264 entirely disabled by the @samp{+nofp} option that follows it.
22266 Most extension names are generically named, but have an effect that is
22267 dependent upon the architecture to which it is applied.  For example,
22268 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22269 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22270 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22271 variant for @samp{armv8-a}.
22273 The table below lists the supported extensions for each architecture.
22274 Architectures not mentioned do not support any extensions.
22276 @table @samp
22277 @item armv5te
22278 @itemx armv6
22279 @itemx armv6j
22280 @itemx armv6k
22281 @itemx armv6kz
22282 @itemx armv6t2
22283 @itemx armv6z
22284 @itemx armv6zk
22285 @table @samp
22286 @item +fp
22287 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22288 used as an alias for this extension.
22290 @item +nofp
22291 Disable the floating-point instructions.
22292 @end table
22294 @item armv7
22295 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22296 @table @samp
22297 @item +fp
22298 The VFPv3 floating-point instructions, with 16 double-precision
22299 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22300 for this extension.  Note that floating-point is not supported by the
22301 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22302 ARMv7-R architectures.
22304 @item +nofp
22305 Disable the floating-point instructions.
22306 @end table
22308 @item armv7-a
22309 @table @samp
22310 @item +mp
22311 The multiprocessing extension.
22313 @item +sec
22314 The security extension.
22316 @item +fp
22317 The VFPv3 floating-point instructions, with 16 double-precision
22318 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22319 for this extension.
22321 @item +simd
22322 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22323 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22324 for this extension.
22326 @item +vfpv3
22327 The VFPv3 floating-point instructions, with 32 double-precision
22328 registers.
22330 @item +vfpv3-d16-fp16
22331 The VFPv3 floating-point instructions, with 16 double-precision
22332 registers and the half-precision floating-point conversion operations.
22334 @item +vfpv3-fp16
22335 The VFPv3 floating-point instructions, with 32 double-precision
22336 registers and the half-precision floating-point conversion operations.
22338 @item +vfpv4-d16
22339 The VFPv4 floating-point instructions, with 16 double-precision
22340 registers.
22342 @item +vfpv4
22343 The VFPv4 floating-point instructions, with 32 double-precision
22344 registers.
22346 @item +neon-fp16
22347 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22348 the half-precision floating-point conversion operations.
22350 @item +neon-vfpv4
22351 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22353 @item +nosimd
22354 Disable the Advanced SIMD instructions (does not disable floating point).
22356 @item +nofp
22357 Disable the floating-point and Advanced SIMD instructions.
22358 @end table
22360 @item armv7ve
22361 The extended version of the ARMv7-A architecture with support for
22362 virtualization.
22363 @table @samp
22364 @item +fp
22365 The VFPv4 floating-point instructions, with 16 double-precision registers.
22366 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22368 @item +simd
22369 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22370 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22372 @item +vfpv3-d16
22373 The VFPv3 floating-point instructions, with 16 double-precision
22374 registers.
22376 @item +vfpv3
22377 The VFPv3 floating-point instructions, with 32 double-precision
22378 registers.
22380 @item +vfpv3-d16-fp16
22381 The VFPv3 floating-point instructions, with 16 double-precision
22382 registers and the half-precision floating-point conversion operations.
22384 @item +vfpv3-fp16
22385 The VFPv3 floating-point instructions, with 32 double-precision
22386 registers and the half-precision floating-point conversion operations.
22388 @item +vfpv4-d16
22389 The VFPv4 floating-point instructions, with 16 double-precision
22390 registers.
22392 @item +vfpv4
22393 The VFPv4 floating-point instructions, with 32 double-precision
22394 registers.
22396 @item +neon
22397 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22398 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22400 @item +neon-fp16
22401 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22402 the half-precision floating-point conversion operations.
22404 @item +nosimd
22405 Disable the Advanced SIMD instructions (does not disable floating point).
22407 @item +nofp
22408 Disable the floating-point and Advanced SIMD instructions.
22409 @end table
22411 @item armv8-a
22412 @table @samp
22413 @item +crc
22414 The Cyclic Redundancy Check (CRC) instructions.
22415 @item +simd
22416 The ARMv8-A Advanced SIMD and floating-point instructions.
22417 @item +crypto
22418 The cryptographic instructions.
22419 @item +nocrypto
22420 Disable the cryptographic instructions.
22421 @item +nofp
22422 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22423 @item +sb
22424 Speculation Barrier Instruction.
22425 @item +predres
22426 Execution and Data Prediction Restriction Instructions.
22427 @end table
22429 @item armv8.1-a
22430 @table @samp
22431 @item +simd
22432 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22434 @item +crypto
22435 The cryptographic instructions.  This also enables the Advanced SIMD and
22436 floating-point instructions.
22438 @item +nocrypto
22439 Disable the cryptographic instructions.
22441 @item +nofp
22442 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22444 @item +sb
22445 Speculation Barrier Instruction.
22447 @item +predres
22448 Execution and Data Prediction Restriction Instructions.
22449 @end table
22451 @item armv8.2-a
22452 @itemx armv8.3-a
22453 @table @samp
22454 @item +fp16
22455 The half-precision floating-point data processing instructions.
22456 This also enables the Advanced SIMD and floating-point instructions.
22458 @item +fp16fml
22459 The half-precision floating-point fmla extension.  This also enables
22460 the half-precision floating-point extension and Advanced SIMD and
22461 floating-point instructions.
22463 @item +simd
22464 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22466 @item +crypto
22467 The cryptographic instructions.  This also enables the Advanced SIMD and
22468 floating-point instructions.
22470 @item +dotprod
22471 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
22473 @item +nocrypto
22474 Disable the cryptographic extension.
22476 @item +nofp
22477 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22479 @item +sb
22480 Speculation Barrier Instruction.
22482 @item +predres
22483 Execution and Data Prediction Restriction Instructions.
22485 @item +i8mm
22486 8-bit Integer Matrix Multiply instructions.
22487 This also enables Advanced SIMD and floating-point instructions.
22489 @item +bf16
22490 Brain half-precision floating-point instructions.
22491 This also enables Advanced SIMD and floating-point instructions.
22492 @end table
22494 @item armv8.4-a
22495 @table @samp
22496 @item +fp16
22497 The half-precision floating-point data processing instructions.
22498 This also enables the Advanced SIMD and floating-point instructions as well
22499 as the Dot Product extension and the half-precision floating-point fmla
22500 extension.
22502 @item +simd
22503 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22504 Dot Product extension.
22506 @item +crypto
22507 The cryptographic instructions.  This also enables the Advanced SIMD and
22508 floating-point instructions as well as the Dot Product extension.
22510 @item +nocrypto
22511 Disable the cryptographic extension.
22513 @item +nofp
22514 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22516 @item +sb
22517 Speculation Barrier Instruction.
22519 @item +predres
22520 Execution and Data Prediction Restriction Instructions.
22522 @item +i8mm
22523 8-bit Integer Matrix Multiply instructions.
22524 This also enables Advanced SIMD and floating-point instructions.
22526 @item +bf16
22527 Brain half-precision floating-point instructions.
22528 This also enables Advanced SIMD and floating-point instructions.
22529 @end table
22531 @item armv8.5-a
22532 @table @samp
22533 @item +fp16
22534 The half-precision floating-point data processing instructions.
22535 This also enables the Advanced SIMD and floating-point instructions as well
22536 as the Dot Product extension and the half-precision floating-point fmla
22537 extension.
22539 @item +simd
22540 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22541 Dot Product extension.
22543 @item +crypto
22544 The cryptographic instructions.  This also enables the Advanced SIMD and
22545 floating-point instructions as well as the Dot Product extension.
22547 @item +nocrypto
22548 Disable the cryptographic extension.
22550 @item +nofp
22551 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22553 @item +i8mm
22554 8-bit Integer Matrix Multiply instructions.
22555 This also enables Advanced SIMD and floating-point instructions.
22557 @item +bf16
22558 Brain half-precision floating-point instructions.
22559 This also enables Advanced SIMD and floating-point instructions.
22560 @end table
22562 @item armv8.6-a
22563 @table @samp
22564 @item +fp16
22565 The half-precision floating-point data processing instructions.
22566 This also enables the Advanced SIMD and floating-point instructions as well
22567 as the Dot Product extension and the half-precision floating-point fmla
22568 extension.
22570 @item +simd
22571 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22572 Dot Product extension.
22574 @item +crypto
22575 The cryptographic instructions.  This also enables the Advanced SIMD and
22576 floating-point instructions as well as the Dot Product extension.
22578 @item +nocrypto
22579 Disable the cryptographic extension.
22581 @item +nofp
22582 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22584 @item +i8mm
22585 8-bit Integer Matrix Multiply instructions.
22586 This also enables Advanced SIMD and floating-point instructions.
22588 @item +bf16
22589 Brain half-precision floating-point instructions.
22590 This also enables Advanced SIMD and floating-point instructions.
22591 @end table
22593 @item armv7-r
22594 @table @samp
22595 @item +fp.sp
22596 The single-precision VFPv3 floating-point instructions.  The extension
22597 @samp{+vfpv3xd} can be used as an alias for this extension.
22599 @item +fp
22600 The VFPv3 floating-point instructions with 16 double-precision registers.
22601 The extension +vfpv3-d16 can be used as an alias for this extension.
22603 @item +vfpv3xd-d16-fp16
22604 The single-precision VFPv3 floating-point instructions with 16 double-precision
22605 registers and the half-precision floating-point conversion operations.
22607 @item +vfpv3-d16-fp16
22608 The VFPv3 floating-point instructions with 16 double-precision
22609 registers and the half-precision floating-point conversion operations.
22611 @item +nofp
22612 Disable the floating-point extension.
22614 @item +idiv
22615 The ARM-state integer division instructions.
22617 @item +noidiv
22618 Disable the ARM-state integer division extension.
22619 @end table
22621 @item armv7e-m
22622 @table @samp
22623 @item +fp
22624 The single-precision VFPv4 floating-point instructions.
22626 @item +fpv5
22627 The single-precision FPv5 floating-point instructions.
22629 @item +fp.dp
22630 The single- and double-precision FPv5 floating-point instructions.
22632 @item +nofp
22633 Disable the floating-point extensions.
22634 @end table
22636 @item  armv8.1-m.main
22637 @table @samp
22639 @item +dsp
22640 The DSP instructions.
22642 @item +mve
22643 The M-Profile Vector Extension (MVE) integer instructions.
22645 @item +mve.fp
22646 The M-Profile Vector Extension (MVE) integer and single precision
22647 floating-point instructions.
22649 @item +fp
22650 The single-precision floating-point instructions.
22652 @item +fp.dp
22653 The single- and double-precision floating-point instructions.
22655 @item +nofp
22656 Disable the floating-point extension.
22658 @item +cdecp0, +cdecp1, ... , +cdecp7
22659 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22660 to the numbers given in the options in the range 0 to 7.
22662 @item +pacbti
22663 Enable the Pointer Authentication and Branch Target Identification Extension.
22664 @end table
22666 @item  armv8-m.main
22667 @table @samp
22668 @item +dsp
22669 The DSP instructions.
22671 @item +nodsp
22672 Disable the DSP extension.
22674 @item +fp
22675 The single-precision floating-point instructions.
22677 @item +fp.dp
22678 The single- and double-precision floating-point instructions.
22680 @item +nofp
22681 Disable the floating-point extension.
22683 @item +cdecp0, +cdecp1, ... , +cdecp7
22684 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22685 to the numbers given in the options in the range 0 to 7.
22686 @end table
22688 @item armv8-r
22689 @table @samp
22690 @item +crc
22691 The Cyclic Redundancy Check (CRC) instructions.
22692 @item +fp.sp
22693 The single-precision FPv5 floating-point instructions.
22694 @item +simd
22695 The ARMv8-A Advanced SIMD and floating-point instructions.
22696 @item +crypto
22697 The cryptographic instructions.
22698 @item +nocrypto
22699 Disable the cryptographic instructions.
22700 @item +nofp
22701 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22702 @end table
22704 @end table
22706 @option{-march=native} causes the compiler to auto-detect the architecture
22707 of the build computer.  At present, this feature is only supported on
22708 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22709 is unsuccessful the option has no effect.
22711 @opindex mtune
22712 @item -mtune=@var{name}
22713 This option specifies the name of the target ARM processor for
22714 which GCC should tune the performance of the code.
22715 For some ARM implementations better performance can be obtained by using
22716 this option.
22717 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22718 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22719 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22720 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22721 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22722 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22723 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22724 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22725 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22726 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22727 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22728 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22729 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22730 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22731 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22732 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22733 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22734 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22735 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22736 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
22737 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22738 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22739 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22740 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22741 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22742 @samp{xgene1}.
22744 Additionally, this option can specify that GCC should tune the performance
22745 of the code for a big.LITTLE system.  Permissible names are:
22746 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22747 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22748 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22749 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22751 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22752 performance for a blend of processors within architecture @var{arch}.
22753 The aim is to generate code that run well on the current most popular
22754 processors, balancing between optimizations that benefit some CPUs in the
22755 range, and avoiding performance pitfalls of other CPUs.  The effects of
22756 this option may change in future GCC versions as CPU models come and go.
22758 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22759 the extension options do not affect the tuning of the generated code.
22761 @option{-mtune=native} causes the compiler to auto-detect the CPU
22762 of the build computer.  At present, this feature is only supported on
22763 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
22764 unsuccessful the option has no effect.
22766 @opindex mcpu
22767 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22768 This specifies the name of the target ARM processor.  GCC uses this name
22769 to derive the name of the target ARM architecture (as if specified
22770 by @option{-march}) and the ARM processor type for which to tune for
22771 performance (as if specified by @option{-mtune}).  Where this option
22772 is used in conjunction with @option{-march} or @option{-mtune},
22773 those options take precedence over the appropriate part of this option.
22775 Many of the supported CPUs implement optional architectural
22776 extensions.  Where this is so the architectural extensions are
22777 normally enabled by default.  If implementations that lack the
22778 extension exist, then the extension syntax can be used to disable
22779 those extensions that have been omitted.  For floating-point and
22780 Advanced SIMD (Neon) instructions, the settings of the options
22781 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22782 floating-point and Advanced SIMD instructions will only be used if
22783 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22784 @option{-mfpu} other than @samp{auto} will override the available
22785 floating-point and SIMD extension instructions.
22787 For example, @samp{cortex-a9} can be found in three major
22788 configurations: integer only, with just a floating-point unit or with
22789 floating-point and Advanced SIMD.  The default is to enable all the
22790 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22791 be used to disable just the SIMD or both the SIMD and floating-point
22792 instructions respectively.
22794 Permissible names for this option are the same as those for
22795 @option{-mtune}.
22797 The following extension options are common to the listed CPUs:
22799 @table @samp
22800 @item +nodsp
22801 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
22802 @samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector
22803 Extension (MVE) integer and single precision floating-point instructions on
22804 @samp{cortex-m55} and @samp{cortex-m85}.
22806 @item +nopacbti
22807 Disable the Pointer Authentication and Branch Target Identification Extension
22808 on @samp{cortex-m85}.
22810 @item +nomve
22811 Disable the M-Profile Vector Extension (MVE) integer and single precision
22812 floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22814 @item +nomve.fp
22815 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22816 instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22818 @item +cdecp0, +cdecp1, ... , +cdecp7
22819 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22820 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22822 @item  +nofp
22823 Disables the floating-point instructions on @samp{arm9e},
22824 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22825 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22826 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22827 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22828 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
22829 @samp{cortex-m55} and @samp{cortex-m85}.
22830 Disables the floating-point and SIMD instructions on
22831 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22832 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22833 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22834 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22835 @samp{cortex-a53} and @samp{cortex-a55}.
22837 @item +nofp.dp
22838 Disables the double-precision component of the floating-point instructions
22839 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22840 @samp{cortex-r52plus} and @samp{cortex-m7}.
22842 @item +nosimd
22843 Disables the SIMD (but not floating-point) instructions on
22844 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22845 and @samp{cortex-a9}.
22847 @item +crypto
22848 Enables the cryptographic instructions on @samp{cortex-a32},
22849 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22850 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22851 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22852 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22853 @samp{cortex-a75.cortex-a55}.
22854 @end table
22856 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22857 VFPv3 with 16 double-precision registers.  It supports the following
22858 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22859 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22860 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22861 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
22862 the extensions to @option{-march=armv7-a}.
22864 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22865 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22866 See @option{-mtune} for more information.
22868 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22869 of the build computer.  At present, this feature is only supported on
22870 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22871 is unsuccessful the option has no effect.
22873 @opindex mfpu
22874 @item -mfpu=@var{name}
22875 This specifies what floating-point hardware (or hardware emulation) is
22876 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
22877 @samp{vfpv3},
22878 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22879 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22880 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22881 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22882 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22883 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22884 is an alias for @samp{vfpv2}.
22886 The setting @samp{auto} is the default and is special.  It causes the
22887 compiler to select the floating-point and Advanced SIMD instructions
22888 based on the settings of @option{-mcpu} and @option{-march}.
22890 If the selected floating-point hardware includes the NEON extension
22891 (e.g.@: @option{-mfpu=neon}), note that floating-point
22892 operations are not generated by GCC's auto-vectorization pass unless
22893 @option{-funsafe-math-optimizations} is also specified.  This is
22894 because NEON hardware does not fully implement the IEEE 754 standard for
22895 floating-point arithmetic (in particular denormal values are treated as
22896 zero), so the use of NEON instructions may lead to a loss of precision.
22898 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}).
22900 @opindex mfp16-format
22901 @item -mfp16-format=@var{name}
22902 Specify the format of the @code{__fp16} half-precision floating-point type.
22903 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22904 the default is @samp{none}, in which case the @code{__fp16} type is not
22905 defined.  @xref{Half-Precision}, for more information.
22907 @opindex mstructure-size-boundary
22908 @item -mstructure-size-boundary=@var{n}
22909 The sizes of all structures and unions are rounded up to a multiple
22910 of the number of bits set by this option.  Permissible values are 8, 32
22911 and 64.  The default value varies for different toolchains.  For the COFF
22912 targeted toolchain the default value is 8.  A value of 64 is only allowed
22913 if the underlying ABI supports it.
22915 Specifying a larger number can produce faster, more efficient code, but
22916 can also increase the size of the program.  Different values are potentially
22917 incompatible.  Code compiled with one value cannot necessarily expect to
22918 work with code or libraries compiled with another value, if they exchange
22919 information using structures or unions.
22921 This option is deprecated.
22923 @opindex mabort-on-noreturn
22924 @item -mabort-on-noreturn
22925 Generate a call to the function @code{abort} at the end of a
22926 @code{noreturn} function.  It is executed if the function tries to
22927 return.
22929 @opindex mlong-calls
22930 @opindex mno-long-calls
22931 @item -mlong-calls
22932 @itemx -mno-long-calls
22933 Tells the compiler to perform function calls by first loading the
22934 address of the function into a register and then performing a subroutine
22935 call on this register.  This switch is needed if the target function
22936 lies outside of the 64-megabyte addressing range of the offset-based
22937 version of subroutine call instruction.
22939 Even if this switch is enabled, not all function calls are turned
22940 into long calls.  The heuristic is that static functions, functions
22941 that have the @code{short_call} attribute, functions that are inside
22942 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22943 definitions have already been compiled within the current compilation
22944 unit are not turned into long calls.  The exceptions to this rule are
22945 that weak function definitions, functions with the @code{long_call}
22946 attribute or the @code{section} attribute, and functions that are within
22947 the scope of a @code{#pragma long_calls} directive are always
22948 turned into long calls.
22950 This feature is not enabled by default.  Specifying
22951 @option{-mno-long-calls} restores the default behavior, as does
22952 placing the function calls within the scope of a @code{#pragma
22953 long_calls_off} directive.  Note these switches have no effect on how
22954 the compiler generates code to handle function calls via function
22955 pointers.
22957 @opindex msingle-pic-base
22958 @item -msingle-pic-base
22959 Treat the register used for PIC addressing as read-only, rather than
22960 loading it in the prologue for each function.  The runtime system is
22961 responsible for initializing this register with an appropriate value
22962 before execution begins.
22964 @opindex mpic-register
22965 @item -mpic-register=@var{reg}
22966 Specify the register to be used for PIC addressing.
22967 For standard PIC base case, the default is any suitable register
22968 determined by compiler.  For single PIC base case, the default is
22969 @samp{R9} if target is EABI based or stack-checking is enabled,
22970 otherwise the default is @samp{R10}.
22972 @opindex mpic-data-is-text-relative
22973 @item -mpic-data-is-text-relative
22974 Assume that the displacement between the text and data segments is fixed
22975 at static link time.  This permits using PC-relative addressing
22976 operations to access data known to be in the data segment.  For
22977 non-VxWorks RTP targets, this option is enabled by default.  When
22978 disabled on such targets, it will enable @option{-msingle-pic-base} by
22979 default.
22981 @opindex mpoke-function-name
22982 @item -mpoke-function-name
22983 Write the name of each function into the text section, directly
22984 preceding the function prologue.  The generated code is similar to this:
22986 @smallexample
22987      t0
22988          .ascii "arm_poke_function_name", 0
22989          .align
22990      t1
22991          .word 0xff000000 + (t1 - t0)
22992      arm_poke_function_name
22993          mov     ip, sp
22994          stmfd   sp!, @{fp, ip, lr, pc@}
22995          sub     fp, ip, #4
22996 @end smallexample
22998 When performing a stack backtrace, code can inspect the value of
22999 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
23000 location @code{pc - 12} and the top 8 bits are set, then we know that
23001 there is a function name embedded immediately preceding this location
23002 and has length @code{((pc[-3]) & 0xff000000)}.
23004 @opindex marm
23005 @opindex mthumb
23006 @item -mthumb
23007 @itemx -marm
23009 Select between generating code that executes in ARM and Thumb
23010 states.  The default for most configurations is to generate code
23011 that executes in ARM state, but the default can be changed by
23012 configuring GCC with the @option{--with-mode=}@var{state}
23013 configure option.
23015 You can also override the ARM and Thumb mode for each function
23016 by using the @code{target("thumb")} and @code{target("arm")} function attributes
23017 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
23019 @opindex mflip-thumb
23020 @item -mflip-thumb 
23021 Switch ARM/Thumb modes on alternating functions.
23022 This option is provided for regression testing of mixed Thumb/ARM code
23023 generation, and is not intended for ordinary use in compiling code.
23025 @opindex mtpcs-frame
23026 @item -mtpcs-frame
23027 Generate a stack frame that is compliant with the Thumb Procedure Call
23028 Standard for all non-leaf functions.  (A leaf function is one that does
23029 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
23031 @opindex mtpcs-leaf-frame
23032 @item -mtpcs-leaf-frame
23033 Generate a stack frame that is compliant with the Thumb Procedure Call
23034 Standard for all leaf functions.  (A leaf function is one that does
23035 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
23037 @opindex mcallee-super-interworking
23038 @item -mcallee-super-interworking
23039 Gives all externally visible functions in the file being compiled an ARM
23040 instruction set header which switches to Thumb mode before executing the
23041 rest of the function.  This allows these functions to be called from
23042 non-interworking code.  This option is not valid in AAPCS configurations
23043 because interworking is enabled by default.
23045 @opindex mcaller-super-interworking
23046 @item -mcaller-super-interworking
23047 Allows calls via function pointers (including virtual functions) to
23048 execute correctly regardless of whether the target code has been
23049 compiled for interworking or not.  There is a small overhead in the cost
23050 of executing a function pointer if this option is enabled.  This option
23051 is not valid in AAPCS configurations because interworking is enabled
23052 by default.
23054 @opindex mtp
23055 @item -mtp=@var{name}
23056 Specify the access model for the thread local storage pointer.  The model
23057 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
23058 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
23059 the thread pointer from the corresponding system register directly
23060 (supported from the arm6k architecture and later).  These system registers
23061 are accessed through the CP15 co-processor interface and the argument
23062 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
23063 The argument @samp{auto} uses the best available method for the selected
23064 processor.  The default setting is @samp{auto}.
23066 @opindex mtls-dialect
23067 @item -mtls-dialect=@var{dialect}
23068 Specify the dialect to use for accessing thread local storage.  Two
23069 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
23070 @samp{gnu} dialect selects the original GNU scheme for supporting
23071 local and global dynamic TLS models.  The @samp{gnu2} dialect
23072 selects the GNU descriptor scheme, which provides better performance
23073 for shared libraries.  The GNU descriptor scheme is compatible with
23074 the original scheme, but does require new assembler, linker and
23075 library support.  Initial and local exec TLS models are unaffected by
23076 this option and always use the original scheme.
23078 @opindex mword-relocations
23079 @item -mword-relocations
23080 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
23081 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
23082 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
23083 is specified. This option conflicts with @option{-mslow-flash-data}.
23085 @opindex mfix-cortex-m3-ldrd
23086 @item -mfix-cortex-m3-ldrd
23087 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
23088 with overlapping destination and base registers are used.  This option avoids
23089 generating these instructions.  This option is enabled by default when
23090 @option{-mcpu=cortex-m3} is specified.
23092 @item -mfix-cortex-a57-aes-1742098
23093 @itemx -mno-fix-cortex-a57-aes-1742098
23094 @itemx -mfix-cortex-a72-aes-1655431
23095 @itemx -mno-fix-cortex-a72-aes-1655431
23096 Enable (disable) mitigation for an erratum on Cortex-A57 and
23097 Cortex-A72 that affects the AES cryptographic instructions.  This
23098 option is enabled by default when either @option{-mcpu=cortex-a57} or
23099 @option{-mcpu=cortex-a72} is specified.
23101 @opindex munaligned-access
23102 @opindex mno-unaligned-access
23103 @item -munaligned-access
23104 @itemx -mno-unaligned-access
23105 Enables (or disables) reading and writing of 16- and 32- bit values
23106 from addresses that are not 16- or 32- bit aligned.  By default
23107 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
23108 ARMv8-M Baseline architectures, and enabled for all other
23109 architectures.  If unaligned access is not enabled then words in packed
23110 data structures are accessed a byte at a time.
23112 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
23113 generated object file to either true or false, depending upon the
23114 setting of this option.  If unaligned access is enabled then the
23115 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
23116 defined.
23118 @opindex mneon-for-64bits
23119 @item -mneon-for-64bits
23120 This option is deprecated and has no effect.
23122 @opindex mslow-flash-data
23123 @item -mslow-flash-data
23124 Assume loading data from flash is slower than fetching instruction.
23125 Therefore literal load is minimized for better performance.
23126 This option is only supported when compiling for ARMv7 M-profile and
23127 off by default. It conflicts with @option{-mword-relocations}.
23129 @opindex masm-syntax-unified
23130 @item -masm-syntax-unified
23131 Assume inline assembler is using unified asm syntax.  The default is
23132 currently off which implies divided syntax.  This option has no impact
23133 on Thumb2. However, this may change in future releases of GCC.
23134 Divided syntax should be considered deprecated.
23136 @opindex mrestrict-it
23137 @item -mrestrict-it
23138 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
23139 IT blocks can only contain a single 16-bit instruction from a select
23140 set of instructions. This option is on by default for ARMv8-A Thumb mode.
23142 @opindex mprint-tune-info
23143 @item -mprint-tune-info
23144 Print CPU tuning information as comment in assembler file.  This is
23145 an option used only for regression testing of the compiler and not
23146 intended for ordinary use in compiling code.  This option is disabled
23147 by default.
23149 @opindex mverbose-cost-dump
23150 @item -mverbose-cost-dump
23151 Enable verbose cost model dumping in the debug dump files.  This option is
23152 provided for use in debugging the compiler.
23154 @opindex mpure-code
23155 @item -mpure-code
23156 Do not allow constant data to be placed in code sections.
23157 Additionally, when compiling for ELF object format give all text sections the
23158 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
23159 is only available when generating non-pic code for M-profile targets.
23161 @opindex mcmse
23162 @item -mcmse
23163 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
23164 Development Tools Engineering Specification", which can be found on
23165 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
23167 @opindex mfix-cmse-cve-2021-35465
23168 @item -mfix-cmse-cve-2021-35465
23169 Mitigate against a potential security issue with the @code{VLLDM} instruction
23170 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
23171 enabled by default when the option @option{-mcpu=} is used with
23172 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85}
23173 or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used
23174 to disable the mitigation.
23176 @opindex mstack-protector-guard
23177 @opindex mstack-protector-guard-offset
23178 @item -mstack-protector-guard=@var{guard}
23179 @itemx -mstack-protector-guard-offset=@var{offset}
23180 Generate stack protection code using canary at @var{guard}.  Supported
23181 locations are @samp{global} for a global canary or @samp{tls} for a
23182 canary accessible via the TLS register. The option
23183 @option{-mstack-protector-guard-offset=} is for use with
23184 @option{-fstack-protector-guard=tls} and not for use in user-land code.
23186 @opindex mfdpic
23187 @opindex mno-fdpic
23188 @item -mfdpic
23189 @itemx -mno-fdpic
23190 Select the FDPIC ABI, which uses 64-bit function descriptors to
23191 represent pointers to functions.  When the compiler is configured for
23192 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
23193 and implies @option{-fPIE} if none of the PIC/PIE-related options is
23194 provided.  On other targets, it only enables the FDPIC-specific code
23195 generation features, and the user should explicitly provide the
23196 PIC/PIE-related options as needed.
23198 Note that static linking is not supported because it would still
23199 involve the dynamic linker when the program self-relocates.  If such
23200 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
23202 The opposite @option{-mno-fdpic} option is useful (and required) to
23203 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
23204 toolchain as the one used to build the userland programs.
23206 @opindex mbranch-protection
23207 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
23208 Enable branch protection features (armv8.1-m.main only).
23209 @samp{none} generate code without branch protection or return address
23210 signing.
23211 @samp{standard[+@var{leaf}]} generate code with all branch protection
23212 features enabled at their standard level.
23213 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
23214 set to its standard level, which is to sign all functions that save
23215 the return address to memory.
23216 @samp{leaf} When return address signing is enabled, also sign leaf
23217 functions even if they do not write the return address to memory.
23218 +@samp{bti} Add landing-pad instructions at the permitted targets of
23219 indirect branch instructions.
23221 If the @samp{+pacbti} architecture extension is not enabled, then all
23222 branch protection and return address signing operations are
23223 constrained to use only the instructions defined in the
23224 architectural-NOP space. The generated code will remain
23225 backwards-compatible with earlier versions of the architecture, but
23226 the additional security can be enabled at run time on processors that
23227 support the @samp{PACBTI} extension.
23229 Branch target enforcement using BTI can only be enabled at runtime if
23230 all code in the application has been compiled with at least
23231 @samp{-mbranch-protection=bti}.
23233 Any setting other than @samp{none} is supported only on armv8-m.main
23234 or later.
23236 The default is to generate code without branch protection or return
23237 address signing.
23239 @end table
23241 @node AVR Options
23242 @subsection AVR Options
23243 @cindex AVR Options
23245 These options are defined for AVR implementations:
23247 @table @gcctabopt
23248 @opindex mmcu
23249 @item -mmcu=@var{mcu}
23250 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
23252 The default for this option is@tie{}@samp{avr2}.
23254 GCC supports the following AVR devices and ISAs:
23256 @include avr-mmcu.texi
23258 @opindex mabsdata
23259 @item -mabsdata
23261 Assume that all data in static storage can be accessed by LDS / STS
23262 instructions.  This option has only an effect on reduced Tiny devices like
23263 ATtiny40.  See also the @code{absdata}
23264 @ref{AVR Variable Attributes,variable attribute}.
23266 @opindex maccumulate-args
23267 @item -maccumulate-args
23268 Accumulate outgoing function arguments and acquire/release the needed
23269 stack space for outgoing function arguments once in function
23270 prologue/epilogue.  Without this option, outgoing arguments are pushed
23271 before calling a function and popped afterwards.
23273 Popping the arguments after the function call can be expensive on
23274 AVR so that accumulating the stack space might lead to smaller
23275 executables because arguments need not be removed from the
23276 stack after such a function call.
23278 This option can lead to reduced code size for functions that perform
23279 several calls to functions that get their arguments on the stack like
23280 calls to printf-like functions.
23282 @opindex mbranch-cost
23283 @item -mbranch-cost=@var{cost}
23284 Set the branch costs for conditional branch instructions to
23285 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23286 integers. The default branch cost is 0.
23288 @opindex mcall-prologues
23289 @item -mcall-prologues
23290 Functions prologues/epilogues are expanded as calls to appropriate
23291 subroutines.  Code size is smaller.
23293 @opindex mdouble
23294 @opindex mlong-double
23295 @item -mdouble=@var{bits}
23296 @itemx -mlong-double=@var{bits}
23297 Set the size (in bits) of the @code{double} or @code{long double} type,
23298 respectively.  Possible values for @var{bits} are 32 and 64.
23299 Whether or not a specific value for @var{bits} is allowed depends on
23300 the @code{--with-double=} and @code{--with-long-double=}
23301 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23302 and the same applies for the default values of the options.
23304 @opindex mgas-isr-prologues
23305 @item -mgas-isr-prologues
23306 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23307 instruction supported by GNU Binutils.
23308 If this option is on, the feature can still be disabled for individual
23309 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23310 function attribute.  This feature is activated per default
23311 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23312 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23314 @opindex mint8
23315 @item -mint8
23316 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23317 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23318 and @code{long long} is 4 bytes.  Please note that this option does not
23319 conform to the C standards, but it results in smaller code
23320 size.
23322 @opindex mmain-is-OS_task
23323 @item -mmain-is-OS_task
23324 Do not save registers in @code{main}.  The effect is the same like
23325 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23326 to @code{main}. It is activated per default if optimization is on.
23328 @opindex mn-flash
23329 @item -mn-flash=@var{num}
23330 Assume that the flash memory has a size of 
23331 @var{num} times 64@tie{}KiB.
23333 @opindex mno-interrupts
23334 @item -mno-interrupts
23335 Generated code is not compatible with hardware interrupts.
23336 Code size is smaller.
23338 @opindex mrelax
23339 @item -mrelax
23340 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23341 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23342 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23343 the assembler's command line and the @option{--relax} option to the
23344 linker's command line.
23346 Jump relaxing is performed by the linker because jump offsets are not
23347 known before code is located. Therefore, the assembler code generated by the
23348 compiler is the same, but the instructions in the executable may
23349 differ from instructions in the assembler code.
23351 Relaxing must be turned on if linker stubs are needed, see the
23352 section on @code{EIND} and linker stubs below.
23354 @opindex mrmw
23355 @item -mrmw
23356 Assume that the device supports the Read-Modify-Write
23357 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
23359 @opindex mshort-calls
23360 @item -mshort-calls
23362 Assume that @code{RJMP} and @code{RCALL} can target the whole
23363 program memory.
23365 This option is used internally for multilib selection.  It is
23366 not an optimization option, and you don't need to set it by hand.
23368 @opindex msp8
23369 @item -msp8
23370 Treat the stack pointer register as an 8-bit register,
23371 i.e.@: assume the high byte of the stack pointer is zero.
23372 In general, you don't need to set this option by hand.
23374 This option is used internally by the compiler to select and
23375 build multilibs for architectures @code{avr2} and @code{avr25}.
23376 These architectures mix devices with and without @code{SPH}.
23377 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
23378 the compiler driver adds or removes this option from the compiler
23379 proper's command line, because the compiler then knows if the device
23380 or architecture has an 8-bit stack pointer and thus no @code{SPH}
23381 register or not.
23383 @opindex mstrict-X
23384 @item -mstrict-X
23385 Use address register @code{X} in a way proposed by the hardware.  This means
23386 that @code{X} is only used in indirect, post-increment or
23387 pre-decrement addressing.
23389 Without this option, the @code{X} register may be used in the same way
23390 as @code{Y} or @code{Z} which then is emulated by additional
23391 instructions.  
23392 For example, loading a value with @code{X+const} addressing with a
23393 small non-negative @code{const < 64} to a register @var{Rn} is
23394 performed as
23396 @example
23397 adiw r26, const   ; X += const
23398 ld   @var{Rn}, X        ; @var{Rn} = *X
23399 sbiw r26, const   ; X -= const
23400 @end example
23402 @opindex mtiny-stack
23403 @item -mtiny-stack
23404 Only change the lower 8@tie{}bits of the stack pointer.
23406 @opindex mfract-convert-truncate
23407 @item -mfract-convert-truncate
23408 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23410 @opindex nodevicelib
23411 @item -nodevicelib
23412 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23414 @opindex nodevicespecs
23415 @item -nodevicespecs
23416 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23417 command line.  The user takes responsibility for supplying the sub-processes
23418 like compiler proper, assembler and linker with appropriate command line
23419 options.  This means that the user has to supply her private device specs
23420 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23421 more need for option @option{-mmcu=@var{mcu}}.
23423 This option can also serve as a replacement for the older way of
23424 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23425 which contains a folder named @code{device-specs} which contains a specs file named
23426 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23428 @opindex Waddr-space-convert
23429 @opindex Wno-addr-space-convert
23430 @item -Waddr-space-convert
23431 Warn about conversions between address spaces in the case where the
23432 resulting address space is not contained in the incoming address space.
23434 @opindex Wmisspelled-isr
23435 @opindex Wno-misspelled-isr
23436 @item -Wmisspelled-isr
23437 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23438 Enabled by default.
23439 @end table
23441 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23442 @cindex @code{EIND}
23443 Pointers in the implementation are 16@tie{}bits wide.
23444 The address of a function or label is represented as word address so
23445 that indirect jumps and calls can target any code address in the
23446 range of 64@tie{}Ki words.
23448 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23449 bytes of program memory space, there is a special function register called
23450 @code{EIND} that serves as most significant part of the target address
23451 when @code{EICALL} or @code{EIJMP} instructions are used.
23453 Indirect jumps and calls on these devices are handled as follows by
23454 the compiler and are subject to some limitations:
23456 @itemize @bullet
23458 @item
23459 The compiler never sets @code{EIND}.
23461 @item
23462 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
23463 instructions or might read @code{EIND} directly in order to emulate an
23464 indirect call/jump by means of a @code{RET} instruction.
23466 @item
23467 The compiler assumes that @code{EIND} never changes during the startup
23468 code or during the application. In particular, @code{EIND} is not
23469 saved/restored in function or interrupt service routine
23470 prologue/epilogue.
23472 @item
23473 For indirect calls to functions and computed goto, the linker
23474 generates @emph{stubs}. Stubs are jump pads sometimes also called
23475 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
23476 The stub contains a direct jump to the desired address.
23478 @item
23479 Linker relaxation must be turned on so that the linker generates
23480 the stubs correctly in all situations. See the compiler option
23481 @option{-mrelax} and the linker option @option{--relax}.
23482 There are corner cases where the linker is supposed to generate stubs
23483 but aborts without relaxation and without a helpful error message.
23485 @item
23486 The default linker script is arranged for code with @code{EIND = 0}.
23487 If code is supposed to work for a setup with @code{EIND != 0}, a custom
23488 linker script has to be used in order to place the sections whose
23489 name start with @code{.trampolines} into the segment where @code{EIND}
23490 points to.
23492 @item
23493 The startup code from libgcc never sets @code{EIND}.
23494 Notice that startup code is a blend of code from libgcc and AVR-LibC.
23495 For the impact of AVR-LibC on @code{EIND}, see the
23496 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
23498 @item
23499 It is legitimate for user-specific startup code to set up @code{EIND}
23500 early, for example by means of initialization code located in
23501 section @code{.init3}. Such code runs prior to general startup code
23502 that initializes RAM and calls constructors, but after the bit
23503 of startup code from AVR-LibC that sets @code{EIND} to the segment
23504 where the vector table is located.
23505 @example
23506 #include <avr/io.h>
23508 static void
23509 __attribute__((section(".init3"),naked,used,no_instrument_function))
23510 init3_set_eind (void)
23512   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23513                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23515 @end example
23517 @noindent
23518 The @code{__trampolines_start} symbol is defined in the linker script.
23520 @item
23521 Stubs are generated automatically by the linker if
23522 the following two conditions are met:
23523 @itemize @minus
23525 @item The address of a label is taken by means of the @code{gs} modifier
23526 (short for @emph{generate stubs}) like so:
23527 @example
23528 LDI r24, lo8(gs(@var{func}))
23529 LDI r25, hi8(gs(@var{func}))
23530 @end example
23531 @item The final location of that label is in a code segment
23532 @emph{outside} the segment where the stubs are located.
23533 @end itemize
23535 @item
23536 The compiler emits such @code{gs} modifiers for code labels in the
23537 following situations:
23538 @itemize @minus
23539 @item Taking address of a function or code label.
23540 @item Computed goto.
23541 @item If prologue-save function is used, see @option{-mcall-prologues}
23542 command-line option.
23543 @item Switch/case dispatch tables. If you do not want such dispatch
23544 tables you can specify the @option{-fno-jump-tables} command-line option.
23545 @item C and C++ constructors/destructors called during startup/shutdown.
23546 @item If the tools hit a @code{gs()} modifier explained above.
23547 @end itemize
23549 @item
23550 Jumping to non-symbolic addresses like so is @emph{not} supported:
23552 @example
23553 int main (void)
23555     /* Call function at word address 0x2 */
23556     return ((int(*)(void)) 0x2)();
23558 @end example
23560 Instead, a stub has to be set up, i.e.@: the function has to be called
23561 through a symbol (@code{func_4} in the example):
23563 @example
23564 int main (void)
23566     extern int func_4 (void);
23568     /* Call function at byte address 0x4 */
23569     return func_4();
23571 @end example
23573 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
23574 Alternatively, @code{func_4} can be defined in the linker script.
23575 @end itemize
23577 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
23578 @cindex @code{RAMPD}
23579 @cindex @code{RAMPX}
23580 @cindex @code{RAMPY}
23581 @cindex @code{RAMPZ}
23582 Some AVR devices support memories larger than the 64@tie{}KiB range
23583 that can be accessed with 16-bit pointers.  To access memory locations
23584 outside this 64@tie{}KiB range, the content of a @code{RAMP}
23585 register is used as high part of the address:
23586 The @code{X}, @code{Y}, @code{Z} address register is concatenated
23587 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
23588 register, respectively, to get a wide address. Similarly,
23589 @code{RAMPD} is used together with direct addressing.
23591 @itemize
23592 @item
23593 The startup code initializes the @code{RAMP} special function
23594 registers with zero.
23596 @item
23597 If a @ref{AVR Named Address Spaces,named address space} other than
23598 generic or @code{__flash} is used, then @code{RAMPZ} is set
23599 as needed before the operation.
23601 @item
23602 If the device supports RAM larger than 64@tie{}KiB and the compiler
23603 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
23604 is reset to zero after the operation.
23606 @item
23607 If the device comes with a specific @code{RAMP} register, the ISR
23608 prologue/epilogue saves/restores that SFR and initializes it with
23609 zero in case the ISR code might (implicitly) use it.
23611 @item
23612 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
23613 If you use inline assembler to read from locations outside the
23614 16-bit address range and change one of the @code{RAMP} registers,
23615 you must reset it to zero after the access.
23617 @end itemize
23619 @subsubsection AVR Built-in Macros
23621 GCC defines several built-in macros so that the user code can test
23622 for the presence or absence of features.  Almost any of the following
23623 built-in macros are deduced from device capabilities and thus
23624 triggered by the @option{-mmcu=} command-line option.
23626 For even more AVR-specific built-in macros see
23627 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
23629 @table @code
23631 @item __AVR_ARCH__
23632 Build-in macro that resolves to a decimal number that identifies the
23633 architecture and depends on the @option{-mmcu=@var{mcu}} option.
23634 Possible values are:
23636 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
23637 @code{4}, @code{5}, @code{51}, @code{6}
23639 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
23640 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
23642 respectively and
23644 @code{100},
23645 @code{102}, @code{103}, @code{104},
23646 @code{105}, @code{106}, @code{107}
23648 for @var{mcu}=@code{avrtiny},
23649 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
23650 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
23651 If @var{mcu} specifies a device, this built-in macro is set
23652 accordingly. For example, with @option{-mmcu=atmega8} the macro is
23653 defined to @code{4}.
23655 @item __AVR_@var{Device}__
23656 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
23657 the device's name. For example, @option{-mmcu=atmega8} defines the
23658 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
23659 @code{__AVR_ATtiny261A__}, etc.
23661 The built-in macros' names follow
23662 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
23663 the device name as from the AVR user manual. The difference between
23664 @var{Device} in the built-in macro and @var{device} in
23665 @option{-mmcu=@var{device}} is that the latter is always lowercase.
23667 If @var{device} is not a device but only a core architecture like
23668 @samp{avr51}, this macro is not defined.
23670 @item __AVR_DEVICE_NAME__
23671 Setting @option{-mmcu=@var{device}} defines this built-in macro to
23672 the device's name. For example, with @option{-mmcu=atmega8} the macro
23673 is defined to @code{atmega8}.
23675 If @var{device} is not a device but only a core architecture like
23676 @samp{avr51}, this macro is not defined.
23678 @item __AVR_XMEGA__
23679 The device / architecture belongs to the XMEGA family of devices.
23681 @item __AVR_HAVE_ELPM__
23682 The device has the @code{ELPM} instruction.
23684 @item __AVR_HAVE_ELPMX__
23685 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23686 R@var{n},Z+} instructions.
23688 @item __AVR_HAVE_MOVW__
23689 The device has the @code{MOVW} instruction to perform 16-bit
23690 register-register moves.
23692 @item __AVR_HAVE_LPMX__
23693 The device has the @code{LPM R@var{n},Z} and
23694 @code{LPM R@var{n},Z+} instructions.
23696 @item __AVR_HAVE_MUL__
23697 The device has a hardware multiplier. 
23699 @item __AVR_HAVE_JMP_CALL__
23700 The device has the @code{JMP} and @code{CALL} instructions.
23701 This is the case for devices with more than 8@tie{}KiB of program
23702 memory.
23704 @item __AVR_HAVE_EIJMP_EICALL__
23705 @itemx __AVR_3_BYTE_PC__
23706 The device has the @code{EIJMP} and @code{EICALL} instructions.
23707 This is the case for devices with more than 128@tie{}KiB of program memory.
23708 This also means that the program counter
23709 (PC) is 3@tie{}bytes wide.
23711 @item __AVR_2_BYTE_PC__
23712 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23713 with up to 128@tie{}KiB of program memory.
23715 @item __AVR_HAVE_8BIT_SP__
23716 @itemx __AVR_HAVE_16BIT_SP__
23717 The stack pointer (SP) register is treated as 8-bit respectively
23718 16-bit register by the compiler.
23719 The definition of these macros is affected by @option{-mtiny-stack}.
23721 @item __AVR_HAVE_SPH__
23722 @itemx __AVR_SP8__
23723 The device has the SPH (high part of stack pointer) special function
23724 register or has an 8-bit stack pointer, respectively.
23725 The definition of these macros is affected by @option{-mmcu=} and
23726 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23727 by @option{-msp8}.
23729 @item __AVR_HAVE_RAMPD__
23730 @itemx __AVR_HAVE_RAMPX__
23731 @itemx __AVR_HAVE_RAMPY__
23732 @itemx __AVR_HAVE_RAMPZ__
23733 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23734 @code{RAMPZ} special function register, respectively.
23736 @item __NO_INTERRUPTS__
23737 This macro reflects the @option{-mno-interrupts} command-line option.
23739 @item __AVR_ERRATA_SKIP__
23740 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23741 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23742 instructions because of a hardware erratum.  Skip instructions are
23743 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23744 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23745 set.
23747 @item __AVR_ISA_RMW__
23748 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23750 @item __AVR_SFR_OFFSET__=@var{offset}
23751 Instructions that can address I/O special function registers directly
23752 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23753 address as if addressed by an instruction to access RAM like @code{LD}
23754 or @code{STS}. This offset depends on the device architecture and has
23755 to be subtracted from the RAM address in order to get the
23756 respective I/O@tie{}address.
23758 @item __AVR_SHORT_CALLS__
23759 The @option{-mshort-calls} command line option is set.
23761 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23762 Some devices support reading from flash memory by means of @code{LD*}
23763 instructions.  The flash memory is seen in the data address space
23764 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
23765 is not defined, this feature is not available.  If defined,
23766 the address space is linear and there is no need to put
23767 @code{.rodata} into RAM.  This is handled by the default linker
23768 description file, and is currently available for
23769 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
23770 there is no need to use address spaces like @code{__flash} or
23771 features like attribute @code{progmem} and @code{pgm_read_*}.
23773 @item __WITH_AVRLIBC__
23774 The compiler is configured to be used together with AVR-Libc.
23775 See the @option{--with-avrlibc} configure option.
23777 @item __HAVE_DOUBLE_MULTILIB__
23778 Defined if @option{-mdouble=} acts as a multilib option.
23780 @item __HAVE_DOUBLE32__
23781 @itemx __HAVE_DOUBLE64__
23782 Defined if the compiler supports 32-bit double resp. 64-bit double.
23783 The actual layout is specified by option @option{-mdouble=}.
23785 @item __DEFAULT_DOUBLE__
23786 The size in bits of @code{double} if @option{-mdouble=} is not set.
23787 To test the layout of @code{double} in a program, use the built-in
23788 macro @code{__SIZEOF_DOUBLE__}.
23790 @item __HAVE_LONG_DOUBLE32__
23791 @itemx __HAVE_LONG_DOUBLE64__
23792 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23793 @itemx __DEFAULT_LONG_DOUBLE__
23794 Same as above, but for @code{long double} instead of @code{double}.
23796 @item __WITH_DOUBLE_COMPARISON__
23797 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23798 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23799 and is defined to @code{2} or @code{3}.
23801 @item __WITH_LIBF7_LIBGCC__
23802 @itemx __WITH_LIBF7_MATH__
23803 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23804 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23805 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23807 @end table
23809 @node Blackfin Options
23810 @subsection Blackfin Options
23811 @cindex Blackfin Options
23813 @table @gcctabopt
23814 @opindex mcpu=
23815 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23816 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
23817 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23818 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23819 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23820 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23821 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23822 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23823 @samp{bf561}, @samp{bf592}.
23825 The optional @var{sirevision} specifies the silicon revision of the target
23826 Blackfin processor.  Any workarounds available for the targeted silicon revision
23827 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
23828 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23829 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
23830 hexadecimal digits representing the major and minor numbers in the silicon
23831 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23832 is not defined.  If @var{sirevision} is @samp{any}, the
23833 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23834 If this optional @var{sirevision} is not used, GCC assumes the latest known
23835 silicon revision of the targeted Blackfin processor.
23837 GCC defines a preprocessor macro for the specified @var{cpu}.
23838 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23839 provided by libgloss to be linked in if @option{-msim} is not given.
23841 Without this option, @samp{bf532} is used as the processor by default.
23843 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
23844 only the preprocessor macro is defined.
23846 @opindex msim
23847 @item -msim
23848 Specifies that the program will be run on the simulator.  This causes
23849 the simulator BSP provided by libgloss to be linked in.  This option
23850 has effect only for @samp{bfin-elf} toolchain.
23851 Certain other options, such as @option{-mid-shared-library} and
23852 @option{-mfdpic}, imply @option{-msim}.
23854 @opindex momit-leaf-frame-pointer
23855 @item -momit-leaf-frame-pointer
23856 Don't keep the frame pointer in a register for leaf functions.  This
23857 avoids the instructions to save, set up and restore frame pointers and
23858 makes an extra register available in leaf functions.
23860 @opindex mspecld-anomaly
23861 @item -mspecld-anomaly
23862 When enabled, the compiler ensures that the generated code does not
23863 contain speculative loads after jump instructions. If this option is used,
23864 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23866 @opindex mno-specld-anomaly
23867 @opindex mspecld-anomaly
23868 @item -mno-specld-anomaly
23869 Don't generate extra code to prevent speculative loads from occurring.
23871 @opindex mcsync-anomaly
23872 @item -mcsync-anomaly
23873 When enabled, the compiler ensures that the generated code does not
23874 contain CSYNC or SSYNC instructions too soon after conditional branches.
23875 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23877 @opindex mno-csync-anomaly
23878 @opindex mcsync-anomaly
23879 @item -mno-csync-anomaly
23880 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23881 occurring too soon after a conditional branch.
23883 @opindex mlow64k
23884 @item -mlow64k
23885 When enabled, the compiler is free to take advantage of the knowledge that
23886 the entire program fits into the low 64k of memory.
23888 @opindex mno-low64k
23889 @item -mno-low64k
23890 Assume that the program is arbitrarily large.  This is the default.
23892 @opindex mstack-check-l1
23893 @item -mstack-check-l1
23894 Do stack checking using information placed into L1 scratchpad memory by the
23895 uClinux kernel.
23897 @opindex mid-shared-library
23898 @item -mid-shared-library
23899 Generate code that supports shared libraries via the library ID method.
23900 This allows for execute in place and shared libraries in an environment
23901 without virtual memory management.  This option implies @option{-fPIC}.
23902 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23904 @opindex mno-id-shared-library
23905 @opindex mid-shared-library
23906 @item -mno-id-shared-library
23907 Generate code that doesn't assume ID-based shared libraries are being used.
23908 This is the default.
23910 @opindex mleaf-id-shared-library
23911 @item -mleaf-id-shared-library
23912 Generate code that supports shared libraries via the library ID method,
23913 but assumes that this library or executable won't link against any other
23914 ID shared libraries.  That allows the compiler to use faster code for jumps
23915 and calls.
23917 @opindex mno-leaf-id-shared-library
23918 @opindex mleaf-id-shared-library
23919 @item -mno-leaf-id-shared-library
23920 Do not assume that the code being compiled won't link against any ID shared
23921 libraries.  Slower code is generated for jump and call insns.
23923 @opindex mshared-library-id
23924 @item -mshared-library-id=n
23925 Specifies the identification number of the ID-based shared library being
23926 compiled.  Specifying a value of 0 generates more compact code; specifying
23927 other values forces the allocation of that number to the current
23928 library but is no more space- or time-efficient than omitting this option.
23930 @opindex msep-data
23931 @item -msep-data
23932 Generate code that allows the data segment to be located in a different
23933 area of memory from the text segment.  This allows for execute in place in
23934 an environment without virtual memory management by eliminating relocations
23935 against the text section.
23937 @opindex mno-sep-data
23938 @opindex msep-data
23939 @item -mno-sep-data
23940 Generate code that assumes that the data segment follows the text segment.
23941 This is the default.
23943 @opindex mlong-calls
23944 @opindex mno-long-calls
23945 @item -mlong-calls
23946 @itemx -mno-long-calls
23947 Tells the compiler to perform function calls by first loading the
23948 address of the function into a register and then performing a subroutine
23949 call on this register.  This switch is needed if the target function
23950 lies outside of the 24-bit addressing range of the offset-based
23951 version of subroutine call instruction.
23953 This feature is not enabled by default.  Specifying
23954 @option{-mno-long-calls} restores the default behavior.  Note these
23955 switches have no effect on how the compiler generates code to handle
23956 function calls via function pointers.
23958 @opindex mfast-fp
23959 @item -mfast-fp
23960 Link with the fast floating-point library. This library relaxes some of
23961 the IEEE floating-point standard's rules for checking inputs against
23962 Not-a-Number (NAN), in the interest of performance.
23964 @opindex minline-plt
23965 @item -minline-plt
23966 Enable inlining of PLT entries in function calls to functions that are
23967 not known to bind locally.  It has no effect without @option{-mfdpic}.
23969 @opindex mmulticore
23970 @item -mmulticore
23971 Build a standalone application for multicore Blackfin processors. 
23972 This option causes proper start files and link scripts supporting 
23973 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
23974 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
23976 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23977 selects the one-application-per-core programming model.  Without
23978 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23979 programming model is used. In this model, the main function of Core B
23980 should be named as @code{coreb_main}.
23982 If this option is not used, the single-core application programming
23983 model is used.
23985 @opindex mcorea
23986 @item -mcorea
23987 Build a standalone application for Core A of BF561 when using
23988 the one-application-per-core programming model. Proper start files
23989 and link scripts are used to support Core A, and the macro
23990 @code{__BFIN_COREA} is defined.
23991 This option can only be used in conjunction with @option{-mmulticore}.
23993 @opindex mcoreb
23994 @item -mcoreb
23995 Build a standalone application for Core B of BF561 when using
23996 the one-application-per-core programming model. Proper start files
23997 and link scripts are used to support Core B, and the macro
23998 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23999 should be used instead of @code{main}. 
24000 This option can only be used in conjunction with @option{-mmulticore}.
24002 @opindex msdram
24003 @item -msdram
24004 Build a standalone application for SDRAM. Proper start files and
24005 link scripts are used to put the application into SDRAM, and the macro
24006 @code{__BFIN_SDRAM} is defined.
24007 The loader should initialize SDRAM before loading the application.
24009 @opindex micplb
24010 @item -micplb
24011 Assume that ICPLBs are enabled at run time.  This has an effect on certain
24012 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
24013 are enabled; for standalone applications the default is off.
24014 @end table
24016 @node C6X Options
24017 @subsection C6X Options
24018 @cindex C6X Options
24020 @table @gcctabopt
24021 @opindex march
24022 @item -march=@var{name}
24023 This specifies the name of the target architecture.  GCC uses this
24024 name to determine what kind of instructions it can emit when generating
24025 assembly code.  Permissible names are: @samp{c62x},
24026 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
24028 @opindex mbig-endian
24029 @item -mbig-endian
24030 Generate code for a big-endian target.
24032 @opindex mlittle-endian
24033 @item -mlittle-endian
24034 Generate code for a little-endian target.  This is the default.
24036 @opindex msim
24037 @item -msim
24038 Choose startup files and linker script suitable for the simulator.
24040 @opindex msdata=default
24041 @item -msdata=default
24042 Put small global and static data in the @code{.neardata} section,
24043 which is pointed to by register @code{B14}.  Put small uninitialized
24044 global and static data in the @code{.bss} section, which is adjacent
24045 to the @code{.neardata} section.  Put small read-only data into the
24046 @code{.rodata} section.  The corresponding sections used for large
24047 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
24049 @opindex msdata=all
24050 @item -msdata=all
24051 Put all data, not just small objects, into the sections reserved for
24052 small data, and use addressing relative to the @code{B14} register to
24053 access them.
24055 @opindex msdata=none
24056 @item -msdata=none
24057 Make no use of the sections reserved for small data, and use absolute
24058 addresses to access all data.  Put all initialized global and static
24059 data in the @code{.fardata} section, and all uninitialized data in the
24060 @code{.far} section.  Put all constant data into the @code{.const}
24061 section.
24062 @end table
24064 @node CRIS Options
24065 @subsection CRIS Options
24066 @cindex CRIS Options
24068 These options are defined specifically for the CRIS ports.
24070 @table @gcctabopt
24071 @opindex march
24072 @opindex mcpu
24073 @item -march=@var{architecture-type}
24074 @itemx -mcpu=@var{architecture-type}
24075 Generate code for the specified architecture.  The choices for
24076 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
24077 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
24078 Default is @samp{v0}.
24080 @opindex mtune
24081 @item -mtune=@var{architecture-type}
24082 Tune to @var{architecture-type} everything applicable about the generated
24083 code, except for the ABI and the set of available instructions.  The
24084 choices for @var{architecture-type} are the same as for
24085 @option{-march=@var{architecture-type}}.
24087 @opindex mmax-stack-frame
24088 @item -mmax-stack-frame=@var{n}
24089 Warn when the stack frame of a function exceeds @var{n} bytes.
24091 @opindex metrax4
24092 @opindex metrax100
24093 @item -metrax4
24094 @itemx -metrax100
24095 The options @option{-metrax4} and @option{-metrax100} are synonyms for
24096 @option{-march=v3} and @option{-march=v8} respectively.
24098 @opindex mmul-bug-workaround
24099 @opindex mno-mul-bug-workaround
24100 @item -mmul-bug-workaround
24101 @itemx -mno-mul-bug-workaround
24102 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
24103 models where it applies.  This option is disabled by default.
24105 @opindex mpdebug
24106 @item -mpdebug
24107 Enable CRIS-specific verbose debug-related information in the assembly
24108 code.  This option also has the effect of turning off the @samp{#NO_APP}
24109 formatted-code indicator to the assembler at the beginning of the
24110 assembly file.
24112 @opindex mcc-init
24113 @item -mcc-init
24114 Do not use condition-code results from previous instruction; always emit
24115 compare and test instructions before use of condition codes.
24117 @opindex mno-side-effects
24118 @opindex mside-effects
24119 @item -mno-side-effects
24120 Do not emit instructions with side effects in addressing modes other than
24121 post-increment.
24123 @opindex mstack-align
24124 @opindex mno-stack-align
24125 @opindex mdata-align
24126 @opindex mno-data-align
24127 @opindex mconst-align
24128 @opindex mno-const-align
24129 @item -mstack-align
24130 @itemx -mno-stack-align
24131 @itemx -mdata-align
24132 @itemx -mno-data-align
24133 @itemx -mconst-align
24134 @itemx -mno-const-align
24135 These options (@samp{no-} options) arrange (eliminate arrangements) for the
24136 stack frame, individual data and constants to be aligned for the maximum
24137 single data access size for the chosen CPU model.  The default is to
24138 arrange for 32-bit alignment.  ABI details such as structure layout are
24139 not affected by these options.
24141 @opindex m32-bit
24142 @opindex m16-bit
24143 @opindex m8-bit
24144 @item -m32-bit
24145 @itemx -m16-bit
24146 @itemx -m8-bit
24147 Similar to the stack- data- and const-align options above, these options
24148 arrange for stack frame, writable data and constants to all be 32-bit,
24149 16-bit or 8-bit aligned.  The default is 32-bit alignment.
24151 @opindex mno-prologue-epilogue
24152 @opindex mprologue-epilogue
24153 @item -mno-prologue-epilogue
24154 @itemx -mprologue-epilogue
24155 With @option{-mno-prologue-epilogue}, the normal function prologue and
24156 epilogue which set up the stack frame are omitted and no return
24157 instructions or return sequences are generated in the code.  Use this
24158 option only together with visual inspection of the compiled code: no
24159 warnings or errors are generated when call-saved registers must be saved,
24160 or storage for local variables needs to be allocated.
24162 @opindex melf
24163 @item -melf
24164 Legacy no-op option.
24166 @opindex sim
24167 @item -sim
24168 This option arranges
24169 to link with input-output functions from a simulator library.  Code,
24170 initialized data and zero-initialized data are allocated consecutively.
24172 @opindex sim2
24173 @item -sim2
24174 Like @option{-sim}, but pass linker options to locate initialized data at
24175 0x40000000 and zero-initialized data at 0x80000000.
24176 @end table
24178 @node C-SKY Options
24179 @subsection C-SKY Options
24180 @cindex C-SKY Options
24182 GCC supports these options when compiling for C-SKY V2 processors.
24184 @table @gcctabopt
24186 @opindex march=
24187 @item -march=@var{arch}
24188 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
24189 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
24190 The default is @samp{ck810}.
24192 @opindex mcpu=
24193 @item -mcpu=@var{cpu}
24194 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
24195 @samp{ck801}, @samp{ck801t},
24196 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
24197 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
24198 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
24199 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
24200 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
24201 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
24202 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
24203 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
24204 @samp{ck803eftr1}, @samp{ck803efhtr1},
24205 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
24206 @samp{ck803sef}, @samp{ck803seft},
24207 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
24208 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
24209 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
24210 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
24212 @opindex mbig-endian
24213 @opindex EB
24214 @opindex mlittle-endian
24215 @opindex EL
24216 @item -mbig-endian
24217 @itemx -EB
24218 @itemx -mlittle-endian
24219 @itemx -EL
24221 Select big- or little-endian code.  The default is little-endian.
24223 @opindex mfloat-abi
24224 @item -mfloat-abi=@var{name}
24225 Specifies which floating-point ABI to use.  Permissible values
24226 are: @samp{soft}, @samp{softfp} and @samp{hard}.
24228 Specifying @samp{soft} causes GCC to generate output containing
24229 library calls for floating-point operations.
24230 @samp{softfp} allows the generation of code using hardware floating-point
24231 instructions, but still uses the soft-float calling conventions.
24232 @samp{hard} allows generation of floating-point instructions
24233 and uses FPU-specific calling conventions.
24235 The default depends on the specific target configuration.  Note that
24236 the hard-float and soft-float ABIs are not link-compatible; you must
24237 compile your entire program with the same ABI, and link with a
24238 compatible set of libraries.
24240 @opindex mhard-float
24241 @opindex msoft-float
24242 @item -mhard-float
24243 @itemx -msoft-float
24245 Select hardware or software floating-point implementations.
24246 The default is soft float.
24248 @opindex mdouble-float
24249 @item -mdouble-float
24250 @itemx -mno-double-float
24251 When @option{-mhard-float} is in effect, enable generation of
24252 double-precision float instructions.  This is the default except
24253 when compiling for CK803.
24255 @opindex mfdivdu
24256 @item -mfdivdu
24257 @itemx -mno-fdivdu
24258 When @option{-mhard-float} is in effect, enable generation of
24259 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
24260 This is the default except when compiling for CK803.
24262 @opindex mfpu=
24263 @item -mfpu=@var{fpu}
24264 Select the floating-point processor.  This option can only be used with
24265 @option{-mhard-float}.
24266 Values for @var{fpu} are
24267 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24268 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24269 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24271 @opindex melrw
24272 @item -melrw
24273 @itemx -mno-elrw
24274 Enable the extended @code{lrw} instruction.  This option defaults to on
24275 for CK801 and off otherwise.
24277 @opindex mistack
24278 @item -mistack
24279 @itemx -mno-istack
24280 Enable interrupt stack instructions; the default is off.
24282 The @option{-mistack} option is required to handle the
24283 @code{interrupt} and @code{isr} function attributes
24284 (@pxref{C-SKY Function Attributes}).
24286 @opindex mmp
24287 @item -mmp
24288 Enable multiprocessor instructions; the default is off.
24290 @opindex mcp
24291 @item -mcp
24292 Enable coprocessor instructions; the default is off.
24294 @opindex mcache
24295 @item -mcache
24296 Enable coprocessor instructions; the default is off.
24298 @opindex msecurity
24299 @item -msecurity
24300 Enable C-SKY security instructions; the default is off.
24302 @opindex mtrust
24303 @item -mtrust
24304 Enable C-SKY trust instructions; the default is off.
24306 @opindex mdsp
24307 @opindex medsp
24308 @opindex mvdsp
24309 @item -mdsp
24310 @itemx -medsp
24311 @itemx -mvdsp
24312 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24313 All of these options default to off.
24315 @opindex mdiv
24316 @item -mdiv
24317 @itemx -mno-div
24318 Generate divide instructions.  Default is off.
24320 @opindex msmart
24321 @item -msmart
24322 @itemx -mno-smart
24323 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24324 use of 16-bit instructions.  This option is ignored for CK801 where this
24325 is the required behavior, and it defaults to on for CK802.
24326 For other targets, the default is off.
24328 @opindex mhigh-registers
24329 @item -mhigh-registers
24330 @itemx -mno-high-registers
24331 Generate code using the high registers numbered 16-31.  This option
24332 is not supported on CK801, CK802, or CK803, and is enabled by default
24333 for other processors.
24335 @opindex manchor
24336 @item -manchor
24337 @itemx -mno-anchor
24338 Generate code using global anchor symbol addresses.
24340 @opindex mpushpop
24341 @item -mpushpop
24342 @itemx -mno-pushpop
24343 Generate code using @code{push} and @code{pop} instructions.  This option
24344 defaults to on.
24346 @opindex mmultiple-stld
24347 @item -mmultiple-stld
24348 @itemx -mstm
24349 @itemx -mno-multiple-stld
24350 @itemx -mno-stm
24351 Generate code using @code{stm} and @code{ldm} instructions.  This option
24352 isn't supported on CK801 but is enabled by default on other processors.
24354 @opindex mconstpool
24355 @item -mconstpool
24356 @itemx -mno-constpool
24357 Create constant pools in the compiler instead of deferring it to the
24358 assembler.  This option is the default and required for correct code
24359 generation on CK801 and CK802, and is optional on other processors.
24361 @opindex mstack-size
24362 @item -mstack-size
24363 @item -mno-stack-size
24364 Emit @code{.stack_size} directives for each function in the assembly
24365 output.  This option defaults to off.
24367 @opindex mccrt
24368 @item -mccrt
24369 @itemx -mno-ccrt
24370 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24371 option defaults to off.
24373 @opindex mbranch-cost=
24374 @item -mbranch-cost=@var{n}
24375 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24377 @opindex msched-prolog
24378 @item -msched-prolog
24379 @itemx -mno-sched-prolog
24380 Permit scheduling of function prologue and epilogue sequences.  Using
24381 this option can result in code that is not compliant with the C-SKY V2 ABI
24382 prologue requirements and that cannot be debugged or backtraced.
24383 It is disabled by default.
24385 @opindex msim
24386 @item -msim
24387 Links the library libsemi.a which is in compatible with simulator. Applicable
24388 to ELF compiler only.
24390 @end table
24392 @node Darwin Options
24393 @subsection Darwin Options
24394 @cindex Darwin options
24396 These options are defined for all architectures running the Darwin operating
24397 system.
24399 FSF GCC on Darwin does not create ``fat'' object files; it creates
24400 an object file for the single architecture that GCC was built to
24401 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
24402 @option{-arch} options are used; it does so by running the compiler or
24403 linker multiple times and joining the results together with
24404 @file{lipo}.
24406 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
24407 @samp{i686}) is determined by the flags that specify the ISA
24408 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
24409 @option{-force_cpusubtype_ALL} option can be used to override this.
24411 The Darwin tools vary in their behavior when presented with an ISA
24412 mismatch.  The assembler, @file{as}, only permits instructions to
24413 be used that are valid for the subtype of the file it is generating,
24414 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
24415 The linker for shared libraries, @file{/usr/bin/libtool}, fails
24416 and prints an error if asked to create a shared library with a less
24417 restrictive subtype than its input files (for instance, trying to put
24418 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
24419 for executables, @command{ld}, quietly gives the executable the most
24420 restrictive subtype of any of its input files.
24422 @table @gcctabopt
24423 @opindex F
24424 @item -F@var{dir}
24425 Add the framework directory @var{dir} to the head of the list of
24426 directories to be searched for header files.  These directories are
24427 interleaved with those specified by @option{-I} options and are
24428 scanned in a left-to-right order.
24430 A framework directory is a directory with frameworks in it.  A
24431 framework is a directory with a @file{Headers} and/or
24432 @file{PrivateHeaders} directory contained directly in it that ends
24433 in @file{.framework}.  The name of a framework is the name of this
24434 directory excluding the @file{.framework}.  Headers associated with
24435 the framework are found in one of those two directories, with
24436 @file{Headers} being searched first.  A subframework is a framework
24437 directory that is in a framework's @file{Frameworks} directory.
24438 Includes of subframework headers can only appear in a header of a
24439 framework that contains the subframework, or in a sibling subframework
24440 header.  Two subframeworks are siblings if they occur in the same
24441 framework.  A subframework should not have the same name as a
24442 framework; a warning is issued if this is violated.  Currently a
24443 subframework cannot have subframeworks; in the future, the mechanism
24444 may be extended to support this.  The standard frameworks can be found
24445 in @file{/System/Library/Frameworks} and
24446 @file{/Library/Frameworks}.  An example include looks like
24447 @code{#include <Framework/header.h>}, where @file{Framework} denotes
24448 the name of the framework and @file{header.h} is found in the
24449 @file{PrivateHeaders} or @file{Headers} directory.
24451 @opindex iframework
24452 @item -iframework@var{dir}
24453 Like @option{-F} except the directory is a treated as a system
24454 directory.  The main difference between this @option{-iframework} and
24455 @option{-F} is that with @option{-iframework} the compiler does not
24456 warn about constructs contained within header files found via
24457 @var{dir}.  This option is valid only for the C family of languages.
24459 @opindex gused
24460 @item -gused
24461 Emit debugging information for symbols that are used.  For stabs
24462 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
24463 This is by default ON@.
24465 @opindex gfull
24466 @item -gfull
24467 Emit debugging information for all symbols and types.
24469 @opindex fconstant-cfstrings
24470 @item -fconstant-cfstrings
24471 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
24473 @opindex mconstant-cfstrings
24474 @item -mconstant-cfstrings
24475 When the NeXT runtime is being used (the default on these systems), override
24476 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
24477 literals to be laid out as constant CoreFoundation strings.
24479 @opindex mmacosx-version-min
24480 @item -mmacosx-version-min=@var{version}
24481 The earliest version of MacOS X that this executable will run on is
24482 @var{version}.  Typical values supported for @var{version} include @code{12},
24483 @code{10.12}, and @code{10.5.8}.
24485 If the compiler was built to use the system's headers by default,
24486 then the default for this option is the system version on which the
24487 compiler is running, otherwise the default is to make choices that
24488 are compatible with as many systems and code bases as possible.
24490 @opindex mkernel
24491 @item -mkernel
24492 Enable kernel development mode.  The @option{-mkernel} option sets
24493 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
24494 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
24495 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
24496 applicable.  This mode also sets @option{-mno-altivec},
24497 @option{-msoft-float}, @option{-fno-builtin} and
24498 @option{-mlong-branch} for PowerPC targets.
24500 @opindex mone-byte-bool
24501 @item -mone-byte-bool
24502 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
24503 By default @code{sizeof(bool)} is @code{4} when compiling for
24504 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
24505 option has no effect on x86.
24507 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
24508 to generate code that is not binary compatible with code generated
24509 without that switch.  Using this switch may require recompiling all
24510 other modules in a program, including system libraries.  Use this
24511 switch to conform to a non-default data model.
24513 @opindex mfix-and-continue
24514 @opindex ffix-and-continue
24515 @opindex findirect-data
24516 @item -mfix-and-continue
24517 @itemx -ffix-and-continue
24518 @itemx -findirect-data
24519 Generate code suitable for fast turnaround development, such as to
24520 allow GDB to dynamically load @file{.o} files into already-running
24521 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
24522 are provided for backwards compatibility.
24524 @opindex all_load
24525 @item -all_load
24526 Loads all members of static archive libraries.
24527 See man ld(1) for more information.
24529 @opindex arch_errors_fatal
24530 @item -arch_errors_fatal
24531 Cause the errors having to do with files that have the wrong architecture
24532 to be fatal.
24534 @opindex bind_at_load
24535 @item -bind_at_load
24536 Causes the output file to be marked such that the dynamic linker will
24537 bind all undefined references when the file is loaded or launched.
24539 @opindex bundle
24540 @item -bundle
24541 Produce a Mach-o bundle format file.
24542 See man ld(1) for more information.
24544 @opindex bundle_loader
24545 @item -bundle_loader @var{executable}
24546 This option specifies the @var{executable} that will load the build
24547 output file being linked.  See man ld(1) for more information.
24549 @opindex dynamiclib
24550 @item -dynamiclib
24551 When passed this option, GCC produces a dynamic library instead of
24552 an executable when linking, using the Darwin @file{libtool} command.
24554 @opindex force_cpusubtype_ALL
24555 @item -force_cpusubtype_ALL
24556 This causes GCC's output file to have the @samp{ALL} subtype, instead of
24557 one controlled by the @option{-mcpu} or @option{-march} option.
24559 @opindex nodefaultrpaths
24560 @item -nodefaultrpaths
24561 Do not add default run paths for the compiler library directories to
24562 executables, modules or dynamic libraries. On macOS 10.5 and later,
24563 the embedded runpath is added by default unless the user adds
24564 @option{-nodefaultrpaths} to the link line. Run paths are needed
24565 (and therefore enforced) to build on macOS version 10.11 or later.
24567 @item -allowable_client  @var{client_name}
24568 @itemx -client_name
24569 @itemx -compatibility_version
24570 @itemx -current_version
24571 @itemx -dead_strip
24572 @itemx -dependency-file
24573 @itemx -dylib_file
24574 @itemx -dylinker_install_name
24575 @itemx -dynamic
24576 @itemx -exported_symbols_list
24577 @itemx -filelist
24578 @need 800
24579 @itemx -flat_namespace
24580 @itemx -force_flat_namespace
24581 @itemx -headerpad_max_install_names
24582 @itemx -image_base
24583 @itemx -init
24584 @itemx -install_name
24585 @itemx -keep_private_externs
24586 @itemx -multi_module
24587 @itemx -multiply_defined
24588 @itemx -multiply_defined_unused
24589 @need 800
24590 @itemx -noall_load
24591 @itemx -no_dead_strip_inits_and_terms
24592 @itemx -nofixprebinding
24593 @itemx -nomultidefs
24594 @itemx -noprebind
24595 @itemx -noseglinkedit
24596 @itemx -pagezero_size
24597 @itemx -prebind
24598 @itemx -prebind_all_twolevel_modules
24599 @itemx -private_bundle
24600 @need 800
24601 @itemx -read_only_relocs
24602 @itemx -sectalign
24603 @itemx -sectobjectsymbols
24604 @itemx -whyload
24605 @itemx -seg1addr
24606 @itemx -sectcreate
24607 @itemx -sectobjectsymbols
24608 @itemx -sectorder
24609 @itemx -segaddr
24610 @itemx -segs_read_only_addr
24611 @need 800
24612 @itemx -segs_read_write_addr
24613 @itemx -seg_addr_table
24614 @itemx -seg_addr_table_filename
24615 @itemx -seglinkedit
24616 @itemx -segprot
24617 @itemx -segs_read_only_addr
24618 @itemx -segs_read_write_addr
24619 @itemx -single_module
24620 @itemx -static
24621 @itemx -sub_library
24622 @need 800
24623 @opindex allowable_client
24624 @opindex client_name
24625 @opindex compatibility_version
24626 @opindex current_version
24627 @opindex dead_strip
24628 @opindex dependency-file
24629 @opindex dylib_file
24630 @opindex dylinker_install_name
24631 @opindex dynamic
24632 @opindex exported_symbols_list
24633 @opindex filelist
24634 @opindex flat_namespace
24635 @opindex force_flat_namespace
24636 @opindex headerpad_max_install_names
24637 @opindex image_base
24638 @opindex init
24639 @opindex install_name
24640 @opindex keep_private_externs
24641 @opindex multi_module
24642 @opindex multiply_defined
24643 @opindex multiply_defined_unused
24644 @opindex noall_load
24645 @opindex no_dead_strip_inits_and_terms
24646 @opindex nofixprebinding
24647 @opindex nomultidefs
24648 @opindex noprebind
24649 @opindex noseglinkedit
24650 @opindex pagezero_size
24651 @opindex prebind
24652 @opindex prebind_all_twolevel_modules
24653 @opindex private_bundle
24654 @opindex read_only_relocs
24655 @opindex sectalign
24656 @opindex sectobjectsymbols
24657 @opindex whyload
24658 @opindex seg1addr
24659 @opindex sectcreate
24660 @opindex sectobjectsymbols
24661 @opindex sectorder
24662 @opindex segaddr
24663 @opindex segs_read_only_addr
24664 @opindex segs_read_write_addr
24665 @opindex seg_addr_table
24666 @opindex seg_addr_table_filename
24667 @opindex seglinkedit
24668 @opindex segprot
24669 @opindex segs_read_only_addr
24670 @opindex segs_read_write_addr
24671 @opindex single_module
24672 @opindex static
24673 @opindex sub_library
24674 @opindex sub_umbrella
24675 @opindex twolevel_namespace
24676 @opindex umbrella
24677 @opindex undefined
24678 @opindex unexported_symbols_list
24679 @opindex weak_reference_mismatches
24680 @opindex whatsloaded
24681 @itemx -sub_umbrella
24682 @itemx -twolevel_namespace
24683 @itemx -umbrella
24684 @itemx -undefined
24685 @itemx -unexported_symbols_list
24686 @itemx -weak_reference_mismatches
24687 @itemx -whatsloaded
24688 These options are passed to the Darwin linker.  The Darwin linker man page
24689 describes them in detail.
24690 @end table
24692 @node DEC Alpha Options
24693 @subsection DEC Alpha Options
24695 These @samp{-m} options are defined for the DEC Alpha implementations:
24697 @table @gcctabopt
24698 @opindex mno-soft-float
24699 @opindex msoft-float
24700 @item -mno-soft-float
24701 @itemx -msoft-float
24702 Use (do not use) the hardware floating-point instructions for
24703 floating-point operations.  When @option{-msoft-float} is specified,
24704 functions in @file{libgcc.a} are used to perform floating-point
24705 operations.  Unless they are replaced by routines that emulate the
24706 floating-point operations, or compiled in such a way as to call such
24707 emulations routines, these routines issue floating-point
24708 operations.   If you are compiling for an Alpha without floating-point
24709 operations, you must ensure that the library is built so as not to call
24710 them.
24712 Note that Alpha implementations without floating-point operations are
24713 required to have floating-point registers.
24715 @opindex mfp-reg
24716 @opindex mno-fp-regs
24717 @item -mfp-reg
24718 @itemx -mno-fp-regs
24719 Generate code that uses (does not use) the floating-point register set.
24720 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
24721 register set is not used, floating-point operands are passed in integer
24722 registers as if they were integers and floating-point results are passed
24723 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
24724 so any function with a floating-point argument or return value called by code
24725 compiled with @option{-mno-fp-regs} must also be compiled with that
24726 option.
24728 A typical use of this option is building a kernel that does not use,
24729 and hence need not save and restore, any floating-point registers.
24731 @opindex mieee
24732 @item -mieee
24733 The Alpha architecture implements floating-point hardware optimized for
24734 maximum performance.  It is mostly compliant with the IEEE floating-point
24735 standard.  However, for full compliance, software assistance is
24736 required.  This option generates code fully IEEE-compliant code
24737 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24738 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24739 defined during compilation.  The resulting code is less efficient but is
24740 able to correctly support denormalized numbers and exceptional IEEE
24741 values such as not-a-number and plus/minus infinity.  Other Alpha
24742 compilers call this option @option{-ieee_with_no_inexact}.
24744 @opindex mieee-with-inexact
24745 @item -mieee-with-inexact
24746 This is like @option{-mieee} except the generated code also maintains
24747 the IEEE @var{inexact-flag}.  Turning on this option causes the
24748 generated code to implement fully-compliant IEEE math.  In addition to
24749 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24750 macro.  On some Alpha implementations the resulting code may execute
24751 significantly slower than the code generated by default.  Since there is
24752 very little code that depends on the @var{inexact-flag}, you should
24753 normally not specify this option.  Other Alpha compilers call this
24754 option @option{-ieee_with_inexact}.
24756 @opindex mfp-trap-mode
24757 @item -mfp-trap-mode=@var{trap-mode}
24758 This option controls what floating-point related traps are enabled.
24759 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24760 The trap mode can be set to one of four values:
24762 @table @samp
24763 @item n
24764 This is the default (normal) setting.  The only traps that are enabled
24765 are the ones that cannot be disabled in software (e.g., division by zero
24766 trap).
24768 @item u
24769 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24770 as well.
24772 @item su
24773 Like @samp{u}, but the instructions are marked to be safe for software
24774 completion (see Alpha architecture manual for details).
24776 @item sui
24777 Like @samp{su}, but inexact traps are enabled as well.
24778 @end table
24780 @opindex mfp-rounding-mode
24781 @item -mfp-rounding-mode=@var{rounding-mode}
24782 Selects the IEEE rounding mode.  Other Alpha compilers call this option
24783 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
24786 @table @samp
24787 @item n
24788 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
24789 the nearest machine number or towards the even machine number in case
24790 of a tie.
24792 @item m
24793 Round towards minus infinity.
24795 @item c
24796 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
24798 @item d
24799 Dynamic rounding mode.  A field in the floating-point control register
24800 (@var{fpcr}, see Alpha architecture reference manual) controls the
24801 rounding mode in effect.  The C library initializes this register for
24802 rounding towards plus infinity.  Thus, unless your program modifies the
24803 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24804 @end table
24806 @opindex mtrap-precision
24807 @item -mtrap-precision=@var{trap-precision}
24808 In the Alpha architecture, floating-point traps are imprecise.  This
24809 means without software assistance it is impossible to recover from a
24810 floating trap and program execution normally needs to be terminated.
24811 GCC can generate code that can assist operating system trap handlers
24812 in determining the exact location that caused a floating-point trap.
24813 Depending on the requirements of an application, different levels of
24814 precisions can be selected:
24816 @table @samp
24817 @item p
24818 Program precision.  This option is the default and means a trap handler
24819 can only identify which program caused a floating-point exception.
24821 @item f
24822 Function precision.  The trap handler can determine the function that
24823 caused a floating-point exception.
24825 @item i
24826 Instruction precision.  The trap handler can determine the exact
24827 instruction that caused a floating-point exception.
24828 @end table
24830 Other Alpha compilers provide the equivalent options called
24831 @option{-scope_safe} and @option{-resumption_safe}.
24833 @opindex mieee-conformant
24834 @item -mieee-conformant
24835 This option marks the generated code as IEEE conformant.  You must not
24836 use this option unless you also specify @option{-mtrap-precision=i} and either
24837 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
24838 is to emit the line @samp{.eflag 48} in the function prologue of the
24839 generated assembly file.
24841 @opindex mbuild-constants
24842 @item -mbuild-constants
24843 Normally GCC examines a 32- or 64-bit integer constant to
24844 see if it can construct it from smaller constants in two or three
24845 instructions.  If it cannot, it outputs the constant as a literal and
24846 generates code to load it from the data segment at run time.
24848 Use this option to require GCC to construct @emph{all} integer constants
24849 using code, even if it takes more instructions (the maximum is six).
24851 You typically use this option to build a shared library dynamic
24852 loader.  Itself a shared library, it must relocate itself in memory
24853 before it can find the variables and constants in its own data segment.
24855 @opindex mbwx
24856 @opindex mno-bwx
24857 @opindex mcix
24858 @opindex mno-cix
24859 @opindex mfix
24860 @opindex mno-fix
24861 @opindex mmax
24862 @opindex mno-max
24863 @item -mbwx
24864 @itemx -mno-bwx
24865 @itemx -mcix
24866 @itemx -mno-cix
24867 @itemx -mfix
24868 @itemx -mno-fix
24869 @itemx -mmax
24870 @itemx -mno-max
24871 Indicate whether GCC should generate code to use the optional BWX,
24872 CIX, FIX and MAX instruction sets.  The default is to use the instruction
24873 sets supported by the CPU type specified via @option{-mcpu=} option or that
24874 of the CPU on which GCC was built if none is specified.
24876 @opindex mfloat-vax
24877 @opindex mfloat-ieee
24878 @item -mfloat-vax
24879 @itemx -mfloat-ieee
24880 Generate code that uses (does not use) VAX F and G floating-point
24881 arithmetic instead of IEEE single and double precision.
24883 @opindex mexplicit-relocs
24884 @opindex mno-explicit-relocs
24885 @item -mexplicit-relocs
24886 @itemx -mno-explicit-relocs
24887 Older Alpha assemblers provided no way to generate symbol relocations
24888 except via assembler macros.  Use of these macros does not allow
24889 optimal instruction scheduling.  GNU binutils as of version 2.12
24890 supports a new syntax that allows the compiler to explicitly mark
24891 which relocations should apply to which instructions.  This option
24892 is mostly useful for debugging, as GCC detects the capabilities of
24893 the assembler when it is built and sets the default accordingly.
24895 @opindex msmall-data
24896 @opindex mlarge-data
24897 @item -msmall-data
24898 @itemx -mlarge-data
24899 When @option{-mexplicit-relocs} is in effect, static data is
24900 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
24901 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24902 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24903 16-bit relocations off of the @code{$gp} register.  This limits the
24904 size of the small data area to 64KB, but allows the variables to be
24905 directly accessed via a single instruction.
24907 The default is @option{-mlarge-data}.  With this option the data area
24908 is limited to just below 2GB@.  Programs that require more than 2GB of
24909 data must use @code{malloc} or @code{mmap} to allocate the data in the
24910 heap instead of in the program's data segment.
24912 When generating code for shared libraries, @option{-fpic} implies
24913 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24915 @opindex msmall-text
24916 @opindex mlarge-text
24917 @item -msmall-text
24918 @itemx -mlarge-text
24919 When @option{-msmall-text} is used, the compiler assumes that the
24920 code of the entire program (or shared library) fits in 4MB, and is
24921 thus reachable with a branch instruction.  When @option{-msmall-data}
24922 is used, the compiler can assume that all local symbols share the
24923 same @code{$gp} value, and thus reduce the number of instructions
24924 required for a function call from 4 to 1.
24926 The default is @option{-mlarge-text}.
24928 @opindex mcpu
24929 @item -mcpu=@var{cpu_type}
24930 Set the instruction set and instruction scheduling parameters for
24931 machine type @var{cpu_type}.  You can specify either the @samp{EV}
24932 style name or the corresponding chip number.  GCC supports scheduling
24933 parameters for the EV4, EV5 and EV6 family of processors and
24934 chooses the default values for the instruction set from the processor
24935 you specify.  If you do not specify a processor type, GCC defaults
24936 to the processor on which the compiler was built.
24938 Supported values for @var{cpu_type} are
24940 @table @samp
24941 @item ev4
24942 @itemx ev45
24943 @itemx 21064
24944 Schedules as an EV4 and has no instruction set extensions.
24946 @item ev5
24947 @itemx 21164
24948 Schedules as an EV5 and has no instruction set extensions.
24950 @item ev56
24951 @itemx 21164a
24952 Schedules as an EV5 and supports the BWX extension.
24954 @item pca56
24955 @itemx 21164pc
24956 @itemx 21164PC
24957 Schedules as an EV5 and supports the BWX and MAX extensions.
24959 @item ev6
24960 @itemx 21264
24961 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24963 @item ev67
24964 @itemx 21264a
24965 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24966 @end table
24968 Native toolchains also support the value @samp{native},
24969 which selects the best architecture option for the host processor.
24970 @option{-mcpu=native} has no effect if GCC does not recognize
24971 the processor.
24973 @opindex mtune
24974 @item -mtune=@var{cpu_type}
24975 Set only the instruction scheduling parameters for machine type
24976 @var{cpu_type}.  The instruction set is not changed.
24978 Native toolchains also support the value @samp{native},
24979 which selects the best architecture option for the host processor.
24980 @option{-mtune=native} has no effect if GCC does not recognize
24981 the processor.
24983 @opindex mmemory-latency
24984 @item -mmemory-latency=@var{time}
24985 Sets the latency the scheduler should assume for typical memory
24986 references as seen by the application.  This number is highly
24987 dependent on the memory access patterns used by the application
24988 and the size of the external cache on the machine.
24990 Valid options for @var{time} are
24992 @table @samp
24993 @item @var{number}
24994 A decimal number representing clock cycles.
24996 @item L1
24997 @itemx L2
24998 @itemx L3
24999 @itemx main
25000 The compiler contains estimates of the number of clock cycles for
25001 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
25002 (also called Dcache, Scache, and Bcache), as well as to main memory.
25003 Note that L3 is only valid for EV5.
25005 @end table
25006 @end table
25008 @node eBPF Options
25009 @subsection eBPF Options
25010 @cindex eBPF Options
25012 @table @gcctabopt
25013 @item -mframe-limit=@var{bytes}
25014 This specifies the hard limit for frame sizes, in bytes.  Currently,
25015 the value that can be specified should be less than or equal to
25016 @samp{32767}.  Defaults to whatever limit is imposed by the version of
25017 the Linux kernel targeted.
25019 @opindex mbig-endian
25020 @item -mbig-endian
25021 Generate code for a big-endian target.
25023 @opindex mlittle-endian
25024 @item -mlittle-endian
25025 Generate code for a little-endian target.  This is the default.
25027 @opindex mjmpext
25028 @item -mjmpext
25029 @itemx -mno-jmpext
25030 Enable or disable generation of extra conditional-branch instructions.
25031 Enabled for CPU v2 and above.
25033 @opindex mjmp32
25034 @item -mjmp32
25035 @itemx -mno-jmp32
25036 Enable or disable generation of 32-bit jump instructions.
25037 Enabled for CPU v3 and above.
25039 @opindex malu32
25040 @item -malu32
25041 @itemx -mno-alu32
25042 Enable or disable generation of 32-bit ALU instructions.
25043 Enabled for CPU v3 and above.
25045 @opindex mv3-atomics
25046 @item -mv3-atomics
25047 @itemx -mno-v3-atomics
25048 Enable or disable instructions for general atomic operations introduced
25049 in CPU v3.  Enabled for CPU v3 and above.
25051 @opindex mbswap
25052 @item -mbswap
25053 @itemx -mno-bswap
25054 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
25056 @opindex msdiv
25057 @item -msdiv
25058 @itemx -mno-sdiv
25059 Enable or disable signed division and modulus instructions.  Enabled for
25060 CPU v4 and above.
25062 @opindex msmov
25063 @item -msmov
25064 @itemx -mno-smov
25065 Enable or disable sign-extending move and memory load instructions.
25066 Enabled for CPU v4 and above.
25068 @opindex mcpu
25069 @item -mcpu=@var{version}
25070 This specifies which version of the eBPF ISA to target. Newer versions
25071 may not be supported by all kernels. The default is @samp{v4}.
25073 Supported values for @var{version} are:
25075 @table @samp
25076 @item v1
25077 The first stable eBPF ISA with no special features or extensions.
25079 @item v2
25080 Supports the jump extensions, as in @option{-mjmpext}.
25082 @item v3
25083 All features of v2, plus:
25084 @itemize @minus
25085 @item 32-bit jump operations, as in @option{-mjmp32}
25086 @item 32-bit ALU operations, as in @option{-malu32}
25087 @item general atomic operations, as in @option{-mv3-atomics}
25088 @end itemize
25090 @item v4
25091 All features of v3, plus:
25092 @itemize @minus
25093 @item Byte swap instructions, as in @option{-mbswap}
25094 @item Signed division and modulus instructions, as in @option{-msdiv}
25095 @item Sign-extending move and memory load instructions, as in @option{-msmov}
25096 @end itemize
25097 @end table
25099 @opindex mco-re
25100 @item -mco-re
25101 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
25102 is implied by @option{-gbtf}.
25104 @opindex mno-co-re
25105 @item -mno-co-re
25106 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
25107 support is enabled by default when generating BTF debug information for
25108 the BPF target.
25110 @item -mxbpf
25111 Generate code for an expanded version of BPF, which relaxes some of
25112 the restrictions imposed by the BPF architecture:
25113 @itemize @minus
25114 @item Save and restore callee-saved registers at function entry and
25115 exit, respectively.
25116 @end itemize
25118 @opindex masm=@var{dialect}
25119 @item -masm=@var{dialect}
25120 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
25121 is @samp{normal}.
25123 Supported values for @var{dialect} are:
25125 @table @samp
25126 @item normal
25127 Outputs normal assembly dialect.
25129 @item pseudoc
25130 Outputs pseudo-c assembly dialect.
25132 @end table
25134 @end table
25136 @node FR30 Options
25137 @subsection FR30 Options
25138 @cindex FR30 Options
25140 These options are defined specifically for the FR30 port.
25142 @table @gcctabopt
25144 @opindex msmall-model
25145 @item -msmall-model
25146 Use the small address space model.  This can produce smaller code, but
25147 it does assume that all symbolic values and addresses fit into a
25148 20-bit range.
25150 @opindex mno-lsim
25151 @item -mno-lsim
25152 Assume that runtime support has been provided and so there is no need
25153 to include the simulator library (@file{libsim.a}) on the linker
25154 command line.
25156 @end table
25158 @node FT32 Options
25159 @subsection FT32 Options
25160 @cindex FT32 Options
25162 These options are defined specifically for the FT32 port.
25164 @table @gcctabopt
25166 @opindex msim
25167 @item -msim
25168 Specifies that the program will be run on the simulator.  This causes
25169 an alternate runtime startup and library to be linked.
25170 You must not use this option when generating programs that will run on
25171 real hardware; you must provide your own runtime library for whatever
25172 I/O functions are needed.
25174 @opindex mlra
25175 @item -mlra
25176 Enable Local Register Allocation.  This is still experimental for FT32,
25177 so by default the compiler uses standard reload.
25179 @opindex mnodiv
25180 @item -mnodiv
25181 Do not use div and mod instructions.
25183 @opindex mft32b
25184 @item -mft32b
25185 Enable use of the extended instructions of the FT32B processor.
25187 @opindex mcompress
25188 @item -mcompress
25189 Compress all code using the Ft32B code compression scheme.
25191 @opindex  mnopm
25192 @item -mnopm
25193 Do not generate code that reads program memory.
25195 @end table
25197 @node FRV Options
25198 @subsection FRV Options
25199 @cindex FRV Options
25201 @table @gcctabopt
25202 @opindex mgpr-32
25203 @item -mgpr-32
25205 Only use the first 32 general-purpose registers.
25207 @opindex mgpr-64
25208 @item -mgpr-64
25210 Use all 64 general-purpose registers.
25212 @opindex mfpr-32
25213 @item -mfpr-32
25215 Use only the first 32 floating-point registers.
25217 @opindex mfpr-64
25218 @item -mfpr-64
25220 Use all 64 floating-point registers.
25222 @opindex mhard-float
25223 @item -mhard-float
25225 Use hardware instructions for floating-point operations.
25227 @opindex msoft-float
25228 @item -msoft-float
25230 Use library routines for floating-point operations.
25232 @opindex malloc-cc
25233 @item -malloc-cc
25235 Dynamically allocate condition code registers.
25237 @opindex mfixed-cc
25238 @item -mfixed-cc
25240 Do not try to dynamically allocate condition code registers, only
25241 use @code{icc0} and @code{fcc0}.
25243 @opindex mdword
25244 @item -mdword
25246 Change ABI to use double word insns.
25248 @opindex mno-dword
25249 @opindex mdword
25250 @item -mno-dword
25252 Do not use double word instructions.
25254 @opindex mdouble
25255 @item -mdouble
25257 Use floating-point double instructions.
25259 @opindex mno-double
25260 @item -mno-double
25262 Do not use floating-point double instructions.
25264 @opindex mmedia
25265 @item -mmedia
25267 Use media instructions.
25269 @opindex mno-media
25270 @item -mno-media
25272 Do not use media instructions.
25274 @opindex mmuladd
25275 @item -mmuladd
25277 Use multiply and add/subtract instructions.
25279 @opindex mno-muladd
25280 @item -mno-muladd
25282 Do not use multiply and add/subtract instructions.
25284 @opindex mfdpic
25285 @item -mfdpic
25287 Select the FDPIC ABI, which uses function descriptors to represent
25288 pointers to functions.  Without any PIC/PIE-related options, it
25289 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25290 assumes GOT entries and small data are within a 12-bit range from the
25291 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25292 are computed with 32 bits.
25293 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25295 @opindex minline-plt
25296 @item -minline-plt
25298 Enable inlining of PLT entries in function calls to functions that are
25299 not known to bind locally.  It has no effect without @option{-mfdpic}.
25300 It's enabled by default if optimizing for speed and compiling for
25301 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25302 optimization option such as @option{-O3} or above is present in the
25303 command line.
25305 @opindex mTLS
25306 @item -mTLS
25308 Assume a large TLS segment when generating thread-local code.
25310 @opindex mtls
25311 @item -mtls
25313 Do not assume a large TLS segment when generating thread-local code.
25315 @opindex mgprel-ro
25316 @item -mgprel-ro
25318 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25319 that is known to be in read-only sections.  It's enabled by default,
25320 except for @option{-fpic} or @option{-fpie}: even though it may help
25321 make the global offset table smaller, it trades 1 instruction for 4.
25322 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25323 one of which may be shared by multiple symbols, and it avoids the need
25324 for a GOT entry for the referenced symbol, so it's more likely to be a
25325 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25327 @opindex multilib-library-pic
25328 @item -multilib-library-pic
25330 Link with the (library, not FD) pic libraries.  It's implied by
25331 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25332 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25333 it explicitly.
25335 @opindex mlinked-fp
25336 @item -mlinked-fp
25338 Follow the EABI requirement of always creating a frame pointer whenever
25339 a stack frame is allocated.  This option is enabled by default and can
25340 be disabled with @option{-mno-linked-fp}.
25342 @opindex mlong-calls
25343 @item -mlong-calls
25345 Use indirect addressing to call functions outside the current
25346 compilation unit.  This allows the functions to be placed anywhere
25347 within the 32-bit address space.
25349 @opindex malign-labels
25350 @item -malign-labels
25352 Try to align labels to an 8-byte boundary by inserting NOPs into the
25353 previous packet.  This option only has an effect when VLIW packing
25354 is enabled.  It doesn't create new packets; it merely adds NOPs to
25355 existing ones.
25357 @opindex mlibrary-pic
25358 @item -mlibrary-pic
25360 Generate position-independent EABI code.
25362 @opindex macc-4
25363 @item -macc-4
25365 Use only the first four media accumulator registers.
25367 @opindex macc-8
25368 @item -macc-8
25370 Use all eight media accumulator registers.
25372 @opindex mpack
25373 @item -mpack
25375 Pack VLIW instructions.
25377 @opindex mno-pack
25378 @item -mno-pack
25380 Do not pack VLIW instructions.
25382 @opindex mno-eflags
25383 @item -mno-eflags
25385 Do not mark ABI switches in e_flags.
25387 @opindex mcond-move
25388 @item -mcond-move
25390 Enable the use of conditional-move instructions (default).
25392 This switch is mainly for debugging the compiler and will likely be removed
25393 in a future version.
25395 @opindex mno-cond-move
25396 @item -mno-cond-move
25398 Disable the use of conditional-move instructions.
25400 This switch is mainly for debugging the compiler and will likely be removed
25401 in a future version.
25403 @opindex mscc
25404 @item -mscc
25406 Enable the use of conditional set instructions (default).
25408 This switch is mainly for debugging the compiler and will likely be removed
25409 in a future version.
25411 @opindex mno-scc
25412 @item -mno-scc
25414 Disable the use of conditional set instructions.
25416 This switch is mainly for debugging the compiler and will likely be removed
25417 in a future version.
25419 @opindex mcond-exec
25420 @item -mcond-exec
25422 Enable the use of conditional execution (default).
25424 This switch is mainly for debugging the compiler and will likely be removed
25425 in a future version.
25427 @opindex mno-cond-exec
25428 @item -mno-cond-exec
25430 Disable the use of conditional execution.
25432 This switch is mainly for debugging the compiler and will likely be removed
25433 in a future version.
25435 @opindex mvliw-branch
25436 @item -mvliw-branch
25438 Run a pass to pack branches into VLIW instructions (default).
25440 This switch is mainly for debugging the compiler and will likely be removed
25441 in a future version.
25443 @opindex mno-vliw-branch
25444 @item -mno-vliw-branch
25446 Do not run a pass to pack branches into VLIW instructions.
25448 This switch is mainly for debugging the compiler and will likely be removed
25449 in a future version.
25451 @opindex mmulti-cond-exec
25452 @item -mmulti-cond-exec
25454 Enable optimization of @code{&&} and @code{||} in conditional execution
25455 (default).
25457 This switch is mainly for debugging the compiler and will likely be removed
25458 in a future version.
25460 @opindex mno-multi-cond-exec
25461 @item -mno-multi-cond-exec
25463 Disable optimization of @code{&&} and @code{||} in conditional execution.
25465 This switch is mainly for debugging the compiler and will likely be removed
25466 in a future version.
25468 @opindex mnested-cond-exec
25469 @item -mnested-cond-exec
25471 Enable nested conditional execution optimizations (default).
25473 This switch is mainly for debugging the compiler and will likely be removed
25474 in a future version.
25476 @opindex mno-nested-cond-exec
25477 @item -mno-nested-cond-exec
25479 Disable nested conditional execution optimizations.
25481 This switch is mainly for debugging the compiler and will likely be removed
25482 in a future version.
25484 @opindex moptimize-membar
25485 @item -moptimize-membar
25487 This switch removes redundant @code{membar} instructions from the
25488 compiler-generated code.  It is enabled by default.
25490 @opindex mno-optimize-membar
25491 @opindex moptimize-membar
25492 @item -mno-optimize-membar
25494 This switch disables the automatic removal of redundant @code{membar}
25495 instructions from the generated code.
25497 @opindex mtomcat-stats
25498 @item -mtomcat-stats
25500 Cause gas to print out tomcat statistics.
25502 @opindex mcpu
25503 @item -mcpu=@var{cpu}
25505 Select the processor type for which to generate code.  Possible values are
25506 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
25507 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
25509 @end table
25511 @node GNU/Linux Options
25512 @subsection GNU/Linux Options
25514 These @samp{-m} options are defined for GNU/Linux targets:
25516 @table @gcctabopt
25517 @opindex mglibc
25518 @item -mglibc
25519 Use the GNU C library.  This is the default except
25520 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
25521 @samp{*-*-linux-*android*} targets.
25523 @opindex muclibc
25524 @item -muclibc
25525 Use uClibc C library.  This is the default on
25526 @samp{*-*-linux-*uclibc*} targets.
25528 @opindex mmusl
25529 @item -mmusl
25530 Use the musl C library.  This is the default on
25531 @samp{*-*-linux-*musl*} targets.
25533 @opindex mbionic
25534 @item -mbionic
25535 Use Bionic C library.  This is the default on
25536 @samp{*-*-linux-*android*} targets.
25538 @opindex mandroid
25539 @item -mandroid
25540 Compile code compatible with Android platform.  This is the default on
25541 @samp{*-*-linux-*android*} targets.
25543 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
25544 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
25545 this option makes the GCC driver pass Android-specific options to the linker.
25546 Finally, this option causes the preprocessor macro @code{__ANDROID__}
25547 to be defined.
25549 @opindex tno-android-cc
25550 @item -tno-android-cc
25551 Disable compilation effects of @option{-mandroid}, i.e., do not enable
25552 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
25553 @option{-fno-rtti} by default.
25555 @opindex tno-android-ld
25556 @item -tno-android-ld
25557 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
25558 linking options to the linker.
25560 @end table
25562 @node H8/300 Options
25563 @subsection H8/300 Options
25565 These @samp{-m} options are defined for the H8/300 implementations:
25567 @table @gcctabopt
25568 @opindex mrelax
25569 @item -mrelax
25570 Shorten some address references at link time, when possible; uses the
25571 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
25572 ld, Using ld}, for a fuller description.
25574 @opindex mh
25575 @item -mh
25576 Generate code for the H8/300H@.
25578 @opindex ms
25579 @item -ms
25580 Generate code for the H8S@.
25582 @opindex mn
25583 @item -mn
25584 Generate code for the H8S and H8/300H in the normal mode.  This switch
25585 must be used either with @option{-mh} or @option{-ms}.
25587 @opindex ms2600
25588 @item -ms2600
25589 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
25591 @opindex mexr
25592 @item -mexr
25593 Extended registers are stored on stack before execution of function
25594 with monitor attribute. Default option is @option{-mexr}.
25595 This option is valid only for H8S targets.
25597 @opindex mno-exr
25598 @opindex mexr
25599 @item -mno-exr
25600 Extended registers are not stored on stack before execution of function 
25601 with monitor attribute. Default option is @option{-mno-exr}. 
25602 This option is valid only for H8S targets.
25604 @opindex mint32
25605 @item -mint32
25606 Make @code{int} data 32 bits by default.
25608 @opindex malign-300
25609 @item -malign-300
25610 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
25611 The default for the H8/300H and H8S is to align longs and floats on
25612 4-byte boundaries.
25613 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
25614 This option has no effect on the H8/300.
25615 @end table
25617 @node HPPA Options
25618 @subsection HPPA Options
25619 @cindex HPPA Options
25621 These @samp{-m} options are defined for the HPPA family of computers:
25623 @table @gcctabopt
25624 @opindex march
25625 @item -march=@var{architecture-type}
25626 Generate code for the specified architecture.  The choices for
25627 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
25628 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
25629 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
25630 architecture option for your machine.  Code compiled for lower numbered
25631 architectures runs on higher numbered architectures, but not the
25632 other way around.
25634 @opindex mpa-risc-1-0
25635 @opindex mpa-risc-1-1
25636 @opindex mpa-risc-2-0
25637 @item -mpa-risc-1-0
25638 @itemx -mpa-risc-1-1
25639 @itemx -mpa-risc-2-0
25640 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
25642 @opindex matomic-libcalls
25643 @opindex mno-atomic-libcalls
25644 @item -matomic-libcalls
25645 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
25646 This option is enabled by default.  It only affects the generation of
25647 atomic libcalls by the HPPA backend.
25649 Both the sync and @file{libatomic} libcall implementations use locking.
25650 As a result, processor stores are not atomic with respect to other
25651 atomic operations.  Processor loads up to DImode are atomic with
25652 respect to other atomic operations provided they are implemented as
25653 a single access.
25655 The PA-RISC architecture does not support any atomic operations in
25656 hardware except for the @code{ldcw} instruction.  Thus, all atomic
25657 support is implemented using sync and atomic libcalls.  Sync libcall
25658 support is in @file{libgcc.a}.  Atomic libcall support is in
25659 @file{libatomic}.
25661 This option generates @code{__atomic_exchange} calls for atomic stores.
25662 It also provides special handling for atomic DImode accesses on 32-bit
25663 targets.
25665 @opindex mbig-switch
25666 @item -mbig-switch
25667 Does nothing.  Preserved for backward compatibility.
25669 @opindex mcaller-copies
25670 @item -mcaller-copies
25671 The caller copies function arguments passed by hidden reference.  This
25672 option should be used with care as it is not compatible with the default
25673 32-bit runtime.  However, only aggregates larger than eight bytes are
25674 passed by hidden reference and the option provides better compatibility
25675 with OpenMP.
25677 @opindex mcoherent-ldcw
25678 @item -mcoherent-ldcw
25679 Use ldcw/ldcd coherent cache-control hint.
25681 @opindex mdisable-fpregs
25682 @item -mdisable-fpregs
25683 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
25685 @opindex mdisable-indexing
25686 @item -mdisable-indexing
25687 Prevent the compiler from using indexing address modes.  This avoids some
25688 rather obscure problems when compiling MIG generated code under MACH@.
25690 @opindex mfast-indirect-calls
25691 @item -mfast-indirect-calls
25692 Generate code that assumes calls never cross space boundaries.  This
25693 allows GCC to emit code that performs faster indirect calls.
25695 This option does not work in the presence of shared libraries or nested
25696 functions.
25698 @opindex mfixed-range
25699 @item -mfixed-range=@var{register-range}
25700 Generate code treating the given register range as fixed registers.
25701 A fixed register is one that the register allocator cannot use.  This is
25702 useful when compiling kernel code.  A register range is specified as
25703 two registers separated by a dash.  Multiple register ranges can be
25704 specified separated by a comma.
25706 @opindex mgas
25707 @item -mgas
25708 Enable the use of assembler directives only GAS understands.
25710 @opindex mgnu-ld
25711 @item -mgnu-ld
25712 Use options specific to GNU @command{ld}.
25713 This passes @option{-shared} to @command{ld} when
25714 building a shared library.  It is the default when GCC is configured,
25715 explicitly or implicitly, with the GNU linker.  This option does not
25716 affect which @command{ld} is called; it only changes what parameters
25717 are passed to that @command{ld}.
25718 The @command{ld} that is called is determined by the
25719 @option{--with-ld} configure option, GCC's program search path, and
25720 finally by the user's @env{PATH}.  The linker used by GCC can be printed
25721 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
25722 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25724 @opindex mhp-ld
25725 @item -mhp-ld
25726 Use options specific to HP @command{ld}.
25727 This passes @option{-b} to @command{ld} when building
25728 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25729 links.  It is the default when GCC is configured, explicitly or
25730 implicitly, with the HP linker.  This option does not affect
25731 which @command{ld} is called; it only changes what parameters are passed to that
25732 @command{ld}.
25733 The @command{ld} that is called is determined by the @option{--with-ld}
25734 configure option, GCC's program search path, and finally by the user's
25735 @env{PATH}.  The linker used by GCC can be printed using @samp{which
25736 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
25737 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25739 @opindex mlinker-opt
25740 @item -mlinker-opt
25741 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
25742 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
25743 linkers in which they give bogus error messages when linking some programs.
25745 @opindex mno-long-calls
25746 @opindex mlong-calls
25747 @item -mlong-calls
25748 Generate code that uses long call sequences.  This ensures that a call
25749 is always able to reach linker generated stubs.  The default is to generate
25750 long calls only when the distance from the call site to the beginning
25751 of the function or translation unit, as the case may be, exceeds a
25752 predefined limit set by the branch type being used.  The limits for
25753 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25754 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
25755 240,000 bytes.
25757 Distances are measured from the beginning of functions when using the
25758 @option{-ffunction-sections} option, or when using the @option{-mgas}
25759 and @option{-mno-portable-runtime} options together under HP-UX with
25760 the SOM linker.
25762 It is normally not desirable to use this option as it degrades
25763 performance.  However, it may be useful in large applications,
25764 particularly when partial linking is used to build the application.
25766 The types of long calls used depends on the capabilities of the
25767 assembler and linker, and the type of code being generated.  The
25768 impact on systems that support long absolute calls, and long pic
25769 symbol-difference or pc-relative calls should be relatively small.
25770 However, an indirect call is used on 32-bit ELF systems in pic code
25771 and it is quite long.
25773 @opindex mlong-load-store
25774 @item -mlong-load-store
25775 Generate 3-instruction load and store sequences as sometimes required by
25776 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
25777 the HP compilers.
25779 @opindex mjump-in-delay
25780 @item -mjump-in-delay
25781 This option is ignored and provided for compatibility purposes only.
25783 @opindex mno-space-regs
25784 @opindex mspace-regs
25785 @item -mno-space-regs
25786 Generate code that assumes the target has no space registers.  This allows
25787 GCC to generate faster indirect calls and use unscaled index address modes.
25789 Such code is suitable for level 0 PA systems and kernels.
25791 @opindex mordered
25792 @item -mordered
25793 Assume memory references are ordered and barriers are not needed.
25795 @opindex mportable-runtime
25796 @item -mportable-runtime
25797 Use the portable calling conventions proposed by HP for ELF systems.
25799 @opindex mschedule
25800 @item -mschedule=@var{cpu-type}
25801 Schedule code according to the constraints for the machine type
25802 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
25803 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
25804 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25805 proper scheduling option for your machine.  The default scheduling is
25806 @samp{8000}.
25808 @opindex msio
25809 @item -msio
25810 Generate the predefine, @code{_SIO}, for server IO@.  The default is
25811 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
25812 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
25813 options are available under HP-UX and HI-UX@.
25815 @opindex msoft-float
25816 @item -msoft-float
25817 Generate output containing library calls for floating point.
25818 @strong{Warning:} the requisite libraries are not available for all HPPA
25819 targets.  Normally the facilities of the machine's usual C compiler are
25820 used, but this cannot be done directly in cross-compilation.  You must make
25821 your own arrangements to provide suitable library functions for
25822 cross-compilation.
25824 @option{-msoft-float} changes the calling convention in the output file;
25825 therefore, it is only useful if you compile @emph{all} of a program with
25826 this option.  In particular, you need to compile @file{libgcc.a}, the
25827 library that comes with GCC, with @option{-msoft-float} in order for
25828 this to work.
25830 @opindex msoft-mult
25831 @item -msoft-mult
25832 Use software integer multiplication.
25834 This disables the use of the @code{xmpyu} instruction.
25836 @opindex march
25837 @item -munix=@var{unix-std}
25838 Generate compiler predefines and select a startfile for the specified
25839 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
25840 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
25841 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
25842 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
25843 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25844 and later.
25846 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25847 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25848 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25849 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25850 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25851 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25853 It is @emph{important} to note that this option changes the interfaces
25854 for various library routines.  It also affects the operational behavior
25855 of the C library.  Thus, @emph{extreme} care is needed in using this
25856 option.
25858 Library code that is intended to operate with more than one UNIX
25859 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25860 as appropriate.  Most GNU software doesn't provide this capability.
25862 @opindex nolibdld
25863 @item -nolibdld
25864 Suppress the generation of link options to search libdld.sl when the
25865 @option{-static} option is specified on HP-UX 10 and later.
25867 @opindex static
25868 @item -static
25869 The HP-UX implementation of setlocale in libc has a dependency on
25870 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
25871 when the @option{-static} option is specified, special link options
25872 are needed to resolve this dependency.
25874 On HP-UX 10 and later, the GCC driver adds the necessary options to
25875 link with libdld.sl when the @option{-static} option is specified.
25876 This causes the resulting binary to be dynamic.  On the 64-bit port,
25877 the linkers generate dynamic binaries by default in any case.  The
25878 @option{-nolibdld} option can be used to prevent the GCC driver from
25879 adding these link options.
25881 @opindex threads
25882 @item -threads
25883 Add support for multithreading with the @dfn{dce thread} library
25884 under HP-UX@.  This option sets flags for both the preprocessor and
25885 linker.
25886 @end table
25888 @node IA-64 Options
25889 @subsection IA-64 Options
25890 @cindex IA-64 Options
25892 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25894 @table @gcctabopt
25895 @opindex mbig-endian
25896 @item -mbig-endian
25897 Generate code for a big-endian target.  This is the default for HP-UX@.
25899 @opindex mlittle-endian
25900 @item -mlittle-endian
25901 Generate code for a little-endian target.  This is the default for AIX5
25902 and GNU/Linux.
25904 @opindex mgnu-as
25905 @opindex mno-gnu-as
25906 @item -mgnu-as
25907 @itemx -mno-gnu-as
25908 Generate (or don't) code for the GNU assembler.  This is the default.
25909 @c Also, this is the default if the configure option @option{--with-gnu-as}
25910 @c is used.
25912 @opindex mgnu-ld
25913 @opindex mno-gnu-ld
25914 @item -mgnu-ld
25915 @itemx -mno-gnu-ld
25916 Generate (or don't) code for the GNU linker.  This is the default.
25917 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25918 @c is used.
25920 @opindex mno-pic
25921 @item -mno-pic
25922 Generate code that does not use a global pointer register.  The result
25923 is not position independent code, and violates the IA-64 ABI@.
25925 @opindex mvolatile-asm-stop
25926 @opindex mno-volatile-asm-stop
25927 @item -mvolatile-asm-stop
25928 @itemx -mno-volatile-asm-stop
25929 Generate (or don't) a stop bit immediately before and after volatile asm
25930 statements.
25932 @opindex mregister-names
25933 @opindex mno-register-names
25934 @item -mregister-names
25935 @itemx -mno-register-names
25936 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25937 the stacked registers.  This may make assembler output more readable.
25939 @opindex mno-sdata
25940 @opindex msdata
25941 @item -mno-sdata
25942 @itemx -msdata
25943 Disable (or enable) optimizations that use the small data section.  This may
25944 be useful for working around optimizer bugs.
25946 @opindex mconstant-gp
25947 @item -mconstant-gp
25948 Generate code that uses a single constant global pointer value.  This is
25949 useful when compiling kernel code.
25951 @opindex mauto-pic
25952 @item -mauto-pic
25953 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
25954 This is useful when compiling firmware code.
25956 @opindex minline-float-divide-min-latency
25957 @item -minline-float-divide-min-latency
25958 Generate code for inline divides of floating-point values
25959 using the minimum latency algorithm.
25961 @opindex minline-float-divide-max-throughput
25962 @item -minline-float-divide-max-throughput
25963 Generate code for inline divides of floating-point values
25964 using the maximum throughput algorithm.
25966 @opindex mno-inline-float-divide
25967 @item -mno-inline-float-divide
25968 Do not generate inline code for divides of floating-point values.
25970 @opindex minline-int-divide-min-latency
25971 @item -minline-int-divide-min-latency
25972 Generate code for inline divides of integer values
25973 using the minimum latency algorithm.
25975 @opindex minline-int-divide-max-throughput
25976 @item -minline-int-divide-max-throughput
25977 Generate code for inline divides of integer values
25978 using the maximum throughput algorithm.
25980 @opindex mno-inline-int-divide
25981 @opindex minline-int-divide
25982 @item -mno-inline-int-divide
25983 Do not generate inline code for divides of integer values.
25985 @opindex minline-sqrt-min-latency
25986 @item -minline-sqrt-min-latency
25987 Generate code for inline square roots
25988 using the minimum latency algorithm.
25990 @opindex minline-sqrt-max-throughput
25991 @item -minline-sqrt-max-throughput
25992 Generate code for inline square roots
25993 using the maximum throughput algorithm.
25995 @opindex mno-inline-sqrt
25996 @item -mno-inline-sqrt
25997 Do not generate inline code for @code{sqrt}.
25999 @opindex mfused-madd
26000 @opindex mno-fused-madd
26001 @item -mfused-madd
26002 @itemx -mno-fused-madd
26003 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
26004 instructions.  The default is to use these instructions.
26006 @opindex mno-dwarf2-asm
26007 @opindex mdwarf2-asm
26008 @item -mno-dwarf2-asm
26009 @itemx -mdwarf2-asm
26010 Don't (or do) generate assembler code for the DWARF line number debugging
26011 info.  This may be useful when not using the GNU assembler.
26013 @opindex mearly-stop-bits
26014 @opindex mno-early-stop-bits
26015 @item -mearly-stop-bits
26016 @itemx -mno-early-stop-bits
26017 Allow stop bits to be placed earlier than immediately preceding the
26018 instruction that triggered the stop bit.  This can improve instruction
26019 scheduling, but does not always do so.
26021 @opindex mfixed-range
26022 @item -mfixed-range=@var{register-range}
26023 Generate code treating the given register range as fixed registers.
26024 A fixed register is one that the register allocator cannot use.  This is
26025 useful when compiling kernel code.  A register range is specified as
26026 two registers separated by a dash.  Multiple register ranges can be
26027 specified separated by a comma.
26029 @opindex mtls-size
26030 @item -mtls-size=@var{tls-size}
26031 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
26034 @opindex mtune
26035 @item -mtune=@var{cpu-type}
26036 Tune the instruction scheduling for a particular CPU, Valid values are
26037 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
26038 and @samp{mckinley}.
26040 @opindex milp32
26041 @opindex mlp64
26042 @item -milp32
26043 @itemx -mlp64
26044 Generate code for a 32-bit or 64-bit environment.
26045 The 32-bit environment sets int, long and pointer to 32 bits.
26046 The 64-bit environment sets int to 32 bits and long and pointer
26047 to 64 bits.  These are HP-UX specific flags.
26049 @opindex mno-sched-br-data-spec
26050 @opindex msched-br-data-spec
26051 @item -mno-sched-br-data-spec
26052 @itemx -msched-br-data-spec
26053 (Dis/En)able data speculative scheduling before reload.
26054 This results in generation of @code{ld.a} instructions and
26055 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26056 The default setting is disabled.
26058 @opindex msched-ar-data-spec
26059 @opindex mno-sched-ar-data-spec
26060 @item -msched-ar-data-spec
26061 @itemx -mno-sched-ar-data-spec
26062 (En/Dis)able data speculative scheduling after reload.
26063 This results in generation of @code{ld.a} instructions and
26064 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
26065 The default setting is enabled.
26067 @opindex mno-sched-control-spec
26068 @opindex msched-control-spec
26069 @item -mno-sched-control-spec
26070 @itemx -msched-control-spec
26071 (Dis/En)able control speculative scheduling.  This feature is
26072 available only during region scheduling (i.e.@: before reload).
26073 This results in generation of the @code{ld.s} instructions and
26074 the corresponding check instructions @code{chk.s}.
26075 The default setting is disabled.
26077 @opindex msched-br-in-data-spec
26078 @opindex mno-sched-br-in-data-spec
26079 @item -msched-br-in-data-spec
26080 @itemx -mno-sched-br-in-data-spec
26081 (En/Dis)able speculative scheduling of the instructions that
26082 are dependent on the data speculative loads before reload.
26083 This is effective only with @option{-msched-br-data-spec} enabled.
26084 The default setting is enabled.
26086 @opindex msched-ar-in-data-spec
26087 @opindex mno-sched-ar-in-data-spec
26088 @item -msched-ar-in-data-spec
26089 @itemx -mno-sched-ar-in-data-spec
26090 (En/Dis)able speculative scheduling of the instructions that
26091 are dependent on the data speculative loads after reload.
26092 This is effective only with @option{-msched-ar-data-spec} enabled.
26093 The default setting is enabled.
26095 @opindex msched-in-control-spec
26096 @opindex mno-sched-in-control-spec
26097 @item -msched-in-control-spec
26098 @itemx -mno-sched-in-control-spec
26099 (En/Dis)able speculative scheduling of the instructions that
26100 are dependent on the control speculative loads.
26101 This is effective only with @option{-msched-control-spec} enabled.
26102 The default setting is enabled.
26104 @opindex mno-sched-prefer-non-data-spec-insns
26105 @opindex msched-prefer-non-data-spec-insns
26106 @item -mno-sched-prefer-non-data-spec-insns
26107 @itemx -msched-prefer-non-data-spec-insns
26108 If enabled, data-speculative instructions are chosen for schedule
26109 only if there are no other choices at the moment.  This makes
26110 the use of the data speculation much more conservative.
26111 The default setting is disabled.
26113 @opindex mno-sched-prefer-non-control-spec-insns
26114 @opindex msched-prefer-non-control-spec-insns
26115 @item -mno-sched-prefer-non-control-spec-insns
26116 @itemx -msched-prefer-non-control-spec-insns
26117 If enabled, control-speculative instructions are chosen for schedule
26118 only if there are no other choices at the moment.  This makes
26119 the use of the control speculation much more conservative.
26120 The default setting is disabled.
26122 @opindex mno-sched-count-spec-in-critical-path
26123 @opindex msched-count-spec-in-critical-path
26124 @item -mno-sched-count-spec-in-critical-path
26125 @itemx -msched-count-spec-in-critical-path
26126 If enabled, speculative dependencies are considered during
26127 computation of the instructions priorities.  This makes the use of the
26128 speculation a bit more conservative.
26129 The default setting is disabled.
26131 @opindex msched-spec-ldc
26132 @item -msched-spec-ldc
26133 Use a simple data speculation check.  This option is on by default.
26135 @opindex msched-spec-ldc
26136 @item -msched-control-spec-ldc
26137 Use a simple check for control speculation.  This option is on by default.
26139 @opindex msched-stop-bits-after-every-cycle
26140 @item -msched-stop-bits-after-every-cycle
26141 Place a stop bit after every cycle when scheduling.  This option is on
26142 by default.
26144 @opindex msched-fp-mem-deps-zero-cost
26145 @item -msched-fp-mem-deps-zero-cost
26146 Assume that floating-point stores and loads are not likely to cause a conflict
26147 when placed into the same instruction group.  This option is disabled by
26148 default.
26150 @opindex msel-sched-dont-check-control-spec
26151 @item -msel-sched-dont-check-control-spec
26152 Generate checks for control speculation in selective scheduling.
26153 This flag is disabled by default.
26155 @opindex msched-max-memory-insns
26156 @item -msched-max-memory-insns=@var{max-insns}
26157 Limit on the number of memory insns per instruction group, giving lower
26158 priority to subsequent memory insns attempting to schedule in the same
26159 instruction group. Frequently useful to prevent cache bank conflicts.
26160 The default value is 1.
26162 @opindex msched-max-memory-insns-hard-limit
26163 @item -msched-max-memory-insns-hard-limit
26164 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
26165 disallowing more than that number in an instruction group.
26166 Otherwise, the limit is ``soft'', meaning that non-memory operations
26167 are preferred when the limit is reached, but memory operations may still
26168 be scheduled.
26170 @end table
26172 @node LM32 Options
26173 @subsection LM32 Options
26174 @cindex LM32 options
26176 These @option{-m} options are defined for the LatticeMico32 architecture:
26178 @table @gcctabopt
26179 @opindex mbarrel-shift-enabled
26180 @item -mbarrel-shift-enabled
26181 Enable barrel-shift instructions.
26183 @opindex mdivide-enabled
26184 @item -mdivide-enabled
26185 Enable divide and modulus instructions.
26187 @opindex multiply-enabled
26188 @item -mmultiply-enabled
26189 Enable multiply instructions.
26191 @opindex msign-extend-enabled
26192 @item -msign-extend-enabled
26193 Enable sign extend instructions.
26195 @opindex muser-enabled
26196 @item -muser-enabled
26197 Enable user-defined instructions.
26199 @end table
26201 @node LoongArch Options
26202 @subsection LoongArch Options
26203 @cindex LoongArch Options
26205 These command-line options are defined for LoongArch targets:
26207 @table @gcctabopt
26208 @opindex march
26209 @item -march=@var{cpu-type}
26210 Generate instructions for the machine type @var{cpu-type}.  In contrast to
26211 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26212 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26213 to generate code that may not run at all on processors other than the one
26214 indicated.  Specifying @option{-march=@var{cpu-type}} implies
26215 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
26217 The choices for @var{cpu-type} are:
26219 @table @samp
26220 @item native
26221 This selects the CPU to generate code for at compilation time by determining
26222 the processor type of the compiling machine.  Using @option{-march=native}
26223 enables all instruction subsets supported by the local machine (hence
26224 the result might not run on different machines).  Using @option{-mtune=native}
26225 produces code optimized for the local machine under the constraints
26226 of the selected instruction set.
26227 @item loongarch64
26228 A generic CPU with 64-bit extensions.
26229 @item la464
26230 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
26231 @end table
26233 @opindex mtune
26234 @item -mtune=@var{cpu-type}
26235 Optimize the output for the given processor, specified by microarchitecture
26236 name.
26238 @opindex mabi
26239 @item -mabi=@var{base-abi-type}
26240 Generate code for the specified calling convention.
26241 @var{base-abi-type} can be one of:
26242 @table @samp
26243 @item lp64d
26244 Uses 64-bit general purpose registers and 32/64-bit floating-point
26245 registers for parameter passing.  Data model is LP64, where @samp{int}
26246 is 32 bits, while @samp{long int} and pointers are 64 bits.
26247 @item lp64f
26248 Uses 64-bit general purpose registers and 32-bit floating-point
26249 registers for parameter passing.  Data model is LP64, where @samp{int}
26250 is 32 bits, while @samp{long int} and pointers are 64 bits.
26251 @item lp64s
26252 Uses 64-bit general purpose registers and no floating-point
26253 registers for parameter passing.  Data model is LP64, where @samp{int}
26254 is 32 bits, while @samp{long int} and pointers are 64 bits.
26255 @end table
26257 @opindex mfpu
26258 @item -mfpu=@var{fpu-type}
26259 Generate code for the specified FPU type, which can be one of:
26260 @table @samp
26261 @item 64
26262 Allow the use of hardware floating-point instructions for 32-bit
26263 and 64-bit operations.
26264 @item 32
26265 Allow the use of hardware floating-point instructions for 32-bit
26266 operations.
26267 @item none
26268 @item 0
26269 Prevent the use of hardware floating-point instructions.
26270 @end table
26272 @opindex msimd
26273 @item -msimd=@var{simd-type}
26274 Enable generation of LoongArch SIMD instructions for vectorization
26275 and via builtin functions.  The value can be one of:
26276 @table @samp
26277 @item lasx
26278 Enable generating instructions from the 256-bit LoongArch Advanced
26279 SIMD Extension (LASX) and the 128-bit LoongArch SIMD Extension (LSX).
26280 @item lsx
26281 Enable generating instructions from the 128-bit LoongArch SIMD
26282 Extension (LSX).
26283 @item none
26284 No LoongArch SIMD instruction may be generated.
26285 @end table
26287 @opindex msoft-float
26288 @item -msoft-float
26289 Force @option{-mfpu=none} and prevents the use of floating-point
26290 registers for parameter passing.  This option may change the target
26291 ABI.
26293 @opindex msingle-float
26294 @item -msingle-float
26295 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26296 registers for parameter passing.  This option may change the target
26297 ABI.
26299 @opindex mdouble-float
26300 @item -mdouble-float
26301 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26302 registers for parameter passing.  This option may change the target
26303 ABI.
26305 @opindex ml[a]sx
26306 @item -mlasx
26307 @itemx -mno-lasx
26308 @item -mlsx
26309 @itemx -mno-lsx
26310 Incrementally adjust the scope of the SIMD extensions (none / LSX / LASX)
26311 that can be used by the compiler for code generation.  Enabling LASX with
26312 @option{mlasx} automatically enables LSX, and diabling LSX with @option{mno-lsx}
26313 automatically disables LASX.  These driver-only options act upon the final
26314 @option{msimd} configuration state and make incremental chagnes in the order
26315 they appear on the GCC driver's command line, deriving the final / canonicalized
26316 @option{msimd} option that is passed to the compiler proper.
26318 @opindex mbranch-cost
26319 @item -mbranch-cost=@var{n}
26320 Set the cost of branches to roughly @var{n} instructions.
26322 @opindex mcheck-zero-division
26323 @item -mcheck-zero-division
26324 @itemx -mno-check-zero-divison
26325 Trap (do not trap) on integer division by zero.  The default is
26326 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26327 @option{-mno-check-zero-division} for other optimization levels.
26329 @opindex mcond-move-int
26330 @item -mcond-move-int
26331 @itemx -mno-cond-move-int
26332 Conditional moves for integral data in general-purpose registers
26333 are enabled (disabled).  The default is @option{-mcond-move-int}.
26335 @opindex mcond-move-float
26336 @item -mcond-move-float
26337 @itemx -mno-cond-move-float
26338 Conditional moves for floating-point registers are enabled (disabled).
26339 The default is @option{-mcond-move-float}.
26341 @opindex mmemcpy
26342 @item -mmemcpy
26343 @itemx -mno-memcpy
26344 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26345 The default is @option{-mno-memcpy}, which allows GCC to inline most
26346 constant-sized copies.  Setting optimization level to @option{-Os} also
26347 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26348 behavior if explicitly specified, regardless of the order these options on
26349 the command line.
26351 @opindex mstrict-align
26352 @item -mstrict-align
26353 @itemx -mno-strict-align
26354 Avoid or allow generating memory accesses that may not be aligned on a natural
26355 object boundary as described in the architecture specification. The default is
26356 @option{-mno-strict-align}.
26358 @opindex msmall-data-limit
26359 @item -msmall-data-limit=@var{number}
26360 Put global and static data smaller than @var{number} bytes into a special
26361 section (on some targets).  The default value is 0.
26363 @opindex mmax-inline-memcpy-size
26364 @item -mmax-inline-memcpy-size=@var{n}
26365 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26366 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26368 @item -mcmodel=@var{code-model}
26369 Set the code model to one of:
26370 @table @samp
26371 @item tiny-static (Not implemented yet)
26372 @item tiny (Not implemented yet)
26374 @item normal
26375 The text segment must be within 128MB addressing space.  The data segment must
26376 be within 2GB addressing space.
26378 @item medium
26379 The text segment and data segment must be within 2GB addressing space.
26381 @item large (Not implemented yet)
26383 @item extreme
26384 This mode does not limit the size of the code segment and data segment.
26385 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt},
26386 and it requires @option{-mexplicit-relocs=always}.
26387 @end table
26388 The default code model is @code{normal}.
26390 @item -mexplicit-relocs=@var{style}
26391 Set when to use assembler relocation operators when dealing with symbolic
26392 addresses.  The alternative is to use assembler macros instead, which may
26393 limit instruction scheduling but allow linker relaxation.
26394 with @option{-mexplicit-relocs=none} the assembler macros are always used,
26395 with @option{-mexplicit-relocs=always} the assembler relocation operators
26396 are always used, with @option{-mexplicit-relocs=auto} the compiler will
26397 use the relocation operators where the linker relaxation is impossible to
26398 improve the code quality, and macros elsewhere.  The default
26399 value for the option is determined with the assembler capability detected
26400 during GCC build-time and the setting of @option{-mrelax}:
26401 @option{-mexplicit-relocs=none} if the assembler does not support
26402 relocation operators at all,
26403 @option{-mexplicit-relocs=always} if the assembler supports relocation
26404 operators but @option{-mrelax} is not enabled,
26405 @option{-mexplicit-relocs=auto} if the assembler supports relocation
26406 operators and @option{-mrelax} is enabled.
26408 @opindex mexplicit-relocs
26409 @item -mexplicit-relocs
26410 An alias of @option{-mexplicit-relocs=always} for backward compatibility.
26412 @opindex mno-explicit-relocs
26413 @item -mno-explicit-relocs
26414 An alias of @option{-mexplicit-relocs=none} for backward compatibility.
26416 @opindex mdirect-extern-access
26417 @item -mdirect-extern-access
26418 @itemx -mno-direct-extern-access
26419 Do not use or use GOT to access external symbols.  The default is
26420 @option{-mno-direct-extern-access}: GOT is used for external symbols with
26421 default visibility, but not used for other external symbols.
26423 With @option{-mdirect-extern-access}, GOT is not used and all external
26424 symbols are PC-relatively addressed.  It is @strong{only} suitable for
26425 environments where no dynamic link is performed, like firmwares, OS
26426 kernels, executables linked with @option{-static} or @option{-static-pie}.
26427 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
26428 @option{-fpic}.
26430 @item -mrelax
26431 @itemx -mno-relax
26432 Take (do not take) advantage of linker relaxations.  If
26433 @option{-mpass-mrelax-to-as} is enabled, this option is also passed to
26434 the assembler.  The default is determined during GCC build-time by
26435 detecting corresponding assembler support:
26436 @option{-mrelax} if the assembler supports both the @option{-mrelax}
26437 option and the conditional branch relaxation (it's required or the
26438 @code{.align} directives and conditional branch instructions in the
26439 assembly code outputted by GCC may be rejected by the assembler because
26440 of a relocation overflow), @option{-mno-relax} otherwise.
26442 @item -mpass-mrelax-to-as
26443 @itemx -mno-pass-mrelax-to-as
26444 Pass (do not pass) the @option{-mrelax} or @option{-mno-relax} option
26445 to the assembler.  The default is determined during GCC build-time by
26446 detecting corresponding assembler support:
26447 @option{-mpass-mrelax-to-as} if the assembler supports the
26448 @option{-mrelax} option, @option{-mno-pass-mrelax-to-as} otherwise.
26449 This option is mostly useful for debugging, or interoperation with
26450 assemblers different from the build-time one.
26452 @item loongarch-vect-unroll-limit
26453 The vectorizer will use available tuning information to determine whether it
26454 would be beneficial to unroll the main vectorized loop and by how much.  This
26455 parameter set's the upper bound of how much the vectorizer will unroll the main
26456 loop.  The default value is six.
26458 @end table
26461 @node M32C Options
26462 @subsection M32C Options
26463 @cindex M32C options
26465 @table @gcctabopt
26466 @opindex mcpu=
26467 @item -mcpu=@var{name}
26468 Select the CPU for which code is generated.  @var{name} may be one of
26469 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
26470 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
26471 the M32C/80 series.
26473 @opindex msim
26474 @item -msim
26475 Specifies that the program will be run on the simulator.  This causes
26476 an alternate runtime library to be linked in which supports, for
26477 example, file I/O@.  You must not use this option when generating
26478 programs that will run on real hardware; you must provide your own
26479 runtime library for whatever I/O functions are needed.
26481 @opindex memregs=
26482 @item -memregs=@var{number}
26483 Specifies the number of memory-based pseudo-registers GCC uses
26484 during code generation.  These pseudo-registers are used like real
26485 registers, so there is a tradeoff between GCC's ability to fit the
26486 code into available registers, and the performance penalty of using
26487 memory instead of registers.  Note that all modules in a program must
26488 be compiled with the same value for this option.  Because of that, you
26489 must not use this option with GCC's default runtime libraries.
26491 @end table
26493 @node M32R/D Options
26494 @subsection M32R/D Options
26495 @cindex M32R/D options
26497 These @option{-m} options are defined for Renesas M32R/D architectures:
26499 @table @gcctabopt
26500 @opindex m32r2
26501 @item -m32r2
26502 Generate code for the M32R/2@.
26504 @opindex m32rx
26505 @item -m32rx
26506 Generate code for the M32R/X@.
26508 @opindex m32r
26509 @item -m32r
26510 Generate code for the M32R@.  This is the default.
26512 @opindex mmodel=small
26513 @item -mmodel=small
26514 Assume all objects live in the lower 16MB of memory (so that their addresses
26515 can be loaded with the @code{ld24} instruction), and assume all subroutines
26516 are reachable with the @code{bl} instruction.
26517 This is the default.
26519 The addressability of a particular object can be set with the
26520 @code{model} attribute.
26522 @opindex mmodel=medium
26523 @item -mmodel=medium
26524 Assume objects may be anywhere in the 32-bit address space (the compiler
26525 generates @code{seth/add3} instructions to load their addresses), and
26526 assume all subroutines are reachable with the @code{bl} instruction.
26528 @opindex mmodel=large
26529 @item -mmodel=large
26530 Assume objects may be anywhere in the 32-bit address space (the compiler
26531 generates @code{seth/add3} instructions to load their addresses), and
26532 assume subroutines may not be reachable with the @code{bl} instruction
26533 (the compiler generates the much slower @code{seth/add3/jl}
26534 instruction sequence).
26536 @opindex msdata=none
26537 @item -msdata=none
26538 Disable use of the small data area.  Variables are put into
26539 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
26540 @code{section} attribute has been specified).
26541 This is the default.
26543 The small data area consists of sections @code{.sdata} and @code{.sbss}.
26544 Objects may be explicitly put in the small data area with the
26545 @code{section} attribute using one of these sections.
26547 @opindex msdata=sdata
26548 @item -msdata=sdata
26549 Put small global and static data in the small data area, but do not
26550 generate special code to reference them.
26552 @opindex msdata=use
26553 @item -msdata=use
26554 Put small global and static data in the small data area, and generate
26555 special instructions to reference them.
26557 @opindex G
26558 @cindex smaller data references
26559 @item -G @var{num}
26560 Put global and static objects less than or equal to @var{num} bytes
26561 into the small data or BSS sections instead of the normal data or BSS
26562 sections.  The default value of @var{num} is 8.
26563 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
26564 for this option to have any effect.
26566 All modules should be compiled with the same @option{-G @var{num}} value.
26567 Compiling with different values of @var{num} may or may not work; if it
26568 doesn't the linker gives an error message---incorrect code is not
26569 generated.
26571 @opindex mdebug
26572 @item -mdebug
26573 Makes the M32R-specific code in the compiler display some statistics
26574 that might help in debugging programs.
26576 @opindex malign-loops
26577 @item -malign-loops
26578 Align all loops to a 32-byte boundary.
26580 @opindex mno-align-loops
26581 @item -mno-align-loops
26582 Do not enforce a 32-byte alignment for loops.  This is the default.
26584 @opindex missue-rate=@var{number}
26585 @item -missue-rate=@var{number}
26586 Issue @var{number} instructions per cycle.  @var{number} can only be 1
26587 or 2.
26589 @opindex mbranch-cost=@var{number}
26590 @item -mbranch-cost=@var{number}
26591 @var{number} can only be 1 or 2.  If it is 1 then branches are
26592 preferred over conditional code, if it is 2, then the opposite applies.
26594 @opindex mflush-trap=@var{number}
26595 @item -mflush-trap=@var{number}
26596 Specifies the trap number to use to flush the cache.  The default is
26597 12.  Valid numbers are between 0 and 15 inclusive.
26599 @opindex mno-flush-trap
26600 @item -mno-flush-trap
26601 Specifies that the cache cannot be flushed by using a trap.
26603 @opindex mflush-func=@var{name}
26604 @item -mflush-func=@var{name}
26605 Specifies the name of the operating system function to call to flush
26606 the cache.  The default is @samp{_flush_cache}, but a function call
26607 is only used if a trap is not available.
26609 @opindex mno-flush-func
26610 @item -mno-flush-func
26611 Indicates that there is no OS function for flushing the cache.
26613 @end table
26615 @node M680x0 Options
26616 @subsection M680x0 Options
26617 @cindex M680x0 options
26619 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
26620 The default settings depend on which architecture was selected when
26621 the compiler was configured; the defaults for the most common choices
26622 are given below.
26624 @table @gcctabopt
26625 @opindex march
26626 @item -march=@var{arch}
26627 Generate code for a specific M680x0 or ColdFire instruction set
26628 architecture.  Permissible values of @var{arch} for M680x0
26629 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
26630 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
26631 architectures are selected according to Freescale's ISA classification
26632 and the permissible values are: @samp{isaa}, @samp{isaaplus},
26633 @samp{isab} and @samp{isac}.
26635 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
26636 code for a ColdFire target.  The @var{arch} in this macro is one of the
26637 @option{-march} arguments given above.
26639 When used together, @option{-march} and @option{-mtune} select code
26640 that runs on a family of similar processors but that is optimized
26641 for a particular microarchitecture.
26643 @opindex mcpu
26644 @item -mcpu=@var{cpu}
26645 Generate code for a specific M680x0 or ColdFire processor.
26646 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
26647 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
26648 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
26649 below, which also classifies the CPUs into families:
26651 @multitable @columnfractions 0.20 0.80
26652 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
26653 @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}
26654 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
26655 @item @samp{5206e} @tab @samp{5206e}
26656 @item @samp{5208} @tab @samp{5207} @samp{5208}
26657 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
26658 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
26659 @item @samp{5216} @tab @samp{5214} @samp{5216}
26660 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
26661 @item @samp{5225} @tab @samp{5224} @samp{5225}
26662 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
26663 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
26664 @item @samp{5249} @tab @samp{5249}
26665 @item @samp{5250} @tab @samp{5250}
26666 @item @samp{5271} @tab @samp{5270} @samp{5271}
26667 @item @samp{5272} @tab @samp{5272}
26668 @item @samp{5275} @tab @samp{5274} @samp{5275}
26669 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
26670 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
26671 @item @samp{5307} @tab @samp{5307}
26672 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
26673 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
26674 @item @samp{5407} @tab @samp{5407}
26675 @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}
26676 @end multitable
26678 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
26679 @var{arch} is compatible with @var{cpu}.  Other combinations of
26680 @option{-mcpu} and @option{-march} are rejected.
26682 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
26683 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
26684 where the value of @var{family} is given by the table above.
26686 @opindex mtune
26687 @item -mtune=@var{tune}
26688 Tune the code for a particular microarchitecture within the
26689 constraints set by @option{-march} and @option{-mcpu}.
26690 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
26691 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
26692 and @samp{cpu32}.  The ColdFire microarchitectures
26693 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
26695 You can also use @option{-mtune=68020-40} for code that needs
26696 to run relatively well on 68020, 68030 and 68040 targets.
26697 @option{-mtune=68020-60} is similar but includes 68060 targets
26698 as well.  These two options select the same tuning decisions as
26699 @option{-m68020-40} and @option{-m68020-60} respectively.
26701 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
26702 when tuning for 680x0 architecture @var{arch}.  It also defines
26703 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
26704 option is used.  If GCC is tuning for a range of architectures,
26705 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
26706 it defines the macros for every architecture in the range.
26708 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
26709 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
26710 of the arguments given above.
26712 @opindex m68000
26713 @opindex mc68000
26714 @item -m68000
26715 @itemx -mc68000
26716 Generate output for a 68000.  This is the default
26717 when the compiler is configured for 68000-based systems.
26718 It is equivalent to @option{-march=68000}.
26720 Use this option for microcontrollers with a 68000 or EC000 core,
26721 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
26723 @opindex m68010
26724 @item -m68010
26725 Generate output for a 68010.  This is the default
26726 when the compiler is configured for 68010-based systems.
26727 It is equivalent to @option{-march=68010}.
26729 @opindex m68020
26730 @opindex mc68020
26731 @item -m68020
26732 @itemx -mc68020
26733 Generate output for a 68020.  This is the default
26734 when the compiler is configured for 68020-based systems.
26735 It is equivalent to @option{-march=68020}.
26737 @opindex m68030
26738 @item -m68030
26739 Generate output for a 68030.  This is the default when the compiler is
26740 configured for 68030-based systems.  It is equivalent to
26741 @option{-march=68030}.
26743 @opindex m68040
26744 @item -m68040
26745 Generate output for a 68040.  This is the default when the compiler is
26746 configured for 68040-based systems.  It is equivalent to
26747 @option{-march=68040}.
26749 This option inhibits the use of 68881/68882 instructions that have to be
26750 emulated by software on the 68040.  Use this option if your 68040 does not
26751 have code to emulate those instructions.
26753 @opindex m68060
26754 @item -m68060
26755 Generate output for a 68060.  This is the default when the compiler is
26756 configured for 68060-based systems.  It is equivalent to
26757 @option{-march=68060}.
26759 This option inhibits the use of 68020 and 68881/68882 instructions that
26760 have to be emulated by software on the 68060.  Use this option if your 68060
26761 does not have code to emulate those instructions.
26763 @opindex mcpu32
26764 @item -mcpu32
26765 Generate output for a CPU32.  This is the default
26766 when the compiler is configured for CPU32-based systems.
26767 It is equivalent to @option{-march=cpu32}.
26769 Use this option for microcontrollers with a
26770 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
26771 68336, 68340, 68341, 68349 and 68360.
26773 @opindex m5200
26774 @item -m5200
26775 Generate output for a 520X ColdFire CPU@.  This is the default
26776 when the compiler is configured for 520X-based systems.
26777 It is equivalent to @option{-mcpu=5206}, and is now deprecated
26778 in favor of that option.
26780 Use this option for microcontroller with a 5200 core, including
26781 the MCF5202, MCF5203, MCF5204 and MCF5206.
26783 @opindex m5206e
26784 @item -m5206e
26785 Generate output for a 5206e ColdFire CPU@.  The option is now
26786 deprecated in favor of the equivalent @option{-mcpu=5206e}.
26788 @opindex m528x
26789 @item -m528x
26790 Generate output for a member of the ColdFire 528X family.
26791 The option is now deprecated in favor of the equivalent
26792 @option{-mcpu=528x}.
26794 @opindex m5307
26795 @item -m5307
26796 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
26797 in favor of the equivalent @option{-mcpu=5307}.
26799 @opindex m5407
26800 @item -m5407
26801 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
26802 in favor of the equivalent @option{-mcpu=5407}.
26804 @opindex mcfv4e
26805 @item -mcfv4e
26806 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
26807 This includes use of hardware floating-point instructions.
26808 The option is equivalent to @option{-mcpu=547x}, and is now
26809 deprecated in favor of that option.
26811 @opindex m68020-40
26812 @item -m68020-40
26813 Generate output for a 68040, without using any of the new instructions.
26814 This results in code that can run relatively efficiently on either a
26815 68020/68881 or a 68030 or a 68040.  The generated code does use the
26816 68881 instructions that are emulated on the 68040.
26818 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26820 @opindex m68020-60
26821 @item -m68020-60
26822 Generate output for a 68060, without using any of the new instructions.
26823 This results in code that can run relatively efficiently on either a
26824 68020/68881 or a 68030 or a 68040.  The generated code does use the
26825 68881 instructions that are emulated on the 68060.
26827 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26829 @opindex mhard-float
26830 @opindex m68881
26831 @item -mhard-float
26832 @itemx -m68881
26833 Generate floating-point instructions.  This is the default for 68020
26834 and above, and for ColdFire devices that have an FPU@.  It defines the
26835 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26836 on ColdFire targets.
26838 @opindex msoft-float
26839 @item -msoft-float
26840 Do not generate floating-point instructions; use library calls instead.
26841 This is the default for 68000, 68010, and 68832 targets.  It is also
26842 the default for ColdFire devices that have no FPU.
26844 @opindex mdiv
26845 @opindex mno-div
26846 @item -mdiv
26847 @itemx -mno-div
26848 Generate (do not generate) ColdFire hardware divide and remainder
26849 instructions.  If @option{-march} is used without @option{-mcpu},
26850 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26851 architectures.  Otherwise, the default is taken from the target CPU
26852 (either the default CPU, or the one specified by @option{-mcpu}).  For
26853 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26854 @option{-mcpu=5206e}.
26856 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26858 @opindex mshort
26859 @item -mshort
26860 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26861 Additionally, parameters passed on the stack are also aligned to a
26862 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26864 @opindex mno-short
26865 @item -mno-short
26866 Do not consider type @code{int} to be 16 bits wide.  This is the default.
26868 @opindex mnobitfield
26869 @opindex mno-bitfield
26870 @item -mnobitfield
26871 @itemx -mno-bitfield
26872 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
26873 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26875 @opindex mbitfield
26876 @item -mbitfield
26877 Do use the bit-field instructions.  The @option{-m68020} option implies
26878 @option{-mbitfield}.  This is the default if you use a configuration
26879 designed for a 68020.
26881 @opindex mrtd
26882 @item -mrtd
26883 Use a different function-calling convention, in which functions
26884 that take a fixed number of arguments return with the @code{rtd}
26885 instruction, which pops their arguments while returning.  This
26886 saves one instruction in the caller since there is no need to pop
26887 the arguments there.
26889 This calling convention is incompatible with the one normally
26890 used on Unix, so you cannot use it if you need to call libraries
26891 compiled with the Unix compiler.
26893 Also, you must provide function prototypes for all functions that
26894 take variable numbers of arguments (including @code{printf});
26895 otherwise incorrect code is generated for calls to those
26896 functions.
26898 In addition, seriously incorrect code results if you call a
26899 function with too many arguments.  (Normally, extra arguments are
26900 harmlessly ignored.)
26902 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26903 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26905 The default is @option{-mno-rtd}.
26907 @opindex malign-int
26908 @opindex mno-align-int
26909 @item -malign-int
26910 @itemx -mno-align-int
26911 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26912 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26913 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26914 Aligning variables on 32-bit boundaries produces code that runs somewhat
26915 faster on processors with 32-bit busses at the expense of more memory.
26917 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26918 aligns structures containing the above types differently than
26919 most published application binary interface specifications for the m68k.
26921 @opindex mpcrel
26922 Use the pc-relative addressing mode of the 68000 directly, instead of
26923 using a global offset table.  At present, this option implies @option{-fpic},
26924 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
26925 not presently supported with @option{-mpcrel}, though this could be supported for
26926 68020 and higher processors.
26928 @opindex mno-strict-align
26929 @opindex mstrict-align
26930 @item -mno-strict-align
26931 @itemx -mstrict-align
26932 Do not (do) assume that unaligned memory references are handled by
26933 the system.
26935 @item -msep-data
26936 Generate code that allows the data segment to be located in a different
26937 area of memory from the text segment.  This allows for execute-in-place in
26938 an environment without virtual memory management.  This option implies
26939 @option{-fPIC}.
26941 @item -mno-sep-data
26942 Generate code that assumes that the data segment follows the text segment.
26943 This is the default.
26945 @item -mid-shared-library
26946 Generate code that supports shared libraries via the library ID method.
26947 This allows for execute-in-place and shared libraries in an environment
26948 without virtual memory management.  This option implies @option{-fPIC}.
26950 @item -mno-id-shared-library
26951 Generate code that doesn't assume ID-based shared libraries are being used.
26952 This is the default.
26954 @item -mshared-library-id=n
26955 Specifies the identification number of the ID-based shared library being
26956 compiled.  Specifying a value of 0 generates more compact code; specifying
26957 other values forces the allocation of that number to the current
26958 library, but is no more space- or time-efficient than omitting this option.
26960 @opindex mxgot
26961 @opindex mno-xgot
26962 @item -mxgot
26963 @itemx -mno-xgot
26964 When generating position-independent code for ColdFire, generate code
26965 that works if the GOT has more than 8192 entries.  This code is
26966 larger and slower than code generated without this option.  On M680x0
26967 processors, this option is not needed; @option{-fPIC} suffices.
26969 GCC normally uses a single instruction to load values from the GOT@.
26970 While this is relatively efficient, it only works if the GOT
26971 is smaller than about 64k.  Anything larger causes the linker
26972 to report an error such as:
26974 @cindex relocation truncated to fit (ColdFire)
26975 @smallexample
26976 relocation truncated to fit: R_68K_GOT16O foobar
26977 @end smallexample
26979 If this happens, you should recompile your code with @option{-mxgot}.
26980 It should then work with very large GOTs.  However, code generated with
26981 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26982 the value of a global symbol.
26984 Note that some linkers, including newer versions of the GNU linker,
26985 can create multiple GOTs and sort GOT entries.  If you have such a linker,
26986 you should only need to use @option{-mxgot} when compiling a single
26987 object file that accesses more than 8192 GOT entries.  Very few do.
26989 These options have no effect unless GCC is generating
26990 position-independent code.
26992 @opindex mlong-jump-table-offsets
26993 @item -mlong-jump-table-offsets
26994 Use 32-bit offsets in @code{switch} tables.  The default is to use
26995 16-bit offsets.
26997 @end table
26999 @node MCore Options
27000 @subsection MCore Options
27001 @cindex MCore options
27003 These are the @samp{-m} options defined for the Motorola M*Core
27004 processors.
27006 @table @gcctabopt
27008 @opindex mhardlit
27009 @opindex mno-hardlit
27010 @item -mhardlit
27011 @itemx -mno-hardlit
27012 Inline constants into the code stream if it can be done in two
27013 instructions or less.
27015 @opindex mdiv
27016 @opindex mno-div
27017 @item -mdiv
27018 @itemx -mno-div
27019 Use the divide instruction.  (Enabled by default).
27021 @opindex mrelax-immediate
27022 @opindex mno-relax-immediate
27023 @item -mrelax-immediate
27024 @itemx -mno-relax-immediate
27025 Allow arbitrary-sized immediates in bit operations.
27027 @opindex mwide-bitfields
27028 @opindex mno-wide-bitfields
27029 @item -mwide-bitfields
27030 @itemx -mno-wide-bitfields
27031 Always treat bit-fields as @code{int}-sized.
27033 @opindex m4byte-functions
27034 @opindex mno-4byte-functions
27035 @item -m4byte-functions
27036 @itemx -mno-4byte-functions
27037 Force all functions to be aligned to a 4-byte boundary.
27039 @opindex mcallgraph-data
27040 @opindex mno-callgraph-data
27041 @item -mcallgraph-data
27042 @itemx -mno-callgraph-data
27043 Emit callgraph information.
27045 @opindex mslow-bytes
27046 @opindex mno-slow-bytes
27047 @item -mslow-bytes
27048 @itemx -mno-slow-bytes
27049 Prefer word access when reading byte quantities.
27051 @opindex mlittle-endian
27052 @opindex mbig-endian
27053 @item -mlittle-endian
27054 @itemx -mbig-endian
27055 Generate code for a little-endian target.
27057 @opindex m210
27058 @opindex m340
27059 @item -m210
27060 @itemx -m340
27061 Generate code for the 210 processor.
27063 @opindex mno-lsim
27064 @item -mno-lsim
27065 Assume that runtime support has been provided and so omit the
27066 simulator library (@file{libsim.a)} from the linker command line.
27068 @opindex mstack-increment
27069 @item -mstack-increment=@var{size}
27070 Set the maximum amount for a single stack increment operation.  Large
27071 values can increase the speed of programs that contain functions
27072 that need a large amount of stack space, but they can also trigger a
27073 segmentation fault if the stack is extended too much.  The default
27074 value is 0x1000.
27076 @end table
27078 @node MicroBlaze Options
27079 @subsection MicroBlaze Options
27080 @cindex MicroBlaze Options
27082 @table @gcctabopt
27084 @opindex msoft-float
27085 @item -msoft-float
27086 Use software emulation for floating point (default).
27088 @opindex mhard-float
27089 @item -mhard-float
27090 Use hardware floating-point instructions.
27092 @opindex mmemcpy
27093 @item -mmemcpy
27094 Do not optimize block moves, use @code{memcpy}.
27096 @opindex mno-clearbss
27097 @item -mno-clearbss
27098 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
27100 @opindex mcpu=
27101 @item -mcpu=@var{cpu-type}
27102 Use features of, and schedule code for, the given CPU.
27103 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
27104 where @var{X} is a major version, @var{YY} is the minor version, and
27105 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
27106 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
27108 @opindex mxl-soft-mul
27109 @item -mxl-soft-mul
27110 Use software multiply emulation (default).
27112 @opindex mxl-soft-div
27113 @item -mxl-soft-div
27114 Use software emulation for divides (default).
27116 @opindex mxl-barrel-shift
27117 @item -mxl-barrel-shift
27118 Use the hardware barrel shifter.
27120 @opindex mxl-pattern-compare
27121 @item -mxl-pattern-compare
27122 Use pattern compare instructions.
27124 @opindex msmall-divides
27125 @item -msmall-divides
27126 Use table lookup optimization for small signed integer divisions.
27128 @opindex mxl-stack-check
27129 @item -mxl-stack-check
27130 This option is deprecated.  Use @option{-fstack-check} instead.
27132 @opindex mxl-gp-opt
27133 @item -mxl-gp-opt
27134 Use GP-relative @code{.sdata}/@code{.sbss} sections.
27136 @opindex mxl-multiply-high
27137 @item -mxl-multiply-high
27138 Use multiply high instructions for high part of 32x32 multiply.
27140 @opindex mxl-float-convert
27141 @item -mxl-float-convert
27142 Use hardware floating-point conversion instructions.
27144 @opindex mxl-float-sqrt
27145 @item -mxl-float-sqrt
27146 Use hardware floating-point square root instruction.
27148 @opindex mbig-endian
27149 @item -mbig-endian
27150 Generate code for a big-endian target.
27152 @opindex mlittle-endian
27153 @item -mlittle-endian
27154 Generate code for a little-endian target.
27156 @opindex mxl-reorder
27157 @item -mxl-reorder
27158 Use reorder instructions (swap and byte reversed load/store).
27160 @item -mxl-mode-@var{app-model}
27161 Select application model @var{app-model}.  Valid models are
27162 @table @samp
27163 @item executable
27164 normal executable (default), uses startup code @file{crt0.o}.
27166 @item xmdstub
27167 for use with Xilinx Microprocessor Debugger (XMD) based
27168 software intrusive debug agent called xmdstub. This uses startup file
27169 @file{crt1.o} and sets the start address of the program to 0x800.
27171 @item bootstrap
27172 for applications that are loaded using a bootloader.
27173 This model uses startup file @file{crt2.o} which does not contain a processor
27174 reset vector handler. This is suitable for transferring control on a
27175 processor reset to the bootloader rather than the application.
27177 @item novectors
27178 for applications that do not require any of the
27179 MicroBlaze vectors. This option may be useful for applications running
27180 within a monitoring application. This model uses @file{crt3.o} as a startup file.
27181 @end table
27183 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
27184 @option{-mxl-mode-@var{app-model}}.
27186 @opindex mpic-data-is-text-relative
27187 @item -mpic-data-is-text-relative
27188 Assume that the displacement between the text and data segments is fixed
27189 at static link time.  This allows data to be referenced by offset from start of
27190 text address instead of GOT since PC-relative addressing is not supported.
27192 @end table
27194 @node MIPS Options
27195 @subsection MIPS Options
27196 @cindex MIPS options
27198 @table @gcctabopt
27200 @opindex EB
27201 @item -EB
27202 Generate big-endian code.
27204 @opindex EL
27205 @item -EL
27206 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
27207 configurations.
27209 @opindex march
27210 @item -march=@var{arch}
27211 Generate code that runs on @var{arch}, which can be the name of a
27212 generic MIPS ISA, or the name of a particular processor.
27213 The ISA names are:
27214 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
27215 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
27216 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
27217 @samp{mips64r5} and @samp{mips64r6}.
27218 The processor names are:
27219 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
27220 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
27221 @samp{5kc}, @samp{5kf},
27222 @samp{20kc},
27223 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
27224 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
27225 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
27226 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
27227 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
27228 @samp{i6400}, @samp{i6500},
27229 @samp{interaptiv},
27230 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
27231 @samp{gs464e}, @samp{gs264e},
27232 @samp{m4k},
27233 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
27234 @samp{m5100}, @samp{m5101},
27235 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
27236 @samp{orion},
27237 @samp{p5600}, @samp{p6600},
27238 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
27239 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
27240 @samp{r6000}, @samp{r8000},
27241 @samp{rm7000}, @samp{rm9000},
27242 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
27243 @samp{sb1},
27244 @samp{sr71000},
27245 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
27246 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
27247 @samp{xlr} and @samp{xlp}.
27248 The special value @samp{from-abi} selects the
27249 most compatible architecture for the selected ABI (that is,
27250 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
27252 The native Linux/GNU toolchain also supports the value @samp{native},
27253 which selects the best architecture option for the host processor.
27254 @option{-march=native} has no effect if GCC does not recognize
27255 the processor.
27257 In processor names, a final @samp{000} can be abbreviated as @samp{k}
27258 (for example, @option{-march=r2k}).  Prefixes are optional, and
27259 @samp{vr} may be written @samp{r}.
27261 Names of the form @samp{@var{n}f2_1} refer to processors with
27262 FPUs clocked at half the rate of the core, names of the form
27263 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
27264 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
27265 processors with FPUs clocked a ratio of 3:2 with respect to the core.
27266 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
27267 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
27268 accepted as synonyms for @samp{@var{n}f1_1}.
27270 GCC defines two macros based on the value of this option.  The first
27271 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
27272 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
27273 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
27274 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
27275 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
27277 Note that the @code{_MIPS_ARCH} macro uses the processor names given
27278 above.  In other words, it has the full prefix and does not
27279 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
27280 the macro names the resolved architecture (either @code{"mips1"} or
27281 @code{"mips3"}).  It names the default architecture when no
27282 @option{-march} option is given.
27284 @opindex mtune
27285 @item -mtune=@var{arch}
27286 Optimize for @var{arch}.  Among other things, this option controls
27287 the way instructions are scheduled, and the perceived cost of arithmetic
27288 operations.  The list of @var{arch} values is the same as for
27289 @option{-march}.
27291 When this option is not used, GCC optimizes for the processor
27292 specified by @option{-march}.  By using @option{-march} and
27293 @option{-mtune} together, it is possible to generate code that
27294 runs on a family of processors, but optimize the code for one
27295 particular member of that family.
27297 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
27298 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
27299 @option{-march} ones described above.
27301 @opindex mips1
27302 @item -mips1
27303 Equivalent to @option{-march=mips1}.
27305 @opindex mips2
27306 @item -mips2
27307 Equivalent to @option{-march=mips2}.
27309 @opindex mips3
27310 @item -mips3
27311 Equivalent to @option{-march=mips3}.
27313 @opindex mips4
27314 @item -mips4
27315 Equivalent to @option{-march=mips4}.
27317 @opindex mips32
27318 @item -mips32
27319 Equivalent to @option{-march=mips32}.
27321 @opindex mips32r3
27322 @item -mips32r3
27323 Equivalent to @option{-march=mips32r3}.
27325 @opindex mips32r5
27326 @item -mips32r5
27327 Equivalent to @option{-march=mips32r5}.
27329 @opindex mips32r6
27330 @item -mips32r6
27331 Equivalent to @option{-march=mips32r6}.
27333 @opindex mips64
27334 @item -mips64
27335 Equivalent to @option{-march=mips64}.
27337 @opindex mips64r2
27338 @item -mips64r2
27339 Equivalent to @option{-march=mips64r2}.
27341 @opindex mips64r3
27342 @item -mips64r3
27343 Equivalent to @option{-march=mips64r3}.
27345 @opindex mips64r5
27346 @item -mips64r5
27347 Equivalent to @option{-march=mips64r5}.
27349 @opindex mips64r6
27350 @item -mips64r6
27351 Equivalent to @option{-march=mips64r6}.
27353 @opindex mips16
27354 @opindex mno-mips16
27355 @item -mips16
27356 @itemx -mno-mips16
27357 Generate (do not generate) MIPS16 code.  If GCC is targeting a
27358 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
27360 MIPS16 code generation can also be controlled on a per-function basis
27361 by means of @code{mips16} and @code{nomips16} attributes.
27362 @xref{Function Attributes}, for more information.
27364 @opindex mmips16e2
27365 @opindex mno-mips16e2
27366 @item -mmips16e2
27367 @itemx -mno-mips16e2
27368 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
27369 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
27371 @opindex mflip-mips16
27372 @item -mflip-mips16
27373 Generate MIPS16 code on alternating functions.  This option is provided
27374 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
27375 not intended for ordinary use in compiling user code.
27377 @opindex minterlink-compressed
27378 @opindex mno-interlink-compressed
27379 @item -minterlink-compressed
27380 @itemx -mno-interlink-compressed
27381 Require (do not require) that code using the standard (uncompressed) MIPS ISA
27382 be link-compatible with MIPS16 and microMIPS code, and vice versa.
27384 For example, code using the standard ISA encoding cannot jump directly
27385 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
27386 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
27387 knows that the target of the jump is not compressed.
27389 @opindex minterlink-mips16
27390 @opindex mno-interlink-mips16
27391 @item -minterlink-mips16
27392 @itemx -mno-interlink-mips16
27393 Aliases of @option{-minterlink-compressed} and
27394 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
27395 and are retained for backwards compatibility.
27397 @opindex mabi=32
27398 @opindex mabi=o64
27399 @opindex mabi=n32
27400 @opindex mabi=64
27401 @opindex mabi=eabi
27402 @item -mabi=32
27403 @itemx -mabi=o64
27404 @itemx -mabi=n32
27405 @itemx -mabi=64
27406 @itemx -mabi=eabi
27407 Generate code for the given ABI@.
27409 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
27410 generates 64-bit code when you select a 64-bit architecture, but you
27411 can use @option{-mgp32} to get 32-bit code instead.
27413 For information about the O64 ABI, see
27414 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
27416 GCC supports a variant of the o32 ABI in which floating-point registers
27417 are 64 rather than 32 bits wide.  You can select this combination with
27418 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
27419 and @code{mfhc1} instructions and is therefore only supported for
27420 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
27422 The register assignments for arguments and return values remain the
27423 same, but each scalar value is passed in a single 64-bit register
27424 rather than a pair of 32-bit registers.  For example, scalar
27425 floating-point values are returned in @samp{$f0} only, not a
27426 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
27427 remains the same in that the even-numbered double-precision registers
27428 are saved.
27430 Two additional variants of the o32 ABI are supported to enable
27431 a transition from 32-bit to 64-bit registers.  These are FPXX
27432 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
27433 The FPXX extension mandates that all code must execute correctly
27434 when run using 32-bit or 64-bit registers.  The code can be interlinked
27435 with either FP32 or FP64, but not both.
27436 The FP64A extension is similar to the FP64 extension but forbids the
27437 use of odd-numbered single-precision registers.  This can be used
27438 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
27439 processors and allows both FP32 and FP64A code to interlink and
27440 run in the same process without changing FPU modes.
27442 @opindex mabicalls
27443 @opindex mno-abicalls
27444 @item -mabicalls
27445 @itemx -mno-abicalls
27446 Generate (do not generate) code that is suitable for SVR4-style
27447 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
27448 systems.
27450 @item -mshared
27451 @itemx -mno-shared
27452 Generate (do not generate) code that is fully position-independent,
27453 and that can therefore be linked into shared libraries.  This option
27454 only affects @option{-mabicalls}.
27456 All @option{-mabicalls} code has traditionally been position-independent,
27457 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
27458 as an extension, the GNU toolchain allows executables to use absolute
27459 accesses for locally-binding symbols.  It can also use shorter GP
27460 initialization sequences and generate direct calls to locally-defined
27461 functions.  This mode is selected by @option{-mno-shared}.
27463 @option{-mno-shared} depends on binutils 2.16 or higher and generates
27464 objects that can only be linked by the GNU linker.  However, the option
27465 does not affect the ABI of the final executable; it only affects the ABI
27466 of relocatable objects.  Using @option{-mno-shared} generally makes
27467 executables both smaller and quicker.
27469 @option{-mshared} is the default.
27471 @opindex mplt
27472 @opindex mno-plt
27473 @item -mplt
27474 @itemx -mno-plt
27475 Assume (do not assume) that the static and dynamic linkers
27476 support PLTs and copy relocations.  This option only affects
27477 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
27478 has no effect without @option{-msym32}.
27480 You can make @option{-mplt} the default by configuring
27481 GCC with @option{--with-mips-plt}.  The default is
27482 @option{-mno-plt} otherwise.
27484 @opindex mxgot
27485 @opindex mno-xgot
27486 @item -mxgot
27487 @itemx -mno-xgot
27488 Lift (do not lift) the usual restrictions on the size of the global
27489 offset table.
27491 GCC normally uses a single instruction to load values from the GOT@.
27492 While this is relatively efficient, it only works if the GOT
27493 is smaller than about 64k.  Anything larger causes the linker
27494 to report an error such as:
27496 @cindex relocation truncated to fit (MIPS)
27497 @smallexample
27498 relocation truncated to fit: R_MIPS_GOT16 foobar
27499 @end smallexample
27501 If this happens, you should recompile your code with @option{-mxgot}.
27502 This works with very large GOTs, although the code is also
27503 less efficient, since it takes three instructions to fetch the
27504 value of a global symbol.
27506 Note that some linkers can create multiple GOTs.  If you have such a
27507 linker, you should only need to use @option{-mxgot} when a single object
27508 file accesses more than 64k's worth of GOT entries.  Very few do.
27510 These options have no effect unless GCC is generating position
27511 independent code.
27513 @opindex mgp32
27514 @item -mgp32
27515 Assume that general-purpose registers are 32 bits wide.
27517 @opindex mgp64
27518 @item -mgp64
27519 Assume that general-purpose registers are 64 bits wide.
27521 @opindex mfp32
27522 @item -mfp32
27523 Assume that floating-point registers are 32 bits wide.
27525 @opindex mfp64
27526 @item -mfp64
27527 Assume that floating-point registers are 64 bits wide.
27529 @opindex mfpxx
27530 @item -mfpxx
27531 Do not assume the width of floating-point registers.
27533 @opindex mhard-float
27534 @item -mhard-float
27535 Use floating-point coprocessor instructions.
27537 @opindex msoft-float
27538 @item -msoft-float
27539 Do not use floating-point coprocessor instructions.  Implement
27540 floating-point calculations using library calls instead.
27542 @opindex mno-float
27543 @item -mno-float
27544 Equivalent to @option{-msoft-float}, but additionally asserts that the
27545 program being compiled does not perform any floating-point operations.
27546 This option is presently supported only by some bare-metal MIPS
27547 configurations, where it may select a special set of libraries
27548 that lack all floating-point support (including, for example, the
27549 floating-point @code{printf} formats).  
27550 If code compiled with @option{-mno-float} accidentally contains
27551 floating-point operations, it is likely to suffer a link-time
27552 or run-time failure.
27554 @opindex msingle-float
27555 @item -msingle-float
27556 Assume that the floating-point coprocessor only supports single-precision
27557 operations.
27559 @opindex mdouble-float
27560 @item -mdouble-float
27561 Assume that the floating-point coprocessor supports double-precision
27562 operations.  This is the default.
27564 @opindex modd-spreg
27565 @opindex mno-odd-spreg
27566 @item -modd-spreg
27567 @itemx -mno-odd-spreg
27568 Enable the use of odd-numbered single-precision floating-point registers
27569 for the o32 ABI.  This is the default for processors that are known to
27570 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
27571 is set by default.
27573 @opindex mabs=2008
27574 @opindex mabs=legacy
27575 @item -mabs=2008
27576 @itemx -mabs=legacy
27577 These options control the treatment of the special not-a-number (NaN)
27578 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
27579 @code{neg.@i{fmt}} machine instructions.
27581 By default or when @option{-mabs=legacy} is used the legacy
27582 treatment is selected.  In this case these instructions are considered
27583 arithmetic and avoided where correct operation is required and the
27584 input operand might be a NaN.  A longer sequence of instructions that
27585 manipulate the sign bit of floating-point datum manually is used
27586 instead unless the @option{-ffinite-math-only} option has also been
27587 specified.
27589 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
27590 this case these instructions are considered non-arithmetic and therefore
27591 operating correctly in all cases, including in particular where the
27592 input operand is a NaN.  These instructions are therefore always used
27593 for the respective operations.
27595 @opindex mnan=2008
27596 @opindex mnan=legacy
27597 @item -mnan=2008
27598 @itemx -mnan=legacy
27599 These options control the encoding of the special not-a-number (NaN)
27600 IEEE 754 floating-point data.
27602 The @option{-mnan=legacy} option selects the legacy encoding.  In this
27603 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
27604 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
27605 by the first bit of their trailing significand field being 1.
27607 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
27608 this case qNaNs are denoted by the first bit of their trailing
27609 significand field being 1, whereas sNaNs are denoted by the first bit of
27610 their trailing significand field being 0.
27612 The default is @option{-mnan=legacy} unless GCC has been configured with
27613 @option{--with-nan=2008}.
27615 @opindex mllsc
27616 @opindex mno-llsc
27617 @item -mllsc
27618 @itemx -mno-llsc
27619 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
27620 implement atomic memory built-in functions.  When neither option is
27621 specified, GCC uses the instructions if the target architecture
27622 supports them.
27624 @option{-mllsc} is useful if the runtime environment can emulate the
27625 instructions and @option{-mno-llsc} can be useful when compiling for
27626 nonstandard ISAs.  You can make either option the default by
27627 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
27628 respectively.  @option{--with-llsc} is the default for some
27629 configurations; see the installation documentation for details.
27631 @opindex mdsp
27632 @opindex mno-dsp
27633 @item -mdsp
27634 @itemx -mno-dsp
27635 Use (do not use) revision 1 of the MIPS DSP ASE@.
27636 @xref{MIPS DSP Built-in Functions}.  This option defines the
27637 preprocessor macro @code{__mips_dsp}.  It also defines
27638 @code{__mips_dsp_rev} to 1.
27640 @opindex mdspr2
27641 @opindex mno-dspr2
27642 @item -mdspr2
27643 @itemx -mno-dspr2
27644 Use (do not use) revision 2 of the MIPS DSP ASE@.
27645 @xref{MIPS DSP Built-in Functions}.  This option defines the
27646 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
27647 It also defines @code{__mips_dsp_rev} to 2.
27649 @opindex msmartmips
27650 @opindex mno-smartmips
27651 @item -msmartmips
27652 @itemx -mno-smartmips
27653 Use (do not use) the MIPS SmartMIPS ASE.
27655 @opindex mpaired-single
27656 @opindex mno-paired-single
27657 @item -mpaired-single
27658 @itemx -mno-paired-single
27659 Use (do not use) paired-single floating-point instructions.
27660 @xref{MIPS Paired-Single Support}.  This option requires
27661 hardware floating-point support to be enabled.
27663 @opindex mdmx
27664 @opindex mno-mdmx
27665 @item -mdmx
27666 @itemx -mno-mdmx
27667 Use (do not use) MIPS Digital Media Extension instructions.
27668 This option can only be used when generating 64-bit code and requires
27669 hardware floating-point support to be enabled.
27671 @opindex mips3d
27672 @opindex mno-mips3d
27673 @item -mips3d
27674 @itemx -mno-mips3d
27675 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
27676 The option @option{-mips3d} implies @option{-mpaired-single}.
27678 @opindex mmicromips
27679 @opindex mno-mmicromips
27680 @item -mmicromips
27681 @itemx -mno-micromips
27682 Generate (do not generate) microMIPS code.
27684 MicroMIPS code generation can also be controlled on a per-function basis
27685 by means of @code{micromips} and @code{nomicromips} attributes.
27686 @xref{Function Attributes}, for more information.
27688 @opindex mmt
27689 @opindex mno-mt
27690 @item -mmt
27691 @itemx -mno-mt
27692 Use (do not use) MT Multithreading instructions.
27694 @opindex mmcu
27695 @opindex mno-mcu
27696 @item -mmcu
27697 @itemx -mno-mcu
27698 Use (do not use) the MIPS MCU ASE instructions.
27700 @opindex meva
27701 @opindex mno-eva
27702 @item -meva
27703 @itemx -mno-eva
27704 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
27706 @opindex mvirt
27707 @opindex mno-virt
27708 @item -mvirt
27709 @itemx -mno-virt
27710 Use (do not use) the MIPS Virtualization (VZ) instructions.
27712 @opindex mxpa
27713 @opindex mno-xpa
27714 @item -mxpa
27715 @itemx -mno-xpa
27716 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
27718 @opindex mcrc
27719 @opindex mno-crc
27720 @item -mcrc
27721 @itemx -mno-crc
27722 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
27724 @opindex mginv
27725 @opindex mno-ginv
27726 @item -mginv
27727 @itemx -mno-ginv
27728 Use (do not use) the MIPS Global INValidate (GINV) instructions.
27730 @opindex mloongson-mmi
27731 @opindex mno-loongson-mmi
27732 @item -mloongson-mmi
27733 @itemx -mno-loongson-mmi
27734 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
27736 @opindex mloongson-ext
27737 @opindex mno-loongson-ext
27738 @item -mloongson-ext
27739 @itemx -mno-loongson-ext
27740 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
27742 @opindex mloongson-ext2
27743 @opindex mno-loongson-ext2
27744 @item -mloongson-ext2
27745 @itemx -mno-loongson-ext2
27746 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
27748 @opindex mlong64
27749 @item -mlong64
27750 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
27751 an explanation of the default and the way that the pointer size is
27752 determined.
27754 @opindex mlong32
27755 @item -mlong32
27756 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
27758 The default size of @code{int}s, @code{long}s and pointers depends on
27759 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
27760 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
27761 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
27762 or the same size as integer registers, whichever is smaller.
27764 @opindex msym32
27765 @opindex mno-sym32
27766 @item -msym32
27767 @itemx -mno-sym32
27768 Assume (do not assume) that all symbols have 32-bit values, regardless
27769 of the selected ABI@.  This option is useful in combination with
27770 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
27771 to generate shorter and faster references to symbolic addresses.
27773 @opindex G
27774 @item -G @var{num}
27775 Put definitions of externally-visible data in a small data section
27776 if that data is no bigger than @var{num} bytes.  GCC can then generate
27777 more efficient accesses to the data; see @option{-mgpopt} for details.
27779 The default @option{-G} option depends on the configuration.
27781 @opindex mlocal-sdata
27782 @opindex mno-local-sdata
27783 @item -mlocal-sdata
27784 @itemx -mno-local-sdata
27785 Extend (do not extend) the @option{-G} behavior to local data too,
27786 such as to static variables in C@.  @option{-mlocal-sdata} is the
27787 default for all configurations.
27789 If the linker complains that an application is using too much small data,
27790 you might want to try rebuilding the less performance-critical parts with
27791 @option{-mno-local-sdata}.  You might also want to build large
27792 libraries with @option{-mno-local-sdata}, so that the libraries leave
27793 more room for the main program.
27795 @opindex mextern-sdata
27796 @opindex mno-extern-sdata
27797 @item -mextern-sdata
27798 @itemx -mno-extern-sdata
27799 Assume (do not assume) that externally-defined data is in
27800 a small data section if the size of that data is within the @option{-G} limit.
27801 @option{-mextern-sdata} is the default for all configurations.
27803 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
27804 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
27805 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
27806 is placed in a small data section.  If @var{Var} is defined by another
27807 module, you must either compile that module with a high-enough
27808 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
27809 definition.  If @var{Var} is common, you must link the application
27810 with a high-enough @option{-G} setting.
27812 The easiest way of satisfying these restrictions is to compile
27813 and link every module with the same @option{-G} option.  However,
27814 you may wish to build a library that supports several different
27815 small data limits.  You can do this by compiling the library with
27816 the highest supported @option{-G} setting and additionally using
27817 @option{-mno-extern-sdata} to stop the library from making assumptions
27818 about externally-defined data.
27820 @opindex mgpopt
27821 @opindex mno-gpopt
27822 @item -mgpopt
27823 @itemx -mno-gpopt
27824 Use (do not use) GP-relative accesses for symbols that are known to be
27825 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27826 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
27827 configurations.
27829 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27830 might not hold the value of @code{_gp}.  For example, if the code is
27831 part of a library that might be used in a boot monitor, programs that
27832 call boot monitor routines pass an unknown value in @code{$gp}.
27833 (In such situations, the boot monitor itself is usually compiled
27834 with @option{-G0}.)
27836 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27837 @option{-mno-extern-sdata}.
27839 @opindex membedded-data
27840 @opindex mno-embedded-data
27841 @item -membedded-data
27842 @itemx -mno-embedded-data
27843 Allocate variables to the read-only data section first if possible, then
27844 next in the small data section if possible, otherwise in data.  This gives
27845 slightly slower code than the default, but reduces the amount of RAM required
27846 when executing, and thus may be preferred for some embedded systems.
27848 @opindex muninit-const-in-rodata
27849 @opindex mno-uninit-const-in-rodata
27850 @item -muninit-const-in-rodata
27851 @itemx -mno-uninit-const-in-rodata
27852 Put uninitialized @code{const} variables in the read-only data section.
27853 This option is only meaningful in conjunction with @option{-membedded-data}.
27855 @opindex mcode-readable
27856 @item -mcode-readable=@var{setting}
27857 Specify whether GCC may generate code that reads from executable sections.
27858 There are three possible settings:
27860 @table @gcctabopt
27861 @item -mcode-readable=yes
27862 Instructions may freely access executable sections.  This is the
27863 default setting.
27865 @item -mcode-readable=pcrel
27866 MIPS16 PC-relative load instructions can access executable sections,
27867 but other instructions must not do so.  This option is useful on 4KSc
27868 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27869 It is also useful on processors that can be configured to have a dual
27870 instruction/data SRAM interface and that, like the M4K, automatically
27871 redirect PC-relative loads to the instruction RAM.
27873 @item -mcode-readable=no
27874 Instructions must not access executable sections.  This option can be
27875 useful on targets that are configured to have a dual instruction/data
27876 SRAM interface but that (unlike the M4K) do not automatically redirect
27877 PC-relative loads to the instruction RAM.
27878 @end table
27880 @opindex msplit-addresses
27881 @opindex mno-split-addresses
27882 @item -msplit-addresses
27883 @itemx -mno-split-addresses
27884 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27885 relocation operators.  This option has been superseded by
27886 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27888 @opindex mexplicit-relocs
27889 @opindex mno-explicit-relocs
27890 @item -mexplicit-relocs
27891 @itemx -mno-explicit-relocs
27892 Use (do not use) assembler relocation operators when dealing with symbolic
27893 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
27894 is to use assembler macros instead.
27896 @option{-mexplicit-relocs} is the default if GCC was configured
27897 to use an assembler that supports relocation operators.
27899 @opindex mcheck-zero-division
27900 @opindex mno-check-zero-division
27901 @item -mcheck-zero-division
27902 @itemx -mno-check-zero-division
27903 Trap (do not trap) on integer division by zero.
27905 The default is @option{-mcheck-zero-division}.
27907 @opindex mdivide-traps
27908 @opindex mdivide-breaks
27909 @item -mdivide-traps
27910 @itemx -mdivide-breaks
27911 MIPS systems check for division by zero by generating either a
27912 conditional trap or a break instruction.  Using traps results in
27913 smaller code, but is only supported on MIPS II and later.  Also, some
27914 versions of the Linux kernel have a bug that prevents trap from
27915 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
27916 allow conditional traps on architectures that support them and
27917 @option{-mdivide-breaks} to force the use of breaks.
27919 The default is usually @option{-mdivide-traps}, but this can be
27920 overridden at configure time using @option{--with-divide=breaks}.
27921 Divide-by-zero checks can be completely disabled using
27922 @option{-mno-check-zero-division}.
27924 @opindex mload-store-pairs
27925 @opindex mno-load-store-pairs
27926 @item -mload-store-pairs
27927 @itemx -mno-load-store-pairs
27928 Enable (disable) an optimization that pairs consecutive load or store
27929 instructions to enable load/store bonding.  This option is enabled by
27930 default but only takes effect when the selected architecture is known
27931 to support bonding.
27933 @opindex munaligned-access
27934 @opindex mno-unaligned-access
27935 @item -munaligned-access
27936 @itemx -mno-unaligned-access
27937 Enable (disable) direct unaligned access for MIPS Release 6.
27938 MIPSr6 requires load/store unaligned-access support,
27939 by hardware or trap&emulate.
27940 So @option{-mno-unaligned-access} may be needed by kernel.
27942 @opindex mmemcpy
27943 @opindex mno-memcpy
27944 @item -mmemcpy
27945 @itemx -mno-memcpy
27946 Force (do not force) the use of @code{memcpy} for non-trivial block
27947 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
27948 most constant-sized copies.
27950 @opindex mlong-calls
27951 @opindex mno-long-calls
27952 @item -mlong-calls
27953 @itemx -mno-long-calls
27954 Disable (do not disable) use of the @code{jal} instruction.  Calling
27955 functions using @code{jal} is more efficient but requires the caller
27956 and callee to be in the same 256 megabyte segment.
27958 This option has no effect on abicalls code.  The default is
27959 @option{-mno-long-calls}.
27961 @opindex mmad
27962 @opindex mno-mad
27963 @item -mmad
27964 @itemx -mno-mad
27965 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27966 instructions, as provided by the R4650 ISA@.
27968 @opindex mimadd
27969 @opindex mno-imadd
27970 @item -mimadd
27971 @itemx -mno-imadd
27972 Enable (disable) use of the @code{madd} and @code{msub} integer
27973 instructions.  The default is @option{-mimadd} on architectures
27974 that support @code{madd} and @code{msub} except for the 74k 
27975 architecture where it was found to generate slower code.
27977 @opindex mfused-madd
27978 @opindex mno-fused-madd
27979 @item -mfused-madd
27980 @itemx -mno-fused-madd
27981 Enable (disable) use of the floating-point multiply-accumulate
27982 instructions, when they are available.  The default is
27983 @option{-mfused-madd}.
27985 On the R8000 CPU when multiply-accumulate instructions are used,
27986 the intermediate product is calculated to infinite precision
27987 and is not subject to the FCSR Flush to Zero bit.  This may be
27988 undesirable in some circumstances.  On other processors the result
27989 is numerically identical to the equivalent computation using
27990 separate multiply, add, subtract and negate instructions.
27992 @opindex nocpp
27993 @item -nocpp
27994 Tell the MIPS assembler to not run its preprocessor over user
27995 assembler files (with a @samp{.s} suffix) when assembling them.
27997 @opindex mfix-24k
27998 @opindex mno-fix-24k
27999 @item -mfix-24k
28000 @itemx -mno-fix-24k
28001 Work around the 24K E48 (lost data on stores during refill) errata.
28002 The workarounds are implemented by the assembler rather than by GCC@.
28004 @opindex mfix-r4000
28005 @opindex mno-fix-r4000
28006 @item -mfix-r4000
28007 @itemx -mno-fix-r4000
28008 Work around certain R4000 CPU errata:
28009 @itemize @minus
28010 @item
28011 A double-word or a variable shift may give an incorrect result if executed
28012 immediately after starting an integer division.
28013 @item
28014 A double-word or a variable shift may give an incorrect result if executed
28015 while an integer multiplication is in progress.
28016 @item
28017 An integer division may give an incorrect result if started in a delay slot
28018 of a taken branch or a jump.
28019 @end itemize
28021 @opindex mfix-r4400
28022 @opindex mno-fix-r4400
28023 @item -mfix-r4400
28024 @itemx -mno-fix-r4400
28025 Work around certain R4400 CPU errata:
28026 @itemize @minus
28027 @item
28028 A double-word or a variable shift may give an incorrect result if executed
28029 immediately after starting an integer division.
28030 @end itemize
28032 @opindex mfix-r10000
28033 @opindex mno-fix-r10000
28034 @item -mfix-r10000
28035 @itemx -mno-fix-r10000
28036 Work around certain R10000 errata:
28037 @itemize @minus
28038 @item
28039 @code{ll}/@code{sc} sequences may not behave atomically on revisions
28040 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
28041 @end itemize
28043 This option can only be used if the target architecture supports
28044 branch-likely instructions.  @option{-mfix-r10000} is the default when
28045 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
28046 otherwise.
28048 @opindex mfix-r5900
28049 @item -mfix-r5900
28050 @itemx -mno-fix-r5900
28051 Do not attempt to schedule the preceding instruction into the delay slot
28052 of a branch instruction placed at the end of a short loop of six
28053 instructions or fewer and always schedule a @code{nop} instruction there
28054 instead.  The short loop bug under certain conditions causes loops to
28055 execute only once or twice, due to a hardware bug in the R5900 chip.  The
28056 workaround is implemented by the assembler rather than by GCC@.
28058 @opindex mfix-rm7000
28059 @item -mfix-rm7000
28060 @itemx -mno-fix-rm7000
28061 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
28062 workarounds are implemented by the assembler rather than by GCC@.
28064 @opindex mfix-vr4120
28065 @item -mfix-vr4120
28066 @itemx -mno-fix-vr4120
28067 Work around certain VR4120 errata:
28068 @itemize @minus
28069 @item
28070 @code{dmultu} does not always produce the correct result.
28071 @item
28072 @code{div} and @code{ddiv} do not always produce the correct result if one
28073 of the operands is negative.
28074 @end itemize
28075 The workarounds for the division errata rely on special functions in
28076 @file{libgcc.a}.  At present, these functions are only provided by
28077 the @code{mips64vr*-elf} configurations.
28079 Other VR4120 errata require a NOP to be inserted between certain pairs of
28080 instructions.  These errata are handled by the assembler, not by GCC itself.
28082 @opindex mfix-vr4130
28083 @item -mfix-vr4130
28084 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
28085 workarounds are implemented by the assembler rather than by GCC,
28086 although GCC avoids using @code{mflo} and @code{mfhi} if the
28087 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
28088 instructions are available instead.
28090 @opindex mfix-sb1
28091 @item -mfix-sb1
28092 @itemx -mno-fix-sb1
28093 Work around certain SB-1 CPU core errata.
28094 (This flag currently works around the SB-1 revision 2
28095 ``F1'' and ``F2'' floating-point errata.)
28097 @opindex mr10k-cache-barrier
28098 @item -mr10k-cache-barrier=@var{setting}
28099 Specify whether GCC should insert cache barriers to avoid the
28100 side effects of speculation on R10K processors.
28102 In common with many processors, the R10K tries to predict the outcome
28103 of a conditional branch and speculatively executes instructions from
28104 the ``taken'' branch.  It later aborts these instructions if the
28105 predicted outcome is wrong.  However, on the R10K, even aborted
28106 instructions can have side effects.
28108 This problem only affects kernel stores and, depending on the system,
28109 kernel loads.  As an example, a speculatively-executed store may load
28110 the target memory into cache and mark the cache line as dirty, even if
28111 the store itself is later aborted.  If a DMA operation writes to the
28112 same area of memory before the ``dirty'' line is flushed, the cached
28113 data overwrites the DMA-ed data.  See the R10K processor manual
28114 for a full description, including other potential problems.
28116 One workaround is to insert cache barrier instructions before every memory
28117 access that might be speculatively executed and that might have side
28118 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
28119 controls GCC's implementation of this workaround.  It assumes that
28120 aborted accesses to any byte in the following regions does not have
28121 side effects:
28123 @enumerate
28124 @item
28125 the memory occupied by the current function's stack frame;
28127 @item
28128 the memory occupied by an incoming stack argument;
28130 @item
28131 the memory occupied by an object with a link-time-constant address.
28132 @end enumerate
28134 It is the kernel's responsibility to ensure that speculative
28135 accesses to these regions are indeed safe.
28137 If the input program contains a function declaration such as:
28139 @smallexample
28140 void foo (void);
28141 @end smallexample
28143 then the implementation of @code{foo} must allow @code{j foo} and
28144 @code{jal foo} to be executed speculatively.  GCC honors this
28145 restriction for functions it compiles itself.  It expects non-GCC
28146 functions (such as hand-written assembly code) to do the same.
28148 The option has three forms:
28150 @table @gcctabopt
28151 @item -mr10k-cache-barrier=load-store
28152 Insert a cache barrier before a load or store that might be
28153 speculatively executed and that might have side effects even
28154 if aborted.
28156 @item -mr10k-cache-barrier=store
28157 Insert a cache barrier before a store that might be speculatively
28158 executed and that might have side effects even if aborted.
28160 @item -mr10k-cache-barrier=none
28161 Disable the insertion of cache barriers.  This is the default setting.
28162 @end table
28164 @opindex mflush-func
28165 @item -mflush-func=@var{func}
28166 @itemx -mno-flush-func
28167 Specifies the function to call to flush the I and D caches, or to not
28168 call any such function.  If called, the function must take the same
28169 arguments as the common @code{_flush_func}, that is, the address of the
28170 memory range for which the cache is being flushed, the size of the
28171 memory range, and the number 3 (to flush both caches).  The default
28172 depends on the target GCC was configured for, but commonly is either
28173 @code{_flush_func} or @code{__cpu_flush}.
28175 @opindex mbranch-cost
28176 @item mbranch-cost=@var{num}
28177 Set the cost of branches to roughly @var{num} ``simple'' instructions.
28178 This cost is only a heuristic and is not guaranteed to produce
28179 consistent results across releases.  A zero cost redundantly selects
28180 the default, which is based on the @option{-mtune} setting.
28182 @opindex mbranch-likely
28183 @opindex mno-branch-likely
28184 @item -mbranch-likely
28185 @itemx -mno-branch-likely
28186 Enable or disable use of Branch Likely instructions, regardless of the
28187 default for the selected architecture.  By default, Branch Likely
28188 instructions may be generated if they are supported by the selected
28189 architecture.  An exception is for the MIPS32 and MIPS64 architectures
28190 and processors that implement those architectures; for those, Branch
28191 Likely instructions are not be generated by default because the MIPS32
28192 and MIPS64 architectures specifically deprecate their use.
28194 @opindex mcompact-branches=never
28195 @opindex mcompact-branches=optimal
28196 @opindex mcompact-branches=always
28197 @item -mcompact-branches=never
28198 @itemx -mcompact-branches=optimal
28199 @itemx -mcompact-branches=always
28200 These options control which form of branches will be generated.  The
28201 default is @option{-mcompact-branches=optimal}.
28203 The @option{-mcompact-branches=never} option ensures that compact branch
28204 instructions will never be generated.
28206 The @option{-mcompact-branches=always} option ensures that a compact
28207 branch instruction will be generated if available for MIPS Release 6 onwards.
28208 If a compact branch instruction is not available (or pre-R6),
28209 a delay slot form of the branch will be used instead.
28211 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
28212 The behaviour for MIPS16/microMIPS may change in future,
28213 since they do have some compact branch instructions.
28215 The @option{-mcompact-branches=optimal} option will cause a delay slot
28216 branch to be used if one is available in the current ISA and the delay
28217 slot is successfully filled.  If the delay slot is not filled, a compact
28218 branch will be chosen if one is available.
28220 @opindex mfp-exceptions
28221 @item -mfp-exceptions
28222 @itemx -mno-fp-exceptions
28223 Specifies whether FP exceptions are enabled.  This affects how
28224 FP instructions are scheduled for some processors.
28225 The default is that FP exceptions are
28226 enabled.
28228 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
28229 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
28230 FP pipe.
28232 @opindex mvr4130-align
28233 @item -mvr4130-align
28234 @itemx -mno-vr4130-align
28235 The VR4130 pipeline is two-way superscalar, but can only issue two
28236 instructions together if the first one is 8-byte aligned.  When this
28237 option is enabled, GCC aligns pairs of instructions that it
28238 thinks should execute in parallel.
28240 This option only has an effect when optimizing for the VR4130.
28241 It normally makes code faster, but at the expense of making it bigger.
28242 It is enabled by default at optimization level @option{-O3}.
28244 @opindex msynci
28245 @item -msynci
28246 @itemx -mno-synci
28247 Enable (disable) generation of @code{synci} instructions on
28248 architectures that support it.  The @code{synci} instructions (if
28249 enabled) are generated when @code{__builtin___clear_cache} is
28250 compiled.
28252 This option defaults to @option{-mno-synci}, but the default can be
28253 overridden by configuring GCC with @option{--with-synci}.
28255 When compiling code for single processor systems, it is generally safe
28256 to use @code{synci}.  However, on many multi-core (SMP) systems, it
28257 does not invalidate the instruction caches on all cores and may lead
28258 to undefined behavior.
28260 @opindex mrelax-pic-calls
28261 @item -mrelax-pic-calls
28262 @itemx -mno-relax-pic-calls
28263 Try to turn PIC calls that are normally dispatched via register
28264 @code{$25} into direct calls.  This is only possible if the linker can
28265 resolve the destination at link time and if the destination is within
28266 range for a direct call.
28268 @option{-mrelax-pic-calls} is the default if GCC was configured to use
28269 an assembler and a linker that support the @code{.reloc} assembly
28270 directive and @option{-mexplicit-relocs} is in effect.  With
28271 @option{-mno-explicit-relocs}, this optimization can be performed by the
28272 assembler and the linker alone without help from the compiler.
28274 @opindex mmcount-ra-address
28275 @opindex mno-mcount-ra-address
28276 @item -mmcount-ra-address
28277 @itemx -mno-mcount-ra-address
28278 Emit (do not emit) code that allows @code{_mcount} to modify the
28279 calling function's return address.  When enabled, this option extends
28280 the usual @code{_mcount} interface with a new @var{ra-address}
28281 parameter, which has type @code{intptr_t *} and is passed in register
28282 @code{$12}.  @code{_mcount} can then modify the return address by
28283 doing both of the following:
28284 @itemize
28285 @item
28286 Returning the new address in register @code{$31}.
28287 @item
28288 Storing the new address in @code{*@var{ra-address}},
28289 if @var{ra-address} is nonnull.
28290 @end itemize
28292 The default is @option{-mno-mcount-ra-address}.
28294 @opindex mframe-header-opt
28295 @item -mframe-header-opt
28296 @itemx -mno-frame-header-opt
28297 Enable (disable) frame header optimization in the o32 ABI.  When using the
28298 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
28299 function to write out register arguments.  When enabled, this optimization
28300 will suppress the allocation of the frame header if it can be determined that
28301 it is unused.
28303 This optimization is off by default at all optimization levels.
28305 @opindex mlxc1-sxc1
28306 @item -mlxc1-sxc1
28307 @itemx -mno-lxc1-sxc1
28308 When applicable, enable (disable) the generation of @code{lwxc1},
28309 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
28311 @opindex mmadd4
28312 @item -mmadd4
28313 @itemx -mno-madd4
28314 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
28315 @code{madd.d} and related instructions.  Enabled by default.
28317 @end table
28319 @node MMIX Options
28320 @subsection MMIX Options
28321 @cindex MMIX Options
28323 These options are defined for the MMIX:
28325 @table @gcctabopt
28326 @opindex mlibfuncs
28327 @opindex mno-libfuncs
28328 @item -mlibfuncs
28329 @itemx -mno-libfuncs
28330 Specify that intrinsic library functions are being compiled, passing all
28331 values in registers, no matter the size.
28333 @opindex mepsilon
28334 @opindex mno-epsilon
28335 @item -mepsilon
28336 @itemx -mno-epsilon
28337 Generate floating-point comparison instructions that compare with respect
28338 to the @code{rE} epsilon register.
28340 @opindex mabi=mmixware
28341 @opindex mabi=gnu
28342 @item -mabi=mmixware
28343 @itemx -mabi=gnu
28344 Generate code that passes function parameters and return values that (in
28345 the called function) are seen as registers @code{$0} and up, as opposed to
28346 the GNU ABI which uses global registers @code{$231} and up.
28348 @opindex mzero-extend
28349 @opindex mno-zero-extend
28350 @item -mzero-extend
28351 @itemx -mno-zero-extend
28352 When reading data from memory in sizes shorter than 64 bits, use (do not
28353 use) zero-extending load instructions by default, rather than
28354 sign-extending ones.
28356 @opindex mknuthdiv
28357 @opindex mno-knuthdiv
28358 @item -mknuthdiv
28359 @itemx -mno-knuthdiv
28360 Make the result of a division yielding a remainder have the same sign as
28361 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
28362 remainder follows the sign of the dividend.  Both methods are
28363 arithmetically valid, the latter being almost exclusively used.
28365 @opindex mtoplevel-symbols
28366 @opindex mno-toplevel-symbols
28367 @item -mtoplevel-symbols
28368 @itemx -mno-toplevel-symbols
28369 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
28370 code can be used with the @code{PREFIX} assembly directive.
28372 @opindex melf
28373 @item -melf
28374 Generate an executable in the ELF format, rather than the default
28375 @samp{mmo} format used by the @command{mmix} simulator.
28377 @opindex mbranch-predict
28378 @opindex mno-branch-predict
28379 @item -mbranch-predict
28380 @itemx -mno-branch-predict
28381 Use (do not use) the probable-branch instructions, when static branch
28382 prediction indicates a probable branch.
28384 @opindex mbase-addresses
28385 @opindex mno-base-addresses
28386 @item -mbase-addresses
28387 @itemx -mno-base-addresses
28388 Generate (do not generate) code that uses @emph{base addresses}.  Using a
28389 base address automatically generates a request (handled by the assembler
28390 and the linker) for a constant to be set up in a global register.  The
28391 register is used for one or more base address requests within the range 0
28392 to 255 from the value held in the register.  The generally leads to short
28393 and fast code, but the number of different data items that can be
28394 addressed is limited.  This means that a program that uses lots of static
28395 data may require @option{-mno-base-addresses}.
28397 @opindex msingle-exit
28398 @opindex mno-single-exit
28399 @item -msingle-exit
28400 @itemx -mno-single-exit
28401 Force (do not force) generated code to have a single exit point in each
28402 function.
28403 @end table
28405 @node MN10300 Options
28406 @subsection MN10300 Options
28407 @cindex MN10300 options
28409 These @option{-m} options are defined for Matsushita MN10300 architectures:
28411 @table @gcctabopt
28412 @opindex mmult-bug
28413 @item -mmult-bug
28414 Generate code to avoid bugs in the multiply instructions for the MN10300
28415 processors.  This is the default.
28417 @opindex mno-mult-bug
28418 @item -mno-mult-bug
28419 Do not generate code to avoid bugs in the multiply instructions for the
28420 MN10300 processors.
28422 @opindex mam33
28423 @item -mam33
28424 Generate code using features specific to the AM33 processor.
28426 @opindex mno-am33
28427 @item -mno-am33
28428 Do not generate code using features specific to the AM33 processor.  This
28429 is the default.
28431 @opindex mam33-2
28432 @item -mam33-2
28433 Generate code using features specific to the AM33/2.0 processor.
28435 @opindex mam34
28436 @item -mam34
28437 Generate code using features specific to the AM34 processor.
28439 @opindex mtune
28440 @item -mtune=@var{cpu-type}
28441 Use the timing characteristics of the indicated CPU type when
28442 scheduling instructions.  This does not change the targeted processor
28443 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
28444 @samp{am33-2} or @samp{am34}.
28446 @opindex mreturn-pointer-on-d0
28447 @item -mreturn-pointer-on-d0
28448 When generating a function that returns a pointer, return the pointer
28449 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
28450 only in @code{a0}, and attempts to call such functions without a prototype
28451 result in errors.  Note that this option is on by default; use
28452 @option{-mno-return-pointer-on-d0} to disable it.
28454 @opindex mno-crt0
28455 @item -mno-crt0
28456 Do not link in the C run-time initialization object file.
28458 @opindex mrelax
28459 @item -mrelax
28460 Indicate to the linker that it should perform a relaxation optimization pass
28461 to shorten branches, calls and absolute memory addresses.  This option only
28462 has an effect when used on the command line for the final link step.
28464 This option makes symbolic debugging impossible.
28466 @opindex mliw
28467 @item -mliw
28468 Allow the compiler to generate @emph{Long Instruction Word}
28469 instructions if the target is the @samp{AM33} or later.  This is the
28470 default.  This option defines the preprocessor macro @code{__LIW__}.
28472 @opindex mno-liw
28473 @item -mno-liw
28474 Do not allow the compiler to generate @emph{Long Instruction Word}
28475 instructions.  This option defines the preprocessor macro
28476 @code{__NO_LIW__}.
28478 @opindex msetlb
28479 @item -msetlb
28480 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
28481 instructions if the target is the @samp{AM33} or later.  This is the
28482 default.  This option defines the preprocessor macro @code{__SETLB__}.
28484 @opindex mno-setlb
28485 @item -mno-setlb
28486 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
28487 instructions.  This option defines the preprocessor macro
28488 @code{__NO_SETLB__}.
28490 @end table
28492 @node Moxie Options
28493 @subsection Moxie Options
28494 @cindex Moxie Options
28496 @table @gcctabopt
28498 @opindex meb
28499 @item -meb
28500 Generate big-endian code.  This is the default for @samp{moxie-*-*}
28501 configurations.
28503 @opindex mel
28504 @item -mel
28505 Generate little-endian code.
28507 @opindex mmul.x
28508 @item -mmul.x
28509 Generate mul.x and umul.x instructions.  This is the default for
28510 @samp{moxiebox-*-*} configurations.
28512 @opindex mno-crt0
28513 @item -mno-crt0
28514 Do not link in the C run-time initialization object file.
28516 @end table
28518 @node MSP430 Options
28519 @subsection MSP430 Options
28520 @cindex MSP430 Options
28522 These options are defined for the MSP430:
28524 @table @gcctabopt
28526 @opindex masm-hex
28527 @item -masm-hex
28528 Force assembly output to always use hex constants.  Normally such
28529 constants are signed decimals, but this option is available for
28530 testsuite and/or aesthetic purposes.
28532 @opindex mmcu=
28533 @item -mmcu=
28534 Select the MCU to target.  This is used to create a C preprocessor
28535 symbol based upon the MCU name, converted to upper case and pre- and
28536 post-fixed with @samp{__}.  This in turn is used by the
28537 @file{msp430.h} header file to select an MCU-specific supplementary
28538 header file.
28540 The option also sets the ISA to use.  If the MCU name is one that is
28541 known to only support the 430 ISA then that is selected, otherwise the
28542 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
28543 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
28544 name selects the 430X ISA.
28546 In addition an MCU-specific linker script is added to the linker
28547 command line.  The script's name is the name of the MCU with
28548 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
28549 command line defines the C preprocessor symbol @code{__XXX__} and
28550 cause the linker to search for a script called @file{xxx.ld}.
28552 The ISA and hardware multiply supported for the different MCUs is hard-coded
28553 into GCC.  However, an external @samp{devices.csv} file can be used to
28554 extend device support beyond those that have been hard-coded.
28556 GCC searches for the @samp{devices.csv} file using the following methods in the
28557 given precedence order, where the first method takes precendence over the
28558 second which takes precedence over the third.
28560 @table @asis
28561 @item Include path specified with @code{-I} and @code{-L}
28562 @samp{devices.csv} will be searched for in each of the directories specified by
28563 include paths and linker library search paths.
28564 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
28565 Define the value of the global environment variable
28566 @samp{MSP430_GCC_INCLUDE_DIR}
28567 to the full path to the directory containing devices.csv, and GCC will search
28568 this directory for devices.csv.  If devices.csv is found, this directory will
28569 also be registered as an include path, and linker library path.  Header files
28570 and linker scripts in this directory can therefore be used without manually
28571 specifying @code{-I} and @code{-L} on the command line.
28572 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
28573 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
28574 toolchain root directory.  This directory does not exist in a default
28575 installation, but if the user has created it and copied @samp{devices.csv}
28576 there, then the MCU data will be read.  As above, this directory will
28577 also be registered as an include path, and linker library path.
28579 @end table
28580 If none of the above search methods find @samp{devices.csv}, then the
28581 hard-coded MCU data is used.
28584 @opindex mwarn-mcu
28585 @opindex mno-warn-mcu
28586 @item -mwarn-mcu
28587 @itemx -mno-warn-mcu
28588 This option enables or disables warnings about conflicts between the
28589 MCU name specified by the @option{-mmcu} option and the ISA set by the
28590 @option{-mcpu} option and/or the hardware multiply support set by the
28591 @option{-mhwmult} option.  It also toggles warnings about unrecognized
28592 MCU names.  This option is on by default.
28594 @opindex mcpu=
28595 @item -mcpu=
28596 Specifies the ISA to use.  Accepted values are @samp{msp430},
28597 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
28598 @option{-mmcu=} option should be used to select the ISA.
28600 @opindex msim
28601 @item -msim
28602 Link to the simulator runtime libraries and linker script.  Overrides
28603 any scripts that would be selected by the @option{-mmcu=} option.
28605 @opindex mlarge
28606 @item -mlarge
28607 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
28609 @opindex msmall
28610 @item -msmall
28611 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
28613 @opindex mrelax
28614 @item -mrelax
28615 This option is passed to the assembler and linker, and allows the
28616 linker to perform certain optimizations that cannot be done until
28617 the final link.
28619 @opindex mhwmult=
28620 @item mhwmult=
28621 Describes the type of hardware multiply supported by the target.
28622 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
28623 for the original 16-bit-only multiply supported by early MCUs.
28624 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
28625 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
28626 A value of @samp{auto} can also be given.  This tells GCC to deduce
28627 the hardware multiply support based upon the MCU name provided by the
28628 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
28629 the MCU name is not recognized then no hardware multiply support is
28630 assumed.  @code{auto} is the default setting.
28632 Hardware multiplies are normally performed by calling a library
28633 routine.  This saves space in the generated code.  When compiling at
28634 @option{-O3} or higher however the hardware multiplier is invoked
28635 inline.  This makes for bigger, but faster code.
28637 The hardware multiply routines disable interrupts whilst running and
28638 restore the previous interrupt state when they finish.  This makes
28639 them safe to use inside interrupt handlers as well as in normal code.
28641 @opindex minrt
28642 @item -minrt
28643 Enable the use of a minimum runtime environment - no static
28644 initializers or constructors.  This is intended for memory-constrained
28645 devices.  The compiler includes special symbols in some objects
28646 that tell the linker and runtime which code fragments are required.
28648 @opindex mtiny-printf
28649 @item -mtiny-printf
28650 Enable reduced code size @code{printf} and @code{puts} library functions.
28651 The @samp{tiny} implementations of these functions are not reentrant, so
28652 must be used with caution in multi-threaded applications.
28654 Support for streams has been removed and the string to be printed will
28655 always be sent to stdout via the @code{write} syscall.  The string is not
28656 buffered before it is sent to write.
28658 This option requires Newlib Nano IO, so GCC must be configured with
28659 @samp{--enable-newlib-nano-formatted-io}.
28661 @opindex mmax-inline-shift=
28662 @item -mmax-inline-shift=
28663 This option takes an integer between 0 and 64 inclusive, and sets
28664 the maximum number of inline shift instructions which should be emitted to
28665 perform a shift operation by a constant amount.  When this value needs to be
28666 exceeded, an mspabi helper function is used instead.  The default value is 4.
28668 This only affects cases where a shift by multiple positions cannot be
28669 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
28671 Shifts of a 32-bit value are at least twice as costly, so the value passed for
28672 this option is divided by 2 and the resulting value used instead.
28674 @opindex mcode-region
28675 @opindex mdata-region
28676 @item -mcode-region=
28677 @itemx -mdata-region=
28678 These options tell the compiler where to place functions and data that
28679 do not have one of the @code{lower}, @code{upper}, @code{either} or
28680 @code{section} attributes.  Possible values are @code{lower},
28681 @code{upper}, @code{either} or @code{any}.  The first three behave
28682 like the corresponding attribute.  The fourth possible value -
28683 @code{any} - is the default.  It leaves placement entirely up to the
28684 linker script and how it assigns the standard sections
28685 (@code{.text}, @code{.data}, etc) to the memory regions.
28687 @opindex msilicon-errata
28688 @item -msilicon-errata=
28689 This option passes on a request to assembler to enable the fixes for
28690 the named silicon errata.
28692 @opindex msilicon-errata-warn
28693 @item -msilicon-errata-warn=
28694 This option passes on a request to the assembler to enable warning
28695 messages when a silicon errata might need to be applied.
28697 @opindex mwarn-devices-csv
28698 @opindex mno-warn-devices-csv
28699 @item -mwarn-devices-csv
28700 @itemx -mno-warn-devices-csv
28701 Warn if @samp{devices.csv} is not found or there are problem parsing it
28702 (default: on).
28704 @end table
28706 @node NDS32 Options
28707 @subsection NDS32 Options
28708 @cindex NDS32 Options
28710 These options are defined for NDS32 implementations:
28712 @table @gcctabopt
28714 @opindex mbig-endian
28715 @item -mbig-endian
28716 Generate code in big-endian mode.
28718 @opindex mlittle-endian
28719 @item -mlittle-endian
28720 Generate code in little-endian mode.
28722 @opindex mreduced-regs
28723 @item -mreduced-regs
28724 Use reduced-set registers for register allocation.
28726 @opindex mfull-regs
28727 @item -mfull-regs
28728 Use full-set registers for register allocation.
28730 @opindex mcmov
28731 @item -mcmov
28732 Generate conditional move instructions.
28734 @opindex mno-cmov
28735 @item -mno-cmov
28736 Do not generate conditional move instructions.
28738 @opindex mext-perf
28739 @item -mext-perf
28740 Generate performance extension instructions.
28742 @opindex mno-ext-perf
28743 @item -mno-ext-perf
28744 Do not generate performance extension instructions.
28746 @opindex mext-perf2
28747 @item -mext-perf2
28748 Generate performance extension 2 instructions.
28750 @opindex mno-ext-perf2
28751 @item -mno-ext-perf2
28752 Do not generate performance extension 2 instructions.
28754 @opindex mext-string
28755 @item -mext-string
28756 Generate string extension instructions.
28758 @opindex mno-ext-string
28759 @item -mno-ext-string
28760 Do not generate string extension instructions.
28762 @opindex mv3push
28763 @item -mv3push
28764 Generate v3 push25/pop25 instructions.
28766 @opindex mno-v3push
28767 @item -mno-v3push
28768 Do not generate v3 push25/pop25 instructions.
28770 @opindex m16-bit
28771 @item -m16-bit
28772 Generate 16-bit instructions.
28774 @opindex mno-16-bit
28775 @item -mno-16-bit
28776 Do not generate 16-bit instructions.
28778 @opindex misr-vector-size
28779 @item -misr-vector-size=@var{num}
28780 Specify the size of each interrupt vector, which must be 4 or 16.
28782 @opindex mcache-block-size
28783 @item -mcache-block-size=@var{num}
28784 Specify the size of each cache block,
28785 which must be a power of 2 between 4 and 512.
28787 @opindex march
28788 @item -march=@var{arch}
28789 Specify the name of the target architecture.
28791 @opindex mcmodel
28792 @item -mcmodel=@var{code-model}
28793 Set the code model to one of
28794 @table @asis
28795 @item @samp{small}
28796 All the data and read-only data segments must be within 512KB addressing space.
28797 The text segment must be within 16MB addressing space.
28798 @item @samp{medium}
28799 The data segment must be within 512KB while the read-only data segment can be
28800 within 4GB addressing space.  The text segment should be still within 16MB
28801 addressing space.
28802 @item @samp{large}
28803 All the text and data segments can be within 4GB addressing space.
28804 @end table
28806 @opindex mctor-dtor
28807 @item -mctor-dtor
28808 Enable constructor/destructor feature.
28810 @opindex mrelax
28811 @item -mrelax
28812 Guide linker to relax instructions.
28814 @end table
28816 @node Nios II Options
28817 @subsection Nios II Options
28818 @cindex Nios II options
28819 @cindex Altera Nios II options
28821 These are the options defined for the Altera Nios II processor.
28823 @table @gcctabopt
28825 @opindex G
28826 @cindex smaller data references
28827 @item -G @var{num}
28828 Put global and static objects less than or equal to @var{num} bytes
28829 into the small data or BSS sections instead of the normal data or BSS
28830 sections.  The default value of @var{num} is 8.
28832 @opindex mgpopt
28833 @opindex mno-gpopt
28834 @item -mgpopt=@var{option}
28835 @itemx -mgpopt
28836 @itemx -mno-gpopt
28837 Generate (do not generate) GP-relative accesses.  The following 
28838 @var{option} names are recognized:
28840 @table @samp
28842 @item none
28843 Do not generate GP-relative accesses.
28845 @item local
28846 Generate GP-relative accesses for small data objects that are not 
28847 external, weak, or uninitialized common symbols.  
28848 Also use GP-relative addressing for objects that
28849 have been explicitly placed in a small data section via a @code{section}
28850 attribute.
28852 @item global
28853 As for @samp{local}, but also generate GP-relative accesses for
28854 small data objects that are external, weak, or common.  If you use this option,
28855 you must ensure that all parts of your program (including libraries) are
28856 compiled with the same @option{-G} setting.
28858 @item data
28859 Generate GP-relative accesses for all data objects in the program.  If you
28860 use this option, the entire data and BSS segments
28861 of your program must fit in 64K of memory and you must use an appropriate
28862 linker script to allocate them within the addressable range of the
28863 global pointer.
28865 @item all
28866 Generate GP-relative addresses for function pointers as well as data
28867 pointers.  If you use this option, the entire text, data, and BSS segments
28868 of your program must fit in 64K of memory and you must use an appropriate
28869 linker script to allocate them within the addressable range of the
28870 global pointer.
28872 @end table
28874 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28875 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28877 The default is @option{-mgpopt} except when @option{-fpic} or
28878 @option{-fPIC} is specified to generate position-independent code.
28879 Note that the Nios II ABI does not permit GP-relative accesses from
28880 shared libraries.
28882 You may need to specify @option{-mno-gpopt} explicitly when building
28883 programs that include large amounts of small data, including large
28884 GOT data sections.  In this case, the 16-bit offset for GP-relative
28885 addressing may not be large enough to allow access to the entire 
28886 small data section.
28888 @opindex mgprel-sec
28889 @item -mgprel-sec=@var{regexp}
28890 This option specifies additional section names that can be accessed via
28891 GP-relative addressing.  It is most useful in conjunction with 
28892 @code{section} attributes on variable declarations 
28893 (@pxref{Common Variable Attributes}) and a custom linker script.  
28894 The @var{regexp} is a POSIX Extended Regular Expression.
28896 This option does not affect the behavior of the @option{-G} option, and 
28897 the specified sections are in addition to the standard @code{.sdata}
28898 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28900 @opindex mr0rel-sec
28901 @item -mr0rel-sec=@var{regexp}
28902 This option specifies names of sections that can be accessed via a 
28903 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
28904 of the 32-bit address space.  It is most useful in conjunction with 
28905 @code{section} attributes on variable declarations 
28906 (@pxref{Common Variable Attributes}) and a custom linker script.  
28907 The @var{regexp} is a POSIX Extended Regular Expression.
28909 In contrast to the use of GP-relative addressing for small data, 
28910 zero-based addressing is never generated by default and there are no 
28911 conventional section names used in standard linker scripts for sections
28912 in the low or high areas of memory.
28914 @opindex mel
28915 @opindex meb
28916 @item -mel
28917 @itemx -meb
28918 Generate little-endian (default) or big-endian (experimental) code,
28919 respectively.
28921 @opindex march
28922 @item -march=@var{arch}
28923 This specifies the name of the target Nios II architecture.  GCC uses this
28924 name to determine what kind of instructions it can emit when generating
28925 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
28927 The preprocessor macro @code{__nios2_arch__} is available to programs,
28928 with value 1 or 2, indicating the targeted ISA level.
28930 @opindex mno-bypass-cache
28931 @opindex mbypass-cache
28932 @item -mbypass-cache
28933 @itemx -mno-bypass-cache
28934 Force all load and store instructions to always bypass cache by 
28935 using I/O variants of the instructions. The default is not to
28936 bypass the cache.
28938 @opindex mcache-volatile 
28939 @opindex mno-cache-volatile
28940 @item -mno-cache-volatile 
28941 @itemx -mcache-volatile       
28942 Volatile memory access bypass the cache using the I/O variants of 
28943 the load and store instructions. The default is not to bypass the cache.
28945 @opindex mno-fast-sw-div
28946 @opindex mfast-sw-div
28947 @item -mno-fast-sw-div
28948 @itemx -mfast-sw-div
28949 Do not use table-based fast divide for small numbers. The default 
28950 is to use the fast divide at @option{-O3} and above.
28952 @opindex mno-hw-mul
28953 @opindex mhw-mul
28954 @opindex mno-hw-mulx
28955 @opindex mhw-mulx
28956 @opindex mno-hw-div
28957 @opindex mhw-div
28958 @item -mno-hw-mul
28959 @itemx -mhw-mul
28960 @itemx -mno-hw-mulx
28961 @itemx -mhw-mulx
28962 @itemx -mno-hw-div
28963 @itemx -mhw-div
28964 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
28965 instructions by the compiler. The default is to emit @code{mul}
28966 and not emit @code{div} and @code{mulx}.
28968 @item -mbmx
28969 @itemx -mno-bmx
28970 @itemx -mcdx
28971 @itemx -mno-cdx
28972 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28973 CDX (code density) instructions.  Enabling these instructions also
28974 requires @option{-march=r2}.  Since these instructions are optional
28975 extensions to the R2 architecture, the default is not to emit them.
28977 @opindex mcustom-@var{insn}
28978 @opindex mno-custom-@var{insn}
28979 @item -mcustom-@var{insn}=@var{N}
28980 @itemx -mno-custom-@var{insn}
28981 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28982 custom instruction with encoding @var{N} when generating code that uses 
28983 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
28984 instruction 253 for single-precision floating-point add operations instead
28985 of the default behavior of using a library call.
28987 The following values of @var{insn} are supported.  Except as otherwise
28988 noted, floating-point operations are expected to be implemented with
28989 normal IEEE 754 semantics and correspond directly to the C operators or the
28990 equivalent GCC built-in functions (@pxref{Other Builtins}).
28992 Single-precision floating point:
28993 @table @asis
28995 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28996 Binary arithmetic operations.
28998 @item @samp{fnegs}
28999 Unary negation.
29001 @item @samp{fabss}
29002 Unary absolute value.
29004 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
29005 Comparison operations.
29007 @item @samp{fmins}, @samp{fmaxs}
29008 Floating-point minimum and maximum.  These instructions are only
29009 generated if @option{-ffinite-math-only} is specified.
29011 @item @samp{fsqrts}
29012 Unary square root operation.
29014 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
29015 Floating-point trigonometric and exponential functions.  These instructions
29016 are only generated if @option{-funsafe-math-optimizations} is also specified.
29018 @end table
29020 Double-precision floating point:
29021 @table @asis
29023 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
29024 Binary arithmetic operations.
29026 @item @samp{fnegd}
29027 Unary negation.
29029 @item @samp{fabsd}
29030 Unary absolute value.
29032 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
29033 Comparison operations.
29035 @item @samp{fmind}, @samp{fmaxd}
29036 Double-precision minimum and maximum.  These instructions are only
29037 generated if @option{-ffinite-math-only} is specified.
29039 @item @samp{fsqrtd}
29040 Unary square root operation.
29042 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
29043 Double-precision trigonometric and exponential functions.  These instructions
29044 are only generated if @option{-funsafe-math-optimizations} is also specified.
29046 @end table
29048 Conversions:
29049 @table @asis
29050 @item @samp{fextsd}
29051 Conversion from single precision to double precision.
29053 @item @samp{ftruncds}
29054 Conversion from double precision to single precision.
29056 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
29057 Conversion from floating point to signed or unsigned integer types, with
29058 truncation towards zero.
29060 @item @samp{round}
29061 Conversion from single-precision floating point to signed integer,
29062 rounding to the nearest integer and ties away from zero.
29063 This corresponds to the @code{__builtin_lroundf} function when
29064 @option{-fno-math-errno} is used.
29066 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
29067 Conversion from signed or unsigned integer types to floating-point types.
29069 @end table
29071 In addition, all of the following transfer instructions for internal
29072 registers X and Y must be provided to use any of the double-precision
29073 floating-point instructions.  Custom instructions taking two
29074 double-precision source operands expect the first operand in the
29075 64-bit register X.  The other operand (or only operand of a unary
29076 operation) is given to the custom arithmetic instruction with the
29077 least significant half in source register @var{src1} and the most
29078 significant half in @var{src2}.  A custom instruction that returns a
29079 double-precision result returns the most significant 32 bits in the
29080 destination register and the other half in 32-bit register Y.  
29081 GCC automatically generates the necessary code sequences to write
29082 register X and/or read register Y when double-precision floating-point
29083 instructions are used.
29085 @table @asis
29087 @item @samp{fwrx}
29088 Write @var{src1} into the least significant half of X and @var{src2} into
29089 the most significant half of X.
29091 @item @samp{fwry}
29092 Write @var{src1} into Y.
29094 @item @samp{frdxhi}, @samp{frdxlo}
29095 Read the most or least (respectively) significant half of X and store it in
29096 @var{dest}.
29098 @item @samp{frdy}
29099 Read the value of Y and store it into @var{dest}.
29100 @end table
29102 Note that you can gain more local control over generation of Nios II custom
29103 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
29104 and @code{target("no-custom-@var{insn}")} function attributes
29105 (@pxref{Function Attributes})
29106 or pragmas (@pxref{Function Specific Option Pragmas}).
29108 @opindex mcustom-fpu-cfg
29109 @item -mcustom-fpu-cfg=@var{name}
29111 This option enables a predefined, named set of custom instruction encodings
29112 (see @option{-mcustom-@var{insn}} above).  
29113 Currently, the following sets are defined:
29115 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
29116 @gccoptlist{-mcustom-fmuls=252
29117 -mcustom-fadds=253
29118 -mcustom-fsubs=254
29119 -fsingle-precision-constant}
29121 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
29122 @gccoptlist{-mcustom-fmuls=252
29123 -mcustom-fadds=253
29124 -mcustom-fsubs=254
29125 -mcustom-fdivs=255
29126 -fsingle-precision-constant}
29128 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
29129 @gccoptlist{-mcustom-floatus=243
29130 -mcustom-fixsi=244
29131 -mcustom-floatis=245
29132 -mcustom-fcmpgts=246
29133 -mcustom-fcmples=249
29134 -mcustom-fcmpeqs=250
29135 -mcustom-fcmpnes=251
29136 -mcustom-fmuls=252
29137 -mcustom-fadds=253
29138 -mcustom-fsubs=254
29139 -mcustom-fdivs=255
29140 -fsingle-precision-constant}
29142 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
29143 @gccoptlist{-mcustom-fabss=224
29144 -mcustom-fnegs=225
29145 -mcustom-fcmpnes=226
29146 -mcustom-fcmpeqs=227
29147 -mcustom-fcmpges=228
29148 -mcustom-fcmpgts=229
29149 -mcustom-fcmples=230
29150 -mcustom-fcmplts=231
29151 -mcustom-fmaxs=232
29152 -mcustom-fmins=233
29153 -mcustom-round=248
29154 -mcustom-fixsi=249
29155 -mcustom-floatis=250
29156 -mcustom-fsqrts=251
29157 -mcustom-fmuls=252
29158 -mcustom-fadds=253
29159 -mcustom-fsubs=254
29160 -mcustom-fdivs=255}
29162 Custom instruction assignments given by individual
29163 @option{-mcustom-@var{insn}=} options override those given by
29164 @option{-mcustom-fpu-cfg=}, regardless of the
29165 order of the options on the command line.
29167 Note that you can gain more local control over selection of a FPU
29168 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
29169 function attribute (@pxref{Function Attributes})
29170 or pragma (@pxref{Function Specific Option Pragmas}).
29172 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
29173 Hardware 2 Component}.  Please note that the custom instructions enabled by
29174 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
29175 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
29176 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
29177 specified.  In contrast to the other configurations,
29178 @option{-fsingle-precision-constant} is not set.
29180 @end table
29182 These additional @samp{-m} options are available for the Altera Nios II
29183 ELF (bare-metal) target:
29185 @table @gcctabopt
29187 @opindex mhal
29188 @item -mhal
29189 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
29190 startup and termination code, and is typically used in conjunction with
29191 @option{-msys-crt0=} to specify the location of the alternate startup code
29192 provided by the HAL BSP.
29194 @opindex msmallc
29195 @item -msmallc
29196 Link with a limited version of the C library, @option{-lsmallc}, rather than
29197 Newlib.
29199 @opindex msys-crt0
29200 @item -msys-crt0=@var{startfile}
29201 @var{startfile} is the file name of the startfile (crt0) to use 
29202 when linking.  This option is only useful in conjunction with @option{-mhal}.
29204 @opindex msys-lib
29205 @item -msys-lib=@var{systemlib}
29206 @var{systemlib} is the library name of the library that provides
29207 low-level system calls required by the C library,
29208 e.g.@: @code{read} and @code{write}.
29209 This option is typically used to link with a library provided by a HAL BSP.
29211 @end table
29213 @node Nvidia PTX Options
29214 @subsection Nvidia PTX Options
29215 @cindex Nvidia PTX options
29216 @cindex nvptx options
29218 These options are defined for Nvidia PTX:
29220 @table @gcctabopt
29222 @opindex m64
29223 @item -m64
29224 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
29225 supported.
29227 @opindex march
29228 @item -march=@var{architecture-string}
29229 Generate code for the specified PTX ISA target architecture
29230 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
29231 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
29232 @samp{sm_80}.
29233 The default depends on how the compiler has been configured, see
29234 @option{--with-arch}.
29236 This option sets the value of the preprocessor macro
29237 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
29238 @samp{350}.
29240 @opindex misa
29241 @item -misa=@var{architecture-string}
29242 Alias of @option{-march=}.
29244 @opindex march
29245 @item -march-map=@var{architecture-string}
29246 Select the closest available @option{-march=} value that is not more
29247 capable.  For instance, for @option{-march-map=sm_50} select
29248 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
29249 @option{-march=sm_53}.
29251 @opindex mptx
29252 @item -mptx=@var{version-string}
29253 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
29254 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
29255 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
29256 version is required for specified PTX ISA target architecture via
29257 option @option{-march=}.
29259 This option sets the values of the preprocessor macros
29260 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
29261 for instance, for @samp{3.1} the macros have the values @samp{3} and
29262 @samp{1}, respectively.
29264 @opindex mmainkernel
29265 @item -mmainkernel
29266 Link in code for a __main kernel.  This is for stand-alone instead of
29267 offloading execution.
29269 @opindex moptimize
29270 @item -moptimize
29271 Apply partitioned execution optimizations.  This is the default when any
29272 level of optimization is selected.
29274 @opindex msoft-stack
29275 @item -msoft-stack
29276 Generate code that does not use @code{.local} memory
29277 directly for stack storage. Instead, a per-warp stack pointer is
29278 maintained explicitly. This enables variable-length stack allocation (with
29279 variable-length arrays or @code{alloca}), and when global memory is used for
29280 underlying storage, makes it possible to access automatic variables from other
29281 threads, or with atomic instructions. This code generation variant is used
29282 for OpenMP offloading, but the option is exposed on its own for the purpose
29283 of testing the compiler; to generate code suitable for linking into programs
29284 using OpenMP offloading, use option @option{-mgomp}.
29286 @opindex muniform-simt
29287 @item -muniform-simt
29288 Switch to code generation variant that allows to execute all threads in each
29289 warp, while maintaining memory state and side effects as if only one thread
29290 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
29291 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
29292 current lane index equals the master lane index), and the register being
29293 assigned is copied via a shuffle instruction from the master lane.  Outside of
29294 SIMD regions lane 0 is the master; inside, each thread sees itself as the
29295 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
29296 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
29297 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
29298 with current lane index to compute the master lane index.
29300 @opindex mgomp
29301 @item -mgomp
29302 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
29303 @option{-muniform-simt} options, and selects corresponding multilib variant.
29305 @end table
29307 @node OpenRISC Options
29308 @subsection OpenRISC Options
29309 @cindex OpenRISC Options
29311 These options are defined for OpenRISC:
29313 @table @gcctabopt
29315 @opindex mboard
29316 @item -mboard=@var{name}
29317 Configure a board specific runtime.  This will be passed to the linker for
29318 newlib board library linking.  The default is @code{or1ksim}.
29320 @opindex mnewlib
29321 @item -mnewlib
29322 This option is ignored; it is for compatibility purposes only.  This used to
29323 select linker and preprocessor options for use with newlib.
29325 @opindex msoft-div
29326 @opindex mhard-div
29327 @item -msoft-div
29328 @itemx -mhard-div
29329 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
29330 This default is hardware divide.
29332 @opindex msoft-mul
29333 @opindex mhard-mul
29334 @item -msoft-mul
29335 @itemx -mhard-mul
29336 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
29337 This default is hardware multiply.
29339 @opindex msoft-float
29340 @opindex mhard-float
29341 @item -msoft-float
29342 @itemx -mhard-float
29343 Select software or hardware for floating point operations.
29344 The default is software.
29346 @opindex mdouble-float
29347 @item -mdouble-float
29348 When @option{-mhard-float} is selected, enables generation of double-precision
29349 floating point instructions.  By default functions from @file{libgcc} are used
29350 to perform double-precision floating point operations.
29352 @opindex munordered-float
29353 @item -munordered-float
29354 When @option{-mhard-float} is selected, enables generation of unordered
29355 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
29356 functions from @file{libgcc} are used to perform unordered floating point
29357 compare and set flag operations.
29359 @opindex mcmov
29360 @item -mcmov
29361 Enable generation of conditional move (@code{l.cmov}) instructions.  By
29362 default the equivalent will be generated using set and branch.
29364 @opindex mror
29365 @item -mror
29366 Enable generation of rotate right (@code{l.ror}) instructions.  By default
29367 functions from @file{libgcc} are used to perform rotate right operations.
29369 @opindex mrori
29370 @item -mrori
29371 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
29372 By default functions from @file{libgcc} are used to perform rotate right with
29373 immediate operations.
29375 @opindex msext
29376 @item -msext
29377 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
29378 memory loads are used to perform sign extension.
29380 @opindex msfimm
29381 @item -msfimm
29382 Enable generation of compare and set flag with immediate (@code{l.sf*i})
29383 instructions.  By default extra instructions will be generated to store the
29384 immediate to a register first.
29386 @opindex mshftimm
29387 @item -mshftimm
29388 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
29389 @code{l.slli}) instructions.  By default extra instructions will be generated
29390 to store the immediate to a register first.
29392 @opindex mcmodel=small
29393 @item -mcmodel=small
29394 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
29395 the default model.
29397 @opindex mcmodel=large
29398 @item -mcmodel=large
29399 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
29402 @end table
29404 @node PDP-11 Options
29405 @subsection PDP-11 Options
29406 @cindex PDP-11 Options
29408 These options are defined for the PDP-11:
29410 @table @gcctabopt
29411 @opindex mfpu
29412 @item -mfpu
29413 Use hardware FPP floating point.  This is the default.  (FIS floating
29414 point on the PDP-11/40 is not supported.)  Implies -m45.
29416 @opindex msoft-float
29417 @item -msoft-float
29418 Do not use hardware floating point.
29420 @opindex mac0
29421 @item -mac0
29422 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
29424 @opindex mno-ac0
29425 @item -mno-ac0
29426 Return floating-point results in memory.  This is the default.
29428 @opindex m40
29429 @item -m40
29430 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
29432 @opindex m45
29433 @item -m45
29434 Generate code for a PDP-11/45.  This is the default.
29436 @opindex m10
29437 @item -m10
29438 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
29440 @opindex mint16
29441 @opindex mno-int32
29442 @item -mint16
29443 @itemx -mno-int32
29444 Use 16-bit @code{int}.  This is the default.
29446 @opindex mint32
29447 @opindex mno-int16
29448 @item -mint32
29449 @itemx -mno-int16
29450 Use 32-bit @code{int}.
29452 @opindex msplit
29453 @item -msplit
29454 Target has split instruction and data space.  Implies -m45.
29456 @opindex munix-asm
29457 @item -munix-asm
29458 Use Unix assembler syntax.
29460 @opindex mdec-asm
29461 @item -mdec-asm
29462 Use DEC assembler syntax.
29464 @opindex mgnu-asm
29465 @item -mgnu-asm
29466 Use GNU assembler syntax.  This is the default.
29468 @opindex mlra
29469 @item -mlra
29470 Use the new LRA register allocator.  By default, the old ``reload''
29471 allocator is used.
29472 @end table
29474 @node PowerPC Options
29475 @subsection PowerPC Options
29476 @cindex PowerPC options
29478 These are listed under @xref{RS/6000 and PowerPC Options}.
29480 @node PRU Options
29481 @subsection PRU Options
29482 @cindex PRU Options
29484 These command-line options are defined for PRU target:
29486 @table @gcctabopt
29487 @opindex minrt
29488 @item -minrt
29489 Link with a minimum runtime environment, with no support for static
29490 initializers and constructors.  Using this option can significantly reduce
29491 the size of the final ELF binary.  Beware that the compiler could still
29492 generate code with static initializers and constructors.  It is up to the
29493 programmer to ensure that the source program will not use those features.
29495 @opindex mmcu
29496 @item -mmcu=@var{mcu}
29497 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
29498 supported MCUs.
29500 @opindex mno-relax
29501 @item -mno-relax
29502 Make GCC pass the @option{--no-relax} command-line option to the linker
29503 instead of the @option{--relax} option.
29505 @opindex mloop
29506 @item -mloop
29507 Allow (or do not allow) GCC to use the LOOP instruction.
29509 @opindex mabi
29510 @item -mabi=@var{variant}
29511 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
29512 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
29513 more naturally with certain GCC assumptions.  These are the differences:
29515 @table @samp
29516 @item Function Pointer Size
29517 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
29518 supports only 32-bit data and code pointers.
29520 @item Optional Return Value Pointer
29521 Function return values larger than 64 bits are passed by using a hidden
29522 pointer as the first argument of the function.  TI ABI, though, mandates that
29523 the pointer can be NULL in case the caller is not using the returned value.
29524 GNU always passes and expects a valid return value pointer.
29526 @end table
29528 The current @option{-mabi=ti} implementation simply raises a compile error
29529 when any of the above code constructs is detected.  As a consequence
29530 the standard C library cannot be built and it is omitted when linking with
29531 @option{-mabi=ti}.
29533 Relaxation is a GNU feature and for safety reasons is disabled when using
29534 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
29535 instructions, so the GNU linker cannot adjust them when shortening adjacent
29536 LDI32 pseudo instructions.
29538 @end table
29540 @node RISC-V Options
29541 @subsection RISC-V Options
29542 @cindex RISC-V Options
29544 These command-line options are defined for RISC-V targets:
29546 @table @gcctabopt
29547 @opindex mbranch-cost
29548 @item -mbranch-cost=@var{n}
29549 Set the cost of branches to roughly @var{n} instructions.
29551 @opindex plt
29552 @item -mplt
29553 @itemx -mno-plt
29554 When generating PIC code, do or don't allow the use of PLTs. Ignored for
29555 non-PIC.  The default is @option{-mplt}.
29557 @opindex mabi
29558 @item -mabi=@var{ABI-string}
29559 Specify integer and floating-point calling convention.  @var{ABI-string}
29560 contains two parts: the size of integer types and the registers used for
29561 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
29562 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
29563 32-bit), and that floating-point values up to 64 bits wide are passed in F
29564 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
29565 allows the compiler to generate code that uses the F and D extensions but only
29566 allows floating-point values up to 32 bits long to be passed in registers; or
29567 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
29568 passed in registers.
29570 The default for this argument is system dependent, users who want a specific
29571 calling convention should specify one explicitly.  The valid calling
29572 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
29573 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
29574 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
29575 invalid because the ABI requires 64-bit values be passed in F registers, but F
29576 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
29577 only be used with the @samp{rv32e} architecture.  This ABI is not well
29578 specified at present, and is subject to change.
29580 @opindex mfdiv
29581 @item -mfdiv
29582 @itemx -mno-fdiv
29583 Do or don't use hardware floating-point divide and square root instructions.
29584 This requires the F or D extensions for floating-point registers.  The default
29585 is to use them if the specified architecture has these instructions.
29587 @opindex mdiv
29588 @item -mdiv
29589 @itemx -mno-div
29590 Do or don't use hardware instructions for integer division.  This requires the
29591 M extension.  The default is to use them if the specified architecture has
29592 these instructions.
29594 @opindex misa-spec
29595 @item -misa-spec=@var{ISA-spec-string}
29596 Specify the version of the RISC-V Unprivileged (formerly User-Level)
29597 ISA specification to produce code conforming to.  The possibilities
29598 for @var{ISA-spec-string} are:
29599 @table @code
29600 @item 2.2
29601 Produce code conforming to version 2.2.
29602 @item 20190608
29603 Produce code conforming to version 20190608.
29604 @item 20191213
29605 Produce code conforming to version 20191213.
29606 @end table
29607 The default is @option{-misa-spec=20191213} unless GCC has been configured
29608 with @option{--with-isa-spec=} specifying a different default version.
29610 @opindex march
29611 @item -march=@var{ISA-string}
29612 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
29613 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
29614 @samp{rv32imaf}.
29616 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
29618 If both @option{-march} and @option{-mcpu=} are not specified, the default for
29619 this argument is system dependent, users who want a specific architecture
29620 extensions should specify one explicitly.
29622 @opindex mcpu
29623 @item -mcpu=@var{processor-string}
29624 Use architecture of and optimize the output for the given processor, specified
29625 by particular CPU name.
29626 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
29627 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
29628 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
29629 @samp{sifive-u54}, and @samp{sifive-u74}.
29631 @opindex mtune
29632 @item -mtune=@var{processor-string}
29633 Optimize the output for the given processor, specified by microarchitecture or
29634 particular CPU name.  Permissible values for this option are: @samp{rocket},
29635 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
29636 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
29638 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
29639 the default is @samp{rocket} if both are not specified.
29641 The @samp{size} choice is not intended for use by end-users.  This is used
29642 when @option{-Os} is specified.  It overrides the instruction cost info
29643 provided by @option{-mtune=}, but does not override the pipeline info.  This
29644 helps reduce code size while still giving good performance.
29646 @opindex mpreferred-stack-boundary
29647 @item -mpreferred-stack-boundary=@var{num}
29648 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29649 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29650 the default is 4 (16 bytes or 128-bits).
29652 @strong{Warning:} If you use this switch, then you must build all modules with
29653 the same value, including any libraries.  This includes the system libraries
29654 and startup modules.
29656 @opindex msmall-data-limit
29657 @item -msmall-data-limit=@var{n}
29658 Put global and static data smaller than @var{n} bytes into a special section
29659 (on some targets).
29661 @opindex msave-restore
29662 @item -msave-restore
29663 @itemx -mno-save-restore
29664 Do or don't use smaller but slower prologue and epilogue code that uses
29665 library function calls.  The default is to use fast inline prologues and
29666 epilogues.
29668 @opindex minline-atomics
29669 @item -minline-atomics
29670 @itemx -mno-inline-atomics
29671 Do or don't use smaller but slower subword atomic emulation code that uses
29672 libatomic function calls.  The default is to use fast inline subword atomics
29673 that do not require libatomic.
29675 @opindex minline-strlen
29676 @item -minline-strlen
29677 @itemx -mno-inline-strlen
29678 Do or do not attempt to inline strlen calls if possible.
29679 Inlining will only be done if the string is properly aligned
29680 and instructions for accelerated processing are available.
29681 The default is to not inline strlen calls.
29683 @opindex minline-strcmp
29684 @item -minline-strcmp
29685 @itemx -mno-inline-strcmp
29686 Do or do not attempt to inline strcmp calls if possible.
29687 Inlining will only be done if the strings are properly aligned
29688 and instructions for accelerated processing are available.
29689 The default is to not inline strcmp calls.
29691 @opindex minline-strncmp
29692 @item -minline-strncmp
29693 @itemx -mno-inline-strncmp
29694 Do or do not attempt to inline strncmp calls if possible.
29695 Inlining will only be done if the strings are properly aligned
29696 and instructions for accelerated processing are available.
29697 The default is to not inline strncmp calls.
29699 @opindex mshorten-memrefs
29700 @item -mshorten-memrefs
29701 @itemx -mno-shorten-memrefs
29702 Do or do not attempt to make more use of compressed load/store instructions by
29703 replacing a load/store of 'base register + large offset' with a new load/store
29704 of 'new base + small offset'.  If the new base gets stored in a compressed
29705 register, then the new load/store can be compressed.  Currently targets 32-bit
29706 integer load/stores only.
29708 @opindex mstrict-align
29709 @item -mstrict-align
29710 @itemx -mno-strict-align
29711 Do not or do generate unaligned memory accesses.  The default is set depending
29712 on whether the processor we are optimizing for supports fast unaligned access
29713 or not.
29715 @opindex mcmodel=medlow
29716 @item -mcmodel=medlow
29717 Generate code for the medium-low code model. The program and its statically
29718 defined symbols must lie within a single 2 GiB address range and must lie
29719 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
29720 statically or dynamically linked. This is the default code model.
29722 @opindex mcmodel=medany
29723 @item -mcmodel=medany
29724 Generate code for the medium-any code model. The program and its statically
29725 defined symbols must be within any single 2 GiB address range. Programs can be
29726 statically or dynamically linked.
29728 The code generated by the medium-any code model is position-independent, but is
29729 not guaranteed to function correctly when linked into position-independent
29730 executables or libraries.
29732 @item -mexplicit-relocs
29733 @itemx -mno-exlicit-relocs
29734 Use or do not use assembler relocation operators when dealing with symbolic
29735 addresses.  The alternative is to use assembler macros instead, which may
29736 limit optimization.
29738 @opindex mrelax
29739 @item -mrelax
29740 @itemx -mno-relax
29741 Take advantage of linker relaxations to reduce the number of instructions
29742 required to materialize symbol addresses. The default is to take advantage of
29743 linker relaxations.
29745 @opindex mriscv-attribute
29746 @item -mriscv-attribute
29747 @itemx -mno-riscv-attribute
29748 Emit (do not emit) RISC-V attribute to record extra information into ELF
29749 objects.  This feature requires at least binutils 2.32.
29751 @opindex mcsr-check
29752 @item -mcsr-check
29753 @itemx -mno-csr-check
29754 Enables or disables the CSR checking.
29756 @opindex malign-data
29757 @item -malign-data=@var{type}
29758 Control how GCC aligns variables and constants of array, structure, or union
29759 types.  Supported values for @var{type} are @samp{xlen} which uses x register
29760 width as the alignment value, and @samp{natural} which uses natural alignment.
29761 @samp{xlen} is the default.
29763 @opindex mbig-endian
29764 @item -mbig-endian
29765 Generate big-endian code.  This is the default when GCC is configured for a
29766 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
29768 @opindex mlittle-endian
29769 @item -mlittle-endian
29770 Generate little-endian code.  This is the default when GCC is configured for a
29771 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
29772 @samp{riscv32be-*-*} target.
29774 @opindex mstack-protector-guard
29775 @opindex mstack-protector-guard-reg
29776 @opindex mstack-protector-guard-offset
29777 @item -mstack-protector-guard=@var{guard}
29778 @itemx -mstack-protector-guard-reg=@var{reg}
29779 @itemx -mstack-protector-guard-offset=@var{offset}
29780 Generate stack protection code using canary at @var{guard}.  Supported
29781 locations are @samp{global} for a global canary or @samp{tls} for per-thread
29782 canary in the TLS block.
29784 With the latter choice the options
29785 @option{-mstack-protector-guard-reg=@var{reg}} and
29786 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29787 which register to use as base register for reading the canary,
29788 and from what offset from that base register. There is no default
29789 register or offset as this is entirely for use within the Linux
29790 kernel.
29791 @end table
29793 @node RL78 Options
29794 @subsection RL78 Options
29795 @cindex RL78 Options
29797 @table @gcctabopt
29799 @opindex msim
29800 @item -msim
29801 Links in additional target libraries to support operation within a
29802 simulator.
29804 @opindex mmul
29805 @item -mmul=none
29806 @itemx -mmul=g10
29807 @itemx -mmul=g13
29808 @itemx -mmul=g14
29809 @itemx -mmul=rl78
29810 Specifies the type of hardware multiplication and division support to
29811 be used.  The simplest is @code{none}, which uses software for both
29812 multiplication and division.  This is the default.  The @code{g13}
29813 value is for the hardware multiply/divide peripheral found on the
29814 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
29815 the multiplication and division instructions supported by the RL78/G14
29816 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
29817 the value @code{mg10} is an alias for @code{none}.
29819 In addition a C preprocessor macro is defined, based upon the setting
29820 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
29821 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
29823 @opindex mcpu
29824 @item -mcpu=g10
29825 @itemx -mcpu=g13
29826 @itemx -mcpu=g14
29827 @itemx -mcpu=rl78
29828 Specifies the RL78 core to target.  The default is the G14 core, also
29829 known as an S3 core or just RL78.  The G13 or S2 core does not have
29830 multiply or divide instructions, instead it uses a hardware peripheral
29831 for these operations.  The G10 or S1 core does not have register
29832 banks, so it uses a different calling convention.
29834 If this option is set it also selects the type of hardware multiply
29835 support to use, unless this is overridden by an explicit
29836 @option{-mmul=none} option on the command line.  Thus specifying
29837 @option{-mcpu=g13} enables the use of the G13 hardware multiply
29838 peripheral and specifying @option{-mcpu=g10} disables the use of
29839 hardware multiplications altogether.
29841 Note, although the RL78/G14 core is the default target, specifying
29842 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
29843 change the behavior of the toolchain since it also enables G14
29844 hardware multiply support.  If these options are not specified on the
29845 command line then software multiplication routines will be used even
29846 though the code targets the RL78 core.  This is for backwards
29847 compatibility with older toolchains which did not have hardware
29848 multiply and divide support.
29850 In addition a C preprocessor macro is defined, based upon the setting
29851 of this option.  Possible values are: @code{__RL78_G10__},
29852 @code{__RL78_G13__} or @code{__RL78_G14__}.
29854 @opindex mg10
29855 @opindex mg13
29856 @opindex mg14
29857 @opindex mrl78
29858 @item -mg10
29859 @itemx -mg13
29860 @itemx -mg14
29861 @itemx -mrl78
29862 These are aliases for the corresponding @option{-mcpu=} option.  They
29863 are provided for backwards compatibility.
29865 @opindex mallregs
29866 @item -mallregs
29867 Allow the compiler to use all of the available registers.  By default
29868 registers @code{r24..r31} are reserved for use in interrupt handlers.
29869 With this option enabled these registers can be used in ordinary
29870 functions as well.
29872 @opindex m64bit-doubles
29873 @opindex m32bit-doubles
29874 @item -m64bit-doubles
29875 @itemx -m32bit-doubles
29876 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29877 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
29878 @option{-m32bit-doubles}.
29880 @opindex msave-mduc-in-interrupts
29881 @opindex mno-save-mduc-in-interrupts
29882 @item -msave-mduc-in-interrupts
29883 @itemx -mno-save-mduc-in-interrupts
29884 Specifies that interrupt handler functions should preserve the
29885 MDUC registers.  This is only necessary if normal code might use
29886 the MDUC registers, for example because it performs multiplication
29887 and division operations.  The default is to ignore the MDUC registers
29888 as this makes the interrupt handlers faster.  The target option -mg13
29889 needs to be passed for this to work as this feature is only available
29890 on the G13 target (S2 core).  The MDUC registers will only be saved
29891 if the interrupt handler performs a multiplication or division
29892 operation or it calls another function.
29894 @end table
29896 @node RS/6000 and PowerPC Options
29897 @subsection IBM RS/6000 and PowerPC Options
29898 @cindex RS/6000 and PowerPC Options
29899 @cindex IBM RS/6000 and PowerPC Options
29901 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29902 @table @gcctabopt
29903 @item -mpowerpc-gpopt
29904 @itemx -mno-powerpc-gpopt
29905 @itemx -mpowerpc-gfxopt
29906 @itemx -mno-powerpc-gfxopt
29907 @need 800
29908 @itemx -mpowerpc64
29909 @itemx -mno-powerpc64
29910 @itemx -mmfcrf
29911 @itemx -mno-mfcrf
29912 @itemx -mpopcntb
29913 @itemx -mno-popcntb
29914 @itemx -mpopcntd
29915 @itemx -mno-popcntd
29916 @itemx -mfprnd
29917 @itemx -mno-fprnd
29918 @need 800
29919 @opindex mpowerpc-gpopt
29920 @opindex mno-powerpc-gpopt
29921 @opindex mpowerpc-gfxopt
29922 @opindex mno-powerpc-gfxopt
29923 @opindex mpowerpc64
29924 @opindex mno-powerpc64
29925 @opindex mmfcrf
29926 @opindex mno-mfcrf
29927 @opindex mpopcntb
29928 @opindex mno-popcntb
29929 @opindex mpopcntd
29930 @opindex mno-popcntd
29931 @opindex mfprnd
29932 @opindex mno-fprnd
29933 @opindex mcmpb
29934 @opindex mno-cmpb
29935 @opindex mhard-dfp
29936 @opindex mno-hard-dfp
29937 @itemx -mcmpb
29938 @itemx -mno-cmpb
29939 @itemx -mhard-dfp
29940 @itemx -mno-hard-dfp
29941 You use these options to specify which instructions are available on the
29942 processor you are using.  The default value of these options is
29943 determined when configuring GCC@.  Specifying the
29944 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29945 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
29946 rather than the options listed above.
29948 Specifying @option{-mpowerpc-gpopt} allows
29949 GCC to use the optional PowerPC architecture instructions in the
29950 General Purpose group, including floating-point square root.  Specifying
29951 @option{-mpowerpc-gfxopt} allows GCC to
29952 use the optional PowerPC architecture instructions in the Graphics
29953 group, including floating-point select.
29955 The @option{-mmfcrf} option allows GCC to generate the move from
29956 condition register field instruction implemented on the POWER4
29957 processor and other processors that support the PowerPC V2.01
29958 architecture.
29959 The @option{-mpopcntb} option allows GCC to generate the popcount and
29960 double-precision FP reciprocal estimate instruction implemented on the
29961 POWER5 processor and other processors that support the PowerPC V2.02
29962 architecture.
29963 The @option{-mpopcntd} option allows GCC to generate the popcount
29964 instruction implemented on the POWER7 processor and other processors
29965 that support the PowerPC V2.06 architecture.
29966 The @option{-mfprnd} option allows GCC to generate the FP round to
29967 integer instructions implemented on the POWER5+ processor and other
29968 processors that support the PowerPC V2.03 architecture.
29969 The @option{-mcmpb} option allows GCC to generate the compare bytes
29970 instruction implemented on the POWER6 processor and other processors
29971 that support the PowerPC V2.05 architecture.
29972 The @option{-mhard-dfp} option allows GCC to generate the decimal
29973 floating-point instructions implemented on some POWER processors.
29975 The @option{-mpowerpc64} option allows GCC to generate the additional
29976 64-bit instructions that are found in the full PowerPC64 architecture
29977 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
29978 @option{-mno-powerpc64}.
29980 @opindex mcpu
29981 @item -mcpu=@var{cpu_type}
29982 Set architecture type, register usage, and
29983 instruction scheduling parameters for machine type @var{cpu_type}.
29984 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29985 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29986 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29987 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29988 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29989 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29990 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29991 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29992 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29993 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29994 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29995 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29997 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29998 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29999 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
30000 architecture machine types, with an appropriate, generic processor
30001 model assumed for scheduling purposes.
30003 Specifying @samp{native} as cpu type detects and selects the
30004 architecture option that corresponds to the host processor of the
30005 system performing the compilation.
30006 @option{-mcpu=native} has no effect if GCC does not recognize the
30007 processor.
30009 The other options specify a specific processor.  Code generated under
30010 those options runs best on that processor, and may not run at all on
30011 others.
30013 The @option{-mcpu} options automatically enable or disable the
30014 following options:
30016 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
30017 -mpopcntb  -mpopcntd  -mpowerpc64
30018 -mpowerpc-gpopt  -mpowerpc-gfxopt
30019 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
30020 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector
30021 -mquad-memory  -mquad-memory-atomic  -mfloat128
30022 -mfloat128-hardware -mprefixed -mpcrel -mmma
30023 -mrop-protect}
30025 The particular options set for any particular CPU varies between
30026 compiler versions, depending on what setting seems to produce optimal
30027 code for that CPU; it doesn't necessarily reflect the actual hardware's
30028 capabilities.  If you wish to set an individual option to a particular
30029 value, you may specify it after the @option{-mcpu} option, like
30030 @option{-mcpu=970 -mno-altivec}.
30032 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
30033 not enabled or disabled by the @option{-mcpu} option at present because
30034 AIX does not have full support for these options.  You may still
30035 enable or disable them individually if you're sure it'll work in your
30036 environment.
30038 @opindex mtune
30039 @item -mtune=@var{cpu_type}
30040 Set the instruction scheduling parameters for machine type
30041 @var{cpu_type}, but do not set the architecture type or register usage,
30042 as @option{-mcpu=@var{cpu_type}} does.  The same
30043 values for @var{cpu_type} are used for @option{-mtune} as for
30044 @option{-mcpu}.  If both are specified, the code generated uses the
30045 architecture and registers set by @option{-mcpu}, but the
30046 scheduling parameters set by @option{-mtune}.
30048 @opindex mcmodel=small
30049 @item -mcmodel=small
30050 Generate PowerPC64 code for the small model: The TOC is limited to
30051 64k.
30053 @opindex mcmodel=medium
30054 @item -mcmodel=medium
30055 Generate PowerPC64 code for the medium model: The TOC and other static
30056 data may be up to a total of 4G in size.  This is the default for 64-bit
30057 Linux.
30059 @opindex mcmodel=large
30060 @item -mcmodel=large
30061 Generate PowerPC64 code for the large model: The TOC may be up to 4G
30062 in size.  Other data and code is only limited by the 64-bit address
30063 space.
30065 @opindex maltivec
30066 @opindex mno-altivec
30067 @item -maltivec
30068 @itemx -mno-altivec
30069 Generate code that uses (does not use) AltiVec instructions, and also
30070 enable the use of built-in functions that allow more direct access to
30071 the AltiVec instruction set.  You may also need to set
30072 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
30073 enhancements.
30075 When @option{-maltivec} is used, the element order for AltiVec intrinsics
30076 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
30077 match array element order corresponding to the endianness of the
30078 target.  That is, element zero identifies the leftmost element in a
30079 vector register when targeting a big-endian platform, and identifies
30080 the rightmost element in a vector register when targeting a
30081 little-endian platform.
30083 @opindex mvrsave
30084 @opindex mno-vrsave
30085 @item -mvrsave
30086 @itemx -mno-vrsave
30087 Generate VRSAVE instructions when generating AltiVec code.
30089 @opindex msecure-plt
30090 @item -msecure-plt
30091 Generate code that allows @command{ld} and @command{ld.so}
30092 to build executables and shared
30093 libraries with non-executable @code{.plt} and @code{.got} sections.
30094 This is a PowerPC
30095 32-bit SYSV ABI option.
30097 @opindex mbss-plt
30098 @item -mbss-plt
30099 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
30100 fills in, and
30101 requires @code{.plt} and @code{.got}
30102 sections that are both writable and executable.
30103 This is a PowerPC 32-bit SYSV ABI option.
30105 @opindex misel
30106 @opindex mno-isel
30107 @item -misel
30108 @itemx -mno-isel
30109 This switch enables or disables the generation of ISEL instructions.
30111 @opindex mvsx
30112 @opindex mno-vsx
30113 @item -mvsx
30114 @itemx -mno-vsx
30115 Generate code that uses (does not use) vector/scalar (VSX)
30116 instructions, and also enable the use of built-in functions that allow
30117 more direct access to the VSX instruction set.
30119 @opindex mcrypto
30120 @opindex mno-crypto
30121 @item -mcrypto
30122 @itemx -mno-crypto
30123 Enable the use (disable) of the built-in functions that allow direct
30124 access to the cryptographic instructions that were added in version
30125 2.07 of the PowerPC ISA.
30127 @opindex mhtm
30128 @opindex mno-htm
30129 @item -mhtm
30130 @itemx -mno-htm
30131 Enable (disable) the use of the built-in functions that allow direct
30132 access to the Hardware Transactional Memory (HTM) instructions that
30133 were added in version 2.07 of the PowerPC ISA.
30135 @opindex mpower8-fusion
30136 @opindex mno-power8-fusion
30137 @item -mpower8-fusion
30138 @itemx -mno-power8-fusion
30139 Generate code that keeps (does not keeps) some integer operations
30140 adjacent so that the instructions can be fused together on power8 and
30141 later processors.
30143 @opindex mpower8-vector
30144 @opindex mno-power8-vector
30145 @item -mpower8-vector
30146 @itemx -mno-power8-vector
30147 Generate code that uses (does not use) the vector and scalar
30148 instructions that were added in version 2.07 of the PowerPC ISA.  Also
30149 enable the use of built-in functions that allow more direct access to
30150 the vector instructions.
30152 @opindex mquad-memory
30153 @opindex mno-quad-memory
30154 @item -mquad-memory
30155 @itemx -mno-quad-memory
30156 Generate code that uses (does not use) the non-atomic quad word memory
30157 instructions.  The @option{-mquad-memory} option requires use of
30158 64-bit mode.
30160 @opindex mquad-memory-atomic
30161 @opindex mno-quad-memory-atomic
30162 @item -mquad-memory-atomic
30163 @itemx -mno-quad-memory-atomic
30164 Generate code that uses (does not use) the atomic quad word memory
30165 instructions.  The @option{-mquad-memory-atomic} option requires use of
30166 64-bit mode.
30168 @opindex mfloat128
30169 @opindex mno-float128
30170 @item -mfloat128
30171 @itemx -mno-float128
30172 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
30173 and use either software emulation for IEEE 128-bit floating point or
30174 hardware instructions.
30176 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
30177 128-bit floating point support.  The IEEE 128-bit floating point is only
30178 supported on Linux.
30180 The default for @option{-mfloat128} is enabled on PowerPC Linux
30181 systems using the VSX instruction set, and disabled on other systems.
30183 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
30184 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
30185 point support will also enable the generation of ISA 3.0 IEEE 128-bit
30186 floating point instructions.  Otherwise, if you do not specify to
30187 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
30188 system, IEEE 128-bit floating point will be done with software
30189 emulation.
30191 @opindex mfloat128-hardware
30192 @opindex mno-float128-hardware
30193 @item -mfloat128-hardware
30194 @itemx -mno-float128-hardware
30195 Enable/disable using ISA 3.0 hardware instructions to support the
30196 @var{__float128} data type.
30198 The default for @option{-mfloat128-hardware} is enabled on PowerPC
30199 Linux systems using the ISA 3.0 instruction set, and disabled on other
30200 systems.
30202 @opindex m32
30203 @opindex m64
30204 @item -m32
30205 @itemx -m64
30206 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
30207 targets (including GNU/Linux).  The 32-bit environment sets int, long
30208 and pointer to 32 bits and generates code that runs on any PowerPC
30209 variant.  The 64-bit environment sets int to 32 bits and long and
30210 pointer to 64 bits, and generates code for PowerPC64, as for
30211 @option{-mpowerpc64}.
30213 @opindex mfull-toc
30214 @opindex mno-fp-in-toc
30215 @opindex mno-sum-in-toc
30216 @opindex mminimal-toc
30217 @item -mfull-toc
30218 @itemx -mno-fp-in-toc
30219 @itemx -mno-sum-in-toc
30220 @itemx -mminimal-toc
30221 Modify generation of the TOC (Table Of Contents), which is created for
30222 every executable file.  The @option{-mfull-toc} option is selected by
30223 default.  In that case, GCC allocates at least one TOC entry for
30224 each unique non-automatic variable reference in your program.  GCC
30225 also places floating-point constants in the TOC@.  However, only
30226 16,384 entries are available in the TOC@.
30228 If you receive a linker error message that saying you have overflowed
30229 the available TOC space, you can reduce the amount of TOC space used
30230 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
30231 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
30232 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
30233 generate code to calculate the sum of an address and a constant at
30234 run time instead of putting that sum into the TOC@.  You may specify one
30235 or both of these options.  Each causes GCC to produce very slightly
30236 slower and larger code at the expense of conserving TOC space.
30238 If you still run out of space in the TOC even when you specify both of
30239 these options, specify @option{-mminimal-toc} instead.  This option causes
30240 GCC to make only one TOC entry for every file.  When you specify this
30241 option, GCC produces code that is slower and larger but which
30242 uses extremely little TOC space.  You may wish to use this option
30243 only on files that contain less frequently-executed code.
30245 @opindex maix64
30246 @opindex maix32
30247 @item -maix64
30248 @itemx -maix32
30249 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
30250 @code{long} type, and the infrastructure needed to support them.
30251 Specifying @option{-maix64} implies @option{-mpowerpc64},
30252 while @option{-maix32} disables the 64-bit ABI and
30253 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
30255 @opindex mxl-compat
30256 @opindex mno-xl-compat
30257 @item -mxl-compat
30258 @itemx -mno-xl-compat
30259 Produce code that conforms more closely to IBM XL compiler semantics
30260 when using AIX-compatible ABI@.  Pass floating-point arguments to
30261 prototyped functions beyond the register save area (RSA) on the stack
30262 in addition to argument FPRs.  Do not assume that most significant
30263 double in 128-bit long double value is properly rounded when comparing
30264 values and converting to double.  Use XL symbol names for long double
30265 support routines.
30267 The AIX calling convention was extended but not initially documented to
30268 handle an obscure K&R C case of calling a function that takes the
30269 address of its arguments with fewer arguments than declared.  IBM XL
30270 compilers access floating-point arguments that do not fit in the
30271 RSA from the stack when a subroutine is compiled without
30272 optimization.  Because always storing floating-point arguments on the
30273 stack is inefficient and rarely needed, this option is not enabled by
30274 default and only is necessary when calling subroutines compiled by IBM
30275 XL compilers without optimization.
30277 @opindex mpe
30278 @item -mpe
30279 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
30280 application written to use message passing with special startup code to
30281 enable the application to run.  The system must have PE installed in the
30282 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
30283 must be overridden with the @option{-specs=} option to specify the
30284 appropriate directory location.  The Parallel Environment does not
30285 support threads, so the @option{-mpe} option and the @option{-pthread}
30286 option are incompatible.
30288 @opindex malign-natural
30289 @opindex malign-power
30290 @item -malign-natural
30291 @itemx -malign-power
30292 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
30293 @option{-malign-natural} overrides the ABI-defined alignment of larger
30294 types, such as floating-point doubles, on their natural size-based boundary.
30295 The option @option{-malign-power} instructs GCC to follow the ABI-specified
30296 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
30298 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
30299 is not supported.
30301 @opindex msoft-float
30302 @opindex mhard-float
30303 @item -msoft-float
30304 @itemx -mhard-float
30305 Generate code that does not use (uses) the floating-point register set.
30306 Software floating-point emulation is provided if you use the
30307 @option{-msoft-float} option, and pass the option to GCC when linking.
30309 @opindex mmultiple
30310 @opindex mno-multiple
30311 @item -mmultiple
30312 @itemx -mno-multiple
30313 Generate code that uses (does not use) the load multiple word
30314 instructions and the store multiple word instructions.  These
30315 instructions are generated by default on POWER systems, and not
30316 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
30317 PowerPC systems, since those instructions do not work when the
30318 processor is in little-endian mode.  The exceptions are PPC740 and
30319 PPC750 which permit these instructions in little-endian mode.
30321 @opindex mupdate
30322 @opindex mno-update
30323 @item -mupdate
30324 @itemx -mno-update
30325 Generate code that uses (does not use) the load or store instructions
30326 that update the base register to the address of the calculated memory
30327 location.  These instructions are generated by default.  If you use
30328 @option{-mno-update}, there is a small window between the time that the
30329 stack pointer is updated and the address of the previous frame is
30330 stored, which means code that walks the stack frame across interrupts or
30331 signals may get corrupted data.
30333 @opindex mavoid-indexed-addresses
30334 @opindex mno-avoid-indexed-addresses
30335 @item -mavoid-indexed-addresses
30336 @itemx -mno-avoid-indexed-addresses
30337 Generate code that tries to avoid (not avoid) the use of indexed load
30338 or store instructions. These instructions can incur a performance
30339 penalty on Power6 processors in certain situations, such as when
30340 stepping through large arrays that cross a 16M boundary.  This option
30341 is enabled by default when targeting Power6 and disabled otherwise.
30343 @opindex mfused-madd
30344 @opindex mno-fused-madd
30345 @item -mfused-madd
30346 @itemx -mno-fused-madd
30347 Generate code that uses (does not use) the floating-point multiply and
30348 accumulate instructions.  These instructions are generated by default
30349 if hardware floating point is used.  The machine-dependent
30350 @option{-mfused-madd} option is now mapped to the machine-independent
30351 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
30352 mapped to @option{-ffp-contract=off}.
30354 @opindex mmulhw
30355 @opindex mno-mulhw
30356 @item -mmulhw
30357 @itemx -mno-mulhw
30358 Generate code that uses (does not use) the half-word multiply and
30359 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
30360 These instructions are generated by default when targeting those
30361 processors.
30363 @opindex mdlmzb
30364 @opindex mno-dlmzb
30365 @item -mdlmzb
30366 @itemx -mno-dlmzb
30367 Generate code that uses (does not use) the string-search @samp{dlmzb}
30368 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
30369 generated by default when targeting those processors.
30371 @opindex mno-bit-align
30372 @opindex mbit-align
30373 @item -mno-bit-align
30374 @itemx -mbit-align
30375 On System V.4 and embedded PowerPC systems do not (do) force structures
30376 and unions that contain bit-fields to be aligned to the base type of the
30377 bit-field.
30379 For example, by default a structure containing nothing but 8
30380 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
30381 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
30382 the structure is aligned to a 1-byte boundary and is 1 byte in
30383 size.
30385 @opindex mno-strict-align
30386 @opindex mstrict-align
30387 @item -mno-strict-align
30388 @itemx -mstrict-align
30389 On System V.4 and embedded PowerPC systems do not (do) assume that
30390 unaligned memory references are handled by the system.
30392 @opindex mrelocatable
30393 @opindex mno-relocatable
30394 @item -mrelocatable
30395 @itemx -mno-relocatable
30396 Generate code that allows (does not allow) a static executable to be
30397 relocated to a different address at run time.  A simple embedded
30398 PowerPC system loader should relocate the entire contents of
30399 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
30400 a table of 32-bit addresses generated by this option.  For this to
30401 work, all objects linked together must be compiled with
30402 @option{-mrelocatable} or @option{-mrelocatable-lib}.
30403 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
30405 @opindex mrelocatable-lib
30406 @opindex mno-relocatable-lib
30407 @item -mrelocatable-lib
30408 @itemx -mno-relocatable-lib
30409 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
30410 @code{.fixup} section to allow static executables to be relocated at
30411 run time, but @option{-mrelocatable-lib} does not use the smaller stack
30412 alignment of @option{-mrelocatable}.  Objects compiled with
30413 @option{-mrelocatable-lib} may be linked with objects compiled with
30414 any combination of the @option{-mrelocatable} options.
30416 @opindex mno-toc
30417 @opindex mtoc
30418 @item -mno-toc
30419 @itemx -mtoc
30420 On System V.4 and embedded PowerPC systems do not (do) assume that
30421 register 2 contains a pointer to a global area pointing to the addresses
30422 used in the program.
30424 @opindex mlittle
30425 @opindex mlittle-endian
30426 @item -mlittle
30427 @itemx -mlittle-endian
30428 On System V.4 and embedded PowerPC systems compile code for the
30429 processor in little-endian mode.  The @option{-mlittle-endian} option is
30430 the same as @option{-mlittle}.
30432 @opindex mbig
30433 @opindex mbig-endian
30434 @item -mbig
30435 @itemx -mbig-endian
30436 On System V.4 and embedded PowerPC systems compile code for the
30437 processor in big-endian mode.  The @option{-mbig-endian} option is
30438 the same as @option{-mbig}.
30440 @opindex mdynamic-no-pic
30441 @item -mdynamic-no-pic
30442 On Darwin / macOS systems, compile code so that it is not
30443 relocatable, but that its external references are relocatable.  The
30444 resulting code is suitable for applications, but not shared
30445 libraries.
30447 @opindex msingle-pic-base
30448 @item -msingle-pic-base
30449 Treat the register used for PIC addressing as read-only, rather than
30450 loading it in the prologue for each function.  The runtime system is
30451 responsible for initializing this register with an appropriate value
30452 before execution begins.
30454 @opindex mprioritize-restricted-insns
30455 @item -mprioritize-restricted-insns=@var{priority}
30456 This option controls the priority that is assigned to
30457 dispatch-slot restricted instructions during the second scheduling
30458 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
30459 or @samp{2} to assign no, highest, or second-highest (respectively) 
30460 priority to dispatch-slot restricted
30461 instructions.
30463 @opindex msched-costly-dep
30464 @item -msched-costly-dep=@var{dependence_type}
30465 This option controls which dependences are considered costly
30466 by the target during instruction scheduling.  The argument
30467 @var{dependence_type} takes one of the following values:
30469 @table @asis
30470 @item @samp{no}
30471 No dependence is costly.
30473 @item @samp{all}
30474 All dependences are costly.
30476 @item @samp{true_store_to_load}
30477 A true dependence from store to load is costly.
30479 @item @samp{store_to_load}
30480 Any dependence from store to load is costly.
30482 @item @var{number}
30483 Any dependence for which the latency is greater than or equal to 
30484 @var{number} is costly.
30485 @end table
30487 @opindex minsert-sched-nops
30488 @item -minsert-sched-nops=@var{scheme}
30489 This option controls which NOP insertion scheme is used during
30490 the second scheduling pass.  The argument @var{scheme} takes one of the
30491 following values:
30493 @table @asis
30494 @item @samp{no}
30495 Don't insert NOPs.
30497 @item @samp{pad}
30498 Pad with NOPs any dispatch group that has vacant issue slots,
30499 according to the scheduler's grouping.
30501 @item @samp{regroup_exact}
30502 Insert NOPs to force costly dependent insns into
30503 separate groups.  Insert exactly as many NOPs as needed to force an insn
30504 to a new group, according to the estimated processor grouping.
30506 @item @var{number}
30507 Insert NOPs to force costly dependent insns into
30508 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
30509 @end table
30511 @opindex mcall-sysv
30512 @item -mcall-sysv
30513 On System V.4 and embedded PowerPC systems compile code using calling
30514 conventions that adhere to the March 1995 draft of the System V
30515 Application Binary Interface, PowerPC processor supplement.  This is the
30516 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
30518 @opindex mcall-sysv-eabi
30519 @opindex mcall-eabi
30520 @item -mcall-sysv-eabi
30521 @itemx -mcall-eabi
30522 Specify both @option{-mcall-sysv} and @option{-meabi} options.
30524 @opindex mcall-sysv-noeabi
30525 @item -mcall-sysv-noeabi
30526 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
30528 @opindex mcall-aixdesc
30529 @item -mcall-aixdesc
30530 On System V.4 and embedded PowerPC systems compile code for the AIX
30531 operating system.
30533 @opindex mcall-linux
30534 @item -mcall-linux
30535 On System V.4 and embedded PowerPC systems compile code for the
30536 Linux-based GNU system.
30538 @opindex mcall-freebsd
30539 @item -mcall-freebsd
30540 On System V.4 and embedded PowerPC systems compile code for the
30541 FreeBSD operating system.
30543 @opindex mcall-netbsd
30544 @item -mcall-netbsd
30545 On System V.4 and embedded PowerPC systems compile code for the
30546 NetBSD operating system.
30548 @opindex mcall-openbsd
30549 @item -mcall-openbsd
30550 On System V.4 and embedded PowerPC systems compile code for the
30551 OpenBSD operating system.
30553 @opindex mtraceback
30554 @item -mtraceback=@var{traceback_type}
30555 Select the type of traceback table. Valid values for @var{traceback_type}
30556 are @samp{full}, @samp{part}, and @samp{no}.
30558 @opindex maix-struct-return
30559 @item -maix-struct-return
30560 Return all structures in memory (as specified by the AIX ABI)@.
30562 @opindex msvr4-struct-return
30563 @item -msvr4-struct-return
30564 Return structures smaller than 8 bytes in registers (as specified by the
30565 SVR4 ABI)@.
30567 @opindex mabi
30568 @item -mabi=@var{abi-type}
30569 Extend the current ABI with a particular extension, or remove such extension.
30570 Valid values are: @samp{altivec}, @samp{no-altivec},
30571 @samp{ibmlongdouble}, @samp{ieeelongdouble},
30572 @samp{elfv1}, @samp{elfv2},
30573 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
30575 @opindex mabi=ibmlongdouble
30576 @item -mabi=ibmlongdouble
30577 Change the current ABI to use IBM extended-precision long double.
30578 This is not likely to work if your system defaults to using IEEE
30579 extended-precision long double.  If you change the long double type
30580 from IEEE extended-precision, the compiler will issue a warning unless
30581 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30582 to be enabled.
30584 @opindex mabi=ieeelongdouble
30585 @item -mabi=ieeelongdouble
30586 Change the current ABI to use IEEE extended-precision long double.
30587 This is not likely to work if your system defaults to using IBM
30588 extended-precision long double.  If you change the long double type
30589 from IBM extended-precision, the compiler will issue a warning unless
30590 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30591 to be enabled.
30593 @opindex mabi=elfv1
30594 @item -mabi=elfv1
30595 Change the current ABI to use the ELFv1 ABI.
30596 This is the default ABI for big-endian PowerPC 64-bit Linux.
30597 Overriding the default ABI requires special system support and is
30598 likely to fail in spectacular ways.
30600 @opindex mabi=elfv2
30601 @item -mabi=elfv2
30602 Change the current ABI to use the ELFv2 ABI.
30603 This is the default ABI for little-endian PowerPC 64-bit Linux.
30604 Overriding the default ABI requires special system support and is
30605 likely to fail in spectacular ways.
30607 @opindex mgnu-attribute
30608 @opindex mno-gnu-attribute
30609 @item -mgnu-attribute
30610 @itemx -mno-gnu-attribute
30611 Emit .gnu_attribute assembly directives to set tag/value pairs in a
30612 .gnu.attributes section that specify ABI variations in function
30613 parameters or return values.
30615 @opindex mprototype
30616 @opindex mno-prototype
30617 @item -mprototype
30618 @itemx -mno-prototype
30619 On System V.4 and embedded PowerPC systems assume that all calls to
30620 variable argument functions are properly prototyped.  Otherwise, the
30621 compiler must insert an instruction before every non-prototyped call to
30622 set or clear bit 6 of the condition code register (@code{CR}) to
30623 indicate whether floating-point values are passed in the floating-point
30624 registers in case the function takes variable arguments.  With
30625 @option{-mprototype}, only calls to prototyped variable argument functions
30626 set or clear the bit.
30628 @opindex msim
30629 @item -msim
30630 On embedded PowerPC systems, assume that the startup module is called
30631 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
30632 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
30633 configurations.
30635 @opindex mmvme
30636 @item -mmvme
30637 On embedded PowerPC systems, assume that the startup module is called
30638 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
30639 @file{libc.a}.
30641 @opindex mads
30642 @item -mads
30643 On embedded PowerPC systems, assume that the startup module is called
30644 @file{crt0.o} and the standard C libraries are @file{libads.a} and
30645 @file{libc.a}.
30647 @opindex myellowknife
30648 @item -myellowknife
30649 On embedded PowerPC systems, assume that the startup module is called
30650 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
30651 @file{libc.a}.
30653 @opindex mvxworks
30654 @item -mvxworks
30655 On System V.4 and embedded PowerPC systems, specify that you are
30656 compiling for a VxWorks system.
30658 @opindex memb
30659 @item -memb
30660 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
30661 header to indicate that @samp{eabi} extended relocations are used.
30663 @opindex meabi
30664 @opindex mno-eabi
30665 @item -meabi
30666 @itemx -mno-eabi
30667 On System V.4 and embedded PowerPC systems do (do not) adhere to the
30668 Embedded Applications Binary Interface (EABI), which is a set of
30669 modifications to the System V.4 specifications.  Selecting @option{-meabi}
30670 means that the stack is aligned to an 8-byte boundary, a function
30671 @code{__eabi} is called from @code{main} to set up the EABI
30672 environment, and the @option{-msdata} option can use both @code{r2} and
30673 @code{r13} to point to two separate small data areas.  Selecting
30674 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
30675 no EABI initialization function is called from @code{main}, and the
30676 @option{-msdata} option only uses @code{r13} to point to a single
30677 small data area.  The @option{-meabi} option is on by default if you
30678 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
30680 @opindex msdata=eabi
30681 @item -msdata=eabi
30682 On System V.4 and embedded PowerPC systems, put small initialized
30683 @code{const} global and static data in the @code{.sdata2} section, which
30684 is pointed to by register @code{r2}.  Put small initialized
30685 non-@code{const} global and static data in the @code{.sdata} section,
30686 which is pointed to by register @code{r13}.  Put small uninitialized
30687 global and static data in the @code{.sbss} section, which is adjacent to
30688 the @code{.sdata} section.  The @option{-msdata=eabi} option is
30689 incompatible with the @option{-mrelocatable} option.  The
30690 @option{-msdata=eabi} option also sets the @option{-memb} option.
30692 @opindex msdata=sysv
30693 @item -msdata=sysv
30694 On System V.4 and embedded PowerPC systems, put small global and static
30695 data in the @code{.sdata} section, which is pointed to by register
30696 @code{r13}.  Put small uninitialized global and static data in the
30697 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
30698 The @option{-msdata=sysv} option is incompatible with the
30699 @option{-mrelocatable} option.
30701 @opindex msdata=default
30702 @opindex msdata
30703 @item -msdata=default
30704 @itemx -msdata
30705 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
30706 compile code the same as @option{-msdata=eabi}, otherwise compile code the
30707 same as @option{-msdata=sysv}.
30709 @opindex msdata=data
30710 @item -msdata=data
30711 On System V.4 and embedded PowerPC systems, put small global
30712 data in the @code{.sdata} section.  Put small uninitialized global
30713 data in the @code{.sbss} section.  Do not use register @code{r13}
30714 to address small data however.  This is the default behavior unless
30715 other @option{-msdata} options are used.
30717 @opindex msdata=none
30718 @opindex mno-sdata
30719 @item -msdata=none
30720 @itemx -mno-sdata
30721 On embedded PowerPC systems, put all initialized global and static data
30722 in the @code{.data} section, and all uninitialized data in the
30723 @code{.bss} section.
30725 @opindex mreadonly-in-sdata
30726 @opindex mno-readonly-in-sdata
30727 @item -mreadonly-in-sdata
30728 Put read-only objects in the @code{.sdata} section as well.  This is the
30729 default.
30731 @opindex mblock-move-inline-limit
30732 @item -mblock-move-inline-limit=@var{num}
30733 Inline all block moves (such as calls to @code{memcpy} or structure
30734 copies) less than or equal to @var{num} bytes.  The minimum value for
30735 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
30736 targets.  The default value is target-specific.
30738 @opindex mblock-compare-inline-limit
30739 @item -mblock-compare-inline-limit=@var{num}
30740 Generate non-looping inline code for all block compares (such as calls
30741 to @code{memcmp} or structure compares) less than or equal to @var{num}
30742 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
30743 block compare is disabled. The default value is target-specific.
30745 @opindex mblock-compare-inline-loop-limit
30746 @item -mblock-compare-inline-loop-limit=@var{num}
30747 Generate an inline expansion using loop code for all block compares that
30748 are less than or equal to @var{num} bytes, but greater than the limit
30749 for non-loop inline block compare expansion. If the block length is not
30750 constant, at most @var{num} bytes will be compared before @code{memcmp}
30751 is called to compare the remainder of the block. The default value is
30752 target-specific.
30754 @opindex mstring-compare-inline-limit
30755 @item -mstring-compare-inline-limit=@var{num}
30756 Compare at most @var{num} string bytes with inline code.
30757 If the difference or end of string is not found at the
30758 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
30759 take care of the rest of the comparison. The default is 64 bytes.
30761 @opindex G
30762 @cindex smaller data references (PowerPC)
30763 @cindex .sdata/.sdata2 references (PowerPC)
30764 @item -G @var{num}
30765 On embedded PowerPC systems, put global and static items less than or
30766 equal to @var{num} bytes into the small data or BSS sections instead of
30767 the normal data or BSS section.  By default, @var{num} is 8.  The
30768 @option{-G @var{num}} switch is also passed to the linker.
30769 All modules should be compiled with the same @option{-G @var{num}} value.
30771 @opindex mregnames
30772 @opindex mno-regnames
30773 @item -mregnames
30774 @itemx -mno-regnames
30775 On System V.4 and embedded PowerPC systems do (do not) emit register
30776 names in the assembly language output using symbolic forms.
30778 @opindex mlongcall
30779 @opindex mno-longcall
30780 @item -mlongcall
30781 @itemx -mno-longcall
30782 By default assume that all calls are far away so that a longer and more
30783 expensive calling sequence is required.  This is required for calls
30784 farther than 32 megabytes (33,554,432 bytes) from the current location.
30785 A short call is generated if the compiler knows
30786 the call cannot be that far away.  This setting can be overridden by
30787 the @code{shortcall} function attribute, or by @code{#pragma
30788 longcall(0)}.
30790 Some linkers are capable of detecting out-of-range calls and generating
30791 glue code on the fly.  On these systems, long calls are unnecessary and
30792 generate slower code.  As of this writing, the AIX linker can do this,
30793 as can the GNU linker for PowerPC/64.  It is planned to add this feature
30794 to the GNU linker for 32-bit PowerPC systems as well.
30796 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
30797 GCC can generate long calls using an inline PLT call sequence (see
30798 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
30799 ELFv1 (big-endian) do not support inline PLT calls.
30801 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
30802 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
30803 addresses represent the callee and the branch island.  The
30804 Darwin/PPC linker prefers the first address and generates a @code{bl
30805 callee} if the PPC @code{bl} instruction reaches the callee directly;
30806 otherwise, the linker generates @code{bl L42} to call the branch
30807 island.  The branch island is appended to the body of the
30808 calling function; it computes the full 32-bit address of the callee
30809 and jumps to it.
30811 On Mach-O (Darwin) systems, this option directs the compiler emit to
30812 the glue for every direct call, and the Darwin linker decides whether
30813 to use or discard it.
30815 In the future, GCC may ignore all longcall specifications
30816 when the linker is known to generate glue.
30818 @opindex mpltseq
30819 @opindex mno-pltseq
30820 @item -mpltseq
30821 @itemx -mno-pltseq
30822 Implement (do not implement) -fno-plt and long calls using an inline
30823 PLT call sequence that supports lazy linking and long calls to
30824 functions in dlopen'd shared libraries.  Inline PLT calls are only
30825 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
30826 linkers, and are enabled by default if the support is detected when
30827 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
30828 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
30829 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
30830 linked together.
30832 @opindex mtls-markers
30833 @opindex mno-tls-markers
30834 @item -mtls-markers
30835 @itemx -mno-tls-markers
30836 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
30837 specifying the function argument.  The relocation allows the linker to
30838 reliably associate function call with argument setup instructions for
30839 TLS optimization, which in turn allows GCC to better schedule the
30840 sequence.
30842 @opindex mrecip
30843 @item -mrecip
30844 @itemx -mno-recip
30845 This option enables use of the reciprocal estimate and
30846 reciprocal square root estimate instructions with additional
30847 Newton-Raphson steps to increase precision instead of doing a divide or
30848 square root and divide for floating-point arguments.  You should use
30849 the @option{-ffast-math} option when using @option{-mrecip} (or at
30850 least @option{-funsafe-math-optimizations},
30851 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30852 @option{-fno-trapping-math}).  Note that while the throughput of the
30853 sequence is generally higher than the throughput of the non-reciprocal
30854 instruction, the precision of the sequence can be decreased by up to 2
30855 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30856 roots.
30858 @opindex mrecip=opt
30859 @item -mrecip=@var{opt}
30860 This option controls which reciprocal estimate instructions
30861 may be used.  @var{opt} is a comma-separated list of options, which may
30862 be preceded by a @code{!} to invert the option:
30864 @table @samp
30866 @item all
30867 Enable all estimate instructions.
30869 @item default 
30870 Enable the default instructions, equivalent to @option{-mrecip}.
30872 @item none 
30873 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30875 @item div 
30876 Enable the reciprocal approximation instructions for both 
30877 single and double precision.
30879 @item divf 
30880 Enable the single-precision reciprocal approximation instructions.
30882 @item divd 
30883 Enable the double-precision reciprocal approximation instructions.
30885 @item rsqrt 
30886 Enable the reciprocal square root approximation instructions for both
30887 single and double precision.
30889 @item rsqrtf 
30890 Enable the single-precision reciprocal square root approximation instructions.
30892 @item rsqrtd 
30893 Enable the double-precision reciprocal square root approximation instructions.
30895 @end table
30897 So, for example, @option{-mrecip=all,!rsqrtd} enables
30898 all of the reciprocal estimate instructions, except for the
30899 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30900 which handle the double-precision reciprocal square root calculations.
30902 @opindex mrecip-precision
30903 @item -mrecip-precision
30904 @itemx -mno-recip-precision
30905 Assume (do not assume) that the reciprocal estimate instructions
30906 provide higher-precision estimates than is mandated by the PowerPC
30907 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30908 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30909 The double-precision square root estimate instructions are not generated by
30910 default on low-precision machines, since they do not provide an
30911 estimate that converges after three steps.
30913 @opindex mveclibabi
30914 @item -mveclibabi=@var{type}
30915 Specifies the ABI type to use for vectorizing intrinsics using an
30916 external library.  The only type supported at present is @samp{mass},
30917 which specifies to use IBM's Mathematical Acceleration Subsystem
30918 (MASS) libraries for vectorizing intrinsics using external libraries.
30919 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30920 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30921 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30922 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30923 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30924 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30925 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30926 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30927 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30928 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30929 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30930 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30931 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30932 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30933 for power7.  Both @option{-ftree-vectorize} and
30934 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
30935 libraries must be specified at link time.
30937 @opindex mfriz
30938 @item -mfriz
30939 @itemx -mno-friz
30940 Generate (do not generate) the @code{friz} instruction when the
30941 @option{-funsafe-math-optimizations} option is used to optimize
30942 rounding of floating-point values to 64-bit integer and back to floating
30943 point.  The @code{friz} instruction does not return the same value if
30944 the floating-point number is too large to fit in an integer.
30946 @opindex mpointers-to-nested-functions
30947 @item -mpointers-to-nested-functions
30948 @itemx -mno-pointers-to-nested-functions
30949 Generate (do not generate) code to load up the static chain register
30950 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30951 systems where a function pointer points to a 3-word descriptor giving
30952 the function address, TOC value to be loaded in register @code{r2}, and
30953 static chain value to be loaded in register @code{r11}.  The
30954 @option{-mpointers-to-nested-functions} is on by default.  You cannot
30955 call through pointers to nested functions or pointers
30956 to functions compiled in other languages that use the static chain if
30957 you use @option{-mno-pointers-to-nested-functions}.
30959 @opindex msave-toc-indirect
30960 @item -msave-toc-indirect
30961 @itemx -mno-save-toc-indirect
30962 Generate (do not generate) code to save the TOC value in the reserved
30963 stack location in the function prologue if the function calls through
30964 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
30965 saved in the prologue, it is saved just before the call through the
30966 pointer.  The @option{-mno-save-toc-indirect} option is the default.
30968 @opindex mcompat-align-parm
30969 @item -mcompat-align-parm
30970 @itemx -mno-compat-align-parm
30971 Generate (do not generate) code to pass structure parameters with a
30972 maximum alignment of 64 bits, for compatibility with older versions
30973 of GCC.
30975 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30976 structure parameter on a 128-bit boundary when that structure contained
30977 a member requiring 128-bit alignment.  This is corrected in more
30978 recent versions of GCC.  This option may be used to generate code
30979 that is compatible with functions compiled with older versions of
30980 GCC.
30982 The @option{-mno-compat-align-parm} option is the default.
30984 @opindex mstack-protector-guard
30985 @opindex mstack-protector-guard-reg
30986 @opindex mstack-protector-guard-offset
30987 @opindex mstack-protector-guard-symbol
30988 @item -mstack-protector-guard=@var{guard}
30989 @itemx -mstack-protector-guard-reg=@var{reg}
30990 @itemx -mstack-protector-guard-offset=@var{offset}
30991 @itemx -mstack-protector-guard-symbol=@var{symbol}
30992 Generate stack protection code using canary at @var{guard}.  Supported
30993 locations are @samp{global} for global canary or @samp{tls} for per-thread
30994 canary in the TLS block (the default with GNU libc version 2.4 or later).
30996 With the latter choice the options
30997 @option{-mstack-protector-guard-reg=@var{reg}} and
30998 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30999 which register to use as base register for reading the canary, and from what
31000 offset from that base register. The default for those is as specified in the
31001 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
31002 the offset with a symbol reference to a canary in the TLS block.
31004 @opindex mpcrel
31005 @opindex mno-pcrel
31006 @item -mpcrel
31007 @itemx -mno-pcrel
31008 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
31009 option requires that the medium code model (@option{-mcmodel=medium})
31010 and prefixed addressing (@option{-mprefixed}) options are enabled.
31012 @opindex mprefixed
31013 @opindex mno-prefixed
31014 @item -mprefixed
31015 @itemx -mno-prefixed
31016 Generate (do not generate) addressing modes using prefixed load and
31017 store instructions.  The @option{-mprefixed} option requires that
31018 the option @option{-mcpu=power10} (or later) is enabled.
31020 @opindex mmma
31021 @opindex mno-mma
31022 @item -mmma
31023 @itemx -mno-mma
31024 Generate (do not generate) the MMA instructions.  The @option{-mma}
31025 option requires that the option @option{-mcpu=power10} (or later)
31026 is enabled.
31028 @opindex mrop-protect
31029 @opindex mno-rop-protect
31030 @item -mrop-protect
31031 @itemx -mno-rop-protect
31032 Generate (do not generate) ROP protection instructions when the target
31033 processor supports them.  Currently this option disables the shrink-wrap
31034 optimization (@option{-fshrink-wrap}).
31036 @opindex mprivileged
31037 @opindex mno-privileged
31038 @item -mprivileged
31039 @itemx -mno-privileged
31040 Generate (do not generate) code that will run in privileged state.
31042 @opindex block-ops-unaligned-vsx
31043 @opindex no-block-ops-unaligned-vsx
31044 @item -mblock-ops-unaligned-vsx
31045 @itemx -mno-block-ops-unaligned-vsx
31046 Generate (do not generate) unaligned vsx loads and stores for
31047 inline expansion of @code{memcpy} and @code{memmove}.
31049 @item --param rs6000-vect-unroll-limit=
31050 The vectorizer will check with target information to determine whether it
31051 would be beneficial to unroll the main vectorized loop and by how much.  This
31052 parameter sets the upper bound of how much the vectorizer will unroll the main
31053 loop.  The default value is four.
31055 @end table
31057 @node RX Options
31058 @subsection RX Options
31059 @cindex RX Options
31061 These command-line options are defined for RX targets:
31063 @table @gcctabopt
31064 @opindex m64bit-doubles
31065 @opindex m32bit-doubles
31066 @item -m64bit-doubles
31067 @itemx -m32bit-doubles
31068 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
31069 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
31070 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
31071 works on 32-bit values, which is why the default is
31072 @option{-m32bit-doubles}.
31074 @opindex fpu
31075 @opindex nofpu
31076 @item -fpu
31077 @itemx -nofpu
31078 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
31079 floating-point hardware.  The default is enabled for the RX600
31080 series and disabled for the RX200 series.
31082 Floating-point instructions are only generated for 32-bit floating-point 
31083 values, however, so the FPU hardware is not used for doubles if the
31084 @option{-m64bit-doubles} option is used.
31086 @emph{Note} If the @option{-fpu} option is enabled then
31087 @option{-funsafe-math-optimizations} is also enabled automatically.
31088 This is because the RX FPU instructions are themselves unsafe.
31090 @opindex mcpu
31091 @item -mcpu=@var{name}
31092 Selects the type of RX CPU to be targeted.  Currently three types are
31093 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
31094 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
31096 The only difference between @samp{RX600} and @samp{RX610} is that the
31097 @samp{RX610} does not support the @code{MVTIPL} instruction.
31099 The @samp{RX200} series does not have a hardware floating-point unit
31100 and so @option{-nofpu} is enabled by default when this type is
31101 selected.
31103 @opindex mbig-endian-data
31104 @opindex mlittle-endian-data
31105 @item -mbig-endian-data
31106 @itemx -mlittle-endian-data
31107 Store data (but not code) in the big-endian format.  The default is
31108 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
31109 format.
31111 @opindex msmall-data-limit
31112 @item -msmall-data-limit=@var{N}
31113 Specifies the maximum size in bytes of global and static variables
31114 which can be placed into the small data area.  Using the small data
31115 area can lead to smaller and faster code, but the size of area is
31116 limited and it is up to the programmer to ensure that the area does
31117 not overflow.  Also when the small data area is used one of the RX's
31118 registers (usually @code{r13}) is reserved for use pointing to this
31119 area, so it is no longer available for use by the compiler.  This
31120 could result in slower and/or larger code if variables are pushed onto
31121 the stack instead of being held in this register.
31123 Note, common variables (variables that have not been initialized) and
31124 constants are not placed into the small data area as they are assigned
31125 to other sections in the output executable.
31127 The default value is zero, which disables this feature.  Note, this
31128 feature is not enabled by default with higher optimization levels
31129 (@option{-O2} etc) because of the potentially detrimental effects of
31130 reserving a register.  It is up to the programmer to experiment and
31131 discover whether this feature is of benefit to their program.  See the
31132 description of the @option{-mpid} option for a description of how the
31133 actual register to hold the small data area pointer is chosen.
31135 @opindex msim
31136 @opindex mno-sim
31137 @item -msim
31138 @itemx -mno-sim
31139 Use the simulator runtime.  The default is to use the libgloss
31140 board-specific runtime.
31142 @opindex mas100-syntax
31143 @opindex mno-as100-syntax
31144 @item -mas100-syntax
31145 @itemx -mno-as100-syntax
31146 When generating assembler output use a syntax that is compatible with
31147 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
31148 assembler, but it has some restrictions so it is not generated by default.
31150 @opindex mmax-constant-size
31151 @item -mmax-constant-size=@var{N}
31152 Specifies the maximum size, in bytes, of a constant that can be used as
31153 an operand in a RX instruction.  Although the RX instruction set does
31154 allow constants of up to 4 bytes in length to be used in instructions,
31155 a longer value equates to a longer instruction.  Thus in some
31156 circumstances it can be beneficial to restrict the size of constants
31157 that are used in instructions.  Constants that are too big are instead
31158 placed into a constant pool and referenced via register indirection.
31160 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
31161 or 4 means that constants of any size are allowed.
31163 @opindex mrelax
31164 @item -mrelax
31165 Enable linker relaxation.  Linker relaxation is a process whereby the
31166 linker attempts to reduce the size of a program by finding shorter
31167 versions of various instructions.  Disabled by default.
31169 @opindex mint-register
31170 @item -mint-register=@var{N}
31171 Specify the number of registers to reserve for fast interrupt handler
31172 functions.  The value @var{N} can be between 0 and 4.  A value of 1
31173 means that register @code{r13} is reserved for the exclusive use
31174 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
31175 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
31176 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
31177 A value of 0, the default, does not reserve any registers.
31179 @opindex msave-acc-in-interrupts
31180 @item -msave-acc-in-interrupts
31181 Specifies that interrupt handler functions should preserve the
31182 accumulator register.  This is only necessary if normal code might use
31183 the accumulator register, for example because it performs 64-bit
31184 multiplications.  The default is to ignore the accumulator as this
31185 makes the interrupt handlers faster.
31187 @opindex mpid
31188 @opindex mno-pid
31189 @item -mpid
31190 @itemx -mno-pid
31191 Enables the generation of position independent data.  When enabled any
31192 access to constant data is done via an offset from a base address
31193 held in a register.  This allows the location of constant data to be
31194 determined at run time without requiring the executable to be
31195 relocated, which is a benefit to embedded applications with tight
31196 memory constraints.  Data that can be modified is not affected by this
31197 option.
31199 Note, using this feature reserves a register, usually @code{r13}, for
31200 the constant data base address.  This can result in slower and/or
31201 larger code, especially in complicated functions.
31203 The actual register chosen to hold the constant data base address
31204 depends upon whether the @option{-msmall-data-limit} and/or the
31205 @option{-mint-register} command-line options are enabled.  Starting
31206 with register @code{r13} and proceeding downwards, registers are
31207 allocated first to satisfy the requirements of @option{-mint-register},
31208 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
31209 is possible for the small data area register to be @code{r8} if both
31210 @option{-mint-register=4} and @option{-mpid} are specified on the
31211 command line.
31213 By default this feature is not enabled.  The default can be restored
31214 via the @option{-mno-pid} command-line option.
31216 @opindex mno-warn-multiple-fast-interrupts
31217 @opindex mwarn-multiple-fast-interrupts
31218 @item -mno-warn-multiple-fast-interrupts
31219 @itemx -mwarn-multiple-fast-interrupts
31220 Prevents GCC from issuing a warning message if it finds more than one
31221 fast interrupt handler when it is compiling a file.  The default is to
31222 issue a warning for each extra fast interrupt handler found, as the RX
31223 only supports one such interrupt.
31225 @opindex mallow-string-insns
31226 @opindex mno-allow-string-insns
31227 @item -mallow-string-insns
31228 @itemx -mno-allow-string-insns
31229 Enables or disables the use of the string manipulation instructions
31230 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
31231 @code{SWHILE} and also the @code{RMPA} instruction.  These
31232 instructions may prefetch data, which is not safe to do if accessing
31233 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
31234 for more information).
31236 The default is to allow these instructions, but it is not possible for
31237 GCC to reliably detect all circumstances where a string instruction
31238 might be used to access an I/O register, so their use cannot be
31239 disabled automatically.  Instead it is reliant upon the programmer to
31240 use the @option{-mno-allow-string-insns} option if their program
31241 accesses I/O space.
31243 When the instructions are enabled GCC defines the C preprocessor
31244 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
31245 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
31247 @opindex mjsr
31248 @opindex mno-jsr
31249 @item -mjsr
31250 @itemx -mno-jsr
31251 Use only (or not only) @code{JSR} instructions to access functions.
31252 This option can be used when code size exceeds the range of @code{BSR}
31253 instructions.  Note that @option{-mno-jsr} does not mean to not use
31254 @code{JSR} but instead means that any type of branch may be used.
31255 @end table
31257 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
31258 has special significance to the RX port when used with the
31259 @code{interrupt} function attribute.  This attribute indicates a
31260 function intended to process fast interrupts.  GCC ensures
31261 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
31262 and/or @code{r13} and only provided that the normal use of the
31263 corresponding registers have been restricted via the
31264 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
31265 options.
31267 @node S/390 and zSeries Options
31268 @subsection S/390 and zSeries Options
31269 @cindex S/390 and zSeries Options
31271 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
31273 @table @gcctabopt
31274 @opindex mhard-float
31275 @opindex msoft-float
31276 @item -mhard-float
31277 @itemx -msoft-float
31278 Use (do not use) the hardware floating-point instructions and registers
31279 for floating-point operations.  When @option{-msoft-float} is specified,
31280 functions in @file{libgcc.a} are used to perform floating-point
31281 operations.  When @option{-mhard-float} is specified, the compiler
31282 generates IEEE floating-point instructions.  This is the default.
31284 @opindex mhard-dfp
31285 @opindex mno-hard-dfp
31286 @item -mhard-dfp
31287 @itemx -mno-hard-dfp
31288 Use (do not use) the hardware decimal-floating-point instructions for
31289 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
31290 specified, functions in @file{libgcc.a} are used to perform
31291 decimal-floating-point operations.  When @option{-mhard-dfp} is
31292 specified, the compiler generates decimal-floating-point hardware
31293 instructions.  This is the default for @option{-march=z9-ec} or higher.
31295 @opindex mlong-double-64
31296 @opindex mlong-double-128
31297 @item -mlong-double-64
31298 @itemx -mlong-double-128
31299 These switches control the size of @code{long double} type. A size
31300 of 64 bits makes the @code{long double} type equivalent to the @code{double}
31301 type. This is the default.
31303 @opindex mbackchain
31304 @opindex mno-backchain
31305 @item -mbackchain
31306 @itemx -mno-backchain
31307 Store (do not store) the address of the caller's frame as backchain pointer
31308 into the callee's stack frame.
31309 A backchain may be needed to allow debugging using tools that do not understand
31310 DWARF call frame information.
31311 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
31312 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
31313 the backchain is placed into the topmost word of the 96/160 byte register
31314 save area.
31316 In general, code compiled with @option{-mbackchain} is call-compatible with
31317 code compiled with @option{-mno-backchain}; however, use of the backchain
31318 for debugging purposes usually requires that the whole binary is built with
31319 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
31320 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31321 to build a linux kernel use @option{-msoft-float}.
31323 The default is to not maintain the backchain.
31325 @opindex mpacked-stack
31326 @opindex mno-packed-stack
31327 @item -mpacked-stack
31328 @itemx -mno-packed-stack
31329 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
31330 specified, the compiler uses the all fields of the 96/160 byte register save
31331 area only for their default purpose; unused fields still take up stack space.
31332 When @option{-mpacked-stack} is specified, register save slots are densely
31333 packed at the top of the register save area; unused space is reused for other
31334 purposes, allowing for more efficient use of the available stack space.
31335 However, when @option{-mbackchain} is also in effect, the topmost word of
31336 the save area is always used to store the backchain, and the return address
31337 register is always saved two words below the backchain.
31339 As long as the stack frame backchain is not used, code generated with
31340 @option{-mpacked-stack} is call-compatible with code generated with
31341 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
31342 S/390 or zSeries generated code that uses the stack frame backchain at run
31343 time, not just for debugging purposes.  Such code is not call-compatible
31344 with code compiled with @option{-mpacked-stack}.  Also, note that the
31345 combination of @option{-mbackchain},
31346 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
31347 to build a linux kernel use @option{-msoft-float}.
31349 The default is to not use the packed stack layout.
31351 @opindex msmall-exec
31352 @opindex mno-small-exec
31353 @item -msmall-exec
31354 @itemx -mno-small-exec
31355 Generate (or do not generate) code using the @code{bras} instruction
31356 to do subroutine calls.
31357 This only works reliably if the total executable size does not
31358 exceed 64k.  The default is to use the @code{basr} instruction instead,
31359 which does not have this limitation.
31361 @opindex m64
31362 @opindex m31
31363 @item -m64
31364 @itemx -m31
31365 When @option{-m31} is specified, generate code compliant to the
31366 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
31367 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
31368 particular to generate 64-bit instructions.  For the @samp{s390}
31369 targets, the default is @option{-m31}, while the @samp{s390x}
31370 targets default to @option{-m64}.
31372 @opindex mzarch
31373 @opindex mesa
31374 @item -mzarch
31375 @itemx -mesa
31376 When @option{-mzarch} is specified, generate code using the
31377 instructions available on z/Architecture.
31378 When @option{-mesa} is specified, generate code using the
31379 instructions available on ESA/390.  Note that @option{-mesa} is
31380 not possible with @option{-m64}.
31381 When generating code compliant to the GNU/Linux for S/390 ABI,
31382 the default is @option{-mesa}.  When generating code compliant
31383 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
31385 @opindex mhtm
31386 @opindex mno-htm
31387 @item -mhtm
31388 @itemx -mno-htm
31389 The @option{-mhtm} option enables a set of builtins making use of
31390 instructions available with the transactional execution facility
31391 introduced with the IBM zEnterprise EC12 machine generation
31392 @ref{S/390 System z Built-in Functions}.
31393 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
31395 @opindex mvx
31396 @opindex mno-vx
31397 @item -mvx
31398 @itemx -mno-vx
31399 When @option{-mvx} is specified, generate code using the instructions
31400 available with the vector extension facility introduced with the IBM
31401 z13 machine generation.
31402 This option changes the ABI for some vector type values with regard to
31403 alignment and calling conventions.  In case vector type values are
31404 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
31405 command will be added to mark the resulting binary with the ABI used.
31406 @option{-mvx} is enabled by default when using @option{-march=z13}.
31408 @opindex mzvector
31409 @opindex mno-zvector
31410 @item -mzvector
31411 @itemx -mno-zvector
31412 The @option{-mzvector} option enables vector language extensions and
31413 builtins using instructions available with the vector extension
31414 facility introduced with the IBM z13 machine generation.
31415 This option adds support for @samp{vector} to be used as a keyword to
31416 define vector type variables and arguments.  @samp{vector} is only
31417 available when GNU extensions are enabled.  It will not be expanded
31418 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
31419 In addition to the GCC low-level builtins @option{-mzvector} enables
31420 a set of builtins added for compatibility with AltiVec-style
31421 implementations like Power and Cell.  In order to make use of these
31422 builtins the header file @file{vecintrin.h} needs to be included.
31423 @option{-mzvector} is disabled by default.
31425 @opindex mmvcle
31426 @opindex mno-mvcle
31427 @item -mmvcle
31428 @itemx -mno-mvcle
31429 Generate (or do not generate) code using the @code{mvcle} instruction
31430 to perform block moves.  When @option{-mno-mvcle} is specified,
31431 use a @code{mvc} loop instead.  This is the default unless optimizing for
31432 size.
31434 @opindex mdebug
31435 @opindex mno-debug
31436 @item -mdebug
31437 @itemx -mno-debug
31438 Print (or do not print) additional debug information when compiling.
31439 The default is to not print debug information.
31441 @opindex march
31442 @item -march=@var{cpu-type}
31443 Generate code that runs on @var{cpu-type}, which is the name of a
31444 system representing a certain processor type.  Possible values for
31445 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
31446 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
31447 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
31448 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
31449 @samp{z16}/@samp{arch14}, and @samp{native}.
31451 The default is @option{-march=z900}.
31453 Specifying @samp{native} as cpu type can be used to select the best
31454 architecture option for the host processor.
31455 @option{-march=native} has no effect if GCC does not recognize the
31456 processor.
31458 @opindex mtune
31459 @item -mtune=@var{cpu-type}
31460 Tune to @var{cpu-type} everything applicable about the generated code,
31461 except for the ABI and the set of available instructions.
31462 The list of @var{cpu-type} values is the same as for @option{-march}.
31463 The default is the value used for @option{-march}.
31465 @opindex mtpf-trace
31466 @opindex mno-tpf-trace
31467 @item -mtpf-trace
31468 @itemx -mno-tpf-trace
31469 Generate code that adds (does not add) in TPF OS specific branches to trace
31470 routines in the operating system.  This option is off by default, even
31471 when compiling for the TPF OS@.
31473 @opindex mtpf-trace-skip
31474 @opindex mno-tpf-trace-skip
31475 @item -mtpf-trace-skip
31476 @itemx -mno-tpf-trace-skip
31477 Generate code that changes (does not change) the default branch
31478 targets enabled by @option{-mtpf-trace} to point to specialized trace
31479 routines providing the ability of selectively skipping function trace
31480 entries for the TPF OS.  This option is off by default, even when
31481 compiling for the TPF OS and specifying @option{-mtpf-trace}.
31483 @opindex mfused-madd
31484 @opindex mno-fused-madd
31485 @item -mfused-madd
31486 @itemx -mno-fused-madd
31487 Generate code that uses (does not use) the floating-point multiply and
31488 accumulate instructions.  These instructions are generated by default if
31489 hardware floating point is used.
31491 @opindex mwarn-framesize
31492 @item -mwarn-framesize=@var{framesize}
31493 Emit a warning if the current function exceeds the given frame size.  Because
31494 this is a compile-time check it doesn't need to be a real problem when the program
31495 runs.  It is intended to identify functions that most probably cause
31496 a stack overflow.  It is useful to be used in an environment with limited stack
31497 size e.g.@: the linux kernel.
31499 @opindex mwarn-dynamicstack
31500 @item -mwarn-dynamicstack
31501 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
31502 arrays.  This is generally a bad idea with a limited stack size.
31504 @opindex mstack-guard
31505 @opindex mstack-size
31506 @item -mstack-guard=@var{stack-guard}
31507 @itemx -mstack-size=@var{stack-size}
31508 If these options are provided the S/390 back end emits additional instructions in
31509 the function prologue that trigger a trap if the stack size is @var{stack-guard}
31510 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
31511 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
31512 the frame size of the compiled function is chosen.
31513 These options are intended to be used to help debugging stack overflow problems.
31514 The additionally emitted code causes only little overhead and hence can also be
31515 used in production-like systems without greater performance degradation.  The given
31516 values have to be exact powers of 2 and @var{stack-size} has to be greater than
31517 @var{stack-guard} without exceeding 64k.
31518 In order to be efficient the extra code makes the assumption that the stack starts
31519 at an address aligned to the value given by @var{stack-size}.
31520 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
31522 @opindex mhotpatch
31523 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
31524 If the hotpatch option is enabled, a ``hot-patching'' function
31525 prologue is generated for all functions in the compilation unit.
31526 The funtion label is prepended with the given number of two-byte
31527 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
31528 the label, 2 * @var{post-halfwords} bytes are appended, using the
31529 largest NOP like instructions the architecture allows (maximum
31530 1000000).
31532 If both arguments are zero, hotpatching is disabled.
31534 This option can be overridden for individual functions with the
31535 @code{hotpatch} attribute.
31536 @end table
31538 @node SH Options
31539 @subsection SH Options
31541 These @samp{-m} options are defined for the SH implementations:
31543 @table @gcctabopt
31544 @opindex m1
31545 @item -m1
31546 Generate code for the SH1.
31548 @opindex m2
31549 @item -m2
31550 Generate code for the SH2.
31552 @item -m2e
31553 Generate code for the SH2e.
31555 @opindex m2a-nofpu
31556 @item -m2a-nofpu
31557 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
31558 that the floating-point unit is not used.
31560 @opindex m2a-single-only
31561 @item -m2a-single-only
31562 Generate code for the SH2a-FPU, in such a way that no double-precision
31563 floating-point operations are used.
31565 @opindex m2a-single
31566 @item -m2a-single
31567 Generate code for the SH2a-FPU assuming the floating-point unit is in
31568 single-precision mode by default.
31570 @opindex m2a
31571 @item -m2a
31572 Generate code for the SH2a-FPU assuming the floating-point unit is in
31573 double-precision mode by default.
31575 @opindex m3
31576 @item -m3
31577 Generate code for the SH3.
31579 @opindex m3e
31580 @item -m3e
31581 Generate code for the SH3e.
31583 @opindex m4-nofpu
31584 @item -m4-nofpu
31585 Generate code for the SH4 without a floating-point unit.
31587 @opindex m4-single-only
31588 @item -m4-single-only
31589 Generate code for the SH4 with a floating-point unit that only
31590 supports single-precision arithmetic.
31592 @opindex m4-single
31593 @item -m4-single
31594 Generate code for the SH4 assuming the floating-point unit is in
31595 single-precision mode by default.
31597 @opindex m4
31598 @item -m4
31599 Generate code for the SH4.
31601 @opindex m4-100
31602 @item -m4-100
31603 Generate code for SH4-100.
31605 @opindex m4-100-nofpu
31606 @item -m4-100-nofpu
31607 Generate code for SH4-100 in such a way that the
31608 floating-point unit is not used.
31610 @opindex m4-100-single
31611 @item -m4-100-single
31612 Generate code for SH4-100 assuming the floating-point unit is in
31613 single-precision mode by default.
31615 @opindex m4-100-single-only
31616 @item -m4-100-single-only
31617 Generate code for SH4-100 in such a way that no double-precision
31618 floating-point operations are used.
31620 @opindex m4-200
31621 @item -m4-200
31622 Generate code for SH4-200.
31624 @opindex m4-200-nofpu
31625 @item -m4-200-nofpu
31626 Generate code for SH4-200 without in such a way that the
31627 floating-point unit is not used.
31629 @opindex m4-200-single
31630 @item -m4-200-single
31631 Generate code for SH4-200 assuming the floating-point unit is in
31632 single-precision mode by default.
31634 @opindex m4-200-single-only
31635 @item -m4-200-single-only
31636 Generate code for SH4-200 in such a way that no double-precision
31637 floating-point operations are used.
31639 @opindex m4-300
31640 @item -m4-300
31641 Generate code for SH4-300.
31643 @opindex m4-300-nofpu
31644 @item -m4-300-nofpu
31645 Generate code for SH4-300 without in such a way that the
31646 floating-point unit is not used.
31648 @opindex m4-300-single
31649 @item -m4-300-single
31650 Generate code for SH4-300 in such a way that no double-precision
31651 floating-point operations are used.
31653 @opindex m4-300-single-only
31654 @item -m4-300-single-only
31655 Generate code for SH4-300 in such a way that no double-precision
31656 floating-point operations are used.
31658 @opindex m4-340
31659 @item -m4-340
31660 Generate code for SH4-340 (no MMU, no FPU).
31662 @opindex m4-500
31663 @item -m4-500
31664 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
31665 assembler.
31667 @opindex m4a-nofpu
31668 @item -m4a-nofpu
31669 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
31670 floating-point unit is not used.
31672 @opindex m4a-single-only
31673 @item -m4a-single-only
31674 Generate code for the SH4a, in such a way that no double-precision
31675 floating-point operations are used.
31677 @opindex m4a-single
31678 @item -m4a-single
31679 Generate code for the SH4a assuming the floating-point unit is in
31680 single-precision mode by default.
31682 @opindex m4a
31683 @item -m4a
31684 Generate code for the SH4a.
31686 @opindex m4al
31687 @item -m4al
31688 Same as @option{-m4a-nofpu}, except that it implicitly passes
31689 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
31690 instructions at the moment.
31692 @opindex mb
31693 @item -mb
31694 Compile code for the processor in big-endian mode.
31696 @opindex ml
31697 @item -ml
31698 Compile code for the processor in little-endian mode.
31700 @opindex mdalign
31701 @item -mdalign
31702 Align doubles at 64-bit boundaries.  Note that this changes the calling
31703 conventions, and thus some functions from the standard C library do
31704 not work unless you recompile it first with @option{-mdalign}.
31706 @opindex mrelax
31707 @item -mrelax
31708 Shorten some address references at link time, when possible; uses the
31709 linker option @option{-relax}.
31711 @opindex mbigtable
31712 @item -mbigtable
31713 Use 32-bit offsets in @code{switch} tables.  The default is to use
31714 16-bit offsets.
31716 @opindex mbitops
31717 @item -mbitops
31718 Enable the use of bit manipulation instructions on SH2A.
31720 @opindex mfmovd
31721 @item -mfmovd
31722 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
31723 alignment constraints.
31725 @opindex mrenesas
31726 @item -mrenesas
31727 Comply with the calling conventions defined by Renesas.
31729 @opindex mno-renesas
31730 @item -mno-renesas
31731 Comply with the calling conventions defined for GCC before the Renesas
31732 conventions were available.  This option is the default for all
31733 targets of the SH toolchain.
31735 @opindex mnomacsave
31736 @item -mnomacsave
31737 Mark the @code{MAC} register as call-clobbered, even if
31738 @option{-mrenesas} is given.
31740 @opindex mieee
31741 @opindex mno-ieee
31742 @item -mieee
31743 @itemx -mno-ieee
31744 Control the IEEE compliance of floating-point comparisons, which affects the
31745 handling of cases where the result of a comparison is unordered.  By default
31746 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
31747 enabled @option{-mno-ieee} is implicitly set, which results in faster
31748 floating-point greater-equal and less-equal comparisons.  The implicit settings
31749 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
31751 @opindex minline-ic_invalidate
31752 @item -minline-ic_invalidate
31753 Inline code to invalidate instruction cache entries after setting up
31754 nested function trampolines.
31755 This option has no effect if @option{-musermode} is in effect and the selected
31756 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
31757 instruction.
31758 If the selected code generation option does not allow the use of the @code{icbi}
31759 instruction, and @option{-musermode} is not in effect, the inlined code
31760 manipulates the instruction cache address array directly with an associative
31761 write.  This not only requires privileged mode at run time, but it also
31762 fails if the cache line had been mapped via the TLB and has become unmapped.
31764 @opindex misize
31765 @item -misize
31766 Dump instruction size and location in the assembly code.
31768 @opindex mpadstruct
31769 @item -mpadstruct
31770 This option is deprecated.  It pads structures to multiple of 4 bytes,
31771 which is incompatible with the SH ABI@.
31773 @opindex matomic-model=@var{model}
31774 @item -matomic-model=@var{model}
31775 Sets the model of atomic operations and additional parameters as a comma
31776 separated list.  For details on the atomic built-in functions see
31777 @ref{__atomic Builtins}.  The following models and parameters are supported:
31779 @table @samp
31781 @item none
31782 Disable compiler generated atomic sequences and emit library calls for atomic
31783 operations.  This is the default if the target is not @code{sh*-*-linux*}.
31785 @item soft-gusa
31786 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
31787 built-in functions.  The generated atomic sequences require additional support
31788 from the interrupt/exception handling code of the system and are only suitable
31789 for SH3* and SH4* single-core systems.  This option is enabled by default when
31790 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
31791 this option also partially utilizes the hardware atomic instructions
31792 @code{movli.l} and @code{movco.l} to create more efficient code, unless
31793 @samp{strict} is specified.  
31795 @item soft-tcb
31796 Generate software atomic sequences that use a variable in the thread control
31797 block.  This is a variation of the gUSA sequences which can also be used on
31798 SH1* and SH2* targets.  The generated atomic sequences require additional
31799 support from the interrupt/exception handling code of the system and are only
31800 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
31801 parameter has to be specified as well.
31803 @item soft-imask
31804 Generate software atomic sequences that temporarily disable interrupts by
31805 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
31806 in privileged mode and is only suitable for single-core systems.  Additional
31807 support from the interrupt/exception handling code of the system is not
31808 required.  This model is enabled by default when the target is
31809 @code{sh*-*-linux*} and SH1* or SH2*.
31811 @item hard-llcs
31812 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
31813 instructions only.  This is only available on SH4A and is suitable for
31814 multi-core systems.  Since the hardware instructions support only 32 bit atomic
31815 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
31816 Code compiled with this option is also compatible with other software
31817 atomic model interrupt/exception handling systems if executed on an SH4A
31818 system.  Additional support from the interrupt/exception handling code of the
31819 system is not required for this model.
31821 @item gbr-offset=
31822 This parameter specifies the offset in bytes of the variable in the thread
31823 control block structure that should be used by the generated atomic sequences
31824 when the @samp{soft-tcb} model has been selected.  For other models this
31825 parameter is ignored.  The specified value must be an integer multiple of four
31826 and in the range 0-1020.
31828 @item strict
31829 This parameter prevents mixed usage of multiple atomic models, even if they
31830 are compatible, and makes the compiler generate atomic sequences of the
31831 specified model only.
31833 @end table
31835 @opindex mtas
31836 @item -mtas
31837 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
31838 Notice that depending on the particular hardware and software configuration
31839 this can degrade overall performance due to the operand cache line flushes
31840 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
31841 processors the @code{tas.b} instruction must be used with caution since it
31842 can result in data corruption for certain cache configurations.
31844 @opindex mprefergot
31845 @item -mprefergot
31846 When generating position-independent code, emit function calls using
31847 the Global Offset Table instead of the Procedure Linkage Table.
31849 @opindex musermode
31850 @opindex mno-usermode
31851 @item -musermode
31852 @itemx -mno-usermode
31853 Don't allow (allow) the compiler generating privileged mode code.  Specifying
31854 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31855 inlined code would not work in user mode.  @option{-musermode} is the default
31856 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
31857 @option{-musermode} has no effect, since there is no user mode.
31859 @opindex multcost=@var{number}
31860 @item -multcost=@var{number}
31861 Set the cost to assume for a multiply insn.
31863 @opindex mdiv=@var{strategy}
31864 @item -mdiv=@var{strategy}
31865 Set the division strategy to be used for integer division operations.
31866 @var{strategy} can be one of: 
31868 @table @samp
31870 @item call-div1
31871 Calls a library function that uses the single-step division instruction
31872 @code{div1} to perform the operation.  Division by zero calculates an
31873 unspecified result and does not trap.  This is the default except for SH4,
31874 SH2A and SHcompact.
31876 @item call-fp
31877 Calls a library function that performs the operation in double precision
31878 floating point.  Division by zero causes a floating-point exception.  This is
31879 the default for SHcompact with FPU.  Specifying this for targets that do not
31880 have a double precision FPU defaults to @code{call-div1}.
31882 @item call-table
31883 Calls a library function that uses a lookup table for small divisors and
31884 the @code{div1} instruction with case distinction for larger divisors.  Division
31885 by zero calculates an unspecified result and does not trap.  This is the default
31886 for SH4.  Specifying this for targets that do not have dynamic shift
31887 instructions defaults to @code{call-div1}.
31889 @end table
31891 When a division strategy has not been specified the default strategy is
31892 selected based on the current target.  For SH2A the default strategy is to
31893 use the @code{divs} and @code{divu} instructions instead of library function
31894 calls.
31896 @opindex maccumulate-outgoing-args
31897 @item -maccumulate-outgoing-args
31898 Reserve space once for outgoing arguments in the function prologue rather
31899 than around each call.  Generally beneficial for performance and size.  Also
31900 needed for unwinding to avoid changing the stack frame around conditional code.
31902 @opindex mdivsi3_libfunc=@var{name}
31903 @item -mdivsi3_libfunc=@var{name}
31904 Set the name of the library function used for 32-bit signed division to
31905 @var{name}.
31906 This only affects the name used in the @samp{call} division strategies, and
31907 the compiler still expects the same sets of input/output/clobbered registers as
31908 if this option were not present.
31910 @opindex mfixed-range
31911 @item -mfixed-range=@var{register-range}
31912 Generate code treating the given register range as fixed registers.
31913 A fixed register is one that the register allocator cannot use.  This is
31914 useful when compiling kernel code.  A register range is specified as
31915 two registers separated by a dash.  Multiple register ranges can be
31916 specified separated by a comma.
31918 @opindex mbranch-cost=@var{num}
31919 @item -mbranch-cost=@var{num}
31920 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
31921 make the compiler try to generate more branch-free code if possible.  
31922 If not specified the value is selected depending on the processor type that
31923 is being compiled for.
31925 @opindex mzdcbranch
31926 @opindex mno-zdcbranch
31927 @item -mzdcbranch
31928 @itemx -mno-zdcbranch
31929 Assume (do not assume) that zero displacement conditional branch instructions
31930 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
31931 compiler prefers zero displacement branch code sequences.  This is
31932 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
31933 disabled by specifying @option{-mno-zdcbranch}.
31935 @opindex mcbranch-force-delay-slot
31936 @item -mcbranch-force-delay-slot
31937 Force the usage of delay slots for conditional branches, which stuffs the delay
31938 slot with a @code{nop} if a suitable instruction cannot be found.  By default
31939 this option is disabled.  It can be enabled to work around hardware bugs as
31940 found in the original SH7055.
31942 @opindex mfused-madd
31943 @opindex mno-fused-madd
31944 @item -mfused-madd
31945 @itemx -mno-fused-madd
31946 Generate code that uses (does not use) the floating-point multiply and
31947 accumulate instructions.  These instructions are generated by default
31948 if hardware floating point is used.  The machine-dependent
31949 @option{-mfused-madd} option is now mapped to the machine-independent
31950 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31951 mapped to @option{-ffp-contract=off}.
31953 @opindex mfsca
31954 @opindex mno-fsca
31955 @item -mfsca
31956 @itemx -mno-fsca
31957 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31958 and cosine approximations.  The option @option{-mfsca} must be used in
31959 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
31960 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
31961 approximations even if @option{-funsafe-math-optimizations} is in effect.
31963 @opindex mfsrra
31964 @opindex mno-fsrra
31965 @item -mfsrra
31966 @itemx -mno-fsrra
31967 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31968 reciprocal square root approximations.  The option @option{-mfsrra} must be used
31969 in combination with @option{-funsafe-math-optimizations} and
31970 @option{-ffinite-math-only}.  It is enabled by default when generating code for
31971 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
31972 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31973 in effect.
31975 @opindex mpretend-cmove
31976 @item -mpretend-cmove
31977 Prefer zero-displacement conditional branches for conditional move instruction
31978 patterns.  This can result in faster code on the SH4 processor.
31980 @opindex fdpic
31981 @item -mfdpic
31982 Generate code using the FDPIC ABI.
31984 @end table
31986 @node Solaris 2 Options
31987 @subsection Solaris 2 Options
31988 @cindex Solaris 2 options
31990 These @samp{-m} options are supported on Solaris 2:
31992 @table @gcctabopt
31993 @opindex mclear-hwcap
31994 @item -mclear-hwcap
31995 @option{-mclear-hwcap} tells the compiler to remove the hardware
31996 capabilities generated by the Solaris assembler.  This is only necessary
31997 when object files use ISA extensions not supported by the current
31998 machine, but check at runtime whether or not to use them.
32000 @opindex mimpure-text
32001 @item -mimpure-text
32002 @option{-mimpure-text}, used in addition to @option{-shared}, tells
32003 the compiler to not pass @option{-z text} to the linker when linking a
32004 shared object.  Using this option, you can link position-dependent
32005 code into a shared object.
32007 @option{-mimpure-text} suppresses the ``relocations remain against
32008 allocatable but non-writable sections'' linker error message.
32009 However, the necessary relocations trigger copy-on-write, and the
32010 shared object is not actually shared across processes.  Instead of
32011 using @option{-mimpure-text}, you should compile all source code with
32012 @option{-fpic} or @option{-fPIC}.
32014 @end table
32016 These switches are supported in addition to the above on Solaris 2:
32018 @table @gcctabopt
32019 @opindex pthreads
32020 @item -pthreads
32021 This is a synonym for @option{-pthread}.
32022 @end table
32024 @node SPARC Options
32025 @subsection SPARC Options
32026 @cindex SPARC options
32028 These @samp{-m} options are supported on the SPARC:
32030 @table @gcctabopt
32031 @opindex mno-app-regs
32032 @opindex mapp-regs
32033 @item -mno-app-regs
32034 @itemx -mapp-regs
32035 Specify @option{-mapp-regs} to generate output using the global registers
32036 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
32037 global register 1, each global register 2 through 4 is then treated as an
32038 allocable register that is clobbered by function calls.  This is the default.
32040 To be fully SVR4 ABI-compliant at the cost of some performance loss,
32041 specify @option{-mno-app-regs}.  You should compile libraries and system
32042 software with this option.
32044 @opindex mflat
32045 @opindex mno-flat
32046 @item -mflat
32047 @itemx -mno-flat
32048 With @option{-mflat}, the compiler does not generate save/restore instructions
32049 and uses a ``flat'' or single register window model.  This model is compatible
32050 with the regular register window model.  The local registers and the input
32051 registers (0--5) are still treated as ``call-saved'' registers and are
32052 saved on the stack as needed.
32054 With @option{-mno-flat} (the default), the compiler generates save/restore
32055 instructions (except for leaf functions).  This is the normal operating mode.
32057 @opindex mfpu
32058 @opindex mhard-float
32059 @item -mfpu
32060 @itemx -mhard-float
32061 Generate output containing floating-point instructions.  This is the
32062 default.
32064 @opindex mno-fpu
32065 @opindex msoft-float
32066 @item -mno-fpu
32067 @itemx -msoft-float
32068 Generate output containing library calls for floating point.
32069 @strong{Warning:} the requisite libraries are not available for all SPARC
32070 targets.  Normally the facilities of the machine's usual C compiler are
32071 used, but this cannot be done directly in cross-compilation.  You must make
32072 your own arrangements to provide suitable library functions for
32073 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
32074 @samp{sparclite-*-*} do provide software floating-point support.
32076 @option{-msoft-float} changes the calling convention in the output file;
32077 therefore, it is only useful if you compile @emph{all} of a program with
32078 this option.  In particular, you need to compile @file{libgcc.a}, the
32079 library that comes with GCC, with @option{-msoft-float} in order for
32080 this to work.
32082 @opindex mhard-quad-float
32083 @item -mhard-quad-float
32084 Generate output containing quad-word (long double) floating-point
32085 instructions.
32087 @opindex msoft-quad-float
32088 @item -msoft-quad-float
32089 Generate output containing library calls for quad-word (long double)
32090 floating-point instructions.  The functions called are those specified
32091 in the SPARC ABI@.  This is the default.
32093 As of this writing, there are no SPARC implementations that have hardware
32094 support for the quad-word floating-point instructions.  They all invoke
32095 a trap handler for one of these instructions, and then the trap handler
32096 emulates the effect of the instruction.  Because of the trap handler overhead,
32097 this is much slower than calling the ABI library routines.  Thus the
32098 @option{-msoft-quad-float} option is the default.
32100 @opindex mno-unaligned-doubles
32101 @opindex munaligned-doubles
32102 @item -mno-unaligned-doubles
32103 @itemx -munaligned-doubles
32104 Assume that doubles have 8-byte alignment.  This is the default.
32106 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
32107 alignment only if they are contained in another type, or if they have an
32108 absolute address.  Otherwise, it assumes they have 4-byte alignment.
32109 Specifying this option avoids some rare compatibility problems with code
32110 generated by other compilers.  It is not the default because it results
32111 in a performance loss, especially for floating-point code.
32113 @opindex muser-mode
32114 @opindex mno-user-mode
32115 @item -muser-mode
32116 @itemx -mno-user-mode
32117 Do not generate code that can only run in supervisor mode.  This is relevant
32118 only for the @code{casa} instruction emitted for the LEON3 processor.  This
32119 is the default.
32121 @opindex mfaster-structs
32122 @opindex mno-faster-structs
32123 @item -mfaster-structs
32124 @itemx -mno-faster-structs
32125 With @option{-mfaster-structs}, the compiler assumes that structures
32126 should have 8-byte alignment.  This enables the use of pairs of
32127 @code{ldd} and @code{std} instructions for copies in structure
32128 assignment, in place of twice as many @code{ld} and @code{st} pairs.
32129 However, the use of this changed alignment directly violates the SPARC
32130 ABI@.  Thus, it's intended only for use on targets where the developer
32131 acknowledges that their resulting code is not directly in line with
32132 the rules of the ABI@.
32134 @opindex mstd-struct-return
32135 @opindex mno-std-struct-return
32136 @item -mstd-struct-return
32137 @itemx -mno-std-struct-return
32138 With @option{-mstd-struct-return}, the compiler generates checking code
32139 in functions returning structures or unions to detect size mismatches
32140 between the two sides of function calls, as per the 32-bit ABI@.
32142 The default is @option{-mno-std-struct-return}.  This option has no effect
32143 in 64-bit mode.
32145 @opindex mlra
32146 @opindex mno-lra
32147 @item -mlra
32148 @itemx -mno-lra
32149 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
32150 so @option{-mno-lra} needs to be passed to get old Reload.
32152 @opindex mcpu
32153 @item -mcpu=@var{cpu_type}
32154 Set the instruction set, register set, and instruction scheduling parameters
32155 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32156 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
32157 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
32158 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
32159 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
32160 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
32161 @samp{m8}.
32163 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
32164 which selects the best architecture option for the host processor.
32165 @option{-mcpu=native} has no effect if GCC does not recognize
32166 the processor.
32168 Default instruction scheduling parameters are used for values that select
32169 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
32170 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
32172 Here is a list of each supported architecture and their supported
32173 implementations.
32175 @table @asis
32176 @item v7
32177 cypress, leon3v7
32179 @item v8
32180 supersparc, hypersparc, leon, leon3, leon5
32182 @item sparclite
32183 f930, f934, sparclite86x
32185 @item sparclet
32186 tsc701
32188 @item v9
32189 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
32190 niagara7, m8
32191 @end table
32193 By default (unless configured otherwise), GCC generates code for the V7
32194 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
32195 additionally optimizes it for the Cypress CY7C602 chip, as used in the
32196 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
32197 SPARCStation 1, 2, IPX etc.
32199 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
32200 architecture.  The only difference from V7 code is that the compiler emits
32201 the integer multiply and integer divide instructions which exist in SPARC-V8
32202 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
32203 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
32204 2000 series.
32206 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
32207 the SPARC architecture.  This adds the integer multiply, integer divide step
32208 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
32209 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
32210 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
32211 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
32212 MB86934 chip, which is the more recent SPARClite with FPU@.
32214 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
32215 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
32216 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
32217 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
32218 optimizes it for the TEMIC SPARClet chip.
32220 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
32221 architecture.  This adds 64-bit integer and floating-point move instructions,
32222 3 additional floating-point condition code registers and conditional move
32223 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
32224 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
32225 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
32226 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
32227 @option{-mcpu=niagara}, the compiler additionally optimizes it for
32228 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
32229 additionally optimizes it for Sun UltraSPARC T2 chips. With
32230 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
32231 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
32232 additionally optimizes it for Sun UltraSPARC T4 chips.  With
32233 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
32234 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
32235 additionally optimizes it for Oracle M8 chips.
32237 @opindex mtune
32238 @item -mtune=@var{cpu_type}
32239 Set the instruction scheduling parameters for machine type
32240 @var{cpu_type}, but do not set the instruction set or register set that the
32241 option @option{-mcpu=@var{cpu_type}} does.
32243 The same values for @option{-mcpu=@var{cpu_type}} can be used for
32244 @option{-mtune=@var{cpu_type}}, but the only useful values are those
32245 that select a particular CPU implementation.  Those are
32246 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
32247 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
32248 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
32249 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
32250 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
32251 and GNU/Linux toolchains, @samp{native} can also be used.
32253 @opindex mv8plus
32254 @opindex mno-v8plus
32255 @item -mv8plus
32256 @itemx -mno-v8plus
32257 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
32258 difference from the V8 ABI is that the global and out registers are
32259 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
32260 mode for all SPARC-V9 processors.
32262 @opindex mvis
32263 @opindex mno-vis
32264 @item -mvis
32265 @itemx -mno-vis
32266 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
32267 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
32269 @opindex mvis2
32270 @opindex mno-vis2
32271 @item -mvis2
32272 @itemx -mno-vis2
32273 With @option{-mvis2}, GCC generates code that takes advantage of
32274 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
32275 default is @option{-mvis2} when targeting a cpu that supports such
32276 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
32277 also sets @option{-mvis}.
32279 @opindex mvis3
32280 @opindex mno-vis3
32281 @item -mvis3
32282 @itemx -mno-vis3
32283 With @option{-mvis3}, GCC generates code that takes advantage of
32284 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
32285 default is @option{-mvis3} when targeting a cpu that supports such
32286 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
32287 also sets @option{-mvis2} and @option{-mvis}.
32289 @opindex mvis4
32290 @opindex mno-vis4
32291 @item -mvis4
32292 @itemx -mno-vis4
32293 With @option{-mvis4}, GCC generates code that takes advantage of
32294 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
32295 default is @option{-mvis4} when targeting a cpu that supports such
32296 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
32297 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
32299 @opindex mvis4b
32300 @opindex mno-vis4b
32301 @item -mvis4b
32302 @itemx -mno-vis4b
32303 With @option{-mvis4b}, GCC generates code that takes advantage of
32304 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
32305 the additional VIS instructions introduced in the Oracle SPARC
32306 Architecture 2017.  The default is @option{-mvis4b} when targeting a
32307 cpu that supports such instructions, such as m8 and later.  Setting
32308 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
32309 @option{-mvis2} and @option{-mvis}.
32311 @opindex mcbcond
32312 @opindex mno-cbcond
32313 @item -mcbcond
32314 @itemx -mno-cbcond
32315 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
32316 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
32317 when targeting a CPU that supports such instructions, such as Niagara-4 and
32318 later.
32320 @opindex mfmaf
32321 @opindex mno-fmaf
32322 @item -mfmaf
32323 @itemx -mno-fmaf
32324 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
32325 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
32326 when targeting a CPU that supports such instructions, such as Niagara-3 and
32327 later.
32329 @opindex mfsmuld
32330 @opindex mno-fsmuld
32331 @item -mfsmuld
32332 @itemx -mno-fsmuld
32333 With @option{-mfsmuld}, GCC generates code that takes advantage of the
32334 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
32335 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
32336 or V9 with FPU except @option{-mcpu=leon}.
32338 @opindex mpopc
32339 @opindex mno-popc
32340 @item -mpopc
32341 @itemx -mno-popc
32342 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
32343 Population Count instruction.  The default is @option{-mpopc}
32344 when targeting a CPU that supports such an instruction, such as Niagara-2 and
32345 later.
32347 @opindex msubxc
32348 @opindex mno-subxc
32349 @item -msubxc
32350 @itemx -mno-subxc
32351 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
32352 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
32353 when targeting a CPU that supports such an instruction, such as Niagara-7 and
32354 later.
32356 @opindex mfix-at697f
32357 @item -mfix-at697f
32358 Enable the documented workaround for the single erratum of the Atmel AT697F
32359 processor (which corresponds to erratum #13 of the AT697E processor).
32361 @opindex mfix-ut699
32362 @item -mfix-ut699
32363 Enable the documented workarounds for the floating-point errata and the data
32364 cache nullify errata of the UT699 processor.
32366 @opindex mfix-ut700
32367 @item -mfix-ut700
32368 Enable the documented workaround for the back-to-back store errata of
32369 the UT699E/UT700 processor.
32371 @opindex mfix-gr712rc
32372 @item -mfix-gr712rc
32373 Enable the documented workaround for the back-to-back store errata of
32374 the GR712RC processor.
32375 @end table
32377 These @samp{-m} options are supported in addition to the above
32378 on SPARC-V9 processors in 64-bit environments:
32380 @table @gcctabopt
32381 @opindex m32
32382 @opindex m64
32383 @item -m32
32384 @itemx -m64
32385 Generate code for a 32-bit or 64-bit environment.
32386 The 32-bit environment sets int, long and pointer to 32 bits.
32387 The 64-bit environment sets int to 32 bits and long and pointer
32388 to 64 bits.
32390 @opindex mcmodel
32391 @item -mcmodel=@var{which}
32392 Set the code model to one of
32394 @table @samp
32395 @item medlow
32396 The Medium/Low code model: 64-bit addresses, programs
32397 must be linked in the low 32 bits of memory.  Programs can be statically
32398 or dynamically linked.
32400 @item medmid
32401 The Medium/Middle code model: 64-bit addresses, programs
32402 must be linked in the low 44 bits of memory, the text and data segments must
32403 be less than 2GB in size and the data segment must be located within 2GB of
32404 the text segment.
32406 @item medany
32407 The Medium/Anywhere code model: 64-bit addresses, programs
32408 may be linked anywhere in memory, the text and data segments must be less
32409 than 2GB in size and the data segment must be located within 2GB of the
32410 text segment.
32412 @item embmedany
32413 The Medium/Anywhere code model for embedded systems:
32414 64-bit addresses, the text and data segments must be less than 2GB in
32415 size, both starting anywhere in memory (determined at link time).  The
32416 global register %g4 points to the base of the data segment.  Programs
32417 are statically linked and PIC is not supported.
32418 @end table
32420 @opindex mmemory-model
32421 @item -mmemory-model=@var{mem-model}
32422 Set the memory model in force on the processor to one of
32424 @table @samp
32425 @item default
32426 The default memory model for the processor and operating system.
32428 @item rmo
32429 Relaxed Memory Order
32431 @item pso
32432 Partial Store Order
32434 @item tso
32435 Total Store Order
32437 @item sc
32438 Sequential Consistency
32439 @end table
32441 These memory models are formally defined in Appendix D of the SPARC-V9
32442 architecture manual, as set in the processor's @code{PSTATE.MM} field.
32444 @opindex mstack-bias
32445 @opindex mno-stack-bias
32446 @item -mstack-bias
32447 @itemx -mno-stack-bias
32448 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
32449 frame pointer if present, are offset by @minus{}2047 which must be added back
32450 when making stack frame references.  This is the default in 64-bit mode.
32451 Otherwise, assume no such offset is present.
32452 @end table
32454 @node System V Options
32455 @subsection Options for System V
32457 These additional options are available on System V Release 4 for
32458 compatibility with other compilers on those systems:
32460 @table @gcctabopt
32461 @opindex G
32462 @item -G
32463 Create a shared object.
32464 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
32466 @opindex Qy
32467 @item -Qy
32468 Identify the versions of each tool used by the compiler, in a
32469 @code{.ident} assembler directive in the output.
32471 @opindex Qn
32472 @item -Qn
32473 Refrain from adding @code{.ident} directives to the output file (this is
32474 the default).
32476 @opindex YP
32477 @item -YP,@var{dirs}
32478 Search the directories @var{dirs}, and no others, for libraries
32479 specified with @option{-l}.
32481 @opindex Ym
32482 @item -Ym,@var{dir}
32483 Look in the directory @var{dir} to find the M4 preprocessor.
32484 The assembler uses this option.
32485 @c This is supposed to go with a -Yd for predefined M4 macro files, but
32486 @c the generic assembler that comes with Solaris takes just -Ym.
32487 @end table
32489 @node V850 Options
32490 @subsection V850 Options
32491 @cindex V850 Options
32493 These @samp{-m} options are defined for V850 implementations:
32495 @table @gcctabopt
32496 @opindex mlong-calls
32497 @opindex mno-long-calls
32498 @item -mlong-calls
32499 @itemx -mno-long-calls
32500 Treat all calls as being far away (near).  If calls are assumed to be
32501 far away, the compiler always loads the function's address into a
32502 register, and calls indirect through the pointer.
32504 @opindex mno-ep
32505 @opindex mep
32506 @item -mno-ep
32507 @itemx -mep
32508 Do not optimize (do optimize) basic blocks that use the same index
32509 pointer 4 or more times to copy pointer into the @code{ep} register, and
32510 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
32511 option is on by default if you optimize.
32513 @opindex mno-prolog-function
32514 @opindex mprolog-function
32515 @item -mno-prolog-function
32516 @itemx -mprolog-function
32517 Do not use (do use) external functions to save and restore registers
32518 at the prologue and epilogue of a function.  The external functions
32519 are slower, but use less code space if more than one function saves
32520 the same number of registers.  The @option{-mprolog-function} option
32521 is on by default if you optimize.
32523 @opindex mspace
32524 @item -mspace
32525 Try to make the code as small as possible.  At present, this just turns
32526 on the @option{-mep} and @option{-mprolog-function} options.
32528 @opindex mtda
32529 @item -mtda=@var{n}
32530 Put static or global variables whose size is @var{n} bytes or less into
32531 the tiny data area that register @code{ep} points to.  The tiny data
32532 area can hold up to 256 bytes in total (128 bytes for byte references).
32534 @opindex msda
32535 @item -msda=@var{n}
32536 Put static or global variables whose size is @var{n} bytes or less into
32537 the small data area that register @code{gp} points to.  The small data
32538 area can hold up to 64 kilobytes.
32540 @opindex mzda
32541 @item -mzda=@var{n}
32542 Put static or global variables whose size is @var{n} bytes or less into
32543 the first 32 kilobytes of memory.
32545 @opindex mv850
32546 @item -mv850
32547 Specify that the target processor is the V850.
32549 @opindex mv850e3v5
32550 @item -mv850e3v5
32551 Specify that the target processor is the V850E3V5.  The preprocessor
32552 constant @code{__v850e3v5__} is defined if this option is used.
32554 @opindex mv850e2v4
32555 @item -mv850e2v4
32556 Specify that the target processor is the V850E3V5.  This is an alias for
32557 the @option{-mv850e3v5} option.
32559 @opindex mv850e2v3
32560 @item -mv850e2v3
32561 Specify that the target processor is the V850E2V3.  The preprocessor
32562 constant @code{__v850e2v3__} is defined if this option is used.
32564 @opindex mv850e2
32565 @item -mv850e2
32566 Specify that the target processor is the V850E2.  The preprocessor
32567 constant @code{__v850e2__} is defined if this option is used.
32569 @opindex mv850e1
32570 @item -mv850e1
32571 Specify that the target processor is the V850E1.  The preprocessor
32572 constants @code{__v850e1__} and @code{__v850e__} are defined if
32573 this option is used.
32575 @opindex mv850es
32576 @item -mv850es
32577 Specify that the target processor is the V850ES.  This is an alias for
32578 the @option{-mv850e1} option.
32580 @opindex mv850e
32581 @item -mv850e
32582 Specify that the target processor is the V850E@.  The preprocessor
32583 constant @code{__v850e__} is defined if this option is used.
32585 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
32586 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
32587 are defined then a default target processor is chosen and the
32588 relevant @samp{__v850*__} preprocessor constant is defined.
32590 The preprocessor constants @code{__v850} and @code{__v851__} are always
32591 defined, regardless of which processor variant is the target.
32593 @opindex mdisable-callt
32594 @opindex mno-disable-callt
32595 @item -mdisable-callt
32596 @itemx -mno-disable-callt
32597 This option suppresses generation of the @code{CALLT} instruction for the
32598 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
32599 architecture.
32601 This option is enabled by default when the RH850 ABI is
32602 in use (see @option{-mrh850-abi}), and disabled by default when the
32603 GCC ABI is in use.  If @code{CALLT} instructions are being generated
32604 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
32606 @opindex mrelax
32607 @opindex mno-relax
32608 @item -mrelax
32609 @itemx -mno-relax
32610 Pass on (or do not pass on) the @option{-mrelax} command-line option
32611 to the assembler.
32613 @opindex mlong-jumps
32614 @opindex mno-long-jumps
32615 @item -mlong-jumps
32616 @itemx -mno-long-jumps
32617 Disable (or re-enable) the generation of PC-relative jump instructions.
32619 @opindex msoft-float
32620 @opindex mhard-float
32621 @item -msoft-float
32622 @itemx -mhard-float
32623 Disable (or re-enable) the generation of hardware floating point
32624 instructions.  This option is only significant when the target
32625 architecture is @samp{V850E2V3} or higher.  If hardware floating point
32626 instructions are being generated then the C preprocessor symbol
32627 @code{__FPU_OK__} is defined, otherwise the symbol
32628 @code{__NO_FPU__} is defined.
32630 @opindex mloop
32631 @item -mloop
32632 Enables the use of the e3v5 LOOP instruction.  The use of this
32633 instruction is not enabled by default when the e3v5 architecture is
32634 selected because its use is still experimental.
32636 @opindex mrh850-abi
32637 @opindex mghs
32638 @item -mrh850-abi
32639 @itemx -mghs
32640 Enables support for the RH850 version of the V850 ABI.  This is the
32641 default.  With this version of the ABI the following rules apply:
32643 @itemize
32644 @item
32645 Integer sized structures and unions are returned via a memory pointer
32646 rather than a register.
32648 @item
32649 Large structures and unions (more than 8 bytes in size) are passed by
32650 value.
32652 @item
32653 Functions are aligned to 16-bit boundaries.
32655 @item
32656 The @option{-m8byte-align} command-line option is supported.
32658 @item
32659 The @option{-mdisable-callt} command-line option is enabled by
32660 default.  The @option{-mno-disable-callt} command-line option is not
32661 supported.
32662 @end itemize
32664 When this version of the ABI is enabled the C preprocessor symbol
32665 @code{__V850_RH850_ABI__} is defined.
32667 @opindex mgcc-abi
32668 @item -mgcc-abi
32669 Enables support for the old GCC version of the V850 ABI.  With this
32670 version of the ABI the following rules apply:
32672 @itemize
32673 @item
32674 Integer sized structures and unions are returned in register @code{r10}.
32676 @item
32677 Large structures and unions (more than 8 bytes in size) are passed by
32678 reference.
32680 @item
32681 Functions are aligned to 32-bit boundaries, unless optimizing for
32682 size.
32684 @item
32685 The @option{-m8byte-align} command-line option is not supported.
32687 @item
32688 The @option{-mdisable-callt} command-line option is supported but not
32689 enabled by default.
32690 @end itemize
32692 When this version of the ABI is enabled the C preprocessor symbol
32693 @code{__V850_GCC_ABI__} is defined.
32695 @opindex m8byte-align
32696 @opindex mno-8byte-align
32697 @item -m8byte-align
32698 @itemx -mno-8byte-align
32699 Enables support for @code{double} and @code{long long} types to be
32700 aligned on 8-byte boundaries.  The default is to restrict the
32701 alignment of all objects to at most 4-bytes.  When
32702 @option{-m8byte-align} is in effect the C preprocessor symbol
32703 @code{__V850_8BYTE_ALIGN__} is defined.
32705 @opindex mbig-switch
32706 @item -mbig-switch
32707 Generate code suitable for big switch tables.  Use this option only if
32708 the assembler/linker complain about out of range branches within a switch
32709 table.
32711 @opindex mapp-regs
32712 @item -mapp-regs
32713 This option causes r2 and r5 to be used in the code generated by
32714 the compiler.  This setting is the default.
32716 @opindex mno-app-regs
32717 @item -mno-app-regs
32718 This option causes r2 and r5 to be treated as fixed registers.
32720 @end table
32722 @node VAX Options
32723 @subsection VAX Options
32724 @cindex VAX options
32726 These @samp{-m} options are defined for the VAX:
32728 @table @gcctabopt
32729 @opindex munix
32730 @item -munix
32731 Do not output certain jump instructions (@code{aobleq} and so on)
32732 that the Unix assembler for the VAX cannot handle across long
32733 ranges.
32735 @opindex mgnu
32736 @item -mgnu
32737 Do output those jump instructions, on the assumption that the
32738 GNU assembler is being used.
32740 @opindex mg
32741 @item -mg
32742 Output code for G-format floating-point numbers instead of D-format.
32744 @opindex mlra
32745 @opindex mno-lra
32746 @item -mlra
32747 @itemx -mno-lra
32748 Enable Local Register Allocation.  This is still experimental for the VAX,
32749 so by default the compiler uses standard reload.
32750 @end table
32752 @node Visium Options
32753 @subsection Visium Options
32754 @cindex Visium options
32756 @table @gcctabopt
32758 @opindex mdebug
32759 @item -mdebug
32760 A program which performs file I/O and is destined to run on an MCM target
32761 should be linked with this option.  It causes the libraries libc.a and
32762 libdebug.a to be linked.  The program should be run on the target under
32763 the control of the GDB remote debugging stub.
32765 @opindex msim
32766 @item -msim
32767 A program which performs file I/O and is destined to run on the simulator
32768 should be linked with option.  This causes libraries libc.a and libsim.a to
32769 be linked.
32771 @opindex mfpu
32772 @opindex mhard-float
32773 @item -mfpu
32774 @itemx -mhard-float
32775 Generate code containing floating-point instructions.  This is the
32776 default.
32778 @opindex mno-fpu
32779 @opindex msoft-float
32780 @item -mno-fpu
32781 @itemx -msoft-float
32782 Generate code containing library calls for floating-point.
32784 @option{-msoft-float} changes the calling convention in the output file;
32785 therefore, it is only useful if you compile @emph{all} of a program with
32786 this option.  In particular, you need to compile @file{libgcc.a}, the
32787 library that comes with GCC, with @option{-msoft-float} in order for
32788 this to work.
32790 @opindex mcpu
32791 @item -mcpu=@var{cpu_type}
32792 Set the instruction set, register set, and instruction scheduling parameters
32793 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32794 @samp{mcm}, @samp{gr5} and @samp{gr6}.
32796 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
32798 By default (unless configured otherwise), GCC generates code for the GR5
32799 variant of the Visium architecture.  
32801 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
32802 architecture.  The only difference from GR5 code is that the compiler will
32803 generate block move instructions.
32805 @opindex mtune
32806 @item -mtune=@var{cpu_type}
32807 Set the instruction scheduling parameters for machine type @var{cpu_type},
32808 but do not set the instruction set or register set that the option
32809 @option{-mcpu=@var{cpu_type}} would.
32811 @opindex msv-mode
32812 @item -msv-mode
32813 Generate code for the supervisor mode, where there are no restrictions on
32814 the access to general registers.  This is the default.
32816 @opindex muser-mode
32817 @item -muser-mode
32818 Generate code for the user mode, where the access to some general registers
32819 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
32820 mode; on the GR6, only registers r29 to r31 are affected.
32821 @end table
32823 @node VMS Options
32824 @subsection VMS Options
32826 These @samp{-m} options are defined for the VMS implementations:
32828 @table @gcctabopt
32829 @opindex mvms-return-codes
32830 @item -mvms-return-codes
32831 Return VMS condition codes from @code{main}. The default is to return POSIX-style
32832 condition (e.g.@: error) codes.
32834 @opindex mdebug-main=@var{prefix}
32835 @item -mdebug-main=@var{prefix}
32836 Flag the first routine whose name starts with @var{prefix} as the main
32837 routine for the debugger.
32839 @opindex mmalloc64
32840 @item -mmalloc64
32841 Default to 64-bit memory allocation routines.
32843 @opindex mpointer-size=@var{size}
32844 @item -mpointer-size=@var{size}
32845 Set the default size of pointers. Possible options for @var{size} are
32846 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
32847 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
32848 The later option disables @code{pragma pointer_size}.
32849 @end table
32851 @node VxWorks Options
32852 @subsection VxWorks Options
32853 @cindex VxWorks Options
32855 The options in this section are defined for all VxWorks targets.
32856 Options specific to the target hardware are listed with the other
32857 options for that target.
32859 @table @gcctabopt
32860 @opindex mrtp
32861 @item -mrtp
32862 GCC can generate code for both VxWorks kernels and real time processes
32863 (RTPs).  This option switches from the former to the latter.  It also
32864 defines the preprocessor macro @code{__RTP__}.
32866 @opindex msmp
32867 @item -msmp
32868 Select SMP runtimes for linking.  Not available on architectures other
32869 than PowerPC, nor on VxWorks version 7 or later, in which the selection
32870 is part of the VxWorks build configuration and the library paths are the
32871 same for either choice.
32873 @opindex non-static
32874 @item -non-static
32875 Link an RTP executable against shared libraries rather than static
32876 libraries.  The options @option{-static} and @option{-shared} can
32877 also be used for RTPs (@pxref{Link Options}); @option{-static}
32878 is the default.
32880 @opindex Bstatic
32881 @opindex Bdynamic
32882 @item -Bstatic
32883 @itemx -Bdynamic
32884 These options are passed down to the linker.  They are defined for
32885 compatibility with Diab.
32887 @opindex Xbind-lazy
32888 @item -Xbind-lazy
32889 Enable lazy binding of function calls.  This option is equivalent to
32890 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32892 @opindex Xbind-now
32893 @item -Xbind-now
32894 Disable lazy binding of function calls.  This option is the default and
32895 is defined for compatibility with Diab.
32896 @end table
32898 @node x86 Options
32899 @subsection x86 Options
32900 @cindex x86 Options
32902 These @samp{-m} options are defined for the x86 family of computers.
32904 @table @gcctabopt
32906 @opindex march
32907 @item -march=@var{cpu-type}
32908 Generate instructions for the machine type @var{cpu-type}.  In contrast to
32909 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
32910 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32911 to generate code that may not run at all on processors other than the one
32912 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
32913 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32915 The choices for @var{cpu-type} are:
32917 @table @samp
32918 @item native
32919 This selects the CPU to generate code for at compilation time by determining
32920 the processor type of the compiling machine.  Using @option{-march=native}
32921 enables all instruction subsets supported by the local machine (hence
32922 the result might not run on different machines).  Using @option{-mtune=native}
32923 produces code optimized for the local machine under the constraints
32924 of the selected instruction set.  
32926 @item x86-64
32927 A generic CPU with 64-bit extensions.
32929 @item x86-64-v2
32930 @itemx x86-64-v3
32931 @itemx x86-64-v4
32932 These choices for @var{cpu-type} select the corresponding
32933 micro-architecture level from the x86-64 psABI.  On ABIs other than
32934 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32935 documents for the particular micro-architecture level.
32937 Since these @var{cpu-type} values do not have a corresponding
32938 @option{-mtune} setting, using @option{-march} with these values enables
32939 generic tuning.  Specific tuning can be enabled using the
32940 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32941 @var{other-cpu-type} value.
32943 @item i386
32944 Original Intel i386 CPU@.
32946 @item i486
32947 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
32949 @item i586
32950 @itemx pentium
32951 Intel Pentium CPU with no MMX support.
32953 @item lakemont
32954 Intel Lakemont MCU, based on Intel Pentium CPU.
32956 @item pentium-mmx
32957 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32959 @item pentiumpro
32960 Intel Pentium Pro CPU@.
32962 @item i686
32963 When used with @option{-march}, the Pentium Pro
32964 instruction set is used, so the code runs on all i686 family chips.
32965 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32967 @item pentium2
32968 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32969 set support.
32971 @item pentium3
32972 @itemx pentium3m
32973 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32974 instruction set support.
32976 @item pentium-m
32977 Intel Pentium M; low-power version of Intel Pentium III CPU
32978 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
32979 notebooks.
32981 @item pentium4
32982 @itemx pentium4m
32983 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32985 @item prescott
32986 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32987 instruction set support.
32989 @item nocona
32990 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32991 SSE2, SSE3 and FXSR instruction set support.
32993 @item core2
32994 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32995 SAHF and FXSR instruction set support.
32997 @item nehalem
32998 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32999 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
33001 @item westmere
33002 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
33003 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
33005 @item sandybridge
33006 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
33007 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
33008 support.
33010 @item ivybridge
33011 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
33012 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
33013 and F16C instruction set support.
33015 @item haswell
33016 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33017 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33018 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
33020 @item broadwell
33021 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33022 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33023 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
33024 instruction set support.
33026 @item skylake
33027 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33028 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33029 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33030 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
33032 @item bonnell
33033 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
33034 instruction set support.
33036 @item silvermont
33037 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33038 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
33039 instruction set support.
33041 @item goldmont
33042 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33043 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
33044 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
33045 set support.
33047 @item goldmont-plus
33048 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33049 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
33050 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
33051 RDPID and SGX instruction set support.
33053 @item tremont
33054 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33055 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
33056 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
33057 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
33058 support.
33060 @item sierraforest
33061 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33062 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33063 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33064 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33065 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33066 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
33067 support.
33069 @item grandridge
33070 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33071 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33072 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33073 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33074 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33075 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD, UINTR and RAOINT
33076 instruction set support.
33078 @item clearwaterforest
33079 Intel Clearwater Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
33080 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE,
33081 XSAVEC, XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB,
33082 MOVDIRI, MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA,
33083 LZCNT, PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33084 ENQCMD, UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16,
33085 SHA512, SM3, SM4, USER_MSR and PREFETCHI instruction set support.
33087 @item knl
33088 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33089 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33090 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33091 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
33093 @item knm
33094 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33095 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33096 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33097 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
33098 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
33100 @item skylake-avx512
33101 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33102 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33103 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33104 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
33105 AVX512DQ and AVX512CD instruction set support.
33107 @item cannonlake
33108 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
33109 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
33110 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
33111 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
33112 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
33113 support.
33115 @item icelake-client
33116 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33117 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33118 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33119 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33120 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
33121 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
33123 @item icelake-server
33124 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33125 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33126 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33127 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33128 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
33129 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
33130 instruction set support.
33132 @item cascadelake
33133 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33134 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33135 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33136 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
33137 AVX512CD and AVX512VNNI instruction set support.
33139 @item cooperlake
33140 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33141 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33142 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33143 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
33144 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
33146 @item tigerlake
33147 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33148 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33149 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33150 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
33151 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33152 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
33153 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
33155 @item sapphirerapids
33156 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33157 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33158 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33159 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33160 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33161 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33162 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33163 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
33164 instruction set support.
33166 @item alderlake
33167 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
33168 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
33169 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
33170 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
33171 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
33172 support.
33174 @item rocketlake
33175 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
33176 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
33177 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
33178 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
33179 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33180 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
33182 @item graniterapids
33183 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33184 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33185 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33186 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33187 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33188 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33189 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33190 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
33191 and PREFETCHI instruction set support.
33193 @item graniterapids-d
33194 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33195 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
33196 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
33197 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
33198 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
33199 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
33200 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
33201 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
33202 PREFETCHI and AMX-COMPLEX instruction set support.
33204 @item arrowlake
33205 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33206 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33207 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33208 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33209 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33210 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set
33211 support.
33213 @item arrowlake-s
33214 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33215 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33216 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33217 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33218 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33219 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
33220 SM3 and SM4 instruction set support.
33222 @item pantherlake
33223 Intel Panther Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
33224 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
33225 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
33226 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
33227 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
33228 UINTR, AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512,
33229 SM3, SM4 and PREFETCHI instruction set support.
33231 @item k6
33232 AMD K6 CPU with MMX instruction set support.
33234 @item k6-2
33235 @itemx k6-3
33236 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
33238 @item athlon
33239 @itemx athlon-tbird
33240 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
33241 support.
33243 @item athlon-4
33244 @itemx athlon-xp
33245 @itemx athlon-mp
33246 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
33247 instruction set support.
33249 @item k8
33250 @itemx opteron
33251 @itemx athlon64
33252 @itemx athlon-fx
33253 Processors based on the AMD K8 core with x86-64 instruction set support,
33254 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
33255 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
33256 instruction set extensions.)
33258 @item k8-sse3
33259 @itemx opteron-sse3
33260 @itemx athlon64-sse3
33261 Improved versions of AMD K8 cores with SSE3 instruction set support.
33263 @item amdfam10
33264 @itemx barcelona
33265 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
33266 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
33267 instruction set extensions.)
33269 @item bdver1
33270 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
33271 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
33272 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
33274 @item bdver2
33275 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33276 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
33277 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
33278 extensions.)
33280 @item bdver3
33281 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33282 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
33283 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
33284 64-bit instruction set extensions.)
33286 @item bdver4
33287 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
33288 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
33289 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
33290 SSE4.2, ABM and 64-bit instruction set extensions.)
33292 @item znver1
33293 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
33294 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
33295 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
33296 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
33297 instruction set extensions.)
33299 @item znver2
33300 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
33301 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33302 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33303 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33304 WBNOINVD, and 64-bit instruction set extensions.)
33306 @item znver3
33307 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33308 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33309 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33310 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33311 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
33313 @item znver4
33314 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
33315 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
33316 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
33317 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
33318 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
33319 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
33320 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
33322 @item btver1
33323 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
33324 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
33325 instruction set extensions.)
33327 @item btver2
33328 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
33329 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
33330 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
33332 @item winchip-c6
33333 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
33334 set support.
33336 @item winchip2
33337 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
33338 instruction set support.
33340 @item c3
33341 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
33342 (No scheduling is implemented for this chip.)
33344 @item c3-2
33345 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
33346 (No scheduling is implemented for this chip.)
33348 @item c7
33349 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33350 (No scheduling is implemented for this chip.)
33352 @item samuel-2
33353 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
33354 (No scheduling is implemented for this chip.)
33356 @item nehemiah
33357 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
33358 (No scheduling is implemented for this chip.)
33360 @item esther
33361 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
33362 (No scheduling is implemented for this chip.)
33364 @item eden-x2
33365 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
33366 (No scheduling is implemented for this chip.)
33368 @item eden-x4
33369 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
33370 AVX and AVX2 instruction set support.
33371 (No scheduling is implemented for this chip.)
33373 @item nano
33374 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33375 instruction set support.
33376 (No scheduling is implemented for this chip.)
33378 @item nano-1000
33379 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33380 instruction set support.
33381 (No scheduling is implemented for this chip.)
33383 @item nano-2000
33384 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
33385 instruction set support.
33386 (No scheduling is implemented for this chip.)
33388 @item nano-3000
33389 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33390 instruction set support.
33391 (No scheduling is implemented for this chip.)
33393 @item nano-x2
33394 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33395 instruction set support.
33396 (No scheduling is implemented for this chip.)
33398 @item nano-x4
33399 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33400 instruction set support.
33401 (No scheduling is implemented for this chip.)
33403 @item lujiazui
33404 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33405 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33406 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
33408 @item yongfeng
33409 ZHAOXIN yongfeng CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33410 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33411 ABM, BMI, BMI2, F16C, FXSR, RDSEED, AVX2, FMA, SHA, LZCNT
33412 instruction set support.
33414 @item geode
33415 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
33416 @end table
33418 @opindex mtune
33419 @item -mtune=@var{cpu-type}
33420 Tune to @var{cpu-type} everything applicable about the generated code, except
33421 for the ABI and the set of available instructions.  
33422 While picking a specific @var{cpu-type} schedules things appropriately
33423 for that particular chip, the compiler does not generate any code that
33424 cannot run on the default machine type unless you use a
33425 @option{-march=@var{cpu-type}} option.
33426 For example, if GCC is configured for i686-pc-linux-gnu
33427 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
33428 but still runs on i686 machines.
33430 The choices for @var{cpu-type} are the same as for @option{-march}.
33431 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
33433 @table @samp
33434 @item generic
33435 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
33436 If you know the CPU on which your code will run, then you should use
33437 the corresponding @option{-mtune} or @option{-march} option instead of
33438 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
33439 of your application will have, then you should use this option.
33441 As new processors are deployed in the marketplace, the behavior of this
33442 option will change.  Therefore, if you upgrade to a newer version of
33443 GCC, code generation controlled by this option will change to reflect
33444 the processors
33445 that are most common at the time that version of GCC is released.
33447 There is no @option{-march=generic} option because @option{-march}
33448 indicates the instruction set the compiler can use, and there is no
33449 generic instruction set applicable to all processors.  In contrast,
33450 @option{-mtune} indicates the processor (or, in this case, collection of
33451 processors) for which the code is optimized.
33453 @item intel
33454 Produce code optimized for the most current Intel processors, which are
33455 Haswell and Silvermont for this version of GCC.  If you know the CPU
33456 on which your code will run, then you should use the corresponding
33457 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
33458 But, if you want your application performs better on both Haswell and
33459 Silvermont, then you should use this option.
33461 As new Intel processors are deployed in the marketplace, the behavior of
33462 this option will change.  Therefore, if you upgrade to a newer version of
33463 GCC, code generation controlled by this option will change to reflect
33464 the most current Intel processors at the time that version of GCC is
33465 released.
33467 There is no @option{-march=intel} option because @option{-march} indicates
33468 the instruction set the compiler can use, and there is no common
33469 instruction set applicable to all processors.  In contrast,
33470 @option{-mtune} indicates the processor (or, in this case, collection of
33471 processors) for which the code is optimized.
33472 @end table
33474 @opindex mcpu
33475 @item -mcpu=@var{cpu-type}
33476 A deprecated synonym for @option{-mtune}.
33478 @opindex mfpmath
33479 @item -mfpmath=@var{unit}
33480 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
33481 for @var{unit} are:
33483 @table @samp
33484 @item 387
33485 Use the standard 387 floating-point coprocessor present on the majority of chips and
33486 emulated otherwise.  Code compiled with this option runs almost everywhere.
33487 The temporary results are computed in 80-bit precision instead of the precision
33488 specified by the type, resulting in slightly different results compared to most
33489 of other chips.  See @option{-ffloat-store} for more detailed description.
33491 This is the default choice for non-Darwin x86-32 targets.
33493 @item sse
33494 Use scalar floating-point instructions present in the SSE instruction set.
33495 This instruction set is supported by Pentium III and newer chips,
33496 and in the AMD line
33497 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
33498 instruction set supports only single-precision arithmetic, thus the double and
33499 extended-precision arithmetic are still done using 387.  A later version, present
33500 only in Pentium 4 and AMD x86-64 chips, supports double-precision
33501 arithmetic too.
33503 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
33504 or @option{-msse2} switches to enable SSE extensions and make this option
33505 effective.  For the x86-64 compiler, these extensions are enabled by default.
33507 The resulting code should be considerably faster in the majority of cases and avoid
33508 the numerical instability problems of 387 code, but may break some existing
33509 code that expects temporaries to be 80 bits.
33511 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
33512 and the default choice for x86-32 targets with the SSE2 instruction set
33513 when @option{-ffast-math} is enabled.
33515 @item sse,387
33516 @itemx sse+387
33517 @itemx both
33518 Attempt to utilize both instruction sets at once.  This effectively doubles the
33519 amount of available registers, and on chips with separate execution units for
33520 387 and SSE the execution resources too.  Use this option with care, as it is
33521 still experimental, because the GCC register allocator does not model separate
33522 functional units well, resulting in unstable performance.
33523 @end table
33525 @opindex masm=@var{dialect}
33526 @item -masm=@var{dialect}
33527 Output assembly instructions using selected @var{dialect}.  Also affects
33528 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
33529 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
33530 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
33531 not support @samp{intel}.
33533 @opindex mieee-fp
33534 @opindex mno-ieee-fp
33535 @item -mieee-fp
33536 @itemx -mno-ieee-fp
33537 Control whether or not the compiler uses IEEE floating-point
33538 comparisons.  These correctly handle the case where the result of a
33539 comparison is unordered.
33541 @opindex m80387
33542 @opindex mhard-float
33543 @item -m80387
33544 @itemx -mhard-float
33545 Generate output containing 80387 instructions for floating point.
33547 @opindex no-80387
33548 @opindex msoft-float
33549 @item -mno-80387
33550 @itemx -msoft-float
33551 Generate output containing library calls for floating point.
33553 @strong{Warning:} the requisite libraries are not part of GCC@.
33554 Normally the facilities of the machine's usual C compiler are used, but
33555 this cannot be done directly in cross-compilation.  You must make your
33556 own arrangements to provide suitable library functions for
33557 cross-compilation.
33559 On machines where a function returns floating-point results in the 80387
33560 register stack, some floating-point opcodes may be emitted even if
33561 @option{-msoft-float} is used.
33563 @opindex mno-fp-ret-in-387
33564 @opindex mfp-ret-in-387
33565 @item -mno-fp-ret-in-387
33566 Do not use the FPU registers for return values of functions.
33568 The usual calling convention has functions return values of types
33569 @code{float} and @code{double} in an FPU register, even if there
33570 is no FPU@.  The idea is that the operating system should emulate
33571 an FPU@.
33573 The option @option{-mno-fp-ret-in-387} causes such values to be returned
33574 in ordinary CPU registers instead.
33576 @opindex mno-fancy-math-387
33577 @opindex mfancy-math-387
33578 @item -mno-fancy-math-387
33579 Some 387 emulators do not support the @code{sin}, @code{cos} and
33580 @code{sqrt} instructions for the 387.  Specify this option to avoid
33581 generating those instructions.
33582 This option is overridden when @option{-march}
33583 indicates that the target CPU always has an FPU and so the
33584 instruction does not need emulation.  These
33585 instructions are not generated unless you also use the
33586 @option{-funsafe-math-optimizations} switch.
33588 @opindex malign-double
33589 @opindex mno-align-double
33590 @item -malign-double
33591 @itemx -mno-align-double
33592 Control whether GCC aligns @code{double}, @code{long double}, and
33593 @code{long long} variables on a two-word boundary or a one-word
33594 boundary.  Aligning @code{double} variables on a two-word boundary
33595 produces code that runs somewhat faster on a Pentium at the
33596 expense of more memory.
33598 On x86-64, @option{-malign-double} is enabled by default.
33600 @strong{Warning:} if you use the @option{-malign-double} switch,
33601 structures containing the above types are aligned differently than
33602 the published application binary interface specifications for the x86-32
33603 and are not binary compatible with structures in code compiled
33604 without that switch.
33606 @opindex m96bit-long-double
33607 @opindex m128bit-long-double
33608 @item -m96bit-long-double
33609 @itemx -m128bit-long-double
33610 These switches control the size of @code{long double} type.  The x86-32
33611 application binary interface specifies the size to be 96 bits,
33612 so @option{-m96bit-long-double} is the default in 32-bit mode.
33614 Modern architectures (Pentium and newer) prefer @code{long double}
33615 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
33616 conforming to the ABI, this is not possible.  So specifying
33617 @option{-m128bit-long-double} aligns @code{long double}
33618 to a 16-byte boundary by padding the @code{long double} with an additional
33619 32-bit zero.
33621 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
33622 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
33624 Notice that neither of these options enable any extra precision over the x87
33625 standard of 80 bits for a @code{long double}.
33627 @strong{Warning:} if you override the default value for your target ABI, this
33628 changes the size of 
33629 structures and arrays containing @code{long double} variables,
33630 as well as modifying the function calling convention for functions taking
33631 @code{long double}.  Hence they are not binary-compatible
33632 with code compiled without that switch.
33634 @opindex mlong-double-64
33635 @opindex mlong-double-80
33636 @opindex mlong-double-128
33637 @item -mlong-double-64
33638 @itemx -mlong-double-80
33639 @itemx -mlong-double-128
33640 These switches control the size of @code{long double} type. A size
33641 of 64 bits makes the @code{long double} type equivalent to the @code{double}
33642 type. This is the default for 32-bit Bionic C library.  A size
33643 of 128 bits makes the @code{long double} type equivalent to the
33644 @code{__float128} type. This is the default for 64-bit Bionic C library.
33646 @strong{Warning:} if you override the default value for your target ABI, this
33647 changes the size of
33648 structures and arrays containing @code{long double} variables,
33649 as well as modifying the function calling convention for functions taking
33650 @code{long double}.  Hence they are not binary-compatible
33651 with code compiled without that switch.
33653 @opindex malign-data
33654 @item -malign-data=@var{type}
33655 Control how GCC aligns variables.  Supported values for @var{type} are
33656 @samp{compat} uses increased alignment value compatible uses GCC 4.8
33657 and earlier, @samp{abi} uses alignment value as specified by the
33658 psABI, and @samp{cacheline} uses increased alignment value to match
33659 the cache line size.  @samp{compat} is the default.
33661 @opindex mlarge-data-threshold
33662 @item -mlarge-data-threshold=@var{threshold}
33663 When @option{-mcmodel=medium} or @option{-mcmodel=large} is specified, data
33664 objects larger than @var{threshold} are placed in large data sections.  The
33665 default is 65535.
33667 @opindex mrtd
33668 @item -mrtd
33669 Use a different function-calling convention, in which functions that
33670 take a fixed number of arguments return with the @code{ret @var{num}}
33671 instruction, which pops their arguments while returning.  This saves one
33672 instruction in the caller since there is no need to pop the arguments
33673 there.
33675 You can specify that an individual function is called with this calling
33676 sequence with the function attribute @code{stdcall}.  You can also
33677 override the @option{-mrtd} option by using the function attribute
33678 @code{cdecl}.  @xref{Function Attributes}.
33680 @strong{Warning:} this calling convention is incompatible with the one
33681 normally used on Unix, so you cannot use it if you need to call
33682 libraries compiled with the Unix compiler.
33684 Also, you must provide function prototypes for all functions that
33685 take variable numbers of arguments (including @code{printf});
33686 otherwise incorrect code is generated for calls to those
33687 functions.
33689 In addition, seriously incorrect code results if you call a
33690 function with too many arguments.  (Normally, extra arguments are
33691 harmlessly ignored.)
33693 @opindex mregparm
33694 @item -mregparm=@var{num}
33695 Control how many registers are used to pass integer arguments.  By
33696 default, no registers are used to pass arguments, and at most 3
33697 registers can be used.  You can control this behavior for a specific
33698 function by using the function attribute @code{regparm}.
33699 @xref{Function Attributes}.
33701 @strong{Warning:} if you use this switch, and
33702 @var{num} is nonzero, then you must build all modules with the same
33703 value, including any libraries.  This includes the system libraries and
33704 startup modules.
33706 @opindex msseregparm
33707 @item -msseregparm
33708 Use SSE register passing conventions for float and double arguments
33709 and return values.  You can control this behavior for a specific
33710 function by using the function attribute @code{sseregparm}.
33711 @xref{Function Attributes}.
33713 @strong{Warning:} if you use this switch then you must build all
33714 modules with the same value, including any libraries.  This includes
33715 the system libraries and startup modules.
33717 @opindex mvect8-ret-in-mem
33718 @item -mvect8-ret-in-mem
33719 Return 8-byte vectors in memory instead of MMX registers.  This is the
33720 default on VxWorks to match the ABI of the Sun Studio compilers until
33721 version 12.  @emph{Only} use this option if you need to remain
33722 compatible with existing code produced by those previous compiler
33723 versions or older versions of GCC@.
33725 @opindex mpc32
33726 @opindex mpc64
33727 @opindex mpc80
33728 @item -mpc32
33729 @itemx -mpc64
33730 @itemx -mpc80
33732 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
33733 is specified, the significands of results of floating-point operations are
33734 rounded to 24 bits (single precision); @option{-mpc64} rounds the
33735 significands of results of floating-point operations to 53 bits (double
33736 precision) and @option{-mpc80} rounds the significands of results of
33737 floating-point operations to 64 bits (extended double precision), which is
33738 the default.  When this option is used, floating-point operations in higher
33739 precisions are not available to the programmer without setting the FPU
33740 control word explicitly.
33742 Setting the rounding of floating-point operations to less than the default
33743 80 bits can speed some programs by 2% or more.  Note that some mathematical
33744 libraries assume that extended-precision (80-bit) floating-point operations
33745 are enabled by default; routines in such libraries could suffer significant
33746 loss of accuracy, typically through so-called ``catastrophic cancellation'',
33747 when this option is used to set the precision to less than extended precision.
33749 @opindex mdaz-ftz
33750 @item -mdaz-ftz
33752 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
33753 are used to control floating-point calculations.SSE and AVX instructions
33754 including scalar and vector instructions could benefit from enabling the FTZ
33755 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
33756 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
33757 will set FTZ/DAZ flags even with @option{-shared}.
33759 @opindex mstackrealign
33760 @item -mstackrealign
33761 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
33762 option generates an alternate prologue and epilogue that realigns the
33763 run-time stack if necessary.  This supports mixing legacy codes that keep
33764 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
33765 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
33766 applicable to individual functions.
33768 @opindex mpreferred-stack-boundary
33769 @item -mpreferred-stack-boundary=@var{num}
33770 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
33771 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
33772 the default is 4 (16 bytes or 128 bits).
33774 @strong{Warning:} When generating code for the x86-64 architecture with
33775 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
33776 used to keep the stack boundary aligned to 8 byte boundary.  Since
33777 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
33778 intended to be used in controlled environment where stack space is
33779 important limitation.  This option leads to wrong code when functions
33780 compiled with 16 byte stack alignment (such as functions from a standard
33781 library) are called with misaligned stack.  In this case, SSE
33782 instructions may lead to misaligned memory access traps.  In addition,
33783 variable arguments are handled incorrectly for 16 byte aligned
33784 objects (including x87 long double and __int128), leading to wrong
33785 results.  You must build all modules with
33786 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
33787 includes the system libraries and startup modules.
33789 @opindex mincoming-stack-boundary
33790 @item -mincoming-stack-boundary=@var{num}
33791 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
33792 boundary.  If @option{-mincoming-stack-boundary} is not specified,
33793 the one specified by @option{-mpreferred-stack-boundary} is used.
33795 On Pentium and Pentium Pro, @code{double} and @code{long double} values
33796 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
33797 suffer significant run time performance penalties.  On Pentium III, the
33798 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
33799 properly if it is not 16-byte aligned.
33801 To ensure proper alignment of this values on the stack, the stack boundary
33802 must be as aligned as that required by any value stored on the stack.
33803 Further, every function must be generated such that it keeps the stack
33804 aligned.  Thus calling a function compiled with a higher preferred
33805 stack boundary from a function compiled with a lower preferred stack
33806 boundary most likely misaligns the stack.  It is recommended that
33807 libraries that use callbacks always use the default setting.
33809 This extra alignment does consume extra stack space, and generally
33810 increases code size.  Code that is sensitive to stack space usage, such
33811 as embedded systems and operating system kernels, may want to reduce the
33812 preferred alignment to @option{-mpreferred-stack-boundary=2}.
33814 @need 200
33815 @opindex mmmx
33816 @item -mmmx
33817 @need 200
33818 @opindex msse
33819 @itemx -msse
33820 @need 200
33821 @opindex msse2
33822 @itemx -msse2
33823 @need 200
33824 @opindex msse3
33825 @itemx -msse3
33826 @need 200
33827 @opindex mssse3
33828 @itemx -mssse3
33829 @need 200
33830 @opindex msse4
33831 @itemx -msse4
33832 @need 200
33833 @opindex msse4a
33834 @itemx -msse4a
33835 @need 200
33836 @opindex msse4.1
33837 @itemx -msse4.1
33838 @need 200
33839 @opindex msse4.2
33840 @itemx -msse4.2
33841 @need 200
33842 @opindex mavx
33843 @itemx -mavx
33844 @need 200
33845 @opindex mavx2
33846 @itemx -mavx2
33847 @need 200
33848 @opindex mavx512f
33849 @itemx -mavx512f
33850 @need 200
33851 @opindex mavx512pf
33852 @itemx -mavx512pf
33853 @need 200
33854 @opindex mavx512er
33855 @itemx -mavx512er
33856 @need 200
33857 @opindex mavx512cd
33858 @itemx -mavx512cd
33859 @need 200
33860 @opindex mavx512vl
33861 @itemx -mavx512vl
33862 @need 200
33863 @opindex mavx512bw
33864 @itemx -mavx512bw
33865 @need 200
33866 @opindex mavx512dq
33867 @itemx -mavx512dq
33868 @need 200
33869 @opindex mavx512ifma
33870 @itemx -mavx512ifma
33871 @need 200
33872 @opindex mavx512vbmi
33873 @itemx -mavx512vbmi
33874 @need 200
33875 @opindex msha
33876 @itemx -msha
33877 @need 200
33878 @opindex maes
33879 @itemx -maes
33880 @need 200
33881 @opindex mpclmul
33882 @itemx -mpclmul
33883 @need 200
33884 @opindex mclflushopt
33885 @itemx -mclflushopt
33886 @need 200
33887 @opindex mclwb
33888 @itemx -mclwb
33889 @need 200
33890 @opindex mfsgsbase
33891 @itemx -mfsgsbase
33892 @need 200
33893 @opindex mptwrite
33894 @itemx -mptwrite
33895 @need 200
33896 @opindex mrdrnd
33897 @itemx -mrdrnd
33898 @need 200
33899 @opindex mf16c
33900 @itemx -mf16c
33901 @need 200
33902 @opindex mfma
33903 @itemx -mfma
33904 @need 200
33905 @opindex mpconfig
33906 @itemx -mpconfig
33907 @need 200
33908 @opindex mwbnoinvd
33909 @itemx -mwbnoinvd
33910 @need 200
33911 @opindex mfma4
33912 @itemx -mfma4
33913 @need 200
33914 @opindex mprfchw
33915 @itemx -mprfchw
33916 @need 200
33917 @opindex mrdpid
33918 @itemx -mrdpid
33919 @need 200
33920 @opindex mprefetchwt1
33921 @itemx -mprefetchwt1
33922 @need 200
33923 @opindex mrdseed
33924 @itemx -mrdseed
33925 @need 200
33926 @opindex msgx
33927 @itemx -msgx
33928 @need 200
33929 @opindex mxop
33930 @itemx -mxop
33931 @need 200
33932 @opindex mlwp
33933 @itemx -mlwp
33934 @need 200
33935 @opindex m3dnow
33936 @itemx -m3dnow
33937 @need 200
33938 @opindex m3dnowa
33939 @itemx -m3dnowa
33940 @need 200
33941 @opindex mpopcnt
33942 @itemx -mpopcnt
33943 @need 200
33944 @opindex mabm
33945 @itemx -mabm
33946 @need 200
33947 @opindex madx
33948 @itemx -madx
33949 @need 200
33950 @opindex mbmi
33951 @itemx -mbmi
33952 @need 200
33953 @opindex mbmi2
33954 @itemx -mbmi2
33955 @need 200
33956 @opindex mlzcnt
33957 @itemx -mlzcnt
33958 @need 200
33959 @opindex mfxsr
33960 @itemx -mfxsr
33961 @need 200
33962 @opindex mxsave
33963 @itemx -mxsave
33964 @need 200
33965 @opindex mxsaveopt
33966 @itemx -mxsaveopt
33967 @need 200
33968 @opindex mxsavec
33969 @itemx -mxsavec
33970 @need 200
33971 @opindex mxsaves
33972 @itemx -mxsaves
33973 @need 200
33974 @opindex mrtm
33975 @itemx -mrtm
33976 @need 200
33977 @opindex mhle
33978 @itemx -mhle
33979 @need 200
33980 @opindex mtbm
33981 @itemx -mtbm
33982 @need 200
33983 @opindex mmwaitx
33984 @itemx -mmwaitx
33985 @need 200
33986 @opindex mclzero
33987 @itemx -mclzero
33988 @need 200
33989 @opindex mpku
33990 @itemx -mpku
33991 @need 200
33992 @opindex mavx512vbmi2
33993 @itemx -mavx512vbmi2
33994 @need 200
33995 @opindex mavx512bf16
33996 @itemx -mavx512bf16
33997 @need 200
33998 @opindex mavx512fp16
33999 @itemx -mavx512fp16
34000 @need 200
34001 @opindex mgfni
34002 @itemx -mgfni
34003 @need 200
34004 @opindex mvaes
34005 @itemx -mvaes
34006 @need 200
34007 @opindex mwaitpkg
34008 @itemx -mwaitpkg
34009 @need 200
34010 @opindex mvpclmulqdq
34011 @itemx -mvpclmulqdq
34012 @need 200
34013 @opindex mavx512bitalg
34014 @itemx -mavx512bitalg
34015 @need 200
34016 @opindex mmovdiri
34017 @itemx -mmovdiri
34018 @need 200
34019 @opindex mmovdir64b
34020 @itemx -mmovdir64b
34021 @need 200
34022 @opindex menqcmd
34023 @opindex muintr
34024 @itemx -menqcmd
34025 @itemx -muintr
34026 @need 200
34027 @opindex mtsxldtrk
34028 @itemx -mtsxldtrk
34029 @need 200
34030 @opindex mavx512vpopcntdq
34031 @itemx -mavx512vpopcntdq
34032 @need 200
34033 @opindex mavx512vp2intersect
34034 @itemx -mavx512vp2intersect
34035 @need 200
34036 @opindex mavx5124fmaps
34037 @itemx -mavx5124fmaps
34038 @need 200
34039 @opindex mavx512vnni
34040 @itemx -mavx512vnni
34041 @need 200
34042 @opindex mavxvnni
34043 @itemx -mavxvnni
34044 @need 200
34045 @opindex mavx5124vnniw
34046 @itemx -mavx5124vnniw
34047 @need 200
34048 @opindex mcldemote
34049 @itemx -mcldemote
34050 @need 200
34051 @opindex mserialize
34052 @itemx -mserialize
34053 @need 200
34054 @opindex mamx-tile
34055 @itemx -mamx-tile
34056 @need 200
34057 @opindex mamx-int8
34058 @itemx -mamx-int8
34059 @need 200
34060 @opindex mamx-bf16
34061 @itemx -mamx-bf16
34062 @need 200
34063 @opindex mhreset
34064 @opindex mkl
34065 @itemx -mhreset
34066 @itemx -mkl
34067 @need 200
34068 @opindex mwidekl
34069 @itemx -mwidekl
34070 @need 200
34071 @opindex mavxifma
34072 @itemx -mavxifma
34073 @need 200
34074 @opindex mavxvnniint8
34075 @itemx -mavxvnniint8
34076 @need 200
34077 @opindex mavxneconvert
34078 @itemx -mavxneconvert
34079 @need 200
34080 @opindex mcmpccxadd
34081 @itemx -mcmpccxadd
34082 @need 200
34083 @opindex mamx-fp16
34084 @itemx -mamx-fp16
34085 @need 200
34086 @opindex mprefetchi
34087 @itemx -mprefetchi
34088 @need 200
34089 @opindex mraoint
34090 @itemx -mraoint
34091 @need 200
34092 @opindex mamx-complex
34093 @itemx -mamx-complex
34094 @need 200
34095 @opindex mavxvnniint16
34096 @itemx -mavxvnniint16
34097 @need 200
34098 @opindex msm3
34099 @itemx -msm3
34100 @need 200
34101 @opindex msha512
34102 @itemx -msha512
34103 @need 200
34104 @opindex msm4
34105 @itemx -msm4
34106 @need 200
34107 @opindex mapxf
34108 @itemx -mapxf
34109 @need 200
34110 @opindex musermsr
34111 @itemx -musermsr
34112 These switches enable the use of instructions in the MMX, SSE,
34113 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
34114 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
34115 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
34116 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
34117 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
34118 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
34119 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
34120 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
34121 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
34122 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4, APX_F, USER_MSR or CLDEMOTE
34123 extended instruction sets.  Each has a corresponding @option{-mno-} option
34124 to disable use of these instructions.
34126 These extensions are also available as built-in functions: see
34127 @ref{x86 Built-in Functions}, for details of the functions enabled and
34128 disabled by these switches.
34130 To generate SSE/SSE2 instructions automatically from floating-point
34131 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
34133 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
34134 generates new AVX instructions or AVX equivalence for all SSEx instructions
34135 when needed.
34137 These options enable GCC to use these extended instructions in
34138 generated code, even without @option{-mfpmath=sse}.  Applications that
34139 perform run-time CPU detection must compile separate files for each
34140 supported architecture, using the appropriate flags.  In particular,
34141 the file containing the CPU detection code should be compiled without
34142 these options.
34144 @opindex mdump-tune-features
34145 @item -mdump-tune-features
34146 This option instructs GCC to dump the names of the x86 performance 
34147 tuning features and default settings. The names can be used in 
34148 @option{-mtune-ctrl=@var{feature-list}}.
34150 @opindex mtune-ctrl=@var{feature-list}
34151 @item -mtune-ctrl=@var{feature-list}
34152 This option is used to do fine grain control of x86 code generation features.
34153 @var{feature-list} is a comma separated list of @var{feature} names. See also
34154 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
34155 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
34156 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
34157 developers. Using it may lead to code paths not covered by testing and can
34158 potentially result in compiler ICEs or runtime errors.
34160 @opindex mno-default
34161 @item -mno-default
34162 This option instructs GCC to turn off all tunable features. See also 
34163 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
34165 @opindex mcld
34166 @item -mcld
34167 This option instructs GCC to emit a @code{cld} instruction in the prologue
34168 of functions that use string instructions.  String instructions depend on
34169 the DF flag to select between autoincrement or autodecrement mode.  While the
34170 ABI specifies the DF flag to be cleared on function entry, some operating
34171 systems violate this specification by not clearing the DF flag in their
34172 exception dispatchers.  The exception handler can be invoked with the DF flag
34173 set, which leads to wrong direction mode when string instructions are used.
34174 This option can be enabled by default on 32-bit x86 targets by configuring
34175 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
34176 instructions can be suppressed with the @option{-mno-cld} compiler option
34177 in this case.
34179 @opindex mvzeroupper
34180 @item -mvzeroupper
34181 This option instructs GCC to emit a @code{vzeroupper} instruction
34182 before a transfer of control flow out of the function to minimize
34183 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
34184 intrinsics.
34186 @opindex mprefer-avx128
34187 @item -mprefer-avx128
34188 This option instructs GCC to use 128-bit AVX instructions instead of
34189 256-bit AVX instructions in the auto-vectorizer.
34191 @opindex mprefer-vector-width
34192 @item -mprefer-vector-width=@var{opt}
34193 This option instructs GCC to use @var{opt}-bit vector width in instructions
34194 instead of default on the selected platform.
34196 @opindex mpartial-vector-fp-math
34197 @item -mpartial-vector-fp-math
34198 This option enables GCC to generate floating-point operations that might
34199 affect the set of floating-point status flags on partial vectors, where
34200 vector elements reside in the low part of the 128-bit SSE register.  Unless
34201 @option{-fno-trapping-math} is specified, the compiler guarantees correct
34202 behavior by sanitizing all input operands to have zeroes in the unused
34203 upper part of the vector register.  Note that by using built-in functions
34204 or inline assembly with partial vector arguments, NaNs, denormal or invalid
34205 values can leak into the upper part of the vector, causing possible
34206 performance issues when @option{-fno-trapping-math} is in effect.  These
34207 issues can be mitigated by manually sanitizing the upper part of the partial
34208 vector argument register or by using @option{-mdaz-ftz} to set
34209 denormals-are-zero (DAZ) flag in the MXCSR register.
34211 This option is enabled by default.
34213 @opindex mmove-max
34214 @item -mmove-max=@var{bits}
34215 This option instructs GCC to set the maximum number of bits can be
34216 moved from memory to memory efficiently to @var{bits}.  The valid
34217 @var{bits} are 128, 256 and 512.
34219 @opindex mstore-max
34220 @item -mstore-max=@var{bits}
34221 This option instructs GCC to set the maximum number of bits can be
34222 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
34223 128, 256 and 512.
34225 @table @samp
34226 @item none
34227 No extra limitations applied to GCC other than defined by the selected platform.
34229 @item 128
34230 Prefer 128-bit vector width for instructions.
34232 @item 256
34233 Prefer 256-bit vector width for instructions.
34235 @item 512
34236 Prefer 512-bit vector width for instructions.
34237 @end table
34239 @opindex mcx16
34240 @item -mcx16
34241 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
34242 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
34243 objects.  This is useful for atomic updates of data structures exceeding one
34244 machine word in size.  The compiler uses this instruction to implement
34245 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
34246 128-bit integers, a library call is always used.
34248 @opindex msahf
34249 @item -msahf
34250 This option enables generation of @code{SAHF} instructions in 64-bit code.
34251 Early Intel Pentium 4 CPUs with Intel 64 support,
34252 prior to the introduction of Pentium 4 G1 step in December 2005,
34253 lacked the @code{LAHF} and @code{SAHF} instructions
34254 which are supported by AMD64.
34255 These are load and store instructions, respectively, for certain status flags.
34256 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
34257 @code{drem}, and @code{remainder} built-in functions;
34258 see @ref{Other Builtins} for details.
34260 @opindex mmovbe
34261 @item -mmovbe
34262 This option enables use of the @code{movbe} instruction to implement
34263 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
34265 @opindex mshstk
34266 @item -mshstk
34267 The @option{-mshstk} option enables shadow stack built-in functions
34268 from x86 Control-flow Enforcement Technology (CET).
34270 @opindex mcrc32
34271 @item -mcrc32
34272 This option enables built-in functions @code{__builtin_ia32_crc32qi},
34273 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
34274 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
34276 @opindex mmwait
34277 @item -mmwait
34278 This option enables built-in functions @code{__builtin_ia32_monitor},
34279 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
34280 @code{mwait} machine instructions.
34282 @opindex mrecip
34283 @item -mrecip
34284 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
34285 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
34286 with an additional Newton-Raphson step
34287 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
34288 (and their vectorized
34289 variants) for single-precision floating-point arguments.  These instructions
34290 are generated only when @option{-funsafe-math-optimizations} is enabled
34291 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
34292 Note that while the throughput of the sequence is higher than the throughput
34293 of the non-reciprocal instruction, the precision of the sequence can be
34294 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
34296 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
34297 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
34298 combination), and doesn't need @option{-mrecip}.
34300 Also note that GCC emits the above sequence with additional Newton-Raphson step
34301 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
34302 already with @option{-ffast-math} (or the above option combination), and
34303 doesn't need @option{-mrecip}.
34305 @opindex mrecip=opt
34306 @item -mrecip=@var{opt}
34307 This option controls which reciprocal estimate instructions
34308 may be used.  @var{opt} is a comma-separated list of options, which may
34309 be preceded by a @samp{!} to invert the option:
34311 @table @samp
34312 @item all
34313 Enable all estimate instructions.
34315 @item default
34316 Enable the default instructions, equivalent to @option{-mrecip}.
34318 @item none
34319 Disable all estimate instructions, equivalent to @option{-mno-recip}.
34321 @item div
34322 Enable the approximation for scalar division.
34324 @item vec-div
34325 Enable the approximation for vectorized division.
34327 @item sqrt
34328 Enable the approximation for scalar square root.
34330 @item vec-sqrt
34331 Enable the approximation for vectorized square root.
34332 @end table
34334 So, for example, @option{-mrecip=all,!sqrt} enables
34335 all of the reciprocal approximations, except for square root.
34337 @opindex mveclibabi
34338 @item -mveclibabi=@var{type}
34339 Specifies the ABI type to use for vectorizing intrinsics using an
34340 external library.  Supported values for @var{type} are @samp{svml} 
34341 for the Intel short
34342 vector math library and @samp{acml} for the AMD math core library.
34343 To use this option, both @option{-ftree-vectorize} and
34344 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
34345 ABI-compatible library must be specified at link time.
34347 GCC currently emits calls to @code{vmldExp2},
34348 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
34349 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
34350 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
34351 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
34352 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
34353 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
34354 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
34355 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
34356 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
34357 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
34358 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
34359 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
34360 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
34361 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
34362 when @option{-mveclibabi=acml} is used.  
34364 @opindex mabi
34365 @item -mabi=@var{name}
34366 Generate code for the specified calling convention.  Permissible values
34367 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
34368 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
34369 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
34370 You can control this behavior for specific functions by
34371 using the function attributes @code{ms_abi} and @code{sysv_abi}.
34372 @xref{Function Attributes}.
34374 @opindex mforce-indirect-call
34375 @item -mforce-indirect-call
34376 Force all calls to functions to be indirect. This is useful
34377 when using Intel Processor Trace where it generates more precise timing
34378 information for function calls.
34380 @opindex mmanual-endbr
34381 @item -mmanual-endbr
34382 Insert ENDBR instruction at function entry only via the @code{cf_check}
34383 function attribute. This is useful when used with the option
34384 @option{-fcf-protection=branch} to control ENDBR insertion at the
34385 function entry.
34387 @opindex mcet-switch
34388 @item -mcet-switch
34389 By default, CET instrumentation is turned off on switch statements that
34390 use a jump table and indirect branch track is disabled.  Since jump
34391 tables are stored in read-only memory, this does not result in a direct
34392 loss of hardening.  But if the jump table index is attacker-controlled,
34393 the indirect jump may not be constrained by CET.  This option turns on
34394 CET instrumentation to enable indirect branch track for switch statements
34395 with jump tables which leads to the jump targets reachable via any indirect
34396 jumps.
34398 @opindex mcall-ms2sysv-xlogues
34399 @opindex mno-call-ms2sysv-xlogues
34400 @item -mcall-ms2sysv-xlogues
34401 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
34402 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
34403 default, the code for saving and restoring these registers is emitted inline,
34404 resulting in fairly lengthy prologues and epilogues.  Using
34405 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
34406 use stubs in the static portion of libgcc to perform these saves and restores,
34407 thus reducing function size at the cost of a few extra instructions.
34409 @opindex mtls-dialect
34410 @item -mtls-dialect=@var{type}
34411 Generate code to access thread-local storage using the @samp{gnu} or
34412 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
34413 @samp{gnu2} is more efficient, but it may add compile- and run-time
34414 requirements that cannot be satisfied on all systems.
34416 @opindex mpush-args
34417 @opindex mno-push-args
34418 @item -mpush-args
34419 @itemx -mno-push-args
34420 Use PUSH operations to store outgoing parameters.  This method is shorter
34421 and usually equally fast as method using SUB/MOV operations and is enabled
34422 by default.  In some cases disabling it may improve performance because of
34423 improved scheduling and reduced dependencies.
34425 @opindex maccumulate-outgoing-args
34426 @item -maccumulate-outgoing-args
34427 If enabled, the maximum amount of space required for outgoing arguments is
34428 computed in the function prologue.  This is faster on most modern CPUs
34429 because of reduced dependencies, improved scheduling and reduced stack usage
34430 when the preferred stack boundary is not equal to 2.  The drawback is a notable
34431 increase in code size.  This switch implies @option{-mno-push-args}.
34433 @opindex mthreads
34434 @item -mthreads
34435 Support thread-safe exception handling on MinGW.  Programs that rely
34436 on thread-safe exception handling must compile and link all code with the
34437 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
34438 @option{-D_MT}; when linking, it links in a special thread helper library
34439 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
34441 @opindex mms-bitfields
34442 @opindex mno-ms-bitfields
34443 @item -mms-bitfields
34444 @itemx -mno-ms-bitfields
34446 Enable/disable bit-field layout compatible with the native Microsoft
34447 Windows compiler.  
34449 If @code{packed} is used on a structure, or if bit-fields are used,
34450 it may be that the Microsoft ABI lays out the structure differently
34451 than the way GCC normally does.  Particularly when moving packed
34452 data between functions compiled with GCC and the native Microsoft compiler
34453 (either via function call or as data in a file), it may be necessary to access
34454 either format.
34456 This option is enabled by default for Microsoft Windows
34457 targets.  This behavior can also be controlled locally by use of variable
34458 or type attributes.  For more information, see @ref{x86 Variable Attributes}
34459 and @ref{x86 Type Attributes}.
34461 The Microsoft structure layout algorithm is fairly simple with the exception
34462 of the bit-field packing.  
34463 The padding and alignment of members of structures and whether a bit-field 
34464 can straddle a storage-unit boundary are determine by these rules:
34466 @enumerate
34467 @item Structure members are stored sequentially in the order in which they are
34468 declared: the first member has the lowest memory address and the last member
34469 the highest.
34471 @item Every data object has an alignment requirement.  The alignment requirement
34472 for all data except structures, unions, and arrays is either the size of the
34473 object or the current packing size (specified with either the
34474 @code{aligned} attribute or the @code{pack} pragma),
34475 whichever is less.  For structures, unions, and arrays,
34476 the alignment requirement is the largest alignment requirement of its members.
34477 Every object is allocated an offset so that:
34479 @smallexample
34480 offset % alignment_requirement == 0
34481 @end smallexample
34483 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
34484 unit if the integral types are the same size and if the next bit-field fits
34485 into the current allocation unit without crossing the boundary imposed by the
34486 common alignment requirements of the bit-fields.
34487 @end enumerate
34489 MSVC interprets zero-length bit-fields in the following ways:
34491 @enumerate
34492 @item If a zero-length bit-field is inserted between two bit-fields that
34493 are normally coalesced, the bit-fields are not coalesced.
34495 For example:
34497 @smallexample
34498 struct
34499  @{
34500    unsigned long bf_1 : 12;
34501    unsigned long : 0;
34502    unsigned long bf_2 : 12;
34503  @} t1;
34504 @end smallexample
34506 @noindent
34507 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
34508 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
34510 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
34511 alignment of the zero-length bit-field is greater than the member that follows it,
34512 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
34514 For example:
34516 @smallexample
34517 struct
34518  @{
34519    char foo : 4;
34520    short : 0;
34521    char bar;
34522  @} t2;
34524 struct
34525  @{
34526    char foo : 4;
34527    short : 0;
34528    double bar;
34529  @} t3;
34530 @end smallexample
34532 @noindent
34533 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
34534 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
34535 bit-field does not affect the alignment of @code{bar} or, as a result, the size
34536 of the structure.
34538 Taking this into account, it is important to note the following:
34540 @enumerate
34541 @item If a zero-length bit-field follows a normal bit-field, the type of the
34542 zero-length bit-field may affect the alignment of the structure as whole. For
34543 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
34544 normal bit-field, and is of type short.
34546 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
34547 still affect the alignment of the structure:
34549 @smallexample
34550 struct
34551  @{
34552    char foo : 6;
34553    long : 0;
34554  @} t4;
34555 @end smallexample
34557 @noindent
34558 Here, @code{t4} takes up 4 bytes.
34559 @end enumerate
34561 @item Zero-length bit-fields following non-bit-field members are ignored:
34563 @smallexample
34564 struct
34565  @{
34566    char foo;
34567    long : 0;
34568    char bar;
34569  @} t5;
34570 @end smallexample
34572 @noindent
34573 Here, @code{t5} takes up 2 bytes.
34574 @end enumerate
34577 @opindex mno-align-stringops
34578 @opindex malign-stringops
34579 @item -mno-align-stringops
34580 Do not align the destination of inlined string operations.  This switch reduces
34581 code size and improves performance in case the destination is already aligned,
34582 but GCC doesn't know about it.
34584 @opindex minline-all-stringops
34585 @item -minline-all-stringops
34586 By default GCC inlines string operations only when the destination is 
34587 known to be aligned to least a 4-byte boundary.  
34588 This enables more inlining and increases code
34589 size, but may improve performance of code that depends on fast
34590 @code{memcpy} and @code{memset} for short lengths.
34591 The option enables inline expansion of @code{strlen} for all
34592 pointer alignments.
34594 @opindex minline-stringops-dynamically
34595 @item -minline-stringops-dynamically
34596 For string operations of unknown size, use run-time checks with
34597 inline code for small blocks and a library call for large blocks.
34599 @opindex mstringop-strategy=@var{alg}
34600 @item -mstringop-strategy=@var{alg}
34601 Override the internal decision heuristic for the particular algorithm to use
34602 for inlining string operations.  The allowed values for @var{alg} are:
34604 @table @samp
34605 @item rep_byte
34606 @itemx rep_4byte
34607 @itemx rep_8byte
34608 Expand using i386 @code{rep} prefix of the specified size.
34610 @item byte_loop
34611 @itemx loop
34612 @itemx unrolled_loop
34613 Expand into an inline loop.
34615 @item libcall
34616 Always use a library call.
34617 @end table
34619 @opindex mmemcpy-strategy=@var{strategy}
34620 @item -mmemcpy-strategy=@var{strategy}
34621 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
34622 should be inlined and what inline algorithm to use when the expected size
34623 of the copy operation is known. @var{strategy} 
34624 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
34625 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
34626 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
34627 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
34628 in the list must be specified in increasing order.  The minimal byte size for 
34629 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
34630 preceding range.
34632 @opindex mmemset-strategy=@var{strategy}
34633 @item -mmemset-strategy=@var{strategy}
34634 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
34635 @code{__builtin_memset} expansion.
34637 @opindex momit-leaf-frame-pointer
34638 @item -momit-leaf-frame-pointer
34639 Don't keep the frame pointer in a register for leaf functions.  This
34640 avoids the instructions to save, set up, and restore frame pointers and
34641 makes an extra register available in leaf functions.  The option
34642 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
34643 which might make debugging harder.
34645 @opindex mtls-direct-seg-refs
34646 @item -mtls-direct-seg-refs
34647 @itemx -mno-tls-direct-seg-refs
34648 Controls whether TLS variables may be accessed with offsets from the
34649 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
34650 or whether the thread base pointer must be added.  Whether or not this
34651 is valid depends on the operating system, and whether it maps the
34652 segment to cover the entire TLS area.
34654 For systems that use the GNU C Library, the default is on.
34656 @opindex msse2avx
34657 @item -msse2avx
34658 @itemx -mno-sse2avx
34659 Specify that the assembler should encode SSE instructions with VEX
34660 prefix.  The option @option{-mavx} turns this on by default.
34662 @opindex mfentry
34663 @item -mfentry
34664 @itemx -mno-fentry
34665 If profiling is active (@option{-pg}), put the profiling
34666 counter call before the prologue.
34667 Note: On x86 architectures the attribute @code{ms_hook_prologue}
34668 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
34670 @opindex mrecord-mcount
34671 @item -mrecord-mcount
34672 @itemx -mno-record-mcount
34673 If profiling is active (@option{-pg}), generate a __mcount_loc section
34674 that contains pointers to each profiling call. This is useful for
34675 automatically patching and out calls.
34677 @opindex mnop-mcount
34678 @item -mnop-mcount
34679 @itemx -mno-nop-mcount
34680 If profiling is active (@option{-pg}), generate the calls to
34681 the profiling functions as NOPs. This is useful when they
34682 should be patched in later dynamically. This is likely only
34683 useful together with @option{-mrecord-mcount}.
34685 @opindex minstrument-return
34686 @item -minstrument-return=@var{type}
34687 Instrument function exit in -pg -mfentry instrumented functions with
34688 call to specified function. This only instruments true returns ending
34689 with ret, but not sibling calls ending with jump. Valid types
34690 are @var{none} to not instrument, @var{call} to generate a call to __return__,
34691 or @var{nop5} to generate a 5 byte nop.
34693 @opindex mrecord-return
34694 @item -mrecord-return
34695 @itemx -mno-record-return
34696 Generate a __return_loc section pointing to all return instrumentation code.
34698 @opindex mfentry-name
34699 @item -mfentry-name=@var{name}
34700 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
34702 @opindex mfentry-section
34703 @item -mfentry-section=@var{name}
34704 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
34706 @opindex mskip-rax-setup
34707 @item -mskip-rax-setup
34708 @itemx -mno-skip-rax-setup
34709 When generating code for the x86-64 architecture with SSE extensions
34710 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
34711 register when there are no variable arguments passed in vector registers.
34713 @strong{Warning:} Since RAX register is used to avoid unnecessarily
34714 saving vector registers on stack when passing variable arguments, the
34715 impacts of this option are callees may waste some stack space,
34716 misbehave or jump to a random location.  GCC 4.4 or newer don't have
34717 those issues, regardless the RAX register value.
34719 @opindex m8bit-idiv
34720 @item -m8bit-idiv
34721 @itemx -mno-8bit-idiv
34722 On some processors, like Intel Atom, 8-bit unsigned integer divide is
34723 much faster than 32-bit/64-bit integer divide.  This option generates a
34724 run-time check.  If both dividend and divisor are within range of 0
34725 to 255, 8-bit unsigned integer divide is used instead of
34726 32-bit/64-bit integer divide.
34728 @opindex mavx256-split-unaligned-load
34729 @opindex mavx256-split-unaligned-store
34730 @item -mavx256-split-unaligned-load
34731 @itemx -mavx256-split-unaligned-store
34732 Split 32-byte AVX unaligned load and store.
34734 @opindex mstack-protector-guard
34735 @opindex mstack-protector-guard-reg
34736 @opindex mstack-protector-guard-offset
34737 @item -mstack-protector-guard=@var{guard}
34738 @itemx -mstack-protector-guard-reg=@var{reg}
34739 @itemx -mstack-protector-guard-offset=@var{offset}
34740 Generate stack protection code using canary at @var{guard}.  Supported
34741 locations are @samp{global} for global canary or @samp{tls} for per-thread
34742 canary in the TLS block (the default).  This option has effect only when
34743 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
34745 With the latter choice the options
34746 @option{-mstack-protector-guard-reg=@var{reg}} and
34747 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
34748 which segment register (@code{%fs} or @code{%gs}) to use as base register
34749 for reading the canary, and from what offset from that base register.
34750 The default for those is as specified in the relevant ABI.
34752 @opindex mgeneral-regs-only
34753 @item -mgeneral-regs-only
34754 Generate code that uses only the general-purpose registers.  This
34755 prevents the compiler from using floating-point, vector, mask and bound
34756 registers.
34758 @opindex mrelax-cmpxchg-loop
34759 @item -mrelax-cmpxchg-loop
34760 When emitting a compare-and-swap loop for @ref{__sync Builtins}
34761 and @ref{__atomic Builtins} lacking a native instruction, optimize
34762 for the highly contended case by issuing an atomic load before the
34763 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
34764 to save CPU power when restarting the loop.
34766 @opindex mindirect-branch
34767 @item -mindirect-branch=@var{choice}
34768 Convert indirect call and jump with @var{choice}.  The default is
34769 @samp{keep}, which keeps indirect call and jump unmodified.
34770 @samp{thunk} converts indirect call and jump to call and return thunk.
34771 @samp{thunk-inline} converts indirect call and jump to inlined call
34772 and return thunk.  @samp{thunk-extern} converts indirect call and jump
34773 to external call and return thunk provided in a separate object file.
34774 You can control this behavior for a specific function by using the
34775 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
34777 Note that @option{-mcmodel=large} is incompatible with
34778 @option{-mindirect-branch=thunk} and
34779 @option{-mindirect-branch=thunk-extern} since the thunk function may
34780 not be reachable in the large code model.
34782 Note that @option{-mindirect-branch=thunk-extern} is compatible with
34783 @option{-fcf-protection=branch} since the external thunk can be made
34784 to enable control-flow check.
34786 @opindex mfunction-return
34787 @item -mfunction-return=@var{choice}
34788 Convert function return with @var{choice}.  The default is @samp{keep},
34789 which keeps function return unmodified.  @samp{thunk} converts function
34790 return to call and return thunk.  @samp{thunk-inline} converts function
34791 return to inlined call and return thunk.  @samp{thunk-extern} converts
34792 function return to external call and return thunk provided in a separate
34793 object file.  You can control this behavior for a specific function by
34794 using the function attribute @code{function_return}.
34795 @xref{Function Attributes}.
34797 Note that @option{-mindirect-return=thunk-extern} is compatible with
34798 @option{-fcf-protection=branch} since the external thunk can be made
34799 to enable control-flow check.
34801 Note that @option{-mcmodel=large} is incompatible with
34802 @option{-mfunction-return=thunk} and
34803 @option{-mfunction-return=thunk-extern} since the thunk function may
34804 not be reachable in the large code model.
34807 @opindex mindirect-branch-register
34808 @item -mindirect-branch-register
34809 Force indirect call and jump via register.
34811 @opindex mharden-sls
34812 @item -mharden-sls=@var{choice}
34813 Generate code to mitigate against straight line speculation (SLS) with
34814 @var{choice}.  The default is @samp{none} which disables all SLS
34815 hardening.  @samp{return} enables SLS hardening for function returns.
34816 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
34817 @samp{all} enables all SLS hardening.
34819 @opindex mindirect-branch-cs-prefix
34820 @item -mindirect-branch-cs-prefix
34821 Add CS prefix to call and jmp to indirect thunk with branch target in
34822 r8-r15 registers so that the call and jmp instruction length is 6 bytes
34823 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
34824 @samp{lfence; jmp *%r8-r15} at run-time.
34826 @end table
34828 These @samp{-m} switches are supported in addition to the above
34829 on x86-64 processors in 64-bit environments.
34831 @table @gcctabopt
34832 @opindex m32
34833 @opindex m64
34834 @opindex mx32
34835 @opindex m16
34836 @opindex miamcu
34837 @item -m32
34838 @itemx -m64
34839 @itemx -mx32
34840 @itemx -m16
34841 @itemx -miamcu
34842 Generate code for a 16-bit, 32-bit or 64-bit environment.
34843 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
34844 to 32 bits, and
34845 generates code that runs in 32-bit mode.
34847 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
34848 types to 64 bits, and generates code for the x86-64 architecture.
34849 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
34850 and @option{-mdynamic-no-pic} options.
34852 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
34853 to 32 bits, and
34854 generates code for the x86-64 architecture.
34856 The @option{-m16} option is the same as @option{-m32}, except for that
34857 it outputs the @code{.code16gcc} assembly directive at the beginning of
34858 the assembly output so that the binary can run in 16-bit mode.
34860 The @option{-miamcu} option generates code which conforms to Intel MCU
34861 psABI.  It requires the @option{-m32} option to be turned on.
34863 @opindex mno-red-zone
34864 @opindex mred-zone
34865 @item -mno-red-zone
34866 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
34867 by the x86-64 ABI; it is a 128-byte area beyond the location of the
34868 stack pointer that is not modified by signal or interrupt handlers
34869 and therefore can be used for temporary data without adjusting the stack
34870 pointer.  The flag @option{-mno-red-zone} disables this red zone.
34872 @opindex mcmodel=small
34873 @item -mcmodel=small
34874 Generate code for the small code model: the program and its symbols must
34875 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
34876 Programs can be statically or dynamically linked.  This is the default
34877 code model.
34879 @opindex mcmodel=kernel
34880 @item -mcmodel=kernel
34881 Generate code for the kernel code model.  The kernel runs in the
34882 negative 2 GB of the address space.
34883 This model has to be used for Linux kernel code.
34885 @opindex mcmodel=medium
34886 @item -mcmodel=medium
34887 Generate code for the medium model: the program is linked in the lower 2
34888 GB of the address space.  Small symbols are also placed there.  Symbols
34889 with sizes larger than @option{-mlarge-data-threshold} are put into
34890 large data or BSS sections and can be located above 2GB.  Programs can
34891 be statically or dynamically linked.
34893 @opindex mcmodel=large
34894 @item -mcmodel=large
34895 Generate code for the large model.  This model makes no assumptions
34896 about addresses and sizes of sections.
34898 @opindex maddress-mode=long
34899 @item -maddress-mode=long
34900 Generate code for long address mode.  This is only supported for 64-bit
34901 and x32 environments.  It is the default address mode for 64-bit
34902 environments.
34904 @opindex maddress-mode=short
34905 @item -maddress-mode=short
34906 Generate code for short address mode.  This is only supported for 32-bit
34907 and x32 environments.  It is the default address mode for 32-bit and
34908 x32 environments.
34910 @opindex mneeded
34911 @item -mneeded
34912 @itemx -mno-needed
34913 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
34914 indicate the micro-architecture ISA level required to execute the binary.
34916 @opindex mno-direct-extern-access
34917 @opindex mdirect-extern-access
34918 @item -mno-direct-extern-access
34919 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
34920 to access external symbols.  With @option{-fpic} or @option{-fPIC},
34921 treat access to protected symbols as local symbols.  The default is
34922 @option{-mdirect-extern-access}.
34924 @strong{Warning:} shared libraries compiled with
34925 @option{-mno-direct-extern-access} and executable compiled with
34926 @option{-mdirect-extern-access} may not be binary compatible if
34927 protected symbols are used in shared libraries and executable.
34929 @opindex munroll-only-small-loops
34930 @opindex mno-unroll-only-small-loops
34931 @item -munroll-only-small-loops
34932 Controls conservative small loop unrolling. It is default enabled by
34933 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
34934 -f[no-]unroll-[all-]loops would disable this flag to avoid any
34935 unintended unrolling behavior that user does not want.
34937 @opindex mlam
34938 @item -mlam=@var{choice}
34939 LAM(linear-address masking) allows special bits in the pointer to be used
34940 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
34941 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
34942 positions 62:57 can be used for metadata.
34943 @end table
34945 @node x86 Windows Options
34946 @subsection x86 Windows Options
34947 @cindex x86 Windows Options
34948 @cindex Windows Options for x86
34950 These additional options are available for Microsoft Windows targets:
34952 @table @gcctabopt
34953 @opindex mconsole
34954 @item -mconsole
34955 This option
34956 specifies that a console application is to be generated, by
34957 instructing the linker to set the PE header subsystem type
34958 required for console applications.
34959 This option is available for Cygwin and MinGW targets and is
34960 enabled by default on those targets.
34962 @opindex mcrtdll
34963 @item -mcrtdll=@var{library}
34964 Preprocess, compile or link with specified C RunTime DLL @var{library}.
34965 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
34966 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
34967 start file for CRT @var{library} and link with CRT @var{library}.
34968 Recognized CRT library names for proprocessor are:
34969 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
34970 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
34971 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
34972 If this options is not specified then the default MinGW import library
34973 @code{msvcrt} is used for linking and no other adjustment for
34974 preprocessor is done. MinGW import library @code{msvcrt} is just a
34975 symlink to (or a copy of) another MinGW CRT import library
34976 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
34977 is for Windows system CRT DLL library @code{msvcrt.dll} and
34978 in most cases is the default MinGW import library.
34979 Generally speaking, changing the CRT DLL requires recompiling
34980 the entire MinGW CRT. This option is for experimental and testing
34981 purposes only.
34982 This option is available for MinGW targets.
34984 @opindex mdll
34985 @item -mdll
34986 This option is available for Cygwin and MinGW targets.  It
34987 specifies that a DLL---a dynamic link library---is to be
34988 generated, enabling the selection of the required runtime
34989 startup object and entry point.
34991 @opindex mnop-fun-dllimport
34992 @item -mnop-fun-dllimport
34993 This option is available for Cygwin and MinGW targets.  It
34994 specifies that the @code{dllimport} attribute should be ignored.
34996 @opindex mthreads
34997 @item -mthreads
34998 This option is available for MinGW targets. It specifies
34999 that MinGW-specific thread support is to be used.
35001 @opindex municode
35002 @item -municode
35003 This option is available for MinGW-w64 targets.  It causes
35004 the @code{UNICODE} preprocessor macro to be predefined, and
35005 chooses Unicode-capable runtime startup code.
35007 @opindex mwin32
35008 @item -mwin32
35009 This option is available for Cygwin and MinGW targets.  It
35010 specifies that the typical Microsoft Windows predefined macros are to
35011 be set in the pre-processor, but does not influence the choice
35012 of runtime library/startup code.
35014 @opindex mwindows
35015 @item -mwindows
35016 This option is available for Cygwin and MinGW targets.  It
35017 specifies that a GUI application is to be generated by
35018 instructing the linker to set the PE header subsystem type
35019 appropriately.
35021 @opindex fno-set-stack-executable
35022 @opindex fset-stack-executable
35023 @item -fno-set-stack-executable
35024 This option is available for MinGW targets. It specifies that
35025 the executable flag for the stack used by nested functions isn't
35026 set. This is necessary for binaries running in kernel mode of
35027 Microsoft Windows, as there the User32 API, which is used to set executable
35028 privileges, isn't available.
35030 @opindex fno-writable-relocated-rdata
35031 @opindex fwritable-relocated-rdata
35032 @item -fwritable-relocated-rdata
35033 This option is available for MinGW and Cygwin targets.  It specifies
35034 that relocated-data in read-only section is put into the @code{.data}
35035 section.  This is a necessary for older runtimes not supporting
35036 modification of @code{.rdata} sections for pseudo-relocation.
35038 @opindex mpe-aligned-commons
35039 @item -mpe-aligned-commons
35040 This option is available for Cygwin and MinGW targets.  It
35041 specifies that the GNU extension to the PE file format that
35042 permits the correct alignment of COMMON variables should be
35043 used when generating code.  It is enabled by default if
35044 GCC detects that the target assembler found during configuration
35045 supports the feature.
35046 @end table
35048 See also under @ref{x86 Options} for standard options.
35050 @node Xstormy16 Options
35051 @subsection Xstormy16 Options
35052 @cindex Xstormy16 Options
35054 These options are defined for Xstormy16:
35056 @table @gcctabopt
35057 @opindex msim
35058 @item -msim
35059 Choose startup files and linker script suitable for the simulator.
35060 @end table
35062 @node Xtensa Options
35063 @subsection Xtensa Options
35064 @cindex Xtensa Options
35066 These options are supported for Xtensa targets:
35068 @table @gcctabopt
35069 @opindex mconst16
35070 @opindex mno-const16
35071 @item -mconst16
35072 @itemx -mno-const16
35073 Enable or disable use of @code{CONST16} instructions for loading
35074 constant values.  The @code{CONST16} instruction is currently not a
35075 standard option from Tensilica.  When enabled, @code{CONST16}
35076 instructions are always used in place of the standard @code{L32R}
35077 instructions.  The use of @code{CONST16} is enabled by default only if
35078 the @code{L32R} instruction is not available.
35080 @opindex mfused-madd
35081 @opindex mno-fused-madd
35082 @item -mfused-madd
35083 @itemx -mno-fused-madd
35084 Enable or disable use of fused multiply/add and multiply/subtract
35085 instructions in the floating-point option.  This has no effect if the
35086 floating-point option is not also enabled.  Disabling fused multiply/add
35087 and multiply/subtract instructions forces the compiler to use separate
35088 instructions for the multiply and add/subtract operations.  This may be
35089 desirable in some cases where strict IEEE 754-compliant results are
35090 required: the fused multiply add/subtract instructions do not round the
35091 intermediate result, thereby producing results with @emph{more} bits of
35092 precision than specified by the IEEE standard.  Disabling fused multiply
35093 add/subtract instructions also ensures that the program output is not
35094 sensitive to the compiler's ability to combine multiply and add/subtract
35095 operations.
35097 @opindex mserialize-volatile
35098 @opindex mno-serialize-volatile
35099 @item -mserialize-volatile
35100 @itemx -mno-serialize-volatile
35101 When this option is enabled, GCC inserts @code{MEMW} instructions before
35102 @code{volatile} memory references to guarantee sequential consistency.
35103 The default is @option{-mserialize-volatile}.  Use
35104 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
35106 @opindex mforce-no-pic
35107 @item -mforce-no-pic
35108 For targets, like GNU/Linux, where all user-mode Xtensa code must be
35109 position-independent code (PIC), this option disables PIC for compiling
35110 kernel code.
35112 @opindex mtext-section-literals
35113 @opindex mno-text-section-literals
35114 @item -mtext-section-literals
35115 @itemx -mno-text-section-literals
35116 These options control the treatment of literal pools.  The default is
35117 @option{-mno-text-section-literals}, which places literals in a separate
35118 section in the output file.  This allows the literal pool to be placed
35119 in a data RAM/ROM, and it also allows the linker to combine literal
35120 pools from separate object files to remove redundant literals and
35121 improve code size.  With @option{-mtext-section-literals}, the literals
35122 are interspersed in the text section in order to keep them as close as
35123 possible to their references.  This may be necessary for large assembly
35124 files.  Literals for each function are placed right before that function.
35126 @opindex mauto-litpools
35127 @opindex mno-auto-litpools
35128 @item -mauto-litpools
35129 @itemx -mno-auto-litpools
35130 These options control the treatment of literal pools.  The default is
35131 @option{-mno-auto-litpools}, which places literals in a separate
35132 section in the output file unless @option{-mtext-section-literals} is
35133 used.  With @option{-mauto-litpools} the literals are interspersed in
35134 the text section by the assembler.  Compiler does not produce explicit
35135 @code{.literal} directives and loads literals into registers with
35136 @code{MOVI} instructions instead of @code{L32R} to let the assembler
35137 do relaxation and place literals as necessary.  This option allows
35138 assembler to create several literal pools per function and assemble
35139 very big functions, which may not be possible with
35140 @option{-mtext-section-literals}.
35142 @opindex mtarget-align
35143 @opindex mno-target-align
35144 @item -mtarget-align
35145 @itemx -mno-target-align
35146 When this option is enabled, GCC instructs the assembler to
35147 automatically align instructions to reduce branch penalties at the
35148 expense of some code density.  The assembler attempts to widen density
35149 instructions to align branch targets and the instructions following call
35150 instructions.  If there are not enough preceding safe density
35151 instructions to align a target, no widening is performed.  The
35152 default is @option{-mtarget-align}.  These options do not affect the
35153 treatment of auto-aligned instructions like @code{LOOP}, which the
35154 assembler always aligns, either by widening density instructions or
35155 by inserting NOP instructions.
35157 @opindex mlongcalls
35158 @opindex mno-longcalls
35159 @item -mlongcalls
35160 @itemx -mno-longcalls
35161 When this option is enabled, GCC instructs the assembler to translate
35162 direct calls to indirect calls unless it can determine that the target
35163 of a direct call is in the range allowed by the call instruction.  This
35164 translation typically occurs for calls to functions in other source
35165 files.  Specifically, the assembler translates a direct @code{CALL}
35166 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
35167 The default is @option{-mno-longcalls}.  This option should be used in
35168 programs where the call target can potentially be out of range.  This
35169 option is implemented in the assembler, not the compiler, so the
35170 assembly code generated by GCC still shows direct call
35171 instructions---look at the disassembled object code to see the actual
35172 instructions.  Note that the assembler uses an indirect call for
35173 every cross-file call, not just those that really are out of range.
35175 @opindex mabi
35176 @item -mabi=@var{name}
35177 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
35178 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
35180 @opindex mabi=call0
35181 @item -mabi=call0
35182 When this option is enabled function parameters are passed in registers
35183 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
35184 caller-saved, and register @code{a15} may be used as a frame pointer.
35185 When this version of the ABI is enabled the C preprocessor symbol
35186 @code{__XTENSA_CALL0_ABI__} is defined.
35188 @opindex mabi=windowed
35189 @item -mabi=windowed
35190 When this option is enabled function parameters are passed in registers
35191 @code{a10} through @code{a15}, and called function rotates register window
35192 by 8 registers on entry so that its arguments are found in registers
35193 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
35194 pointer.  Register window is rotated 8 registers back upon return.
35195 When this version of the ABI is enabled the C preprocessor symbol
35196 @code{__XTENSA_WINDOWED_ABI__} is defined.
35198 @opindex mextra-l32r-costs
35199 @item -mextra-l32r-costs=@var{n}
35200 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
35201 instructions, in clock cycles.  This affects, when optimizing for speed,
35202 whether loading a constant from literal pool using @code{L32R} or
35203 synthesizing the constant from a small one with a couple of arithmetic
35204 instructions.  The default value is 0.
35206 @opindex mstrict-align
35207 @opindex mno-strict-align
35208 @item -mstrict-align
35209 @itemx -mno-strict-align
35210 Avoid or allow generating memory accesses that may not be aligned on a natural
35211 object boundary as described in the architecture specification.
35212 The default is @option{-mno-strict-align} for cores that support both
35213 unaligned loads and stores in hardware and @option{-mstrict-align} for all
35214 other cores.
35216 @end table
35218 @node zSeries Options
35219 @subsection zSeries Options
35220 @cindex zSeries options
35222 These are listed under @xref{S/390 and zSeries Options}.
35225 @c man end
35227 @node Spec Files
35228 @section Specifying Subprocesses and the Switches to Pass to Them
35229 @cindex Spec Files
35231 @command{gcc} is a driver program.  It performs its job by invoking a
35232 sequence of other programs to do the work of compiling, assembling and
35233 linking.  GCC interprets its command-line parameters and uses these to
35234 deduce which programs it should invoke, and which command-line options
35235 it ought to place on their command lines.  This behavior is controlled
35236 by @dfn{spec strings}.  In most cases there is one spec string for each
35237 program that GCC can invoke, but a few programs have multiple spec
35238 strings to control their behavior.  The spec strings built into GCC can
35239 be overridden by using the @option{-specs=} command-line switch to specify
35240 a spec file.
35242 @dfn{Spec files} are plain-text files that are used to construct spec
35243 strings.  They consist of a sequence of directives separated by blank
35244 lines.  The type of directive is determined by the first non-whitespace
35245 character on the line, which can be one of the following:
35247 @table @code
35248 @item %@var{command}
35249 Issues a @var{command} to the spec file processor.  The commands that can
35250 appear here are:
35252 @table @code
35253 @cindex @code{%include}
35254 @item %include <@var{file}>
35255 Search for @var{file} and insert its text at the current point in the
35256 specs file.
35258 @cindex @code{%include_noerr}
35259 @item %include_noerr <@var{file}>
35260 Just like @samp{%include}, but do not generate an error message if the include
35261 file cannot be found.
35263 @cindex @code{%rename}
35264 @item %rename @var{old_name} @var{new_name}
35265 Rename the spec string @var{old_name} to @var{new_name}.
35267 @end table
35269 @item *[@var{spec_name}]:
35270 This tells the compiler to create, override or delete the named spec
35271 string.  All lines after this directive up to the next directive or
35272 blank line are considered to be the text for the spec string.  If this
35273 results in an empty string then the spec is deleted.  (Or, if the
35274 spec did not exist, then nothing happens.)  Otherwise, if the spec
35275 does not currently exist a new spec is created.  If the spec does
35276 exist then its contents are overridden by the text of this
35277 directive, unless the first character of that text is the @samp{+}
35278 character, in which case the text is appended to the spec.
35280 @item [@var{suffix}]:
35281 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
35282 and up to the next directive or blank line are considered to make up the
35283 spec string for the indicated suffix.  When the compiler encounters an
35284 input file with the named suffix, it processes the spec string in
35285 order to work out how to compile that file.  For example:
35287 @smallexample
35288 .ZZ:
35289 z-compile -input %i
35290 @end smallexample
35292 This says that any input file whose name ends in @samp{.ZZ} should be
35293 passed to the program @samp{z-compile}, which should be invoked with the
35294 command-line switch @option{-input} and with the result of performing the
35295 @samp{%i} substitution.  (See below.)
35297 As an alternative to providing a spec string, the text following a
35298 suffix directive can be one of the following:
35300 @table @code
35301 @item @@@var{language}
35302 This says that the suffix is an alias for a known @var{language}.  This is
35303 similar to using the @option{-x} command-line switch to GCC to specify a
35304 language explicitly.  For example:
35306 @smallexample
35307 .ZZ:
35308 @@c++
35309 @end smallexample
35311 Says that .ZZ files are, in fact, C++ source files.
35313 @item #@var{name}
35314 This causes an error messages saying:
35316 @smallexample
35317 @var{name} compiler not installed on this system.
35318 @end smallexample
35319 @end table
35321 GCC already has an extensive list of suffixes built into it.
35322 This directive adds an entry to the end of the list of suffixes, but
35323 since the list is searched from the end backwards, it is effectively
35324 possible to override earlier entries using this technique.
35326 @end table
35328 GCC has the following spec strings built into it.  Spec files can
35329 override these strings or create their own.  Note that individual
35330 targets can also add their own spec strings to this list.
35332 @smallexample
35333 asm          Options to pass to the assembler
35334 asm_final    Options to pass to the assembler post-processor
35335 cpp          Options to pass to the C preprocessor
35336 cc1          Options to pass to the C compiler
35337 cc1plus      Options to pass to the C++ compiler
35338 endfile      Object files to include at the end of the link
35339 link         Options to pass to the linker
35340 lib          Libraries to include on the command line to the linker
35341 libgcc       Decides which GCC support library to pass to the linker
35342 linker       Sets the name of the linker
35343 predefines   Defines to be passed to the C preprocessor
35344 signed_char  Defines to pass to CPP to say whether @code{char} is signed
35345              by default
35346 startfile    Object files to include at the start of the link
35347 @end smallexample
35349 Here is a small example of a spec file:
35351 @smallexample
35352 %rename lib                 old_lib
35354 *lib:
35355 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
35356 @end smallexample
35358 This example renames the spec called @samp{lib} to @samp{old_lib} and
35359 then overrides the previous definition of @samp{lib} with a new one.
35360 The new definition adds in some extra command-line options before
35361 including the text of the old definition.
35363 @dfn{Spec strings} are a list of command-line options to be passed to their
35364 corresponding program.  In addition, the spec strings can contain
35365 @samp{%}-prefixed sequences to substitute variable text or to
35366 conditionally insert text into the command line.  Using these constructs
35367 it is possible to generate quite complex command lines.
35369 Here is a table of all defined @samp{%}-sequences for spec
35370 strings.  Note that spaces are not generated automatically around the
35371 results of expanding these sequences.  Therefore you can concatenate them
35372 together or combine them with constant text in a single argument.
35374 @table @code
35375 @item %%
35376 Substitute one @samp{%} into the program name or argument.
35378 @item %"
35379 Substitute an empty argument.
35381 @item %i
35382 Substitute the name of the input file being processed.
35384 @item %b
35385 Substitute the basename for outputs related with the input file being
35386 processed.  This is often the substring up to (and not including) the
35387 last period and not including the directory but, unless %w is active, it
35388 expands to the basename for auxiliary outputs, which may be influenced
35389 by an explicit output name, and by various other options that control
35390 how auxiliary outputs are named.
35392 @item %B
35393 This is the same as @samp{%b}, but include the file suffix (text after
35394 the last period).  Without %w, it expands to the basename for dump
35395 outputs.
35397 @item %d
35398 Marks the argument containing or following the @samp{%d} as a
35399 temporary file name, so that that file is deleted if GCC exits
35400 successfully.  Unlike @samp{%g}, this contributes no text to the
35401 argument.
35403 @item %g@var{suffix}
35404 Substitute a file name that has suffix @var{suffix} and is chosen
35405 once per compilation, and mark the argument in the same way as
35406 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
35407 name is now chosen in a way that is hard to predict even when previously
35408 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
35409 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
35410 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
35411 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
35412 was simply substituted with a file name chosen once per compilation,
35413 without regard to any appended suffix (which was therefore treated
35414 just like ordinary text), making such attacks more likely to succeed.
35416 @item %u@var{suffix}
35417 Like @samp{%g}, but generates a new temporary file name
35418 each time it appears instead of once per compilation.
35420 @item %U@var{suffix}
35421 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
35422 new one if there is no such last file name.  In the absence of any
35423 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
35424 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
35425 involves the generation of two distinct file names, one
35426 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
35427 simply substituted with a file name chosen for the previous @samp{%u},
35428 without regard to any appended suffix.
35430 @item %j@var{suffix}
35431 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
35432 writable, and if @option{-save-temps} is not used; 
35433 otherwise, substitute the name
35434 of a temporary file, just like @samp{%u}.  This temporary file is not
35435 meant for communication between processes, but rather as a junk
35436 disposal mechanism.
35438 @item %|@var{suffix}
35439 @itemx %m@var{suffix}
35440 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
35441 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
35442 all.  These are the two most common ways to instruct a program that it
35443 should read from standard input or write to standard output.  If you
35444 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
35445 construct: see for example @file{gcc/fortran/lang-specs.h}.
35447 @item %.@var{SUFFIX}
35448 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
35449 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
35450 terminated by the next space or %.
35452 @item %w
35453 Marks the argument containing or following the @samp{%w} as the
35454 designated output file of this compilation.  This puts the argument
35455 into the sequence of arguments that @samp{%o} substitutes.
35457 @item %V
35458 Indicates that this compilation produces no output file.
35460 @item %o
35461 Substitutes the names of all the output files, with spaces
35462 automatically placed around them.  You should write spaces
35463 around the @samp{%o} as well or the results are undefined.
35464 @samp{%o} is for use in the specs for running the linker.
35465 Input files whose names have no recognized suffix are not compiled
35466 at all, but they are included among the output files, so they are
35467 linked.
35469 @item %O
35470 Substitutes the suffix for object files.  Note that this is
35471 handled specially when it immediately follows @samp{%g, %u, or %U},
35472 because of the need for those to form complete file names.  The
35473 handling is such that @samp{%O} is treated exactly as if it had already
35474 been substituted, except that @samp{%g, %u, and %U} do not currently
35475 support additional @var{suffix} characters following @samp{%O} as they do
35476 following, for example, @samp{.o}.
35478 @item %I
35479 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
35480 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
35481 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
35482 and @option{-imultilib} as necessary.
35484 @item %s
35485 Current argument is the name of a library or startup file of some sort.
35486 Search for that file in a standard list of directories and substitute
35487 the full name found.  The current working directory is included in the
35488 list of directories scanned.
35490 @item %T
35491 Current argument is the name of a linker script.  Search for that file
35492 in the current list of directories to scan for libraries. If the file
35493 is located insert a @option{--script} option into the command line
35494 followed by the full path name found.  If the file is not found then
35495 generate an error message.  Note: the current working directory is not
35496 searched.
35498 @item %e@var{str}
35499 Print @var{str} as an error message.  @var{str} is terminated by a newline.
35500 Use this when inconsistent options are detected.
35502 @item %n@var{str}
35503 Print @var{str} as a notice.  @var{str} is terminated by a newline.
35505 @item %(@var{name})
35506 Substitute the contents of spec string @var{name} at this point.
35508 @item %x@{@var{option}@}
35509 Accumulate an option for @samp{%X}.
35511 @item %X
35512 Output the accumulated linker options specified by a @samp{%x} spec string.
35514 @item %Y
35515 Output the accumulated assembler options specified by @option{-Wa}.
35517 @item %Z
35518 Output the accumulated preprocessor options specified by @option{-Wp}.
35520 @item %M
35521 Output @code{multilib_os_dir}.
35523 @item %R
35524 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
35526 @item %a
35527 Process the @code{asm} spec.  This is used to compute the
35528 switches to be passed to the assembler.
35530 @item %A
35531 Process the @code{asm_final} spec.  This is a spec string for
35532 passing switches to an assembler post-processor, if such a program is
35533 needed.
35535 @item %l
35536 Process the @code{link} spec.  This is the spec for computing the
35537 command line passed to the linker.  Typically it makes use of the
35538 @samp{%L %G %S %D and %E} sequences.
35540 @item %D
35541 Dump out a @option{-L} option for each directory that GCC believes might
35542 contain startup files.  If the target supports multilibs then the
35543 current multilib directory is prepended to each of these paths.
35545 @item %L
35546 Process the @code{lib} spec.  This is a spec string for deciding which
35547 libraries are included on the command line to the linker.
35549 @item %G
35550 Process the @code{libgcc} spec.  This is a spec string for deciding
35551 which GCC support library is included on the command line to the linker.
35553 @item %S
35554 Process the @code{startfile} spec.  This is a spec for deciding which
35555 object files are the first ones passed to the linker.  Typically
35556 this might be a file named @file{crt0.o}.
35558 @item %E
35559 Process the @code{endfile} spec.  This is a spec string that specifies
35560 the last object files that are passed to the linker.
35562 @item %C
35563 Process the @code{cpp} spec.  This is used to construct the arguments
35564 to be passed to the C preprocessor.
35566 @item %1
35567 Process the @code{cc1} spec.  This is used to construct the options to be
35568 passed to the actual C compiler (@command{cc1}).
35570 @item %2
35571 Process the @code{cc1plus} spec.  This is used to construct the options to be
35572 passed to the actual C++ compiler (@command{cc1plus}).
35574 @item %*
35575 Substitute the variable part of a matched option.  See below.
35576 Note that each comma in the substituted string is replaced by
35577 a single space.
35579 @item %<S
35580 Remove all occurrences of @code{-S} from the command line.  Note---this
35581 command is position dependent.  @samp{%} commands in the spec string
35582 before this one see @code{-S}, @samp{%} commands in the spec string
35583 after this one do not.
35585 @item %<S*
35586 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
35588 @item %>S
35589 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
35591 @item %:@var{function}(@var{args})
35592 Call the named function @var{function}, passing it @var{args}.
35593 @var{args} is first processed as a nested spec string, then split
35594 into an argument vector in the usual fashion.  The function returns
35595 a string which is processed as if it had appeared literally as part
35596 of the current spec.
35598 The following built-in spec functions are provided:
35600 @table @code
35601 @item @code{getenv}
35602 The @code{getenv} spec function takes two arguments: an environment
35603 variable name and a string.  If the environment variable is not
35604 defined, a fatal error is issued.  Otherwise, the return value is the
35605 value of the environment variable concatenated with the string.  For
35606 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
35608 @smallexample
35609 %:getenv(TOPDIR /include)
35610 @end smallexample
35612 expands to @file{/path/to/top/include}.
35614 @item @code{if-exists}
35615 The @code{if-exists} spec function takes one argument, an absolute
35616 pathname to a file.  If the file exists, @code{if-exists} returns the
35617 pathname.  Here is a small example of its usage:
35619 @smallexample
35620 *startfile:
35621 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
35622 @end smallexample
35624 @item @code{if-exists-else}
35625 The @code{if-exists-else} spec function is similar to the @code{if-exists}
35626 spec function, except that it takes two arguments.  The first argument is
35627 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
35628 returns the pathname.  If it does not exist, it returns the second argument.
35629 This way, @code{if-exists-else} can be used to select one file or another,
35630 based on the existence of the first.  Here is a small example of its usage:
35632 @smallexample
35633 *startfile:
35634 crt0%O%s %:if-exists(crti%O%s) \
35635 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
35636 @end smallexample
35638 @item @code{if-exists-then-else}
35639 The @code{if-exists-then-else} spec function takes at least two arguments
35640 and an optional third one. The first argument is an absolute pathname to a
35641 file.  If the file exists, the function returns the second argument.
35642 If the file does not exist, the function returns the third argument if there
35643 is one, or NULL otherwise. This can be used to expand one text, or optionally
35644 another, based on the existence of a file.  Here is a small example of its
35645 usage:
35647 @smallexample
35648 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
35649 @end smallexample
35651 @item @code{sanitize}
35652 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
35653 any address, thread or undefined behavior sanitizers are active.
35655 @smallexample
35656 %@{%:sanitize(address):-funwind-tables@}
35657 @end smallexample
35659 @item @code{replace-outfile}
35660 The @code{replace-outfile} spec function takes two arguments.  It looks for the
35661 first argument in the outfiles array and replaces it with the second argument.  Here
35662 is a small example of its usage:
35664 @smallexample
35665 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
35666 @end smallexample
35668 @item @code{remove-outfile}
35669 The @code{remove-outfile} spec function takes one argument.  It looks for the
35670 first argument in the outfiles array and removes it.  Here is a small example
35671 its usage:
35673 @smallexample
35674 %:remove-outfile(-lm)
35675 @end smallexample
35677 @item @code{version-compare}
35678 The @code{version-compare} spec function takes four or five arguments of the following
35679 form:
35681 @smallexample
35682 <comparison-op> <arg1> [<arg2>] <switch> <result>
35683 @end smallexample
35685 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
35686 The supported @code{comparison-op} values are:
35688 @table @code
35689 @item >=
35690 True if @code{switch} is a later (or same) version than @code{arg1}
35692 @item !>
35693 Opposite of @code{>=}
35695 @item <
35696 True if @code{switch} is an earlier version than @code{arg1}
35698 @item !<
35699 Opposite of @code{<}
35701 @item ><
35702 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
35704 @item <>
35705 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
35706 @end table
35708 If the @code{switch} is not present at all, the condition is false unless the first character
35709 of the @code{comparison-op} is @code{!}.
35711 @smallexample
35712 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
35713 @end smallexample
35715 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
35716 passed.
35718 @item @code{include}
35719 The @code{include} spec function behaves much like @code{%include}, with the advantage
35720 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
35721 the filename, and looks for it in the startfile path.  It always returns NULL.
35723 @smallexample
35724 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
35725 @end smallexample
35727 @item @code{pass-through-libs}
35728 The @code{pass-through-libs} spec function takes any number of arguments.  It
35729 finds any @option{-l} options and any non-options ending in @file{.a} (which it
35730 assumes are the names of linker input library archive files) and returns a
35731 result containing all the found arguments each prepended by
35732 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
35733 intended to be passed to the LTO linker plugin.
35735 @smallexample
35736 %:pass-through-libs(%G %L %G)
35737 @end smallexample
35739 @item @code{print-asm-header}
35740 The @code{print-asm-header} function takes no arguments and simply
35741 prints a banner like:
35743 @smallexample
35744 Assembler options
35745 =================
35747 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
35748 @end smallexample
35750 It is used to separate compiler options from assembler options
35751 in the @option{--target-help} output.
35753 @item @code{gt}
35754 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
35755 empty string) if the second-to-last argument is greater than the last argument, and NULL
35756 otherwise.  The following example inserts the @code{link_gomp} spec if the last
35757 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
35759 @smallexample
35760 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
35761 @end smallexample
35763 @item @code{debug-level-gt}
35764 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
35765 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
35766 otherwise.
35768 @smallexample
35769 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
35770 @end smallexample
35771 @end table
35773 @item %@{S@}
35774 Substitutes the @code{-S} switch, if that switch is given to GCC@.
35775 If that switch is not specified, this substitutes nothing.  Note that
35776 the leading dash is omitted when specifying this option, and it is
35777 automatically inserted if the substitution is performed.  Thus the spec
35778 string @samp{%@{foo@}} matches the command-line option @option{-foo}
35779 and outputs the command-line option @option{-foo}.
35781 @item %W@{S@}
35782 Like %@{@code{S}@} but mark last argument supplied within as a file to be
35783 deleted on failure.
35785 @item %@@@{S@}
35786 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
35787 @code{@@FILE} if an @code{@@file} argument has been supplied.
35789 @item %@{S*@}
35790 Substitutes all the switches specified to GCC whose names start
35791 with @code{-S}, but which also take an argument.  This is used for
35792 switches like @option{-o}, @option{-D}, @option{-I}, etc.
35793 GCC considers @option{-o foo} as being
35794 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
35795 text, including the space.  Thus two arguments are generated.
35797 @item %@{S*&T*@}
35798 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
35799 (the order of @code{S} and @code{T} in the spec is not significant).
35800 There can be any number of ampersand-separated variables; for each the
35801 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
35803 @item %@{S:X@}
35804 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
35806 @item %@{!S:X@}
35807 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
35809 @item %@{S*:X@}
35810 Substitutes @code{X} if one or more switches whose names start with
35811 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
35812 once, no matter how many such switches appeared.  However, if @code{%*}
35813 appears somewhere in @code{X}, then @code{X} is substituted once
35814 for each matching switch, with the @code{%*} replaced by the part of
35815 that switch matching the @code{*}.
35817 If @code{%*} appears as the last part of a spec sequence then a space
35818 is added after the end of the last substitution.  If there is more
35819 text in the sequence, however, then a space is not generated.  This
35820 allows the @code{%*} substitution to be used as part of a larger
35821 string.  For example, a spec string like this:
35823 @smallexample
35824 %@{mcu=*:--script=%*/memory.ld@}
35825 @end smallexample
35827 @noindent
35828 when matching an option like @option{-mcu=newchip} produces:
35830 @smallexample
35831 --script=newchip/memory.ld
35832 @end smallexample
35834 @item %@{.S:X@}
35835 Substitutes @code{X}, if processing a file with suffix @code{S}.
35837 @item %@{!.S:X@}
35838 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
35840 @item %@{,S:X@}
35841 Substitutes @code{X}, if processing a file for language @code{S}.
35843 @item %@{!,S:X@}
35844 Substitutes @code{X}, if not processing a file for language @code{S}.
35846 @item %@{S|P:X@}
35847 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
35848 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
35849 @code{*} sequences as well, although they have a stronger binding than
35850 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
35851 alternatives must be starred, and only the first matching alternative
35852 is substituted.
35854 For example, a spec string like this:
35856 @smallexample
35857 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
35858 @end smallexample
35860 @noindent
35861 outputs the following command-line options from the following input
35862 command-line options:
35864 @smallexample
35865 fred.c        -foo -baz
35866 jim.d         -bar -boggle
35867 -d fred.c     -foo -baz -boggle
35868 -d jim.d      -bar -baz -boggle
35869 @end smallexample
35871 @item %@{%:@var{function}(@var{args}):X@}
35873 Call function named @var{function} with args @var{args}.  If the
35874 function returns non-NULL, then @code{X} is substituted, if it returns
35875 NULL, it isn't substituted.
35877 @item %@{S:X; T:Y; :D@}
35879 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
35880 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
35881 be as many clauses as you need.  This may be combined with @code{.},
35882 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
35885 @end table
35887 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
35888 or similar construct can use a backslash to ignore the special meaning
35889 of the character following it, thus allowing literal matching of a
35890 character that is otherwise specially treated.  For example,
35891 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
35892 @option{-std=iso9899:1999} option is given.
35894 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
35895 construct may contain other nested @samp{%} constructs or spaces, or
35896 even newlines.  They are processed as usual, as described above.
35897 Trailing white space in @code{X} is ignored.  White space may also
35898 appear anywhere on the left side of the colon in these constructs,
35899 except between @code{.} or @code{*} and the corresponding word.
35901 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
35902 handled specifically in these constructs.  If another value of
35903 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
35904 @option{-W} switch is found later in the command line, the earlier
35905 switch value is ignored, except with @{@code{S}*@} where @code{S} is
35906 just one letter, which passes all matching options.
35908 The character @samp{|} at the beginning of the predicate text is used to
35909 indicate that a command should be piped to the following command, but
35910 only if @option{-pipe} is specified.
35912 It is built into GCC which switches take arguments and which do not.
35913 (You might think it would be useful to generalize this to allow each
35914 compiler's spec to say which switches take arguments.  But this cannot
35915 be done in a consistent fashion.  GCC cannot even decide which input
35916 files have been specified without knowing which switches take arguments,
35917 and it must know which input files to compile in order to tell which
35918 compilers to run).
35920 GCC also knows implicitly that arguments starting in @option{-l} are to be
35921 treated as compiler output files, and passed to the linker in their
35922 proper position among the other output files.
35924 @node Environment Variables
35925 @section Environment Variables Affecting GCC
35926 @cindex environment variables
35928 @c man begin ENVIRONMENT
35929 This section describes several environment variables that affect how GCC
35930 operates.  Some of them work by specifying directories or prefixes to use
35931 when searching for various kinds of files.  Some are used to specify other
35932 aspects of the compilation environment.
35934 Note that you can also specify places to search using options such as
35935 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
35936 take precedence over places specified using environment variables, which
35937 in turn take precedence over those specified by the configuration of GCC@.
35938 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
35939 GNU Compiler Collection (GCC) Internals}.
35941 @table @env
35942 @vindex LANG
35943 @vindex LC_CTYPE
35944 @c @vindex LC_COLLATE
35945 @vindex LC_MESSAGES
35946 @c @vindex LC_MONETARY
35947 @c @vindex LC_NUMERIC
35948 @c @vindex LC_TIME
35949 @vindex LC_ALL
35950 @cindex locale
35951 @item LANG
35952 @itemx LC_CTYPE
35953 @c @itemx LC_COLLATE
35954 @itemx LC_MESSAGES
35955 @c @itemx LC_MONETARY
35956 @c @itemx LC_NUMERIC
35957 @c @itemx LC_TIME
35958 @itemx LC_ALL
35959 These environment variables control the way that GCC uses
35960 localization information which allows GCC to work with different
35961 national conventions.  GCC inspects the locale categories
35962 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
35963 so.  These locale categories can be set to any value supported by your
35964 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
35965 Kingdom encoded in UTF-8.
35967 The @env{LC_CTYPE} environment variable specifies character
35968 classification.  GCC uses it to determine the character boundaries in
35969 a string; this is needed for some multibyte encodings that contain quote
35970 and escape characters that are otherwise interpreted as a string
35971 end or escape.
35973 The @env{LC_MESSAGES} environment variable specifies the language to
35974 use in diagnostic messages.
35976 If the @env{LC_ALL} environment variable is set, it overrides the value
35977 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
35978 and @env{LC_MESSAGES} default to the value of the @env{LANG}
35979 environment variable.  If none of these variables are set, GCC
35980 defaults to traditional C English behavior.
35982 @vindex TMPDIR
35983 @item TMPDIR
35984 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35985 files.  GCC uses temporary files to hold the output of one stage of
35986 compilation which is to be used as input to the next stage: for example,
35987 the output of the preprocessor, which is the input to the compiler
35988 proper.
35990 @vindex GCC_COMPARE_DEBUG
35991 @item GCC_COMPARE_DEBUG
35992 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35993 @option{-fcompare-debug} to the compiler driver.  See the documentation
35994 of this option for more details.
35996 @vindex GCC_EXEC_PREFIX
35997 @item GCC_EXEC_PREFIX
35998 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35999 names of the subprograms executed by the compiler.  No slash is added
36000 when this prefix is combined with the name of a subprogram, but you can
36001 specify a prefix that ends with a slash if you wish.
36003 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
36004 an appropriate prefix to use based on the pathname it is invoked with.
36006 If GCC cannot find the subprogram using the specified prefix, it
36007 tries looking in the usual places for the subprogram.
36009 The default value of @env{GCC_EXEC_PREFIX} is
36010 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
36011 the installed compiler. In many cases @var{prefix} is the value
36012 of @code{prefix} when you ran the @file{configure} script.
36014 Other prefixes specified with @option{-B} take precedence over this prefix.
36016 This prefix is also used for finding files such as @file{crt0.o} that are
36017 used for linking.
36019 In addition, the prefix is used in an unusual way in finding the
36020 directories to search for header files.  For each of the standard
36021 directories whose name normally begins with @samp{/usr/local/lib/gcc}
36022 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
36023 replacing that beginning with the specified prefix to produce an
36024 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
36025 @file{foo/bar} just before it searches the standard directory 
36026 @file{/usr/local/lib/bar}.
36027 If a standard directory begins with the configured
36028 @var{prefix} then the value of @var{prefix} is replaced by
36029 @env{GCC_EXEC_PREFIX} when looking for header files.
36031 @vindex COMPILER_PATH
36032 @item COMPILER_PATH
36033 The value of @env{COMPILER_PATH} is a colon-separated list of
36034 directories, much like @env{PATH}.  GCC tries the directories thus
36035 specified when searching for subprograms, if it cannot find the
36036 subprograms using @env{GCC_EXEC_PREFIX}.
36038 @vindex LIBRARY_PATH
36039 @item LIBRARY_PATH
36040 The value of @env{LIBRARY_PATH} is a colon-separated list of
36041 directories, much like @env{PATH}.  When configured as a native compiler,
36042 GCC tries the directories thus specified when searching for special
36043 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
36044 using GCC also uses these directories when searching for ordinary
36045 libraries for the @option{-l} option (but directories specified with
36046 @option{-L} come first).
36048 @vindex LANG
36049 @cindex locale definition
36050 @item LANG
36051 This variable is used to pass locale information to the compiler.  One way in
36052 which this information is used is to determine the character set to be used
36053 when character literals, string literals and comments are parsed in C and C++.
36054 When the compiler is configured to allow multibyte characters,
36055 the following values for @env{LANG} are recognized:
36057 @table @samp
36058 @item C-JIS
36059 Recognize JIS characters.
36060 @item C-SJIS
36061 Recognize SJIS characters.
36062 @item C-EUCJP
36063 Recognize EUCJP characters.
36064 @end table
36066 If @env{LANG} is not defined, or if it has some other value, then the
36067 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
36068 recognize and translate multibyte characters.
36070 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
36071 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
36072 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
36073 then additional text will be emitted to stderr when fix-it hints are
36074 emitted.  @option{-fdiagnostics-parseable-fixits} and
36075 @option{-fno-diagnostics-parseable-fixits} take precedence over this
36076 environment variable.
36078 @table @samp
36079 @item fixits-v1
36080 Emit parseable fix-it hints, equivalent to
36081 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
36082 expressed as a count of bytes, starting at byte 1 for the initial column.
36084 @item fixits-v2
36085 As @code{fixits-v1}, but columns are expressed as display columns,
36086 as per @option{-fdiagnostics-column-unit=display}.
36087 @end table
36089 @end table
36091 @noindent
36092 Some additional environment variables affect the behavior of the
36093 preprocessor.
36095 @include cppenv.texi
36097 @c man end
36099 @node Precompiled Headers
36100 @section Using Precompiled Headers
36101 @cindex precompiled headers
36102 @cindex speed of compilation
36104 Often large projects have many header files that are included in every
36105 source file.  The time the compiler takes to process these header files
36106 over and over again can account for nearly all of the time required to
36107 build the project.  To make builds faster, GCC allows you to
36108 @dfn{precompile} a header file.
36110 To create a precompiled header file, simply compile it as you would any
36111 other file, if necessary using the @option{-x} option to make the driver
36112 treat it as a C or C++ header file.  You may want to use a
36113 tool like @command{make} to keep the precompiled header up-to-date when
36114 the headers it contains change.
36116 A precompiled header file is searched for when @code{#include} is
36117 seen in the compilation.  As it searches for the included file
36118 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
36119 compiler looks for a precompiled header in each directory just before it
36120 looks for the include file in that directory.  The name searched for is
36121 the name specified in the @code{#include} with @samp{.gch} appended.  If
36122 the precompiled header file cannot be used, it is ignored.
36124 For instance, if you have @code{#include "all.h"}, and you have
36125 @file{all.h.gch} in the same directory as @file{all.h}, then the
36126 precompiled header file is used if possible, and the original
36127 header is used otherwise.
36129 Alternatively, you might decide to put the precompiled header file in a
36130 directory and use @option{-I} to ensure that directory is searched
36131 before (or instead of) the directory containing the original header.
36132 Then, if you want to check that the precompiled header file is always
36133 used, you can put a file of the same name as the original header in this
36134 directory containing an @code{#error} command.
36136 This also works with @option{-include}.  So yet another way to use
36137 precompiled headers, good for projects not designed with precompiled
36138 header files in mind, is to simply take most of the header files used by
36139 a project, include them from another header file, precompile that header
36140 file, and @option{-include} the precompiled header.  If the header files
36141 have guards against multiple inclusion, they are skipped because
36142 they've already been included (in the precompiled header).
36144 If you need to precompile the same header file for different
36145 languages, targets, or compiler options, you can instead make a
36146 @emph{directory} named like @file{all.h.gch}, and put each precompiled
36147 header in the directory, perhaps using @option{-o}.  It doesn't matter
36148 what you call the files in the directory; every precompiled header in
36149 the directory is considered.  The first precompiled header
36150 encountered in the directory that is valid for this compilation is
36151 used; they're searched in no particular order.
36153 There are many other possibilities, limited only by your imagination,
36154 good sense, and the constraints of your build system.
36156 A precompiled header file can be used only when these conditions apply:
36158 @itemize
36159 @item
36160 Only one precompiled header can be used in a particular compilation.
36162 @item
36163 A precompiled header cannot be used once the first C token is seen.  You
36164 can have preprocessor directives before a precompiled header; you cannot
36165 include a precompiled header from inside another header.
36167 @item
36168 The precompiled header file must be produced for the same language as
36169 the current compilation.  You cannot use a C precompiled header for a C++
36170 compilation.
36172 @item
36173 The precompiled header file must have been produced by the same compiler
36174 binary as the current compilation is using.
36176 @item
36177 Any macros defined before the precompiled header is included must
36178 either be defined in the same way as when the precompiled header was
36179 generated, or must not affect the precompiled header, which usually
36180 means that they don't appear in the precompiled header at all.
36182 The @option{-D} option is one way to define a macro before a
36183 precompiled header is included; using a @code{#define} can also do it.
36184 There are also some options that define macros implicitly, like
36185 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
36186 defined this way.
36188 @item If debugging information is output when using the precompiled
36189 header, using @option{-g} or similar, the same kind of debugging information
36190 must have been output when building the precompiled header.  However,
36191 a precompiled header built using @option{-g} can be used in a compilation
36192 when no debugging information is being output.
36194 @item The same @option{-m} options must generally be used when building
36195 and using the precompiled header.  @xref{Submodel Options},
36196 for any cases where this rule is relaxed.
36198 @item Each of the following options must be the same when building and using
36199 the precompiled header:
36201 @gccoptlist{-fexceptions}
36203 @item
36204 Some other command-line options starting with @option{-f},
36205 @option{-p}, or @option{-O} must be defined in the same way as when
36206 the precompiled header was generated.  At present, it's not clear
36207 which options are safe to change and which are not; the safest choice
36208 is to use exactly the same options when generating and using the
36209 precompiled header.  The following are known to be safe:
36211 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
36212 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
36213 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
36214 -pedantic-errors}
36216 @item Address space layout randomization (ASLR) can lead to not binary identical
36217 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
36218 PCH files.
36220 @end itemize
36222 For all of these except the last, the compiler automatically
36223 ignores the precompiled header if the conditions aren't met.  If you
36224 find an option combination that doesn't work and doesn't cause the
36225 precompiled header to be ignored, please consider filing a bug report,
36226 see @ref{Bugs}.
36228 If you do use differing options when generating and using the
36229 precompiled header, the actual behavior is a mixture of the
36230 behavior for the options.  For instance, if you use @option{-g} to
36231 generate the precompiled header but not when using it, you may or may
36232 not get debugging information for routines in the precompiled header.
36234 @node C++ Modules
36235 @section C++ Modules
36236 @cindex speed of compilation
36238 Modules are a C++20 language feature.  As the name suggests, they
36239 provides a modular compilation system, intending to provide both
36240 faster builds and better library isolation.  The ``Merging Modules''
36241 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
36242 of changes to the standard, although it does not capture later
36243 changes.
36245 @emph{G++'s modules support is not complete.}  Other than bugs, the
36246 known missing pieces are:
36248 @table @emph
36250 @item Private Module Fragment
36251 The Private Module Fragment is recognized, but an error is emitted.
36253 @item Partition definition visibility rules
36254 Entities may be defined in implementation partitions, and those
36255 definitions are not available outside of the module.  This is not
36256 implemented, and the definitions are available to extra-module use.
36258 @item Textual merging of reachable GM entities
36259 Entities may be multiply defined across different header-units.
36260 These must be de-duplicated, and this is implemented across imports,
36261 or when an import redefines a textually-defined entity.  However the
36262 reverse is not implemented---textually redefining an entity that has
36263 been defined in an imported header-unit.  A redefinition error is
36264 emitted.
36266 @item Translation-Unit local referencing rules
36267 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
36268 (@uref{https://wg21.link/p2003}) add limitations on which entities an
36269 exported region may reference (for instance, the entities an exported
36270 template definition may reference).  These are not fully implemented.
36272 @item Standard Library Header Units
36273 The Standard Library is not provided as importable header units.  If
36274 you want to import such units, you must explicitly build them first.
36275 If you do not do this with care, you may have multiple declarations,
36276 which the module machinery must merge---compiler resource usage can be
36277 affected by how you partition header files into header units.
36279 @end table
36281 Modular compilation is @emph{not} enabled with just the
36282 @option{-std=c++20} option.  You must explicitly enable it with the
36283 @option{-fmodules-ts} option.  It is independent of the language
36284 version selected, although in pre-C++20 versions, it is of course an
36285 extension.
36287 No new source file suffixes are required or supported.  If you wish to
36288 use a non-standard suffix (@pxref{Overall Options}), you also need
36289 to provide a @option{-x c++} option too.@footnote{Some users like to
36290 distinguish module interface files with a new suffix, such as naming
36291 the source @code{module.cppm}, which involves
36292 teaching all tools about the new suffix.  A different scheme, such as
36293 naming @code{module-m.cpp} would be less invasive.}
36295 Compiling a module interface unit produces an additional output (to
36296 the assembly or object file), called a Compiled Module Interface
36297 (CMI).  This encodes the exported declarations of the module.
36298 Importing a module reads in the CMI.  The import graph is a Directed
36299 Acyclic Graph (DAG).  You must build imports before the importer.
36301 Header files may themselves be compiled to header units, which are a
36302 transitional ability aiming at faster compilation.  The
36303 @option{-fmodule-header} option is used to enable this, and implies
36304 the @option{-fmodules-ts} option.  These CMIs are named by the fully
36305 resolved underlying header file, and thus may be a complete pathname
36306 containing subdirectories.  If the header file is found at an absolute
36307 pathname, the CMI location is still relative to a CMI root directory.
36309 As header files often have no suffix, you commonly have to specify a
36310 @option{-x} option to tell the compiler the source is a header file.
36311 You may use @option{-x c++-header}, @option{-x c++-user-header} or
36312 @option{-x c++-system-header}.  When used in conjunction with
36313 @option{-fmodules-ts}, these all imply an appropriate
36314 @option{-fmodule-header} option.  The latter two variants use the
36315 user or system include path to search for the file specified.  This
36316 allows you to, for instance, compile standard library header files as
36317 header units, without needing to know exactly where they are
36318 installed.  Specifying the language as one of these variants also
36319 inhibits output of the object file, as header files have no associated
36320 object file.
36322 The @option{-fmodule-only} option disables generation of the
36323 associated object file for compiling a module interface.  Only the CMI
36324 is generated.  This option is implied when using the
36325 @option{-fmodule-header} option.
36327 The @option{-flang-info-include-translate} and
36328 @option{-flang-info-include-translate-not} options notes whether
36329 include translation occurs or not.  With no argument, the first will
36330 note all include translation.  The second will note all
36331 non-translations of include files not known to intentionally be
36332 textual.  With an argument, queries about include translation of a
36333 header files with that particular trailing pathname are noted.  You
36334 may repeat this form to cover several different header files.  This
36335 option may be helpful in determining whether include translation is
36336 happening---if it is working correctly, it behaves as if it isn't
36337 there at all.
36339 The @option{-flang-info-module-cmi} option can be used to determine
36340 where the compiler is reading a CMI from.  Without the option, the
36341 compiler is silent when such a read is successful.  This option has an
36342 optional argument, which will restrict the notification to just the
36343 set of named modules or header units specified.
36345 The @option{-Winvalid-imported-macros} option causes all imported macros
36346 to be resolved at the end of compilation.  Without this, imported
36347 macros are only resolved when expanded or (re)defined.  This option
36348 detects conflicting import definitions for all macros.
36350 For details of the @option{-fmodule-mapper} family of options,
36351 @pxref{C++ Module Mapper}.
36353 @menu
36354 * C++ Module Mapper::       Module Mapper
36355 * C++ Module Preprocessing::  Module Preprocessing
36356 * C++ Compiled Module Interface:: Compiled Module Interface
36357 @end menu
36359 @node C++ Module Mapper
36360 @subsection Module Mapper
36361 @cindex C++ Module Mapper
36363 A module mapper provides a server or file that the compiler queries to
36364 determine the mapping between module names and CMI files.  It is also
36365 used to build CMIs on demand.  @emph{Mapper functionality is in its
36366 infancy and is intended for experimentation with build system
36367 interactions.}
36369 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
36370 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
36371 have one of the following forms:
36373 @table @gcctabopt
36375 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
36376 An optional hostname and a numeric port number to connect to.  If the
36377 hostname is omitted, the loopback address is used.  If the hostname
36378 corresponds to multiple IPV6 addresses, these are tried in turn, until
36379 one is successful.  If your host lacks IPv6, this form is
36380 non-functional.  If you must use IPv4 use
36381 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
36383 @item =@var{socket}@r{[}?@var{ident}@r{]}
36384 A local domain socket.  If your host lacks local domain sockets, this
36385 form is non-functional.
36387 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
36388 A program to spawn, and communicate with on its stdin/stdout streams.
36389 Your @var{PATH} environment variable is searched for the program.
36390 Arguments are separated by space characters, (it is not possible for
36391 one of the arguments delivered to the program to contain a space).  An
36392 exception is if @var{program} begins with @@.  In that case
36393 @var{program} (sans @@) is looked for in the compiler's internal
36394 binary directory.  Thus the sample mapper-server can be specified
36395 with @code{@@g++-mapper-server}.
36397 @item <>@r{[}?@var{ident}@r{]}
36398 @item <>@var{inout}@r{[}?@var{ident}@r{]}
36399 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
36400 Named pipes or file descriptors to communicate over.  The first form,
36401 @option{<>}, communicates over stdin and stdout.  The other forms
36402 allow you to specify a file descriptor or name a pipe.  A numeric value
36403 is interpreted as a file descriptor, otherwise named pipe is opened.
36404 The second form specifies a bidirectional pipe and the last form
36405 allows specifying two independent pipes.  Using file descriptors
36406 directly in this manner is fragile in general, as it can require the
36407 cooperation of intermediate processes.  In particular using stdin &
36408 stdout is fraught with danger as other compiler options might also
36409 cause the compiler to read stdin or write stdout, and it can have
36410 unfortunate interactions with signal delivery from the terminal.
36412 @item @var{file}@r{[}?@var{ident}@r{]}
36413 A mapping file consisting of space-separated module-name, filename
36414 pairs, one per line.  Only the mappings for the direct imports and any
36415 module export name need be provided.  If other mappings are provided,
36416 they override those stored in any imported CMI files.  A repository
36417 root may be specified in the mapping file by using @samp{$root} as the
36418 module name in the first active line.  Use of this option will disable
36419 any default module->CMI name mapping.
36421 @end table
36423 As shown, an optional @var{ident} may suffix the first word of the
36424 option, indicated by a @samp{?} prefix.  The value is used in the
36425 initial handshake with the module server, or to specify a prefix on
36426 mapping file lines.  In the server case, the main source file name is
36427 used if no @var{ident} is specified.  In the file case, all non-blank
36428 lines are significant, unless a value is specified, in which case only
36429 lines beginning with @var{ident} are significant.  The @var{ident}
36430 must be separated by whitespace from the module name.  Be aware that
36431 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
36432 significant to the shell, and therefore may need quoting.
36434 The mapper is connected to or loaded lazily, when the first module
36435 mapping is required.  The networking protocols are only supported on
36436 hosts that provide networking.  If no mapper is specified a default is
36437 provided.
36439 A project-specific mapper is expected to be provided by the build
36440 system that invokes the compiler.  It is not expected that a
36441 general-purpose server is provided for all compilations.  As such, the
36442 server will know the build configuration, the compiler it invoked, and
36443 the environment (such as working directory) in which that is
36444 operating.  As it may parallelize builds, several compilations may
36445 connect to the same socket.
36447 The default mapper generates CMI files in a @samp{gcm.cache}
36448 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
36449 is used directly to provide the basename.  Header units construct a
36450 relative path using the underlying header file name.  If the path is
36451 already relative, a @samp{,} directory is prepended.  Internal
36452 @samp{..} components are translated to @samp{,,}.  No attempt is made
36453 to canonicalize these filenames beyond that done by the preprocessor's
36454 include search algorithm, as in general it is ambiguous when symbolic
36455 links are present.
36457 The mapper protocol was published as ``A Module Mapper''
36458 @uref{https://wg21.link/p1184}.  The implementation is provided by
36459 @command{libcody}, @uref{https://github.com/urnathan/libcody},
36460 which specifies the canonical protocol definition.  A proof of concept
36461 server implementation embedded in @command{make} was described in
36462 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
36464 @node C++ Module Preprocessing
36465 @subsection Module Preprocessing
36466 @cindex C++ Module Preprocessing
36468 Modules affect preprocessing because of header units and include
36469 translation.  Some uses of the preprocessor as a separate step either
36470 do not produce a correct output, or require CMIs to be available.
36472 Header units import macros.  These macros can affect later conditional
36473 inclusion, which therefore can cascade to differing import sets.  When
36474 preprocessing, it is necessary to load the CMI.  If a header unit is
36475 unavailable, the preprocessor issues a warning and continue (when
36476 not just preprocessing, an error is emitted).  Detecting such imports
36477 requires preprocessor tokenization of the input stream to phase 4
36478 (macro expansion).
36480 Include translation converts @code{#include}, @code{#include_next} and
36481 @code{#import} directives to internal @code{import} declarations.
36482 Whether a particular directive is translated is controlled by the
36483 module mapper.  Header unit names are canonicalized during
36484 preprocessing.
36486 Dependency information can be emitted for macro import, extending the
36487 functionality of @option{-MD} and @option{-MMD} options.  Detection of
36488 import declarations also requires phase 4 preprocessing, and thus
36489 requires full preprocessing (or compilation).
36491 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
36492 preprocessing before phase 4.
36494 The @option{-save-temps} option uses @option{-fdirectives-only} for
36495 preprocessing, and preserve the macro definitions in the preprocessed
36496 output.  Usually you also want to use this option when explicitly
36497 preprocessing a header-unit, or consuming such preprocessed output:
36499 @smallexample
36500 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
36501 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
36502 @end smallexample
36504 @node C++ Compiled Module Interface
36505 @subsection Compiled Module Interface
36506 @cindex C++ Compiled Module Interface
36508 CMIs are an additional artifact when compiling named module
36509 interfaces, partitions or header units.  These are read when
36510 importing.  CMI contents are implementation-specific, and in GCC's
36511 case tied to the compiler version.  Consider them a rebuildable cache
36512 artifact, not a distributable object.
36514 When creating an output CMI, any missing directory components are
36515 created in a manner that is safe for concurrent builds creating
36516 multiple, different, CMIs within a common subdirectory tree.
36518 CMI contents are written to a temporary file, which is then atomically
36519 renamed.  Observers either see old contents (if there is an
36520 existing file), or complete new contents.  They do not observe the
36521 CMI during its creation.  This is unlike object file writing, which
36522 may be observed by an external process.
36524 CMIs are read in lazily, if the host OS provides @code{mmap}
36525 functionality.  Generally blocks are read when name lookup or template
36526 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
36527 option may be used.
36529 The @option{--param lazy-modules=@var{n}} parameter controls the limit
36530 on the number of concurrently open module files during lazy loading.
36531 Should more modules be imported, an LRU algorithm is used to determine
36532 which files to close---until that file is needed again.  This limit
36533 may be exceeded with deep module dependency hierarchies.  With large
36534 code bases there may be more imports than the process limit of file
36535 descriptors.  By default, the limit is a few less than the per-process
36536 file descriptor hard limit, if that is determinable.@footnote{Where
36537 applicable the soft limit is incremented as needed towards the hard limit.}
36539 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
36540 You may use @command{readelf} to inspect them, although section
36541 contents are largely undecipherable.  There is a section named
36542 @code{.gnu.c++.README}, which contains human-readable text.  Other
36543 than the first line, each line consists of @code{@var{tag}: @code{value}}
36544 tuples.
36546 @smallexample
36547 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
36549 String dump of section '.gnu.c++.README':
36550   [     0]  GNU C++ primary module interface
36551   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
36552   [    6f]  version: 2020/11/16-04:54
36553   [    89]  module: foo
36554   [    95]  source: c_b.ii
36555   [    a4]  dialect: C++20/coroutines
36556   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
36557   [    ee]  repository: gcm.cache
36558   [   104]  buildtime: 2020/11/16 15:03:21 UTC
36559   [   127]  localtime: 2020/11/16 07:03:21 PST
36560   [   14a]  export: foo:part1 foo-part1.gcm
36561 @end smallexample
36563 Amongst other things, this lists the source that was built, C++
36564 dialect used and imports of the module.@footnote{The precise contents
36565 of this output may change.} The timestamp is the same value as that
36566 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
36567 explicitly specified with the environment variable
36568 @code{SOURCE_DATE_EPOCH}.  For further details
36569 @pxref{Environment Variables}.
36571 A set of related CMIs may be copied, provided the relative pathnames
36572 are preserved.
36574 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
36575 it may be removed or altered.  The section numbering of the sections
36576 whose names do not begin with @code{.gnu.c++.}, or are not the string
36577 section is significant and must not be altered.