c++: Fix up mangling of function/block scope static structured bindings [PR111069]
[official-gcc.git] / gcc / doc / invoke.texi
blob02de0f657e858f37085b68626ad8c07f3cb263e5
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  -fpermissive
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
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-c2x-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-json
452 -fdump-analyzer-state-purge
453 -fdump-analyzer-stderr
454 -fdump-analyzer-supergraph
455 -fdump-analyzer-untracked
456 -Wno-analyzer-double-fclose
457 -Wno-analyzer-double-free
458 -Wno-analyzer-exposure-through-output-file
459 -Wno-analyzer-exposure-through-uninit-copy
460 -Wno-analyzer-fd-access-mode-mismatch
461 -Wno-analyzer-fd-double-close
462 -Wno-analyzer-fd-leak
463 -Wno-analyzer-fd-phase-mismatch
464 -Wno-analyzer-fd-type-mismatch
465 -Wno-analyzer-fd-use-after-close
466 -Wno-analyzer-fd-use-without-check
467 -Wno-analyzer-file-leak
468 -Wno-analyzer-free-of-non-heap
469 -Wno-analyzer-imprecise-fp-arithmetic
470 -Wno-analyzer-infinite-recursion
471 -Wno-analyzer-jump-through-null
472 -Wno-analyzer-malloc-leak
473 -Wno-analyzer-mismatching-deallocation
474 -Wno-analyzer-null-argument
475 -Wno-analyzer-null-dereference
476 -Wno-analyzer-out-of-bounds
477 -Wno-analyzer-overlapping-buffers
478 -Wno-analyzer-possible-null-argument
479 -Wno-analyzer-possible-null-dereference
480 -Wno-analyzer-putenv-of-auto-var
481 -Wno-analyzer-shift-count-negative
482 -Wno-analyzer-shift-count-overflow
483 -Wno-analyzer-stale-setjmp-buffer
484 -Wno-analyzer-tainted-allocation-size
485 -Wno-analyzer-tainted-assertion
486 -Wno-analyzer-tainted-array-index
487 -Wno-analyzer-tainted-divisor
488 -Wno-analyzer-tainted-offset
489 -Wno-analyzer-tainted-size
490 -Wanalyzer-too-complex
491 -Wno-analyzer-unsafe-call-within-signal-handler
492 -Wno-analyzer-use-after-free
493 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
494 -Wno-analyzer-use-of-uninitialized-value
495 -Wno-analyzer-va-arg-type-mismatch
496 -Wno-analyzer-va-list-exhausted
497 -Wno-analyzer-va-list-leak
498 -Wno-analyzer-va-list-use-after-va-end
499 -Wno-analyzer-write-to-const
500 -Wno-analyzer-write-to-string-literal
503 @item C and Objective-C-only Warning Options
504 @gccoptlist{-Wbad-function-cast  -Wmissing-declarations
505 -Wmissing-parameter-type -Wmissing-prototypes -Wmissing-variable-declarations
506 -Wnested-externs -Wold-style-declaration  -Wold-style-definition
507 -Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion
508 -Wdeclaration-after-statement  -Wpointer-sign}
510 @item Debugging Options
511 @xref{Debugging Options,,Options for Debugging Your Program}.
512 @gccoptlist{-g  -g@var{level}  -gdwarf  -gdwarf-@var{version}
513 -gbtf -gctf  -gctf@var{level}
514 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches
515 -gstrict-dwarf  -gno-strict-dwarf
516 -gas-loc-support  -gno-as-loc-support
517 -gas-locview-support  -gno-as-locview-support
518 -gcodeview
519 -gcolumn-info  -gno-column-info  -gdwarf32  -gdwarf64
520 -gstatement-frontiers  -gno-statement-frontiers
521 -gvariable-location-views  -gno-variable-location-views
522 -ginternal-reset-location-views  -gno-internal-reset-location-views
523 -ginline-points  -gno-inline-points
524 -gvms -gz@r{[}=@var{type}@r{]}
525 -gsplit-dwarf  -gdescribe-dies  -gno-describe-dies
526 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section
527 -fno-eliminate-unused-debug-types
528 -femit-struct-debug-baseonly  -femit-struct-debug-reduced
529 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
530 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always
531 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm
532 -fvar-tracking  -fvar-tracking-assignments}
534 @item Optimization Options
535 @xref{Optimize Options,,Options that Control Optimization}.
536 @gccoptlist{-faggressive-loop-optimizations
537 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
538 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
539 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
540 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]]
541 -fno-allocation-dce -fallow-store-data-races
542 -fassociative-math  -fauto-profile  -fauto-profile[=@var{path}]
543 -fauto-inc-dec  -fbranch-probabilities
544 -fcaller-saves
545 -fcombine-stack-adjustments  -fconserve-stack
546 -fcompare-elim  -fcprop-registers  -fcrossjumping
547 -fcse-follow-jumps  -fcse-skip-blocks  -fcx-fortran-rules
548 -fcx-limited-range
549 -fdata-sections  -fdce  -fdelayed-branch
550 -fdelete-null-pointer-checks  -fdevirtualize  -fdevirtualize-speculatively
551 -fdevirtualize-at-ltrans  -fdse
552 -fearly-inlining  -fipa-sra  -fexpensive-optimizations  -ffat-lto-objects
553 -ffast-math  -ffinite-math-only  -ffloat-store  -fexcess-precision=@var{style}
554 -ffinite-loops
555 -fforward-propagate  -ffp-contract=@var{style}  -ffunction-sections
556 -fgcse  -fgcse-after-reload  -fgcse-las  -fgcse-lm  -fgraphite-identity
557 -fgcse-sm  -fhoist-adjacent-loads  -fif-conversion
558 -fif-conversion2  -findirect-inlining
559 -finline-functions  -finline-functions-called-once  -finline-limit=@var{n}
560 -finline-small-functions -fipa-modref -fipa-cp  -fipa-cp-clone
561 -fipa-bit-cp  -fipa-vrp  -fipa-pta  -fipa-profile  -fipa-pure-const
562 -fipa-reference  -fipa-reference-addressable
563 -fipa-stack-alignment  -fipa-icf  -fira-algorithm=@var{algorithm}
564 -flive-patching=@var{level}
565 -fira-region=@var{region}  -fira-hoist-pressure
566 -fira-loop-pressure  -fno-ira-share-save-slots
567 -fno-ira-share-spill-slots
568 -fisolate-erroneous-paths-dereference  -fisolate-erroneous-paths-attribute
569 -fivopts  -fkeep-inline-functions  -fkeep-static-functions
570 -fkeep-static-consts  -flimit-function-alignment  -flive-range-shrinkage
571 -floop-block  -floop-interchange  -floop-strip-mine
572 -floop-unroll-and-jam  -floop-nest-optimize
573 -floop-parallelize-all  -flra-remat  -flto  -flto-compression-level
574 -flto-partition=@var{alg}  -fmerge-all-constants
575 -fmerge-constants  -fmodulo-sched  -fmodulo-sched-allow-regmoves
576 -fmove-loop-invariants  -fmove-loop-stores  -fno-branch-count-reg
577 -fno-defer-pop  -fno-fp-int-builtin-inexact  -fno-function-cse
578 -fno-guess-branch-probability  -fno-inline  -fno-math-errno  -fno-peephole
579 -fno-peephole2  -fno-printf-return-value  -fno-sched-interblock
580 -fno-sched-spec  -fno-signed-zeros
581 -fno-toplevel-reorder  -fno-trapping-math  -fno-zero-initialized-in-bss
582 -fomit-frame-pointer  -foptimize-sibling-calls
583 -fpartial-inlining  -fpeel-loops  -fpredictive-commoning
584 -fprefetch-loop-arrays
585 -fprofile-correction
586 -fprofile-use  -fprofile-use=@var{path} -fprofile-partial-training
587 -fprofile-values -fprofile-reorder-functions
588 -freciprocal-math  -free  -frename-registers  -freorder-blocks
589 -freorder-blocks-algorithm=@var{algorithm}
590 -freorder-blocks-and-partition  -freorder-functions
591 -frerun-cse-after-loop  -freschedule-modulo-scheduled-loops
592 -frounding-math  -fsave-optimization-record
593 -fsched2-use-superblocks  -fsched-pressure
594 -fsched-spec-load  -fsched-spec-load-dangerous
595 -fsched-stalled-insns-dep[=@var{n}]  -fsched-stalled-insns[=@var{n}]
596 -fsched-group-heuristic  -fsched-critical-path-heuristic
597 -fsched-spec-insn-heuristic  -fsched-rank-heuristic
598 -fsched-last-insn-heuristic  -fsched-dep-count-heuristic
599 -fschedule-fusion
600 -fschedule-insns  -fschedule-insns2  -fsection-anchors
601 -fselective-scheduling  -fselective-scheduling2
602 -fsel-sched-pipelining  -fsel-sched-pipelining-outer-loops
603 -fsemantic-interposition  -fshrink-wrap  -fshrink-wrap-separate
604 -fsignaling-nans
605 -fsingle-precision-constant  -fsplit-ivs-in-unroller  -fsplit-loops
606 -fsplit-paths
607 -fsplit-wide-types  -fsplit-wide-types-early  -fssa-backprop  -fssa-phiopt
608 -fstdarg-opt  -fstore-merging  -fstrict-aliasing -fipa-strict-aliasing
609 -fthread-jumps  -ftracer  -ftree-bit-ccp
610 -ftree-builtin-call-dce  -ftree-ccp  -ftree-ch
611 -ftree-coalesce-vars  -ftree-copy-prop  -ftree-dce  -ftree-dominator-opts
612 -ftree-dse  -ftree-forwprop  -ftree-fre  -fcode-hoisting
613 -ftree-loop-if-convert  -ftree-loop-im
614 -ftree-phiprop  -ftree-loop-distribution  -ftree-loop-distribute-patterns
615 -ftree-loop-ivcanon  -ftree-loop-linear  -ftree-loop-optimize
616 -ftree-loop-vectorize
617 -ftree-parallelize-loops=@var{n}  -ftree-pre  -ftree-partial-pre  -ftree-pta
618 -ftree-reassoc  -ftree-scev-cprop  -ftree-sink  -ftree-slsr  -ftree-sra
619 -ftree-switch-conversion  -ftree-tail-merge
620 -ftree-ter  -ftree-vectorize  -ftree-vrp  -ftrivial-auto-var-init
621 -funconstrained-commons -funit-at-a-time  -funroll-all-loops
622 -funroll-loops -funsafe-math-optimizations  -funswitch-loops
623 -fipa-ra  -fvariable-expansion-in-unroller  -fvect-cost-model  -fvpt
624 -fweb  -fwhole-program  -fwpa  -fuse-linker-plugin -fzero-call-used-regs
625 --param @var{name}=@var{value}
626 -O  -O0  -O1  -O2  -O3  -Os  -Ofast  -Og  -Oz}
628 @item Program Instrumentation Options
629 @xref{Instrumentation Options,,Program Instrumentation Options}.
630 @gccoptlist{-p  -pg  -fprofile-arcs  --coverage  -ftest-coverage
631 -fprofile-abs-path
632 -fprofile-dir=@var{path}  -fprofile-generate  -fprofile-generate=@var{path}
633 -fprofile-info-section  -fprofile-info-section=@var{name}
634 -fprofile-note=@var{path} -fprofile-prefix-path=@var{path}
635 -fprofile-update=@var{method} -fprofile-filter-files=@var{regex}
636 -fprofile-exclude-files=@var{regex}
637 -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
638 -fsanitize=@var{style}  -fsanitize-recover  -fsanitize-recover=@var{style}
639 -fsanitize-trap   -fsanitize-trap=@var{style}
640 -fasan-shadow-offset=@var{number}  -fsanitize-sections=@var{s1},@var{s2},...
641 -fsanitize-undefined-trap-on-error  -fbounds-check
642 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
643 -fharden-compares -fharden-conditional-branches
644 -fstack-protector  -fstack-protector-all  -fstack-protector-strong
645 -fstack-protector-explicit  -fstack-check
646 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym}
647 -fno-stack-limit  -fsplit-stack
648 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
649 -fvtv-counts  -fvtv-debug
650 -finstrument-functions  -finstrument-functions-once
651 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
652 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
653 -fprofile-prefix-map=@var{old}=@var{new}}
655 @item Preprocessor Options
656 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
657 @gccoptlist{-A@var{question}=@var{answer}
658 -A-@var{question}@r{[}=@var{answer}@r{]}
659 -C  -CC  -D@var{macro}@r{[}=@var{defn}@r{]}
660 -dD  -dI  -dM  -dN  -dU
661 -fdebug-cpp  -fdirectives-only  -fdollars-in-identifiers
662 -fexec-charset=@var{charset}  -fextended-identifiers
663 -finput-charset=@var{charset}  -flarge-source-files
664 -fmacro-prefix-map=@var{old}=@var{new} -fmax-include-depth=@var{depth}
665 -fno-canonical-system-headers  -fpch-deps  -fpch-preprocess
666 -fpreprocessed  -ftabstop=@var{width}  -ftrack-macro-expansion
667 -fwide-exec-charset=@var{charset}  -fworking-directory
668 -H  -imacros @var{file}  -include @var{file}
669 -M  -MD  -MF  -MG  -MM  -MMD  -MP  -MQ  -MT -Mno-modules
670 -no-integrated-cpp  -P  -pthread  -remap
671 -traditional  -traditional-cpp  -trigraphs
672 -U@var{macro}  -undef
673 -Wp,@var{option}  -Xpreprocessor @var{option}}
675 @item Assembler Options
676 @xref{Assembler Options,,Passing Options to the Assembler}.
677 @gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
679 @item Linker Options
680 @xref{Link Options,,Options for Linking}.
681 @gccoptlist{@var{object-file-name}  -fuse-ld=@var{linker}  -l@var{library}
682 -nostartfiles  -nodefaultlibs  -nolibc  -nostdlib  -nostdlib++
683 -e @var{entry}  --entry=@var{entry}
684 -pie  -pthread  -r  -rdynamic
685 -s  -static  -static-pie  -static-libgcc  -static-libstdc++
686 -static-libasan  -static-libtsan  -static-liblsan  -static-libubsan
687 -shared  -shared-libgcc  -symbolic
688 -T @var{script}  -Wl,@var{option}  -Xlinker @var{option}
689 -u @var{symbol}  -z @var{keyword}}
691 @item Directory Options
692 @xref{Directory Options,,Options for Directory Search}.
693 @gccoptlist{-B@var{prefix}  -I@var{dir}  -I-
694 -idirafter @var{dir}
695 -imacros @var{file}  -imultilib @var{dir}
696 -iplugindir=@var{dir}  -iprefix @var{file}
697 -iquote @var{dir}  -isysroot @var{dir}  -isystem @var{dir}
698 -iwithprefix @var{dir}  -iwithprefixbefore @var{dir}
699 -L@var{dir}  -no-canonical-prefixes  --no-sysroot-suffix
700 -nostdinc  -nostdinc++  --sysroot=@var{dir}}
702 @item Code Generation Options
703 @xref{Code Gen Options,,Options for Code Generation Conventions}.
704 @gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg}
705 -ffixed-@var{reg}  -fexceptions
706 -fnon-call-exceptions  -fdelete-dead-exceptions  -funwind-tables
707 -fasynchronous-unwind-tables
708 -fno-gnu-unique
709 -finhibit-size-directive  -fcommon  -fno-ident
710 -fpcc-struct-return  -fpic  -fPIC  -fpie  -fPIE  -fno-plt
711 -fno-jump-tables -fno-bit-tests
712 -frecord-gcc-switches
713 -freg-struct-return  -fshort-enums  -fshort-wchar
714 -fverbose-asm  -fpack-struct[=@var{n}]
715 -fleading-underscore  -ftls-model=@var{model}
716 -fstack-reuse=@var{reuse_level}
717 -ftrampolines  -ftrapv  -fwrapv
718 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
719 -fstrict-volatile-bitfields  -fsync-libcalls}
721 @item Developer Options
722 @xref{Developer Options,,GCC Developer Options}.
723 @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion
724 -dumpfullversion  -fcallgraph-info@r{[}=su,da@r{]}
725 -fchecking  -fchecking=@var{n}
726 -fdbg-cnt-list  -fdbg-cnt=@var{counter-value-list}
727 -fdisable-ipa-@var{pass_name}
728 -fdisable-rtl-@var{pass_name}
729 -fdisable-rtl-@var{pass-name}=@var{range-list}
730 -fdisable-tree-@var{pass_name}
731 -fdisable-tree-@var{pass-name}=@var{range-list}
732 -fdump-debug  -fdump-earlydebug
733 -fdump-noaddr  -fdump-unnumbered  -fdump-unnumbered-links
734 -fdump-final-insns@r{[}=@var{file}@r{]}
735 -fdump-ipa-all  -fdump-ipa-cgraph  -fdump-ipa-inline
736 -fdump-lang-all
737 -fdump-lang-@var{switch}
738 -fdump-lang-@var{switch}-@var{options}
739 -fdump-lang-@var{switch}-@var{options}=@var{filename}
740 -fdump-passes
741 -fdump-rtl-@var{pass}  -fdump-rtl-@var{pass}=@var{filename}
742 -fdump-statistics
743 -fdump-tree-all
744 -fdump-tree-@var{switch}
745 -fdump-tree-@var{switch}-@var{options}
746 -fdump-tree-@var{switch}-@var{options}=@var{filename}
747 -fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second
748 -fenable-@var{kind}-@var{pass}
749 -fenable-@var{kind}-@var{pass}=@var{range-list}
750 -fira-verbose=@var{n}
751 -flto-report  -flto-report-wpa  -fmem-report-wpa
752 -fmem-report  -fpre-ipa-mem-report  -fpost-ipa-mem-report
753 -fopt-info  -fopt-info-@var{options}@r{[}=@var{file}@r{]}
754 -fmultiflags  -fprofile-report
755 -frandom-seed=@var{string}  -fsched-verbose=@var{n}
756 -fsel-sched-verbose  -fsel-sched-dump-cfg  -fsel-sched-pipelining-verbose
757 -fstats  -fstack-usage  -ftime-report  -ftime-report-details
758 -fvar-tracking-assignments-toggle  -gtoggle
759 -print-file-name=@var{library}  -print-libgcc-file-name
760 -print-multi-directory  -print-multi-lib  -print-multi-os-directory
761 -print-prog-name=@var{program}  -print-search-dirs  -Q
762 -print-sysroot  -print-sysroot-headers-suffix
763 -save-temps  -save-temps=cwd  -save-temps=obj  -time@r{[}=@var{file}@r{]}}
765 @item Machine-Dependent Options
766 @xref{Submodel Options,,Machine-Dependent Options}.
767 @c This list is ordered alphanumerically by subsection name.
768 @c Try and put the significant identifier (CPU or system) first,
769 @c so users have a clue at guessing where the ones they want will be.
771 @emph{AArch64 Options}
772 @gccoptlist{-mabi=@var{name}  -mbig-endian  -mlittle-endian
773 -mgeneral-regs-only
774 -mcmodel=tiny  -mcmodel=small  -mcmodel=large
775 -mstrict-align  -mno-strict-align
776 -momit-leaf-frame-pointer
777 -mtls-dialect=desc  -mtls-dialect=traditional
778 -mtls-size=@var{size}
779 -mfix-cortex-a53-835769  -mfix-cortex-a53-843419
780 -mlow-precision-recip-sqrt  -mlow-precision-sqrt  -mlow-precision-div
781 -mpc-relative-literal-loads
782 -msign-return-address=@var{scope}
783 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
784 +@var{b-key}]|@var{bti}
785 -mharden-sls=@var{opts}
786 -march=@var{name}  -mcpu=@var{name}  -mtune=@var{name}
787 -moverride=@var{string}  -mverbose-cost-dump
788 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg}
789 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation
790 -moutline-atomics }
792 @emph{Adapteva Epiphany Options}
793 @gccoptlist{-mhalf-reg-file  -mprefer-short-insn-regs
794 -mbranch-cost=@var{num}  -mcmove  -mnops=@var{num}  -msoft-cmpsf
795 -msplit-lohi  -mpost-inc  -mpost-modify  -mstack-offset=@var{num}
796 -mround-nearest  -mlong-calls  -mshort-calls  -msmall16
797 -mfp-mode=@var{mode}  -mvect-double  -max-vect-align=@var{num}
798 -msplit-vecmove-early  -m1reg-@var{reg}}
800 @emph{AMD GCN Options}
801 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
803 @emph{ARC Options}
804 @gccoptlist{-mbarrel-shifter  -mjli-always
805 -mcpu=@var{cpu}  -mA6  -mARC600  -mA7  -mARC700
806 -mdpfp  -mdpfp-compact  -mdpfp-fast  -mno-dpfp-lrsr
807 -mea  -mno-mpy  -mmul32x16  -mmul64  -matomic
808 -mnorm  -mspfp  -mspfp-compact  -mspfp-fast  -msimd  -msoft-float  -mswap
809 -mcrc  -mdsp-packa  -mdvbf  -mlock  -mmac-d16  -mmac-24  -mrtsc  -mswape
810 -mtelephony  -mxy  -misize  -mannotate-align  -marclinux  -marclinux_prof
811 -mlong-calls  -mmedium-calls  -msdata  -mirq-ctrl-saved
812 -mrgf-banked-regs  -mlpc-width=@var{width}  -G @var{num}
813 -mvolatile-cache  -mtp-regno=@var{regno}
814 -malign-call  -mauto-modify-reg  -mbbit-peephole  -mno-brcc
815 -mcase-vector-pcrel  -mcompact-casesi  -mno-cond-exec  -mearly-cbranchsi
816 -mexpand-adddi  -mindexed-loads  -mlra  -mlra-priority-none
817 -mlra-priority-compact -mlra-priority-noncompact  -mmillicode
818 -mmixed-code  -mq-class  -mRcq  -mRcw  -msize-level=@var{level}
819 -mtune=@var{cpu}  -mmultcost=@var{num}  -mcode-density-frame
820 -munalign-prob-threshold=@var{probability}  -mmpy-option=@var{multo}
821 -mdiv-rem  -mcode-density  -mll64  -mfpu=@var{fpu}  -mrf16  -mbranch-index}
823 @emph{ARM Options}
824 @gccoptlist{-mapcs-frame  -mno-apcs-frame
825 -mabi=@var{name}
826 -mapcs-stack-check  -mno-apcs-stack-check
827 -mapcs-reentrant  -mno-apcs-reentrant
828 -mgeneral-regs-only
829 -msched-prolog  -mno-sched-prolog
830 -mlittle-endian  -mbig-endian
831 -mbe8  -mbe32
832 -mfloat-abi=@var{name}
833 -mfp16-format=@var{name}
834 -mthumb-interwork  -mno-thumb-interwork
835 -mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}
836 -mtune=@var{name}  -mprint-tune-info
837 -mstructure-size-boundary=@var{n}
838 -mabort-on-noreturn
839 -mlong-calls  -mno-long-calls
840 -msingle-pic-base  -mno-single-pic-base
841 -mpic-register=@var{reg}
842 -mnop-fun-dllimport
843 -mpoke-function-name
844 -mthumb  -marm  -mflip-thumb
845 -mtpcs-frame  -mtpcs-leaf-frame
846 -mcaller-super-interworking  -mcallee-super-interworking
847 -mtp=@var{name}  -mtls-dialect=@var{dialect}
848 -mword-relocations
849 -mfix-cortex-m3-ldrd
850 -mfix-cortex-a57-aes-1742098
851 -mfix-cortex-a72-aes-1655431
852 -munaligned-access
853 -mneon-for-64bits
854 -mslow-flash-data
855 -masm-syntax-unified
856 -mrestrict-it
857 -mverbose-cost-dump
858 -mpure-code
859 -mcmse
860 -mfix-cmse-cve-2021-35465
861 -mstack-protector-guard=@var{guard} -mstack-protector-guard-offset=@var{offset}
862 -mfdpic
863 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}]
864 [+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]}
866 @emph{AVR Options}
867 @gccoptlist{-mmcu=@var{mcu}  -mabsdata  -maccumulate-args
868 -mbranch-cost=@var{cost}
869 -mcall-prologues  -mgas-isr-prologues  -mint8
870 -mdouble=@var{bits} -mlong-double=@var{bits}
871 -mn_flash=@var{size}  -mno-interrupts
872 -mmain-is-OS_task  -mrelax  -mrmw  -mstrict-X  -mtiny-stack
873 -mfract-convert-truncate
874 -mshort-calls  -nodevicelib  -nodevicespecs
875 -Waddr-space-convert  -Wmisspelled-isr}
877 @emph{Blackfin Options}
878 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
879 -msim  -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer
880 -mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly
881 -mlow-64k  -mno-low64k  -mstack-check-l1  -mid-shared-library
882 -mno-id-shared-library  -mshared-library-id=@var{n}
883 -mleaf-id-shared-library  -mno-leaf-id-shared-library
884 -msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls
885 -mfast-fp  -minline-plt  -mmulticore  -mcorea  -mcoreb  -msdram
886 -micplb}
888 @emph{C6X Options}
889 @gccoptlist{-mbig-endian  -mlittle-endian  -march=@var{cpu}
890 -msim  -msdata=@var{sdata-type}}
892 @emph{CRIS Options}
893 @gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}
894 -mtune=@var{cpu} -mmax-stack-frame=@var{n}
895 -metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects
896 -mstack-align  -mdata-align  -mconst-align
897 -m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue
898 -melf  -maout  -sim  -sim2
899 -mmul-bug-workaround  -mno-mul-bug-workaround}
901 @emph{C-SKY Options}
902 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}
903 -mbig-endian  -EB  -mlittle-endian  -EL
904 -mhard-float  -msoft-float  -mfpu=@var{fpu}  -mdouble-float  -mfdivdu
905 -mfloat-abi=@var{name}
906 -melrw  -mistack  -mmp  -mcp  -mcache  -msecurity  -mtrust
907 -mdsp  -medsp  -mvdsp
908 -mdiv  -msmart  -mhigh-registers  -manchor
909 -mpushpop  -mmultiple-stld  -mconstpool  -mstack-size  -mccrt
910 -mbranch-cost=@var{n}  -mcse-cc  -msched-prolog -msim}
912 @emph{Darwin Options}
913 @gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal
914 -arch_only  -bind_at_load  -bundle  -bundle_loader
915 -client_name  -compatibility_version  -current_version
916 -dead_strip
917 -dependency-file  -dylib_file  -dylinker_install_name
918 -dynamic  -dynamiclib  -exported_symbols_list
919 -filelist  -flat_namespace  -force_cpusubtype_ALL
920 -force_flat_namespace  -headerpad_max_install_names
921 -iframework
922 -image_base  -init  -install_name  -keep_private_externs
923 -multi_module  -multiply_defined  -multiply_defined_unused
924 -noall_load   -no_dead_strip_inits_and_terms
925 -nofixprebinding  -nomultidefs  -noprebind  -noseglinkedit
926 -pagezero_size  -prebind  -prebind_all_twolevel_modules
927 -private_bundle  -read_only_relocs  -sectalign
928 -sectobjectsymbols  -whyload  -seg1addr
929 -sectcreate  -sectobjectsymbols  -sectorder
930 -segaddr  -segs_read_only_addr  -segs_read_write_addr
931 -seg_addr_table  -seg_addr_table_filename  -seglinkedit
932 -segprot  -segs_read_only_addr  -segs_read_write_addr
933 -single_module  -static  -sub_library  -sub_umbrella
934 -twolevel_namespace  -umbrella  -undefined
935 -unexported_symbols_list  -weak_reference_mismatches
936 -whatsloaded  -F  -gused  -gfull  -mmacosx-version-min=@var{version}
937 -mkernel  -mone-byte-bool}
939 @emph{DEC Alpha Options}
940 @gccoptlist{-mno-fp-regs  -msoft-float
941 -mieee  -mieee-with-inexact  -mieee-conformant
942 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
943 -mtrap-precision=@var{mode}  -mbuild-constants
944 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}
945 -mbwx  -mmax  -mfix  -mcix
946 -mfloat-vax  -mfloat-ieee
947 -mexplicit-relocs  -msmall-data  -mlarge-data
948 -msmall-text  -mlarge-text
949 -mmemory-latency=@var{time}}
951 @emph{eBPF Options}
952 @gccoptlist{-mbig-endian -mlittle-endian
953 -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext
954 -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version}
955 -masm=@var{dialect}}
957 @emph{FR30 Options}
958 @gccoptlist{-msmall-model  -mno-lsim}
960 @emph{FT32 Options}
961 @gccoptlist{-msim  -mlra  -mnodiv  -mft32b  -mcompress  -mnopm}
963 @emph{FRV Options}
964 @gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64
965 -mhard-float  -msoft-float
966 -malloc-cc  -mfixed-cc  -mdword  -mno-dword
967 -mdouble  -mno-double
968 -mmedia  -mno-media  -mmuladd  -mno-muladd
969 -mfdpic  -minline-plt  -mgprel-ro  -multilib-library-pic
970 -mlinked-fp  -mlong-calls  -malign-labels
971 -mlibrary-pic  -macc-4  -macc-8
972 -mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move
973 -moptimize-membar  -mno-optimize-membar
974 -mscc  -mno-scc  -mcond-exec  -mno-cond-exec
975 -mvliw-branch  -mno-vliw-branch
976 -mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec
977 -mno-nested-cond-exec  -mtomcat-stats
978 -mTLS  -mtls
979 -mcpu=@var{cpu}}
981 @emph{GNU/Linux Options}
982 @gccoptlist{-mglibc  -muclibc  -mmusl  -mbionic  -mandroid
983 -tno-android-cc  -tno-android-ld}
985 @emph{H8/300 Options}
986 @gccoptlist{-mrelax  -mh  -ms  -mn  -mexr  -mno-exr  -mint32  -malign-300}
988 @emph{HPPA Options}
989 @gccoptlist{-march=@var{architecture-type}
990 -matomic-libcalls  -mbig-switch
991 -mcaller-copies  -mdisable-fpregs  -mdisable-indexing
992 -mordered  -mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld
993 -mfixed-range=@var{register-range}
994 -mcoherent-ldcw -mjump-in-delay  -mlinker-opt  -mlong-calls
995 -mlong-load-store  -mno-atomic-libcalls  -mno-disable-fpregs
996 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
997 -mno-jump-in-delay  -mno-long-load-store
998 -mno-portable-runtime  -mno-soft-float
999 -mno-space-regs  -msoft-float  -mpa-risc-1-0
1000 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime
1001 -mschedule=@var{cpu-type}  -mspace-regs  -msoft-mult  -msio  -mwsio
1002 -munix=@var{unix-std}  -nolibdld  -static  -threads}
1004 @emph{IA-64 Options}
1005 @gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic
1006 -mvolatile-asm-stop  -mregister-names  -msdata  -mno-sdata
1007 -mconstant-gp  -mauto-pic  -mfused-madd
1008 -minline-float-divide-min-latency
1009 -minline-float-divide-max-throughput
1010 -mno-inline-float-divide
1011 -minline-int-divide-min-latency
1012 -minline-int-divide-max-throughput
1013 -mno-inline-int-divide
1014 -minline-sqrt-min-latency  -minline-sqrt-max-throughput
1015 -mno-inline-sqrt
1016 -mdwarf2-asm  -mearly-stop-bits
1017 -mfixed-range=@var{register-range}  -mtls-size=@var{tls-size}
1018 -mtune=@var{cpu-type}  -milp32  -mlp64
1019 -msched-br-data-spec  -msched-ar-data-spec  -msched-control-spec
1020 -msched-br-in-data-spec  -msched-ar-in-data-spec  -msched-in-control-spec
1021 -msched-spec-ldc  -msched-spec-control-ldc
1022 -msched-prefer-non-data-spec-insns  -msched-prefer-non-control-spec-insns
1023 -msched-stop-bits-after-every-cycle  -msched-count-spec-in-critical-path
1024 -msel-sched-dont-check-control-spec  -msched-fp-mem-deps-zero-cost
1025 -msched-max-memory-insns-hard-limit  -msched-max-memory-insns=@var{max-insns}}
1027 @emph{LM32 Options}
1028 @gccoptlist{-mbarrel-shift-enabled  -mdivide-enabled  -mmultiply-enabled
1029 -msign-extend-enabled  -muser-enabled}
1031 @emph{LoongArch Options}
1032 @gccoptlist{-march=@var{cpu-type}  -mtune=@var{cpu-type} -mabi=@var{base-abi-type}
1033 -mfpu=@var{fpu-type} -msoft-float -msingle-float -mdouble-float
1034 -mbranch-cost=@var{n}  -mcheck-zero-division -mno-check-zero-division
1035 -mcond-move-int  -mno-cond-move-int
1036 -mcond-move-float  -mno-cond-move-float
1037 -memcpy  -mno-memcpy -mstrict-align -mno-strict-align
1038 -mmax-inline-memcpy-size=@var{n}
1039 -mexplicit-relocs -mno-explicit-relocs
1040 -mdirect-extern-access -mno-direct-extern-access
1041 -mcmodel=@var{code-model}}
1043 @emph{M32R/D Options}
1044 @gccoptlist{-m32r2  -m32rx  -m32r
1045 -mdebug
1046 -malign-loops  -mno-align-loops
1047 -missue-rate=@var{number}
1048 -mbranch-cost=@var{number}
1049 -mmodel=@var{code-size-model-type}
1050 -msdata=@var{sdata-type}
1051 -mno-flush-func  -mflush-func=@var{name}
1052 -mno-flush-trap  -mflush-trap=@var{number}
1053 -G @var{num}}
1055 @emph{M32C Options}
1056 @gccoptlist{-mcpu=@var{cpu}  -msim  -memregs=@var{number}}
1058 @emph{M680x0 Options}
1059 @gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
1060 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
1061 -m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407
1062 -mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020
1063 -mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort
1064 -mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel
1065 -malign-int  -mstrict-align  -msep-data  -mno-sep-data
1066 -mshared-library-id=n  -mid-shared-library  -mno-id-shared-library
1067 -mxgot  -mno-xgot  -mlong-jump-table-offsets}
1069 @emph{MCore Options}
1070 @gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates
1071 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields
1072 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data
1073 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim
1074 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
1076 @emph{MicroBlaze Options}
1077 @gccoptlist{-msoft-float  -mhard-float  -msmall-divides  -mcpu=@var{cpu}
1078 -mmemcpy  -mxl-soft-mul  -mxl-soft-div  -mxl-barrel-shift
1079 -mxl-pattern-compare  -mxl-stack-check  -mxl-gp-opt  -mno-clearbss
1080 -mxl-multiply-high  -mxl-float-convert  -mxl-float-sqrt
1081 -mbig-endian  -mlittle-endian  -mxl-reorder  -mxl-mode-@var{app-model}
1082 -mpic-data-is-text-relative}
1084 @emph{MIPS Options}
1085 @gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch}
1086 -mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2  -mips32r3  -mips32r5
1087 -mips32r6  -mips64  -mips64r2  -mips64r3  -mips64r5  -mips64r6
1088 -mips16  -mno-mips16  -mflip-mips16
1089 -minterlink-compressed  -mno-interlink-compressed
1090 -minterlink-mips16  -mno-interlink-mips16
1091 -mabi=@var{abi}  -mabicalls  -mno-abicalls
1092 -mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot
1093 -mgp32  -mgp64  -mfp32  -mfpxx  -mfp64  -mhard-float  -msoft-float
1094 -mno-float  -msingle-float  -mdouble-float
1095 -modd-spreg  -mno-odd-spreg
1096 -mabs=@var{mode}  -mnan=@var{encoding}
1097 -mdsp  -mno-dsp  -mdspr2  -mno-dspr2
1098 -mmcu  -mmno-mcu
1099 -meva  -mno-eva
1100 -mvirt  -mno-virt
1101 -mxpa  -mno-xpa
1102 -mcrc  -mno-crc
1103 -mginv  -mno-ginv
1104 -mmicromips  -mno-micromips
1105 -mmsa  -mno-msa
1106 -mloongson-mmi  -mno-loongson-mmi
1107 -mloongson-ext  -mno-loongson-ext
1108 -mloongson-ext2  -mno-loongson-ext2
1109 -mfpu=@var{fpu-type}
1110 -msmartmips  -mno-smartmips
1111 -mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx
1112 -mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc
1113 -mlong64  -mlong32  -msym32  -mno-sym32
1114 -G@var{num}  -mlocal-sdata  -mno-local-sdata
1115 -mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt
1116 -membedded-data  -mno-embedded-data
1117 -muninit-const-in-rodata  -mno-uninit-const-in-rodata
1118 -mcode-readable=@var{setting}
1119 -msplit-addresses  -mno-split-addresses
1120 -mexplicit-relocs  -mno-explicit-relocs
1121 -mcheck-zero-division  -mno-check-zero-division
1122 -mdivide-traps  -mdivide-breaks
1123 -mload-store-pairs  -mno-load-store-pairs
1124 -munaligned-access  -mno-unaligned-access
1125 -mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls
1126 -mmad  -mno-mad  -mimadd  -mno-imadd  -mfused-madd  -mno-fused-madd  -nocpp
1127 -mfix-24k  -mno-fix-24k
1128 -mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400
1129 -mfix-r5900  -mno-fix-r5900
1130 -mfix-r10000  -mno-fix-r10000  -mfix-rm7000  -mno-fix-rm7000
1131 -mfix-vr4120  -mno-fix-vr4120
1132 -mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1
1133 -mflush-func=@var{func}  -mno-flush-func
1134 -mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely
1135 -mcompact-branches=@var{policy}
1136 -mfp-exceptions  -mno-fp-exceptions
1137 -mvr4130-align  -mno-vr4130-align  -msynci  -mno-synci
1138 -mlxc1-sxc1  -mno-lxc1-sxc1  -mmadd4  -mno-madd4
1139 -mrelax-pic-calls  -mno-relax-pic-calls  -mmcount-ra-address
1140 -mframe-header-opt  -mno-frame-header-opt}
1142 @emph{MMIX Options}
1143 @gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu
1144 -mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols
1145 -melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses
1146 -mno-base-addresses  -msingle-exit  -mno-single-exit}
1148 @emph{MN10300 Options}
1149 @gccoptlist{-mmult-bug  -mno-mult-bug
1150 -mno-am33  -mam33  -mam33-2  -mam34
1151 -mtune=@var{cpu-type}
1152 -mreturn-pointer-on-d0
1153 -mno-crt0  -mrelax  -mliw  -msetlb}
1155 @emph{Moxie Options}
1156 @gccoptlist{-meb  -mel  -mmul.x  -mno-crt0}
1158 @emph{MSP430 Options}
1159 @gccoptlist{-msim  -masm-hex  -mmcu=  -mcpu=  -mlarge  -msmall  -mrelax
1160 -mwarn-mcu
1161 -mcode-region=  -mdata-region=
1162 -msilicon-errata=  -msilicon-errata-warn=
1163 -mhwmult=  -minrt  -mtiny-printf  -mmax-inline-shift=}
1165 @emph{NDS32 Options}
1166 @gccoptlist{-mbig-endian  -mlittle-endian
1167 -mreduced-regs  -mfull-regs
1168 -mcmov  -mno-cmov
1169 -mext-perf  -mno-ext-perf
1170 -mext-perf2  -mno-ext-perf2
1171 -mext-string  -mno-ext-string
1172 -mv3push  -mno-v3push
1173 -m16bit  -mno-16bit
1174 -misr-vector-size=@var{num}
1175 -mcache-block-size=@var{num}
1176 -march=@var{arch}
1177 -mcmodel=@var{code-model}
1178 -mctor-dtor  -mrelax}
1180 @emph{Nios II Options}
1181 @gccoptlist{-G @var{num}  -mgpopt=@var{option}  -mgpopt  -mno-gpopt
1182 -mgprel-sec=@var{regexp}  -mr0rel-sec=@var{regexp}
1183 -mel  -meb
1184 -mno-bypass-cache  -mbypass-cache
1185 -mno-cache-volatile  -mcache-volatile
1186 -mno-fast-sw-div  -mfast-sw-div
1187 -mhw-mul  -mno-hw-mul  -mhw-mulx  -mno-hw-mulx  -mno-hw-div  -mhw-div
1188 -mcustom-@var{insn}=@var{N}  -mno-custom-@var{insn}
1189 -mcustom-fpu-cfg=@var{name}
1190 -mhal  -msmallc  -msys-crt0=@var{name}  -msys-lib=@var{name}
1191 -march=@var{arch}  -mbmx  -mno-bmx  -mcdx  -mno-cdx}
1193 @emph{Nvidia PTX Options}
1194 @gccoptlist{-m64  -mmainkernel  -moptimize}
1196 @emph{OpenRISC Options}
1197 @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div
1198 -msoft-mul  -msoft-div
1199 -msoft-float  -mhard-float  -mdouble-float -munordered-float
1200 -mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm
1201 -mcmodel=@var{code-model}}
1203 @emph{PDP-11 Options}
1204 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10
1205 -mint32  -mno-int16  -mint16  -mno-int32
1206 -msplit  -munix-asm  -mdec-asm  -mgnu-asm  -mlra}
1208 @emph{PowerPC Options}
1209 See RS/6000 and PowerPC Options.
1211 @emph{PRU Options}
1212 @gccoptlist{-mmcu=@var{mcu}  -minrt  -mno-relax  -mloop
1213 -mabi=@var{variant}}
1215 @emph{RISC-V Options}
1216 @gccoptlist{-mbranch-cost=@var{N-instruction}
1217 -mplt  -mno-plt
1218 -mabi=@var{ABI-string}
1219 -mfdiv  -mno-fdiv
1220 -mdiv  -mno-div
1221 -misa-spec=@var{ISA-spec-string}
1222 -march=@var{ISA-string}
1223 -mtune=@var{processor-string}
1224 -mpreferred-stack-boundary=@var{num}
1225 -msmall-data-limit=@var{N-bytes}
1226 -msave-restore  -mno-save-restore
1227 -mshorten-memrefs  -mno-shorten-memrefs
1228 -mstrict-align  -mno-strict-align
1229 -mcmodel=medlow  -mcmodel=medany
1230 -mexplicit-relocs  -mno-explicit-relocs
1231 -mrelax  -mno-relax
1232 -mriscv-attribute  -mno-riscv-attribute
1233 -malign-data=@var{type}
1234 -mbig-endian  -mlittle-endian
1235 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
1236 -mstack-protector-guard-offset=@var{offset}
1237 -mcsr-check -mno-csr-check
1238 -minline-atomics  -mno-inline-atomics}
1240 @emph{RL78 Options}
1241 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
1242 -mcpu=g10  -mcpu=g13  -mcpu=g14  -mg10  -mg13  -mg14
1243 -m64bit-doubles  -m32bit-doubles  -msave-mduc-in-interrupts}
1245 @emph{RS/6000 and PowerPC Options}
1246 @gccoptlist{-mcpu=@var{cpu-type}
1247 -mtune=@var{cpu-type}
1248 -mcmodel=@var{code-model}
1249 -mpowerpc64
1250 -maltivec  -mno-altivec
1251 -mpowerpc-gpopt  -mno-powerpc-gpopt
1252 -mpowerpc-gfxopt  -mno-powerpc-gfxopt
1253 -mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb  -mpopcntd  -mno-popcntd
1254 -mfprnd  -mno-fprnd
1255 -mcmpb  -mno-cmpb  -mhard-dfp  -mno-hard-dfp
1256 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc
1257 -m64  -m32  -mxl-compat  -mno-xl-compat  -mpe
1258 -malign-power  -malign-natural
1259 -msoft-float  -mhard-float  -mmultiple  -mno-multiple
1260 -mupdate  -mno-update
1261 -mavoid-indexed-addresses  -mno-avoid-indexed-addresses
1262 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
1263 -mstrict-align  -mno-strict-align  -mrelocatable
1264 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
1265 -mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian
1266 -mdynamic-no-pic  -mswdiv  -msingle-pic-base
1267 -mprioritize-restricted-insns=@var{priority}
1268 -msched-costly-dep=@var{dependence_type}
1269 -minsert-sched-nops=@var{scheme}
1270 -mcall-aixdesc  -mcall-eabi  -mcall-freebsd
1271 -mcall-linux  -mcall-netbsd  -mcall-openbsd
1272 -mcall-sysv  -mcall-sysv-eabi  -mcall-sysv-noeabi
1273 -mtraceback=@var{traceback_type}
1274 -maix-struct-return  -msvr4-struct-return
1275 -mabi=@var{abi-type}  -msecure-plt  -mbss-plt
1276 -mlongcall  -mno-longcall  -mpltseq  -mno-pltseq
1277 -mblock-move-inline-limit=@var{num}
1278 -mblock-compare-inline-limit=@var{num}
1279 -mblock-compare-inline-loop-limit=@var{num}
1280 -mno-block-ops-unaligned-vsx
1281 -mstring-compare-inline-limit=@var{num}
1282 -misel  -mno-isel
1283 -mvrsave  -mno-vrsave
1284 -mmulhw  -mno-mulhw
1285 -mdlmzb  -mno-dlmzb
1286 -mprototype  -mno-prototype
1287 -msim  -mmvme  -mads  -myellowknife  -memb  -msdata
1288 -msdata=@var{opt}  -mreadonly-in-sdata  -mvxworks  -G @var{num}
1289 -mrecip  -mrecip=@var{opt}  -mno-recip  -mrecip-precision
1290 -mno-recip-precision
1291 -mveclibabi=@var{type}  -mfriz  -mno-friz
1292 -mpointers-to-nested-functions  -mno-pointers-to-nested-functions
1293 -msave-toc-indirect  -mno-save-toc-indirect
1294 -mpower8-fusion  -mno-mpower8-fusion  -mpower8-vector  -mno-power8-vector
1295 -mcrypto  -mno-crypto  -mhtm  -mno-htm
1296 -mquad-memory  -mno-quad-memory
1297 -mquad-memory-atomic  -mno-quad-memory-atomic
1298 -mcompat-align-parm  -mno-compat-align-parm
1299 -mfloat128  -mno-float128  -mfloat128-hardware  -mno-float128-hardware
1300 -mgnu-attribute  -mno-gnu-attribute
1301 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg}
1302 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed
1303 -mpcrel -mno-pcrel -mmma -mno-mmma -mrop-protect -mno-rop-protect
1304 -mprivileged -mno-privileged}
1306 @emph{RX Options}
1307 @gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu
1308 -mcpu=
1309 -mbig-endian-data  -mlittle-endian-data
1310 -msmall-data
1311 -msim  -mno-sim
1312 -mas100-syntax  -mno-as100-syntax
1313 -mrelax
1314 -mmax-constant-size=
1315 -mint-register=
1316 -mpid
1317 -mallow-string-insns  -mno-allow-string-insns
1318 -mjsr
1319 -mno-warn-multiple-fast-interrupts
1320 -msave-acc-in-interrupts}
1322 @emph{S/390 and zSeries Options}
1323 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1324 -mhard-float  -msoft-float  -mhard-dfp  -mno-hard-dfp
1325 -mlong-double-64  -mlong-double-128
1326 -mbackchain  -mno-backchain  -mpacked-stack  -mno-packed-stack
1327 -msmall-exec  -mno-small-exec  -mmvcle  -mno-mvcle
1328 -m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch
1329 -mhtm  -mvx  -mzvector
1330 -mtpf-trace  -mno-tpf-trace  -mtpf-trace-skip  -mno-tpf-trace-skip
1331 -mfused-madd  -mno-fused-madd
1332 -mwarn-framesize  -mwarn-dynamicstack  -mstack-size  -mstack-guard
1333 -mhotpatch=@var{halfwords},@var{halfwords}}
1335 @emph{SH Options}
1336 @gccoptlist{-m1  -m2  -m2e
1337 -m2a-nofpu  -m2a-single-only  -m2a-single  -m2a
1338 -m3  -m3e
1339 -m4-nofpu  -m4-single-only  -m4-single  -m4
1340 -m4a-nofpu  -m4a-single-only  -m4a-single  -m4a  -m4al
1341 -mb  -ml  -mdalign  -mrelax
1342 -mbigtable  -mfmovd  -mrenesas  -mno-renesas  -mnomacsave
1343 -mieee  -mno-ieee  -mbitops  -misize  -minline-ic_invalidate  -mpadstruct
1344 -mprefergot  -musermode  -multcost=@var{number}  -mdiv=@var{strategy}
1345 -mdivsi3_libfunc=@var{name}  -mfixed-range=@var{register-range}
1346 -maccumulate-outgoing-args
1347 -matomic-model=@var{atomic-model}
1348 -mbranch-cost=@var{num}  -mzdcbranch  -mno-zdcbranch
1349 -mcbranch-force-delay-slot
1350 -mfused-madd  -mno-fused-madd  -mfsca  -mno-fsca  -mfsrra  -mno-fsrra
1351 -mpretend-cmove  -mtas}
1353 @emph{Solaris 2 Options}
1354 @gccoptlist{-mclear-hwcap  -mno-clear-hwcap  -mimpure-text  -mno-impure-text
1355 -pthreads}
1357 @emph{SPARC Options}
1358 @gccoptlist{-mcpu=@var{cpu-type}
1359 -mtune=@var{cpu-type}
1360 -mcmodel=@var{code-model}
1361 -mmemory-model=@var{mem-model}
1362 -m32  -m64  -mapp-regs  -mno-app-regs
1363 -mfaster-structs  -mno-faster-structs  -mflat  -mno-flat
1364 -mfpu  -mno-fpu  -mhard-float  -msoft-float
1365 -mhard-quad-float  -msoft-quad-float
1366 -mstack-bias  -mno-stack-bias
1367 -mstd-struct-return  -mno-std-struct-return
1368 -munaligned-doubles  -mno-unaligned-doubles
1369 -muser-mode  -mno-user-mode
1370 -mv8plus  -mno-v8plus  -mvis  -mno-vis
1371 -mvis2  -mno-vis2  -mvis3  -mno-vis3
1372 -mvis4  -mno-vis4  -mvis4b  -mno-vis4b
1373 -mcbcond  -mno-cbcond  -mfmaf  -mno-fmaf  -mfsmuld  -mno-fsmuld
1374 -mpopc  -mno-popc  -msubxc  -mno-subxc
1375 -mfix-at697f  -mfix-ut699  -mfix-ut700  -mfix-gr712rc
1376 -mlra  -mno-lra}
1378 @emph{System V Options}
1379 @gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
1381 @emph{V850 Options}
1382 @gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep
1383 -mprolog-function  -mno-prolog-function  -mspace
1384 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n}
1385 -mapp-regs  -mno-app-regs
1386 -mdisable-callt  -mno-disable-callt
1387 -mv850e2v3  -mv850e2  -mv850e1  -mv850es
1388 -mv850e  -mv850  -mv850e3v5
1389 -mloop
1390 -mrelax
1391 -mlong-jumps
1392 -msoft-float
1393 -mhard-float
1394 -mgcc-abi
1395 -mrh850-abi
1396 -mbig-switch}
1398 @emph{VAX Options}
1399 @gccoptlist{-mg  -mgnu  -munix  -mlra}
1401 @emph{Visium Options}
1402 @gccoptlist{-mdebug  -msim  -mfpu  -mno-fpu  -mhard-float  -msoft-float
1403 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type}  -msv-mode  -muser-mode}
1405 @emph{VMS Options}
1406 @gccoptlist{-mvms-return-codes  -mdebug-main=@var{prefix}  -mmalloc64
1407 -mpointer-size=@var{size}}
1409 @emph{VxWorks Options}
1410 @gccoptlist{-mrtp  -msmp  -non-static  -Bstatic  -Bdynamic
1411 -Xbind-lazy  -Xbind-now}
1413 @emph{x86 Options}
1414 @gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type}
1415 -mtune-ctrl=@var{feature-list}  -mdump-tune-features  -mno-default
1416 -mfpmath=@var{unit}
1417 -masm=@var{dialect}  -mno-fancy-math-387
1418 -mno-fp-ret-in-387  -m80387  -mhard-float  -msoft-float
1419 -mno-wide-multiply  -mrtd  -malign-double
1420 -mpreferred-stack-boundary=@var{num}
1421 -mincoming-stack-boundary=@var{num}
1422 -mcld  -mcx16  -msahf  -mmovbe  -mcrc32 -mmwait
1423 -mrecip  -mrecip=@var{opt}
1424 -mvzeroupper  -mprefer-avx128  -mprefer-vector-width=@var{opt}
1425 -mpartial-vector-fp-math
1426 -mmove-max=@var{bits} -mstore-max=@var{bits}
1427 -mmmx  -msse  -msse2  -msse3  -mssse3  -msse4.1  -msse4.2  -msse4  -mavx
1428 -mavx2  -mavx512f  -mavx512pf  -mavx512er  -mavx512cd  -mavx512vl
1429 -mavx512bw  -mavx512dq  -mavx512ifma  -mavx512vbmi  -msha  -maes
1430 -mpclmul  -mfsgsbase  -mrdrnd  -mf16c  -mfma  -mpconfig  -mwbnoinvd
1431 -mptwrite  -mprefetchwt1  -mclflushopt  -mclwb  -mxsavec  -mxsaves
1432 -msse4a  -m3dnow  -m3dnowa  -mpopcnt  -mabm  -mbmi  -mtbm  -mfma4  -mxop
1433 -madx  -mlzcnt  -mbmi2  -mfxsr  -mxsave  -mxsaveopt  -mrtm  -mhle  -mlwp
1434 -mmwaitx  -mclzero  -mpku  -mthreads  -mgfni  -mvaes  -mwaitpkg
1435 -mshstk -mmanual-endbr -mcet-switch -mforce-indirect-call
1436 -mavx512vbmi2 -mavx512bf16 -menqcmd
1437 -mvpclmulqdq  -mavx512bitalg  -mmovdiri  -mmovdir64b  -mavx512vpopcntdq
1438 -mavx5124fmaps  -mavx512vnni  -mavx5124vnniw  -mprfchw  -mrdpid
1439 -mrdseed  -msgx -mavx512vp2intersect -mserialize -mtsxldtrk
1440 -mamx-tile  -mamx-int8  -mamx-bf16 -muintr -mhreset -mavxvnni
1441 -mavx512fp16 -mavxifma -mavxvnniint8 -mavxneconvert -mcmpccxadd -mamx-fp16
1442 -mprefetchi -mraoint -mamx-complex -mavxvnniint16 -msm3 -msha512 -msm4
1443 -mcldemote  -mms-bitfields  -mno-align-stringops  -minline-all-stringops
1444 -minline-stringops-dynamically  -mstringop-strategy=@var{alg}
1445 -mkl -mwidekl
1446 -mmemcpy-strategy=@var{strategy}  -mmemset-strategy=@var{strategy}
1447 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double
1448 -m96bit-long-double  -mlong-double-64  -mlong-double-80  -mlong-double-128
1449 -mregparm=@var{num}  -msseregparm
1450 -mveclibabi=@var{type}  -mvect8-ret-in-mem
1451 -mpc32  -mpc64  -mpc80  -mdaz-ftz -mstackrealign
1452 -momit-leaf-frame-pointer  -mno-red-zone  -mno-tls-direct-seg-refs
1453 -mcmodel=@var{code-model}  -mabi=@var{name}  -maddress-mode=@var{mode}
1454 -m32  -m64  -mx32  -m16  -miamcu  -mlarge-data-threshold=@var{num}
1455 -msse2avx  -mfentry  -mrecord-mcount  -mnop-mcount  -m8bit-idiv
1456 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name}
1457 -mavx256-split-unaligned-load  -mavx256-split-unaligned-store
1458 -malign-data=@var{type}  -mstack-protector-guard=@var{guard}
1459 -mstack-protector-guard-reg=@var{reg}
1460 -mstack-protector-guard-offset=@var{offset}
1461 -mstack-protector-guard-symbol=@var{symbol}
1462 -mgeneral-regs-only  -mcall-ms2sysv-xlogues -mrelax-cmpxchg-loop
1463 -mindirect-branch=@var{choice}  -mfunction-return=@var{choice}
1464 -mindirect-branch-register -mharden-sls=@var{choice}
1465 -mindirect-branch-cs-prefix -mneeded -mno-direct-extern-access
1466 -munroll-only-small-loops -mlam=@var{choice}}
1468 @emph{x86 Windows Options}
1469 @gccoptlist{-mconsole  -mcrtdll=@var{library}  -mcygwin  -mno-cygwin  -mdll
1470 -mnop-fun-dllimport  -mthread
1471 -municode  -mwin32  -mwindows  -fno-set-stack-executable}
1473 @emph{Xstormy16 Options}
1474 @gccoptlist{-msim}
1476 @emph{Xtensa Options}
1477 @gccoptlist{-mconst16  -mno-const16
1478 -mfused-madd  -mno-fused-madd
1479 -mforce-no-pic
1480 -mserialize-volatile  -mno-serialize-volatile
1481 -mtext-section-literals  -mno-text-section-literals
1482 -mauto-litpools  -mno-auto-litpools
1483 -mtarget-align  -mno-target-align
1484 -mlongcalls  -mno-longcalls
1485 -mabi=@var{abi-type}
1486 -mextra-l32r-costs=@var{cycles}
1487 -mstrict-align  -mno-strict-align}
1489 @emph{zSeries Options}
1490 See S/390 and zSeries Options.
1491 @end table
1494 @node Overall Options
1495 @section Options Controlling the Kind of Output
1497 Compilation can involve up to four stages: preprocessing, compilation
1498 proper, assembly and linking, always in that order.  GCC is capable of
1499 preprocessing and compiling several files either into several
1500 assembler input files, or into one assembler input file; then each
1501 assembler input file produces an object file, and linking combines all
1502 the object files (those newly compiled, and those specified as input)
1503 into an executable file.
1505 @cindex file name suffix
1506 For any given input file, the file name suffix determines what kind of
1507 compilation is done:
1509 @table @gcctabopt
1510 @item @var{file}.c
1511 C source code that must be preprocessed.
1513 @item @var{file}.i
1514 C source code that should not be preprocessed.
1516 @item @var{file}.ii
1517 C++ source code that should not be preprocessed.
1519 @item @var{file}.m
1520 Objective-C source code.  Note that you must link with the @file{libobjc}
1521 library to make an Objective-C program work.
1523 @item @var{file}.mi
1524 Objective-C source code that should not be preprocessed.
1526 @item @var{file}.mm
1527 @itemx @var{file}.M
1528 Objective-C++ source code.  Note that you must link with the @file{libobjc}
1529 library to make an Objective-C++ program work.  Note that @samp{.M} refers
1530 to a literal capital M@.
1532 @item @var{file}.mii
1533 Objective-C++ source code that should not be preprocessed.
1535 @item @var{file}.h
1536 C, C++, Objective-C or Objective-C++ header file to be turned into a
1537 precompiled header (default), or C, C++ header file to be turned into an
1538 Ada spec (via the @option{-fdump-ada-spec} switch).
1540 @item @var{file}.cc
1541 @itemx @var{file}.cp
1542 @itemx @var{file}.cxx
1543 @itemx @var{file}.cpp
1544 @itemx @var{file}.CPP
1545 @itemx @var{file}.c++
1546 @itemx @var{file}.C
1547 C++ source code that must be preprocessed.  Note that in @samp{.cxx},
1548 the last two letters must both be literally @samp{x}.  Likewise,
1549 @samp{.C} refers to a literal capital C@.
1551 @item @var{file}.mm
1552 @itemx @var{file}.M
1553 Objective-C++ source code that must be preprocessed.
1555 @item @var{file}.mii
1556 Objective-C++ source code that should not be preprocessed.
1558 @item @var{file}.hh
1559 @itemx @var{file}.H
1560 @itemx @var{file}.hp
1561 @itemx @var{file}.hxx
1562 @itemx @var{file}.hpp
1563 @itemx @var{file}.HPP
1564 @itemx @var{file}.h++
1565 @itemx @var{file}.tcc
1566 C++ header file to be turned into a precompiled header or Ada spec.
1568 @item @var{file}.f
1569 @itemx @var{file}.for
1570 @itemx @var{file}.ftn
1571 Fixed form Fortran source code that should not be preprocessed.
1573 @item @var{file}.F
1574 @itemx @var{file}.FOR
1575 @itemx @var{file}.fpp
1576 @itemx @var{file}.FPP
1577 @itemx @var{file}.FTN
1578 Fixed form Fortran source code that must be preprocessed (with the traditional
1579 preprocessor).
1581 @item @var{file}.f90
1582 @itemx @var{file}.f95
1583 @itemx @var{file}.f03
1584 @itemx @var{file}.f08
1585 Free form Fortran source code that should not be preprocessed.
1587 @item @var{file}.F90
1588 @itemx @var{file}.F95
1589 @itemx @var{file}.F03
1590 @itemx @var{file}.F08
1591 Free form Fortran source code that must be preprocessed (with the
1592 traditional preprocessor).
1594 @item @var{file}.go
1595 Go source code.
1597 @item @var{file}.d
1598 D source code.
1600 @item @var{file}.di
1601 D interface file.
1603 @item @var{file}.dd
1604 D documentation code (Ddoc).
1606 @item @var{file}.ads
1607 Ada source code file that contains a library unit declaration (a
1608 declaration of a package, subprogram, or generic, or a generic
1609 instantiation), or a library unit renaming declaration (a package,
1610 generic, or subprogram renaming declaration).  Such files are also
1611 called @dfn{specs}.
1613 @item @var{file}.adb
1614 Ada source code file containing a library unit body (a subprogram or
1615 package body).  Such files are also called @dfn{bodies}.
1617 @c GCC also knows about some suffixes for languages not yet included:
1618 @c Ratfor:
1619 @c @var{file}.r
1621 @item @var{file}.s
1622 Assembler code.
1624 @item @var{file}.S
1625 @itemx @var{file}.sx
1626 Assembler code that must be preprocessed.
1628 @item @var{other}
1629 An object file to be fed straight into linking.
1630 Any file name with no recognized suffix is treated this way.
1631 @end table
1633 @opindex x
1634 You can specify the input language explicitly with the @option{-x} option:
1636 @table @gcctabopt
1637 @item -x @var{language}
1638 Specify explicitly the @var{language} for the following input files
1639 (rather than letting the compiler choose a default based on the file
1640 name suffix).  This option applies to all following input files until
1641 the next @option{-x} option.  Possible values for @var{language} are:
1642 @smallexample
1643 c  c-header  cpp-output
1644 c++  c++-header  c++-system-header c++-user-header c++-cpp-output
1645 objective-c  objective-c-header  objective-c-cpp-output
1646 objective-c++ objective-c++-header objective-c++-cpp-output
1647 assembler  assembler-with-cpp
1650 f77  f77-cpp-input f95  f95-cpp-input
1652 @end smallexample
1654 @item -x none
1655 Turn off any specification of a language, so that subsequent files are
1656 handled according to their file name suffixes (as they are if @option{-x}
1657 has not been used at all).
1658 @end table
1660 If you only want some of the stages of compilation, you can use
1661 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1662 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1663 @command{gcc} is to stop.  Note that some combinations (for example,
1664 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1666 @table @gcctabopt
1667 @opindex c
1668 @item -c
1669 Compile or assemble the source files, but do not link.  The linking
1670 stage simply is not done.  The ultimate output is in the form of an
1671 object file for each source file.
1673 By default, the object file name for a source file is made by replacing
1674 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1676 Unrecognized input files, not requiring compilation or assembly, are
1677 ignored.
1679 @opindex S
1680 @item -S
1681 Stop after the stage of compilation proper; do not assemble.  The output
1682 is in the form of an assembler code file for each non-assembler input
1683 file specified.
1685 By default, the assembler file name for a source file is made by
1686 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1688 Input files that don't require compilation are ignored.
1690 @opindex E
1691 @item -E
1692 Stop after the preprocessing stage; do not run the compiler proper.  The
1693 output is in the form of preprocessed source code, which is sent to the
1694 standard output.
1696 Input files that don't require preprocessing are ignored.
1698 @cindex output file option
1699 @opindex o
1700 @item -o @var{file}
1701 Place the primary output in file @var{file}.  This applies to whatever
1702 sort of output is being produced, whether it be an executable file, an
1703 object file, an assembler file or preprocessed C code.
1705 If @option{-o} is not specified, the default is to put an executable
1706 file in @file{a.out}, the object file for
1707 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1708 assembler file in @file{@var{source}.s}, a precompiled header file in
1709 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1710 standard output.
1712 Though @option{-o} names only the primary output, it also affects the
1713 naming of auxiliary and dump outputs.  See the examples below.  Unless
1714 overridden, both auxiliary outputs and dump outputs are placed in the
1715 same directory as the primary output.  In auxiliary outputs, the suffix
1716 of the input file is replaced with that of the auxiliary output file
1717 type; in dump outputs, the suffix of the dump file is appended to the
1718 input file suffix.  In compilation commands, the base name of both
1719 auxiliary and dump outputs is that of the primary output; in compile and
1720 link commands, the primary output name, minus the executable suffix, is
1721 combined with the input file name.  If both share the same base name,
1722 disregarding the suffix, the result of the combination is that base
1723 name, otherwise, they are concatenated, separated by a dash.
1725 @smallexample
1726 gcc -c foo.c ...
1727 @end smallexample
1729 will use @file{foo.o} as the primary output, and place aux outputs and
1730 dumps next to it, e.g., aux file @file{foo.dwo} for
1731 @option{-gsplit-dwarf}, and dump file @file{foo.c.???r.final} for
1732 @option{-fdump-rtl-final}.
1734 If a non-linker output file is explicitly specified, aux and dump files
1735 by default take the same base name:
1737 @smallexample
1738 gcc -c foo.c -o dir/foobar.o ...
1739 @end smallexample
1741 will name aux outputs @file{dir/foobar.*} and dump outputs
1742 @file{dir/foobar.c.*}.
1744 A linker output will instead prefix aux and dump outputs:
1746 @smallexample
1747 gcc foo.c bar.c -o dir/foobar ...
1748 @end smallexample
1750 will generally name aux outputs @file{dir/foobar-foo.*} and
1751 @file{dir/foobar-bar.*}, and dump outputs @file{dir/foobar-foo.c.*} and
1752 @file{dir/foobar-bar.c.*}.
1754 The one exception to the above is when the executable shares the base
1755 name with the single input:
1757 @smallexample
1758 gcc foo.c -o dir/foo ...
1759 @end smallexample
1761 in which case aux outputs are named @file{dir/foo.*} and dump outputs
1762 named @file{dir/foo.c.*}.
1764 The location and the names of auxiliary and dump outputs can be adjusted
1765 by the options @option{-dumpbase}, @option{-dumpbase-ext},
1766 @option{-dumpdir}, @option{-save-temps=cwd}, and
1767 @option{-save-temps=obj}.
1770 @opindex dumpbase
1771 @item -dumpbase @var{dumpbase}
1772 This option sets the base name for auxiliary and dump output files.  It
1773 does not affect the name of the primary output file.  Intermediate
1774 outputs, when preserved, are not regarded as primary outputs, but as
1775 auxiliary outputs:
1777 @smallexample
1778 gcc -save-temps -S foo.c
1779 @end smallexample
1781 saves the (no longer) temporary preprocessed file in @file{foo.i}, and
1782 then compiles to the (implied) output file @file{foo.s}, whereas:
1784 @smallexample
1785 gcc -save-temps -dumpbase save-foo -c foo.c
1786 @end smallexample
1788 preprocesses to in @file{save-foo.i}, compiles to @file{save-foo.s} (now
1789 an intermediate, thus auxiliary output), and then assembles to the
1790 (implied) output file @file{foo.o}.
1792 Absent this option, dump and aux files take their names from the input
1793 file, or from the (non-linker) output file, if one is explicitly
1794 specified: dump output files (e.g. those requested by @option{-fdump-*}
1795 options) with the input name suffix, and aux output files (those
1796 requested by other non-dump options, e.g. @code{-save-temps},
1797 @code{-gsplit-dwarf}, @code{-fcallgraph-info}) without it.
1799 Similar suffix differentiation of dump and aux outputs can be attained
1800 for explicitly-given @option{-dumpbase basename.suf} by also specifying
1801 @option{-dumpbase-ext .suf}.
1803 If @var{dumpbase} is explicitly specified with any directory component,
1804 any @var{dumppfx} specification (e.g. @option{-dumpdir} or
1805 @option{-save-temps=*}) is ignored, and instead of appending to it,
1806 @var{dumpbase} fully overrides it:
1808 @smallexample
1809 gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
1810   -dumpdir pfx- -save-temps=cwd ...
1811 @end smallexample
1813 creates auxiliary and dump outputs named @file{alt/foo.*}, disregarding
1814 @file{dir/} in @option{-o}, the @file{./} prefix implied by
1815 @option{-save-temps=cwd}, and @file{pfx-} in @option{-dumpdir}.
1817 When @option{-dumpbase} is specified in a command that compiles multiple
1818 inputs, or that compiles and then links, it may be combined with
1819 @var{dumppfx}, as specified under @option{-dumpdir}.  Then, each input
1820 file is compiled using the combined @var{dumppfx}, and default values
1821 for @var{dumpbase} and @var{auxdropsuf} are computed for each input
1822 file:
1824 @smallexample
1825 gcc foo.c bar.c -c -dumpbase main ...
1826 @end smallexample
1828 creates @file{foo.o} and @file{bar.o} as primary outputs, and avoids
1829 overwriting the auxiliary and dump outputs by using the @var{dumpbase}
1830 as a prefix, creating auxiliary and dump outputs named @file{main-foo.*}
1831 and @file{main-bar.*}.
1833 An empty string specified as @var{dumpbase} avoids the influence of the
1834 output basename in the naming of auxiliary and dump outputs during
1835 compilation, computing default values :
1837 @smallexample
1838 gcc -c foo.c -o dir/foobar.o -dumpbase '' ...
1839 @end smallexample
1841 will name aux outputs @file{dir/foo.*} and dump outputs
1842 @file{dir/foo.c.*}.  Note how their basenames are taken from the input
1843 name, but the directory still defaults to that of the output.
1845 The empty-string dumpbase does not prevent the use of the output
1846 basename for outputs during linking:
1848 @smallexample
1849 gcc foo.c bar.c -o dir/foobar -dumpbase '' -flto ...
1850 @end smallexample
1852 The compilation of the source files will name auxiliary outputs
1853 @file{dir/foo.*} and @file{dir/bar.*}, and dump outputs
1854 @file{dir/foo.c.*} and @file{dir/bar.c.*}.  LTO recompilation during
1855 linking will use @file{dir/foobar.} as the prefix for dumps and
1856 auxiliary files.
1859 @opindex dumpbase-ext
1860 @item -dumpbase-ext @var{auxdropsuf}
1861 When forming the name of an auxiliary (but not a dump) output file, drop
1862 trailing @var{auxdropsuf} from @var{dumpbase} before appending any
1863 suffixes.  If not specified, this option defaults to the suffix of a
1864 default @var{dumpbase}, i.e., the suffix of the input file when
1865 @option{-dumpbase} is not present in the command line, or @var{dumpbase}
1866 is combined with @var{dumppfx}.
1868 @smallexample
1869 gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
1870 @end smallexample
1872 creates @file{dir/foo.o} as the main output, and generates auxiliary
1873 outputs in @file{dir/x-foo.*}, taking the location of the primary
1874 output, and dropping the @file{.c} suffix from the @var{dumpbase}.  Dump
1875 outputs retain the suffix: @file{dir/x-foo.c.*}.
1877 This option is disregarded if it does not match the suffix of a
1878 specified @var{dumpbase}, except as an alternative to the executable
1879 suffix when appending the linker output base name to @var{dumppfx}, as
1880 specified below:
1882 @smallexample
1883 gcc foo.c bar.c -o main.out -dumpbase-ext .out ...
1884 @end smallexample
1886 creates @file{main.out} as the primary output, and avoids overwriting
1887 the auxiliary and dump outputs by using the executable name minus
1888 @var{auxdropsuf} as a prefix, creating auxiliary outputs named
1889 @file{main-foo.*} and @file{main-bar.*} and dump outputs named
1890 @file{main-foo.c.*} and @file{main-bar.c.*}.
1893 @opindex dumpdir
1894 @item -dumpdir @var{dumppfx}
1895 When forming the name of an auxiliary or dump output file, use
1896 @var{dumppfx} as a prefix:
1898 @smallexample
1899 gcc -dumpdir pfx- -c foo.c ...
1900 @end smallexample
1902 creates @file{foo.o} as the primary output, and auxiliary outputs named
1903 @file{pfx-foo.*}, combining the given @var{dumppfx} with the default
1904 @var{dumpbase} derived from the default primary output, derived in turn
1905 from the input name.  Dump outputs also take the input name suffix:
1906 @file{pfx-foo.c.*}.
1908 If @var{dumppfx} is to be used as a directory name, it must end with a
1909 directory separator:
1911 @smallexample
1912 gcc -dumpdir dir/ -c foo.c -o obj/bar.o ...
1913 @end smallexample
1915 creates @file{obj/bar.o} as the primary output, and auxiliary outputs
1916 named @file{dir/bar.*}, combining the given @var{dumppfx} with the
1917 default @var{dumpbase} derived from the primary output name.  Dump
1918 outputs also take the input name suffix: @file{dir/bar.c.*}.
1920 It defaults to the location of the output file, unless the output
1921 file is a special file like @code{/dev/null}. Options
1922 @option{-save-temps=cwd} and @option{-save-temps=obj} override this
1923 default, just like an explicit @option{-dumpdir} option.  In case
1924 multiple such options are given, the last one prevails:
1926 @smallexample
1927 gcc -dumpdir pfx- -c foo.c -save-temps=obj ...
1928 @end smallexample
1930 outputs @file{foo.o}, with auxiliary outputs named @file{foo.*} because
1931 @option{-save-temps=*} overrides the @var{dumppfx} given by the earlier
1932 @option{-dumpdir} option.  It does not matter that @option{=obj} is the
1933 default for @option{-save-temps}, nor that the output directory is
1934 implicitly the current directory.  Dump outputs are named
1935 @file{foo.c.*}.
1937 When compiling from multiple input files, if @option{-dumpbase} is
1938 specified, @var{dumpbase}, minus a @var{auxdropsuf} suffix, and a dash
1939 are appended to (or override, if containing any directory components) an
1940 explicit or defaulted @var{dumppfx}, so that each of the multiple
1941 compilations gets differently-named aux and dump outputs.
1943 @smallexample
1944 gcc foo.c bar.c -c -dumpdir dir/pfx- -dumpbase main ...
1945 @end smallexample
1947 outputs auxiliary dumps to @file{dir/pfx-main-foo.*} and
1948 @file{dir/pfx-main-bar.*}, appending @var{dumpbase}- to @var{dumppfx}.
1949 Dump outputs retain the input file suffix: @file{dir/pfx-main-foo.c.*}
1950 and @file{dir/pfx-main-bar.c.*}, respectively.  Contrast with the
1951 single-input compilation:
1953 @smallexample
1954 gcc foo.c -c -dumpdir dir/pfx- -dumpbase main ...
1955 @end smallexample
1957 that, applying @option{-dumpbase} to a single source, does not compute
1958 and append a separate @var{dumpbase} per input file.  Its auxiliary and
1959 dump outputs go in @file{dir/pfx-main.*}.
1961 When compiling and then linking from multiple input files, a defaulted
1962 or explicitly specified @var{dumppfx} also undergoes the @var{dumpbase}-
1963 transformation above (e.g. the compilation of @file{foo.c} and
1964 @file{bar.c} above, but without @option{-c}).  If neither
1965 @option{-dumpdir} nor @option{-dumpbase} are given, the linker output
1966 base name, minus @var{auxdropsuf}, if specified, or the executable
1967 suffix otherwise, plus a dash is appended to the default @var{dumppfx}
1968 instead.  Note, however, that unlike earlier cases of linking:
1970 @smallexample
1971 gcc foo.c bar.c -dumpdir dir/pfx- -o main ...
1972 @end smallexample
1974 does not append the output name @file{main} to @var{dumppfx}, because
1975 @option{-dumpdir} is explicitly specified.  The goal is that the
1976 explicitly-specified @var{dumppfx} may contain the specified output name
1977 as part of the prefix, if desired; only an explicitly-specified
1978 @option{-dumpbase} would be combined with it, in order to avoid simply
1979 discarding a meaningful option.
1981 When compiling and then linking from a single input file, the linker
1982 output base name will only be appended to the default @var{dumppfx} as
1983 above if it does not share the base name with the single input file
1984 name.  This has been covered in single-input linking cases above, but
1985 not with an explicit @option{-dumpdir} that inhibits the combination,
1986 even if overridden by @option{-save-temps=*}:
1988 @smallexample
1989 gcc foo.c -dumpdir alt/pfx- -o dir/main.exe -save-temps=cwd ...
1990 @end smallexample
1992 Auxiliary outputs are named @file{foo.*}, and dump outputs
1993 @file{foo.c.*}, in the current working directory as ultimately requested
1994 by @option{-save-temps=cwd}.
1996 Summing it all up for an intuitive though slightly imprecise data flow:
1997 the primary output name is broken into a directory part and a basename
1998 part; @var{dumppfx} is set to the former, unless overridden by
1999 @option{-dumpdir} or @option{-save-temps=*}, and @var{dumpbase} is set
2000 to the latter, unless overriden by @option{-dumpbase}.  If there are
2001 multiple inputs or linking, this @var{dumpbase} may be combined with
2002 @var{dumppfx} and taken from each input file.  Auxiliary output names
2003 for each input are formed by combining @var{dumppfx}, @var{dumpbase}
2004 minus suffix, and the auxiliary output suffix; dump output names are
2005 only different in that the suffix from @var{dumpbase} is retained.
2007 When it comes to auxiliary and dump outputs created during LTO
2008 recompilation, a combination of @var{dumppfx} and @var{dumpbase}, as
2009 given or as derived from the linker output name but not from inputs,
2010 even in cases in which this combination would not otherwise be used as
2011 such, is passed down with a trailing period replacing the compiler-added
2012 dash, if any, as a @option{-dumpdir} option to @command{lto-wrapper};
2013 being involved in linking, this program does not normally get any
2014 @option{-dumpbase} and @option{-dumpbase-ext}, and it ignores them.
2016 When running sub-compilers, @command{lto-wrapper} appends LTO stage
2017 names to the received @var{dumppfx}, ensures it contains a directory
2018 component so that it overrides any @option{-dumpdir}, and passes that as
2019 @option{-dumpbase} to sub-compilers.
2021 @opindex v
2022 @item -v
2023 Print (on standard error output) the commands executed to run the stages
2024 of compilation.  Also print the version number of the compiler driver
2025 program and of the preprocessor and the compiler proper.
2027 @opindex ###
2028 @item -###
2029 Like @option{-v} except the commands are not executed and arguments
2030 are quoted unless they contain only alphanumeric characters or @code{./-_}.
2031 This is useful for shell scripts to capture the driver-generated command lines.
2033 @opindex help
2034 @item --help
2035 Print (on the standard output) a description of the command-line options
2036 understood by @command{gcc}.  If the @option{-v} option is also specified
2037 then @option{--help} is also passed on to the various processes
2038 invoked by @command{gcc}, so that they can display the command-line options
2039 they accept.  If the @option{-Wextra} option has also been specified
2040 (prior to the @option{--help} option), then command-line options that
2041 have no documentation associated with them are also displayed.
2043 @opindex target-help
2044 @item --target-help
2045 Print (on the standard output) a description of target-specific command-line
2046 options for each tool.  For some targets extra target-specific
2047 information may also be printed.
2049 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
2050 Print (on the standard output) a description of the command-line
2051 options understood by the compiler that fit into all specified classes
2052 and qualifiers.  These are the supported classes:
2054 @table @asis
2055 @item @samp{optimizers}
2056 Display all of the optimization options supported by the
2057 compiler.
2059 @item @samp{warnings}
2060 Display all of the options controlling warning messages
2061 produced by the compiler.
2063 @item @samp{target}
2064 Display target-specific options.  Unlike the
2065 @option{--target-help} option however, target-specific options of the
2066 linker and assembler are not displayed.  This is because those
2067 tools do not currently support the extended @option{--help=} syntax.
2069 @item @samp{params}
2070 Display the values recognized by the @option{--param}
2071 option.
2073 @item @var{language}
2074 Display the options supported for @var{language}, where
2075 @var{language} is the name of one of the languages supported in this
2076 version of GCC@.  If an option is supported by all languages, one needs
2077 to select @samp{common} class.
2079 @item @samp{common}
2080 Display the options that are common to all languages.
2081 @end table
2083 These are the supported qualifiers:
2085 @table @asis
2086 @item @samp{undocumented}
2087 Display only those options that are undocumented.
2089 @item @samp{joined}
2090 Display options taking an argument that appears after an equal
2091 sign in the same continuous piece of text, such as:
2092 @samp{--help=target}.
2094 @item @samp{separate}
2095 Display options taking an argument that appears as a separate word
2096 following the original option, such as: @samp{-o output-file}.
2097 @end table
2099 Thus for example to display all the undocumented target-specific
2100 switches supported by the compiler, use:
2102 @smallexample
2103 --help=target,undocumented
2104 @end smallexample
2106 The sense of a qualifier can be inverted by prefixing it with the
2107 @samp{^} character, so for example to display all binary warning
2108 options (i.e., ones that are either on or off and that do not take an
2109 argument) that have a description, use:
2111 @smallexample
2112 --help=warnings,^joined,^undocumented
2113 @end smallexample
2115 The argument to @option{--help=} should not consist solely of inverted
2116 qualifiers.
2118 Combining several classes is possible, although this usually
2119 restricts the output so much that there is nothing to display.  One
2120 case where it does work, however, is when one of the classes is
2121 @var{target}.  For example, to display all the target-specific
2122 optimization options, use:
2124 @smallexample
2125 --help=target,optimizers
2126 @end smallexample
2128 The @option{--help=} option can be repeated on the command line.  Each
2129 successive use displays its requested class of options, skipping
2130 those that have already been displayed.  If @option{--help} is also
2131 specified anywhere on the command line then this takes precedence
2132 over any @option{--help=} option.
2134 If the @option{-Q} option appears on the command line before the
2135 @option{--help=} option, then the descriptive text displayed by
2136 @option{--help=} is changed.  Instead of describing the displayed
2137 options, an indication is given as to whether the option is enabled,
2138 disabled or set to a specific value (assuming that the compiler
2139 knows this at the point where the @option{--help=} option is used).
2141 Here is a truncated example from the ARM port of @command{gcc}:
2143 @smallexample
2144   % gcc -Q -mabi=2 --help=target -c
2145   The following options are target specific:
2146   -mabi=                                2
2147   -mabort-on-noreturn                   [disabled]
2148   -mapcs                                [disabled]
2149 @end smallexample
2151 The output is sensitive to the effects of previous command-line
2152 options, so for example it is possible to find out which optimizations
2153 are enabled at @option{-O2} by using:
2155 @smallexample
2156 -Q -O2 --help=optimizers
2157 @end smallexample
2159 Alternatively you can discover which binary optimizations are enabled
2160 by @option{-O3} by using:
2162 @smallexample
2163 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
2164 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
2165 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
2166 @end smallexample
2168 @opindex version
2169 @item --version
2170 Display the version number and copyrights of the invoked GCC@.
2172 @opindex pass-exit-codes
2173 @item -pass-exit-codes
2174 Normally the @command{gcc} program exits with the code of 1 if any
2175 phase of the compiler returns a non-success return code.  If you specify
2176 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
2177 the numerically highest error produced by any phase returning an error
2178 indication.  The C, C++, and Fortran front ends return 4 if an internal
2179 compiler error is encountered.
2181 @opindex pipe
2182 @item -pipe
2183 Use pipes rather than temporary files for communication between the
2184 various stages of compilation.  This fails to work on some systems where
2185 the assembler is unable to read from a pipe; but the GNU assembler has
2186 no trouble.
2188 @opindex specs
2189 @item -specs=@var{file}
2190 Process @var{file} after the compiler reads in the standard @file{specs}
2191 file, in order to override the defaults which the @command{gcc} driver
2192 program uses when determining what switches to pass to @command{cc1},
2193 @command{cc1plus}, @command{as}, @command{ld}, etc.  More than one
2194 @option{-specs=@var{file}} can be specified on the command line, and they
2195 are processed in order, from left to right.  @xref{Spec Files}, for
2196 information about the format of the @var{file}.
2198 @opindex wrapper
2199 @item -wrapper
2200 Invoke all subcommands under a wrapper program.  The name of the
2201 wrapper program and its parameters are passed as a comma separated
2202 list.
2204 @smallexample
2205 gcc -c t.c -wrapper gdb,--args
2206 @end smallexample
2208 @noindent
2209 This invokes all subprograms of @command{gcc} under
2210 @samp{gdb --args}, thus the invocation of @command{cc1} is
2211 @samp{gdb --args cc1 @dots{}}.
2213 @opindex ffile-prefix-map
2214 @item -ffile-prefix-map=@var{old}=@var{new}
2215 When compiling files residing in directory @file{@var{old}}, record
2216 any references to them in the result of the compilation as if the
2217 files resided in directory @file{@var{new}} instead.  Specifying this
2218 option is equivalent to specifying all the individual
2219 @option{-f*-prefix-map} options.  This can be used to make reproducible
2220 builds that are location independent.  Directories referenced by
2221 directives are not affected by these options.  See also
2222 @option{-fmacro-prefix-map}, @option{-fdebug-prefix-map},
2223 @option{-fprofile-prefix-map} and @option{-fcanon-prefix-map}.
2225 @opindex fcanon-prefix-map
2226 @item -fcanon-prefix-map
2227 For the @option{-f*-prefix-map} options normally comparison
2228 of @file{@var{old}} prefix against the filename that would be normally
2229 referenced in the result of the compilation is done using textual
2230 comparison of the prefixes, or ignoring character case for case insensitive
2231 filesystems and considering slashes and backslashes as equal on DOS based
2232 filesystems.  The @option{-fcanon-prefix-map} causes such comparisons
2233 to be done on canonicalized paths of @file{@var{old}}
2234 and the referenced filename.
2236 @opindex fplugin
2237 @item -fplugin=@var{name}.so
2238 Load the plugin code in file @var{name}.so, assumed to be a
2239 shared object to be dlopen'd by the compiler.  The base name of
2240 the shared object file is used to identify the plugin for the
2241 purposes of argument parsing (See
2242 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
2243 Each plugin should define the callback functions specified in the
2244 Plugins API.
2246 @opindex fplugin-arg
2247 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
2248 Define an argument called @var{key} with a value of @var{value}
2249 for the plugin called @var{name}.
2251 @opindex fdump-ada-spec
2252 @item -fdump-ada-spec@r{[}-slim@r{]}
2253 For C and C++ source and include files, generate corresponding Ada specs.
2254 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
2255 GNAT User's Guide}, which provides detailed documentation on this feature.
2257 @opindex fada-spec-parent
2258 @item -fada-spec-parent=@var{unit}
2259 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
2260 Ada specs as child units of parent @var{unit}.
2262 @opindex fdump-go-spec
2263 @item -fdump-go-spec=@var{file}
2264 For input files in any language, generate corresponding Go
2265 declarations in @var{file}.  This generates Go @code{const},
2266 @code{type}, @code{var}, and @code{func} declarations which may be a
2267 useful way to start writing a Go interface to code written in some
2268 other language.
2270 @include @value{srcdir}/../libiberty/at-file.texi
2271 @end table
2273 @node Invoking G++
2274 @section Compiling C++ Programs
2276 @cindex suffixes for C++ source
2277 @cindex C++ source file suffixes
2278 C++ source files conventionally use one of the suffixes @samp{.C},
2279 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
2280 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
2281 @samp{.H}, or (for shared template code) @samp{.tcc}; and
2282 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
2283 files with these names and compiles them as C++ programs even if you
2284 call the compiler the same way as for compiling C programs (usually
2285 with the name @command{gcc}).
2287 @findex g++
2288 @findex c++
2289 However, the use of @command{gcc} does not add the C++ library.
2290 @command{g++} is a program that calls GCC and automatically specifies linking
2291 against the C++ library.  It treats @samp{.c},
2292 @samp{.h} and @samp{.i} files as C++ source files instead of C source
2293 files unless @option{-x} is used.  This program is also useful when
2294 precompiling a C header file with a @samp{.h} extension for use in C++
2295 compilations.  On many systems, @command{g++} is also installed with
2296 the name @command{c++}.
2298 @cindex invoking @command{g++}
2299 When you compile C++ programs, you may specify many of the same
2300 command-line options that you use for compiling programs in any
2301 language; or command-line options meaningful for C and related
2302 languages; or options that are meaningful only for C++ programs.
2303 @xref{C Dialect Options,,Options Controlling C Dialect}, for
2304 explanations of options for languages related to C@.
2305 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
2306 explanations of options that are meaningful only for C++ programs.
2308 @node C Dialect Options
2309 @section Options Controlling C Dialect
2310 @cindex dialect options
2311 @cindex language dialect options
2312 @cindex options, dialect
2314 The following options control the dialect of C (or languages derived
2315 from C, such as C++, Objective-C and Objective-C++) that the compiler
2316 accepts:
2318 @table @gcctabopt
2319 @cindex ANSI support
2320 @cindex ISO support
2321 @opindex ansi
2322 @item -ansi
2323 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
2324 equivalent to @option{-std=c++98}.
2326 This turns off certain features of GCC that are incompatible with ISO
2327 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
2328 such as the @code{asm} and @code{typeof} keywords, and
2329 predefined macros such as @code{unix} and @code{vax} that identify the
2330 type of system you are using.  It also enables the undesirable and
2331 rarely used ISO trigraph feature.  For the C compiler,
2332 it disables recognition of C++ style @samp{//} comments as well as
2333 the @code{inline} keyword.
2335 The alternate keywords @code{__asm__}, @code{__extension__},
2336 @code{__inline__} and @code{__typeof__} continue to work despite
2337 @option{-ansi}.  You would not want to use them in an ISO C program, of
2338 course, but it is useful to put them in header files that might be included
2339 in compilations done with @option{-ansi}.  Alternate predefined macros
2340 such as @code{__unix__} and @code{__vax__} are also available, with or
2341 without @option{-ansi}.
2343 The @option{-ansi} option does not cause non-ISO programs to be
2344 rejected gratuitously.  For that, @option{-Wpedantic} is required in
2345 addition to @option{-ansi}.  @xref{Warning Options}.
2347 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
2348 option is used.  Some header files may notice this macro and refrain
2349 from declaring certain functions or defining certain macros that the
2350 ISO standard doesn't call for; this is to avoid interfering with any
2351 programs that might use these names for other things.
2353 Functions that are normally built in but do not have semantics
2354 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
2355 functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
2356 built-in functions provided by GCC}, for details of the functions
2357 affected.
2359 @opindex std
2360 @item -std=
2361 Determine the language standard. @xref{Standards,,Language Standards
2362 Supported by GCC}, for details of these standard versions.  This option
2363 is currently only supported when compiling C or C++.
2365 The compiler can accept several base standards, such as @samp{c90} or
2366 @samp{c++98}, and GNU dialects of those standards, such as
2367 @samp{gnu90} or @samp{gnu++98}.  When a base standard is specified, the
2368 compiler accepts all programs following that standard plus those
2369 using GNU extensions that do not contradict it.  For example,
2370 @option{-std=c90} turns off certain features of GCC that are
2371 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
2372 keywords, but not other GNU extensions that do not have a meaning in
2373 ISO C90, such as omitting the middle term of a @code{?:}
2374 expression. On the other hand, when a GNU dialect of a standard is
2375 specified, all features supported by the compiler are enabled, even when
2376 those features change the meaning of the base standard.  As a result, some
2377 strict-conforming programs may be rejected.  The particular standard
2378 is used by @option{-Wpedantic} to identify which features are GNU
2379 extensions given that version of the standard. For example
2380 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
2381 comments, while @option{-std=gnu99 -Wpedantic} does not.
2383 A value for this option must be provided; possible values are
2385 @table @samp
2386 @item c90
2387 @itemx c89
2388 @itemx iso9899:1990
2389 Support all ISO C90 programs (certain GNU extensions that conflict
2390 with ISO C90 are disabled). Same as @option{-ansi} for C code.
2392 @item iso9899:199409
2393 ISO C90 as modified in amendment 1.
2395 @item c99
2396 @itemx c9x
2397 @itemx iso9899:1999
2398 @itemx iso9899:199x
2399 ISO C99.  This standard is substantially completely supported, modulo
2400 bugs and floating-point issues
2401 (mainly but not entirely relating to optional C99 features from
2402 Annexes F and G).  See
2403 @w{@uref{https://gcc.gnu.org/c99status.html}} for more information.  The
2404 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
2406 @item c11
2407 @itemx c1x
2408 @itemx iso9899:2011
2409 ISO C11, the 2011 revision of the ISO C standard.  This standard is
2410 substantially completely supported, modulo bugs, floating-point issues
2411 (mainly but not entirely relating to optional C11 features from
2412 Annexes F and G) and the optional Annexes K (Bounds-checking
2413 interfaces) and L (Analyzability).  The name @samp{c1x} is deprecated.
2415 @item c17
2416 @itemx c18
2417 @itemx iso9899:2017
2418 @itemx iso9899:2018
2419 ISO C17, the 2017 revision of the ISO C standard
2420 (published in 2018).  This standard is
2421 same as C11 except for corrections of defects (all of which are also
2422 applied with @option{-std=c11}) and a new value of
2423 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2425 @item c2x
2426 The next version of the ISO C standard, still under development.  The
2427 support for this version is experimental and incomplete.
2429 @item gnu90
2430 @itemx gnu89
2431 GNU dialect of ISO C90 (including some C99 features).
2433 @item gnu99
2434 @itemx gnu9x
2435 GNU dialect of ISO C99.  The name @samp{gnu9x} is deprecated.
2437 @item gnu11
2438 @itemx gnu1x
2439 GNU dialect of ISO C11.
2440 The name @samp{gnu1x} is deprecated.
2442 @item gnu17
2443 @itemx gnu18
2444 GNU dialect of ISO C17.  This is the default for C code.
2446 @item gnu2x
2447 The next version of the ISO C standard, still under development, plus
2448 GNU extensions.  The support for this version is experimental and
2449 incomplete.
2451 @item c++98
2452 @itemx c++03
2453 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2454 additional defect reports. Same as @option{-ansi} for C++ code.
2456 @item gnu++98
2457 @itemx gnu++03
2458 GNU dialect of @option{-std=c++98}.
2460 @item c++11
2461 @itemx c++0x
2462 The 2011 ISO C++ standard plus amendments.
2463 The name @samp{c++0x} is deprecated.
2465 @item gnu++11
2466 @itemx gnu++0x
2467 GNU dialect of @option{-std=c++11}.
2468 The name @samp{gnu++0x} is deprecated.
2470 @item c++14
2471 @itemx c++1y
2472 The 2014 ISO C++ standard plus amendments.
2473 The name @samp{c++1y} is deprecated.
2475 @item gnu++14
2476 @itemx gnu++1y
2477 GNU dialect of @option{-std=c++14}.
2478 The name @samp{gnu++1y} is deprecated.
2480 @item c++17
2481 @itemx c++1z
2482 The 2017 ISO C++ standard plus amendments.
2483 The name @samp{c++1z} is deprecated.
2485 @item gnu++17
2486 @itemx gnu++1z
2487 GNU dialect of @option{-std=c++17}.
2488 This is the default for C++ code.
2489 The name @samp{gnu++1z} is deprecated.
2491 @item c++20
2492 @itemx c++2a
2493 The 2020 ISO C++ standard plus amendments.
2494 Support is experimental, and could change in incompatible ways in
2495 future releases.
2496 The name @samp{c++2a} is deprecated.
2498 @item gnu++20
2499 @itemx gnu++2a
2500 GNU dialect of @option{-std=c++20}.
2501 Support is experimental, and could change in incompatible ways in
2502 future releases.
2503 The name @samp{gnu++2a} is deprecated.
2505 @item c++2b
2506 @itemx c++23
2507 The next revision of the ISO C++ standard, planned for
2508 2023.  Support is highly experimental, and will almost certainly
2509 change in incompatible ways in future releases.
2511 @item gnu++2b
2512 @itemx gnu++23
2513 GNU dialect of @option{-std=c++2b}.  Support is highly experimental,
2514 and will almost certainly change in incompatible ways in future
2515 releases.
2517 @item c++2c
2518 @itemx c++26
2519 The next revision of the ISO C++ standard, planned for
2520 2026.  Support is highly experimental, and will almost certainly
2521 change in incompatible ways in future releases.
2523 @item gnu++2c
2524 @itemx gnu++26
2525 GNU dialect of @option{-std=c++2c}.  Support is highly experimental,
2526 and will almost certainly change in incompatible ways in future
2527 releases.
2528 @end table
2530 @opindex aux-info
2531 @item -aux-info @var{filename}
2532 Output to the given filename prototyped declarations for all functions
2533 declared and/or defined in a translation unit, including those in header
2534 files.  This option is silently ignored in any language other than C@.
2536 Besides declarations, the file indicates, in comments, the origin of
2537 each declaration (source file and line), whether the declaration was
2538 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2539 @samp{O} for old, respectively, in the first character after the line
2540 number and the colon), and whether it came from a declaration or a
2541 definition (@samp{C} or @samp{F}, respectively, in the following
2542 character).  In the case of function definitions, a K&R-style list of
2543 arguments followed by their declarations is also provided, inside
2544 comments, after the declaration.
2546 @opindex fno-asm
2547 @opindex fasm
2548 @item -fno-asm
2549 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2550 keyword, so that code can use these words as identifiers.  You can use
2551 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2552 instead.  In C, @option{-ansi} implies @option{-fno-asm}.
2554 In C++, @code{inline} is a standard keyword and is not affected by
2555 this switch.  You may want to use the @option{-fno-gnu-keywords} flag
2556 instead, which disables @code{typeof} but not @code{asm} and
2557 @code{inline}.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}),
2558 this switch only affects the @code{asm} and @code{typeof} keywords,
2559 since @code{inline} is a standard keyword in ISO C99.  In C2X mode
2560 (@option{-std=c2x} or @option{-std=gnu2x}), this switch only affects
2561 the @code{asm} keyword, since @code{typeof} is a standard keyword in
2562 ISO C2X.
2564 @opindex fno-builtin
2565 @opindex fbuiltin
2566 @cindex built-in functions
2567 @item -fno-builtin
2568 @itemx -fno-builtin-@var{function}
2569 Don't recognize built-in functions that do not begin with
2570 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
2571 functions provided by GCC}, for details of the functions affected,
2572 including those which are not built-in functions when @option{-ansi} or
2573 @option{-std} options for strict ISO C conformance are used because they
2574 do not have an ISO standard meaning.
2576 GCC normally generates special code to handle certain built-in functions
2577 more efficiently; for instance, calls to @code{alloca} may become single
2578 instructions which adjust the stack directly, and calls to @code{memcpy}
2579 may become inline copy loops.  The resulting code is often both smaller
2580 and faster, but since the function calls no longer appear as such, you
2581 cannot set a breakpoint on those calls, nor can you change the behavior
2582 of the functions by linking with a different library.  In addition,
2583 when a function is recognized as a built-in function, GCC may use
2584 information about that function to warn about problems with calls to
2585 that function, or to generate more efficient code, even if the
2586 resulting code still contains calls to that function.  For example,
2587 warnings are given with @option{-Wformat} for bad calls to
2588 @code{printf} when @code{printf} is built in and @code{strlen} is
2589 known not to modify global memory.
2591 With the @option{-fno-builtin-@var{function}} option
2592 only the built-in function @var{function} is
2593 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
2594 function is named that is not built-in in this version of GCC, this
2595 option is ignored.  There is no corresponding
2596 @option{-fbuiltin-@var{function}} option; if you wish to enable
2597 built-in functions selectively when using @option{-fno-builtin} or
2598 @option{-ffreestanding}, you may define macros such as:
2600 @smallexample
2601 #define abs(n)          __builtin_abs ((n))
2602 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
2603 @end smallexample
2605 @opindex fcond-mismatch
2606 @item -fcond-mismatch
2607 Allow conditional expressions with mismatched types in the second and
2608 third arguments.  The value of such an expression is void.  This option
2609 is not supported for C++.
2611 @opindex ffreestanding
2612 @cindex hosted environment
2613 @item -ffreestanding
2615 Assert that compilation targets a freestanding environment.  This
2616 implies @option{-fno-builtin}.  A freestanding environment
2617 is one in which the standard library may not exist, and program startup may
2618 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
2619 This is equivalent to @option{-fno-hosted}.
2621 @xref{Standards,,Language Standards Supported by GCC}, for details of
2622 freestanding and hosted environments.
2624 @opindex fgimple
2625 @item -fgimple
2627 Enable parsing of function definitions marked with @code{__GIMPLE}.
2628 This is an experimental feature that allows unit testing of GIMPLE
2629 passes.
2631 @opindex fgnu-tm
2632 @item -fgnu-tm
2633 When the option @option{-fgnu-tm} is specified, the compiler
2634 generates code for the Linux variant of Intel's current Transactional
2635 Memory ABI specification document (Revision 1.1, May 6 2009).  This is
2636 an experimental feature whose interface may change in future versions
2637 of GCC, as the official specification changes.  Please note that not
2638 all architectures are supported for this feature.
2640 For more information on GCC's support for transactional memory,
2641 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2642 Transactional Memory Library}.
2644 Note that the transactional memory feature is not supported with
2645 non-call exceptions (@option{-fnon-call-exceptions}).
2647 @opindex fgnu89-inline
2648 @item -fgnu89-inline
2649 The option @option{-fgnu89-inline} tells GCC to use the traditional
2650 GNU semantics for @code{inline} functions when in C99 mode.
2651 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2652 Using this option is roughly equivalent to adding the
2653 @code{gnu_inline} function attribute to all inline functions
2654 (@pxref{Function Attributes}).
2656 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2657 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2658 specifies the default behavior).
2659 This option is not supported in @option{-std=c90} or
2660 @option{-std=gnu90} mode.
2662 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2663 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2664 in effect for @code{inline} functions.  @xref{Common Predefined
2665 Macros,,,cpp,The C Preprocessor}.
2667 @opindex fhosted
2668 @cindex hosted environment
2669 @item -fhosted
2671 Assert that compilation targets a hosted environment.  This implies
2672 @option{-fbuiltin}.  A hosted environment is one in which the
2673 entire standard library is available, and in which @code{main} has a return
2674 type of @code{int}.  Examples are nearly everything except a kernel.
2675 This is equivalent to @option{-fno-freestanding}.
2677 @opindex flax-vector-conversions
2678 @item -flax-vector-conversions
2679 Allow implicit conversions between vectors with differing numbers of
2680 elements and/or incompatible element types.  This option should not be
2681 used for new code.
2683 @opindex fms-extensions
2684 @item -fms-extensions
2685 Accept some non-standard constructs used in Microsoft header files.
2687 In C++ code, this allows member names in structures to be similar
2688 to previous types declarations.
2690 @smallexample
2691 typedef int UOW;
2692 struct ABC @{
2693   UOW UOW;
2695 @end smallexample
2697 Some cases of unnamed fields in structures and unions are only
2698 accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
2699 fields within structs/unions}, for details.
2701 Note that this option is off for all targets except for x86
2702 targets using ms-abi.
2704 @opindex foffload
2705 @cindex Offloading targets
2706 @cindex OpenACC offloading targets
2707 @cindex OpenMP offloading targets
2708 @item -foffload=disable
2709 @itemx -foffload=default
2710 @itemx -foffload=@var{target-list}
2711 Specify for which OpenMP and OpenACC offload targets code should be generated.
2712 The default behavior, equivalent to @option{-foffload=default}, is to generate
2713 code for all supported offload targets.  The @option{-foffload=disable} form
2714 generates code only for the host fallback, while
2715 @option{-foffload=@var{target-list}} generates code only for the specified
2716 comma-separated list of offload targets.
2718 Offload targets are specified in GCC's internal target-triplet format. You can
2719 run the compiler with @option{-v} to show the list of configured offload targets
2720 under @code{OFFLOAD_TARGET_NAMES}.
2722 @opindex foffload-options
2723 @cindex Offloading options
2724 @cindex OpenACC offloading options
2725 @cindex OpenMP offloading options
2726 @item -foffload-options=@var{options}
2727 @itemx -foffload-options=@var{target-triplet-list}=@var{options}
2729 With @option{-foffload-options=@var{options}}, GCC passes the specified
2730 @var{options} to the compilers for all enabled offloading targets.  You can
2731 specify options that apply only to a specific target or targets by using
2732 the @option{-foffload-options=@var{target-list}=@var{options}} form.  The
2733 @var{target-list} is a comma-separated list in the same format as for the
2734 @option{-foffload=} option.
2736 Typical command lines are
2738 @smallexample
2739 -foffload-options='-fno-math-errno -ffinite-math-only' -foffload-options=nvptx-none=-latomic
2740 -foffload-options=amdgcn-amdhsa=-march=gfx906
2741 @end smallexample
2743 @opindex fopenacc
2744 @cindex OpenACC accelerator programming
2745 @item -fopenacc
2746 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2747 @code{!$acc} in Fortran.  When @option{-fopenacc} is specified, the
2748 compiler generates accelerated code according to the OpenACC Application
2749 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}.  This option
2750 implies @option{-pthread}, and thus is only supported on targets that
2751 have support for @option{-pthread}.
2753 @opindex fopenacc-dim
2754 @cindex OpenACC accelerator programming
2755 @item -fopenacc-dim=@var{geom}
2756 Specify default compute dimensions for parallel offload regions that do
2757 not explicitly specify.  The @var{geom} value is a triple of
2758 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'.  A size
2759 can be omitted, to use a target-specific default value.
2761 @opindex fopenmp
2762 @cindex OpenMP parallel
2763 @item -fopenmp
2764 Enable handling of OpenMP directives @code{#pragma omp} in C/C++,
2765 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++ and
2766 @code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
2767 compiler generates parallel code according to the OpenMP Application
2768 Program Interface v4.5 @w{@uref{https://www.openmp.org}}.  This option
2769 implies @option{-pthread}, and thus is only supported on targets that
2770 have support for @option{-pthread}. @option{-fopenmp} implies
2771 @option{-fopenmp-simd}.
2773 @opindex fopenmp-simd
2774 @cindex OpenMP SIMD
2775 @cindex SIMD
2776 @item -fopenmp-simd
2777 Enable handling of OpenMP's @code{simd}, @code{declare simd},
2778 @code{declare reduction}, @code{assume}, @code{ordered}, @code{scan},
2779 @code{loop} directives and combined or composite directives with
2780 @code{simd} as constituent with @code{#pragma omp} in C/C++,
2781 @code{[[omp::directive(...)]]} and @code{[[omp::sequence(...)]]} in C++
2782 and @code{!$omp} in Fortran.  Other OpenMP directives are ignored.
2784 @opindex fopenmp-target-simd-clone
2785 @cindex OpenMP target SIMD clone
2786 @item -fopenmp-target-simd-clone
2787 @item -fopenmp-target-simd-clone=@var{device-type}
2788 In addition to generating SIMD clones for functions marked with the
2789 @code{declare simd} directive, GCC also generates clones
2790 for functions marked with the OpenMP @code{declare target} directive
2791 that are suitable for vectorization when this option is in effect.  The
2792 @var{device-type} may be one of @code{none}, @code{host}, @code{nohost},
2793 and @code{any}, which correspond to keywords for the @code{device_type}
2794 clause of the @code{declare target} directive; clones are generated for
2795 the intersection of devices specified.
2796 @option{-fopenmp-target-simd-clone} is equivalent to
2797 @option{-fopenmp-target-simd-clone=any} and
2798 @option{-fno-openmp-target-simd-clone} is equivalent to
2799 @option{-fopenmp-target-simd-clone=none}.
2801 At @option{-O2} and higher (but not @option{-Os} or @option{-Og}) this
2802 optimization defaults to @option{-fopenmp-target-simd-clone=nohost}; otherwise
2803 it is disabled by default.
2805 @opindex fpermitted-flt-eval-methods
2806 @opindex fpermitted-flt-eval-methods=c11
2807 @opindex fpermitted-flt-eval-methods=ts-18661-3
2808 @item -fpermitted-flt-eval-methods=@var{style}
2809 ISO/IEC TS 18661-3 defines new permissible values for
2810 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2811 a semantic type that is an interchange or extended format should be
2812 evaluated to the precision and range of that type.  These new values are
2813 a superset of those permitted under C99/C11, which does not specify the
2814 meaning of other positive values of @code{FLT_EVAL_METHOD}.  As such, code
2815 conforming to C11 may not have been written expecting the possibility of
2816 the new values.
2818 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2819 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2820 or the extended set of values specified in ISO/IEC TS 18661-3.
2822 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2824 The default when in a standards compliant mode (@option{-std=c11} or similar)
2825 is @option{-fpermitted-flt-eval-methods=c11}.  The default when in a GNU
2826 dialect (@option{-std=gnu11} or similar) is
2827 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2829 @opindex fplan9-extensions
2830 @item -fplan9-extensions
2831 Accept some non-standard constructs used in Plan 9 code.
2833 This enables @option{-fms-extensions}, permits passing pointers to
2834 structures with anonymous fields to functions that expect pointers to
2835 elements of the type of the field, and permits referring to anonymous
2836 fields declared using a typedef.  @xref{Unnamed Fields,,Unnamed
2837 struct/union fields within structs/unions}, for details.  This is only
2838 supported for C, not C++.
2840 @opindex fsigned-bitfields
2841 @opindex funsigned-bitfields
2842 @opindex fno-signed-bitfields
2843 @opindex fno-unsigned-bitfields
2844 @item -fsigned-bitfields
2845 @itemx -funsigned-bitfields
2846 @itemx -fno-signed-bitfields
2847 @itemx -fno-unsigned-bitfields
2848 These options control whether a bit-field is signed or unsigned, when the
2849 declaration does not use either @code{signed} or @code{unsigned}.  By
2850 default, such a bit-field is signed, because this is consistent: the
2851 basic integer types such as @code{int} are signed types.
2853 @opindex fsigned-char
2854 @item -fsigned-char
2855 Let the type @code{char} be signed, like @code{signed char}.
2857 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2858 the negative form of @option{-funsigned-char}.  Likewise, the option
2859 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2861 @opindex funsigned-char
2862 @item -funsigned-char
2863 Let the type @code{char} be unsigned, like @code{unsigned char}.
2865 Each kind of machine has a default for what @code{char} should
2866 be.  It is either like @code{unsigned char} by default or like
2867 @code{signed char} by default.
2869 Ideally, a portable program should always use @code{signed char} or
2870 @code{unsigned char} when it depends on the signedness of an object.
2871 But many programs have been written to use plain @code{char} and
2872 expect it to be signed, or expect it to be unsigned, depending on the
2873 machines they were written for.  This option, and its inverse, let you
2874 make such a program work with the opposite default.
2876 The type @code{char} is always a distinct type from each of
2877 @code{signed char} or @code{unsigned char}, even though its behavior
2878 is always just like one of those two.
2880 @opindex fstrict-flex-arrays
2881 @opindex fno-strict-flex-arrays
2882 @item -fstrict-flex-arrays
2883 Control when to treat the trailing array of a structure as a flexible array
2884 member for the purpose of accessing the elements of such an array.
2885 The positive form is equivalent to @option{-fstrict-flex-arrays=3}, which is the
2886 strictest.  A trailing array is treated as a flexible array member only when it
2887 is declared as a flexible array member per C99 standard onwards.
2888 The negative form is equivalent to @option{-fstrict-flex-arrays=0}, which is the
2889 least strict.  All trailing arrays of structures are treated as flexible array
2890 members.
2892 @opindex fstrict-flex-arrays=@var{level}
2893 @item -fstrict-flex-arrays=@var{level}
2894 Control when to treat the trailing array of a structure as a flexible array
2895 member for the purpose of accessing the elements of such an array.  The value
2896 of @var{level} controls the level of strictness.
2898 The possible values of @var{level} are the same as for the
2899 @code{strict_flex_array} attribute (@pxref{Variable Attributes}).
2901 You can control this behavior for a specific trailing array field of a
2902 structure by using the variable attribute @code{strict_flex_array} attribute
2903 (@pxref{Variable Attributes}).
2905 @opindex fsso-struct
2906 @item -fsso-struct=@var{endianness}
2907 Set the default scalar storage order of structures and unions to the
2908 specified endianness.  The accepted values are @samp{big-endian},
2909 @samp{little-endian} and @samp{native} for the native endianness of
2910 the target (the default).  This option is not supported for C++.
2912 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2913 code that is not binary compatible with code generated without it if the
2914 specified endianness is not the native endianness of the target.
2915 @end table
2917 @node C++ Dialect Options
2918 @section Options Controlling C++ Dialect
2920 @cindex compiler options, C++
2921 @cindex C++ options, command-line
2922 @cindex options, C++
2923 This section describes the command-line options that are only meaningful
2924 for C++ programs.  You can also use most of the GNU compiler options
2925 regardless of what language your program is in.  For example, you
2926 might compile a file @file{firstClass.C} like this:
2928 @smallexample
2929 g++ -g -fstrict-enums -O -c firstClass.C
2930 @end smallexample
2932 @noindent
2933 In this example, only @option{-fstrict-enums} is an option meant
2934 only for C++ programs; you can use the other options with any
2935 language supported by GCC@.
2937 Some options for compiling C programs, such as @option{-std}, are also
2938 relevant for C++ programs.
2939 @xref{C Dialect Options,,Options Controlling C Dialect}.
2941 Here is a list of options that are @emph{only} for compiling C++ programs:
2943 @table @gcctabopt
2945 @opindex fabi-version
2946 @item -fabi-version=@var{n}
2947 Use version @var{n} of the C++ ABI@.  The default is version 0.
2949 Version 0 refers to the version conforming most closely to
2950 the C++ ABI specification.  Therefore, the ABI obtained using version 0
2951 will change in different versions of G++ as ABI bugs are fixed.
2953 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2955 Version 2 is the version of the C++ ABI that first appeared in G++
2956 3.4, and was the default through G++ 4.9.
2958 Version 3 corrects an error in mangling a constant address as a
2959 template argument.
2961 Version 4, which first appeared in G++ 4.5, implements a standard
2962 mangling for vector types.
2964 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2965 attribute const/volatile on function pointer types, decltype of a
2966 plain decl, and use of a function parameter in the declaration of
2967 another parameter.
2969 Version 6, which first appeared in G++ 4.7, corrects the promotion
2970 behavior of C++11 scoped enums and the mangling of template argument
2971 packs, const/static_cast, prefix ++ and --, and a class scope function
2972 used as a template argument.
2974 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2975 builtin type and corrects the mangling of lambdas in default argument
2976 scope.
2978 Version 8, which first appeared in G++ 4.9, corrects the substitution
2979 behavior of function types with function-cv-qualifiers.
2981 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2982 @code{nullptr_t}.
2984 Version 10, which first appeared in G++ 6.1, adds mangling of
2985 attributes that affect type identity, such as ia32 calling convention
2986 attributes (e.g.@: @samp{stdcall}).
2988 Version 11, which first appeared in G++ 7, corrects the mangling of
2989 sizeof... expressions and operator names.  For multiple entities with
2990 the same name within a function, that are declared in different scopes,
2991 the mangling now changes starting with the twelfth occurrence.  It also
2992 implies @option{-fnew-inheriting-ctors}.
2994 Version 12, which first appeared in G++ 8, corrects the calling
2995 conventions for empty classes on the x86_64 target and for classes
2996 with only deleted copy/move constructors.  It accidentally changes the
2997 calling convention for classes with a deleted copy constructor and a
2998 trivial move constructor.
3000 Version 13, which first appeared in G++ 8.2, fixes the accidental
3001 change in version 12.
3003 Version 14, which first appeared in G++ 10, corrects the mangling of
3004 the nullptr expression.
3006 Version 15, which first appeared in G++ 10.3, corrects G++ 10 ABI
3007 tag regression.
3009 Version 16, which first appeared in G++ 11, changes the mangling of
3010 @code{__alignof__} to be distinct from that of @code{alignof}, and
3011 dependent operator names.
3013 Version 17, which first appeared in G++ 12, fixes layout of classes
3014 that inherit from aggregate classes with default member initializers
3015 in C++14 and up.
3017 Version 18, which first appeard in G++ 13, fixes manglings of lambdas
3018 that have additional context.
3020 Version 19, which first appeard in G++ 14, fixes manglings of structured
3021 bindings to include ABI tags.
3023 See also @option{-Wabi}.
3025 @opindex fabi-compat-version
3026 @item -fabi-compat-version=@var{n}
3027 On targets that support strong aliases, G++
3028 works around mangling changes by creating an alias with the correct
3029 mangled name when defining a symbol with an incorrect mangled name.
3030 This switch specifies which ABI version to use for the alias.
3032 With @option{-fabi-version=0} (the default), this defaults to 13 (GCC 8.2
3033 compatibility).  If another ABI version is explicitly selected, this
3034 defaults to 0.  For compatibility with GCC versions 3.2 through 4.9,
3035 use @option{-fabi-compat-version=2}.
3037 If this option is not provided but @option{-Wabi=@var{n}} is, that
3038 version is used for compatibility aliases.  If this option is provided
3039 along with @option{-Wabi} (without the version), the version from this
3040 option is used for the warning.
3042 @opindex fno-access-control
3043 @opindex faccess-control
3044 @item -fno-access-control
3045 Turn off all access checking.  This switch is mainly useful for working
3046 around bugs in the access control code.
3048 @opindex faligned-new
3049 @item -faligned-new
3050 Enable support for C++17 @code{new} of types that require more
3051 alignment than @code{void* ::operator new(std::size_t)} provides.  A
3052 numeric argument such as @code{-faligned-new=32} can be used to
3053 specify how much alignment (in bytes) is provided by that function,
3054 but few users will need to override the default of
3055 @code{alignof(std::max_align_t)}.
3057 This flag is enabled by default for @option{-std=c++17}.
3059 @opindex fchar8_t
3060 @opindex fno-char8_t
3061 @item -fchar8_t
3062 @itemx -fno-char8_t
3063 Enable support for @code{char8_t} as adopted for C++20.  This includes
3064 the addition of a new @code{char8_t} fundamental type, changes to the
3065 types of UTF-8 string and character literals, new signatures for
3066 user-defined literals, associated standard library updates, and new
3067 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
3069 This option enables functions to be overloaded for ordinary and UTF-8
3070 strings:
3072 @smallexample
3073 int f(const char *);    // #1
3074 int f(const char8_t *); // #2
3075 int v1 = f("text");     // Calls #1
3076 int v2 = f(u8"text");   // Calls #2
3077 @end smallexample
3079 @noindent
3080 and introduces new signatures for user-defined literals:
3082 @smallexample
3083 int operator""_udl1(char8_t);
3084 int v3 = u8'x'_udl1;
3085 int operator""_udl2(const char8_t*, std::size_t);
3086 int v4 = u8"text"_udl2;
3087 template<typename T, T...> int operator""_udl3();
3088 int v5 = u8"text"_udl3;
3089 @end smallexample
3091 @noindent
3092 The change to the types of UTF-8 string and character literals introduces
3093 incompatibilities with ISO C++11 and later standards.  For example, the
3094 following code is well-formed under ISO C++11, but is ill-formed when
3095 @option{-fchar8_t} is specified.
3097 @smallexample
3098 const char *cp = u8"xx";// error: invalid conversion from
3099                         //        `const char8_t*' to `const char*'
3100 int f(const char*);
3101 auto v = f(u8"xx");     // error: invalid conversion from
3102                         //        `const char8_t*' to `const char*'
3103 std::string s@{u8"xx"@};  // error: no matching function for call to
3104                         //        `std::basic_string<char>::basic_string()'
3105 using namespace std::literals;
3106 s = u8"xx"s;            // error: conversion from
3107                         //        `basic_string<char8_t>' to non-scalar
3108                         //        type `basic_string<char>' requested
3109 @end smallexample
3111 @opindex fcheck-new
3112 @item -fcheck-new
3113 Check that the pointer returned by @code{operator new} is non-null
3114 before attempting to modify the storage allocated.  This check is
3115 normally unnecessary because the C++ standard specifies that
3116 @code{operator new} only returns @code{0} if it is declared
3117 @code{throw()}, in which case the compiler always checks the
3118 return value even without this option.  In all other cases, when
3119 @code{operator new} has a non-empty exception specification, memory
3120 exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
3121 @samp{new (nothrow)}.
3123 @opindex fconcepts
3124 @opindex fconcepts-ts
3125 @item -fconcepts
3126 @itemx -fconcepts-ts
3127 Enable support for the C++ Concepts feature for constraining template
3128 arguments.  With @option{-std=c++20} and above, Concepts are part of
3129 the language standard, so @option{-fconcepts} defaults to on.
3131 Some constructs that were allowed by the earlier C++ Extensions for
3132 Concepts Technical Specification, ISO 19217 (2015), but didn't make it
3133 into the standard, can additionally be enabled by
3134 @option{-fconcepts-ts}.
3136 @opindex fconstexpr-depth
3137 @item -fconstexpr-depth=@var{n}
3138 Set the maximum nested evaluation depth for C++11 constexpr functions
3139 to @var{n}.  A limit is needed to detect endless recursion during
3140 constant expression evaluation.  The minimum specified by the standard
3141 is 512.
3143 @opindex fconstexpr-cache-depth
3144 @item -fconstexpr-cache-depth=@var{n}
3145 Set the maximum level of nested evaluation depth for C++11 constexpr
3146 functions that will be cached to @var{n}.  This is a heuristic that
3147 trades off compilation speed (when the cache avoids repeated
3148 calculations) against memory consumption (when the cache grows very
3149 large from highly recursive evaluations).  The default is 8.  Very few
3150 users are likely to want to adjust it, but if your code does heavy
3151 constexpr calculations you might want to experiment to find which
3152 value works best for you.
3154 @opindex fconstexpr-fp-except
3155 @item -fconstexpr-fp-except
3156 Annex F of the C standard specifies that IEC559 floating point
3157 exceptions encountered at compile time should not stop compilation.
3158 C++ compilers have historically not followed this guidance, instead
3159 treating floating point division by zero as non-constant even though
3160 it has a well defined value.  This flag tells the compiler to give
3161 Annex F priority over other rules saying that a particular operation
3162 is undefined.
3164 @smallexample
3165 constexpr float inf = 1./0.; // OK with -fconstexpr-fp-except
3166 @end smallexample
3168 @opindex fconstexpr-loop-limit
3169 @item -fconstexpr-loop-limit=@var{n}
3170 Set the maximum number of iterations for a loop in C++14 constexpr functions
3171 to @var{n}.  A limit is needed to detect infinite loops during
3172 constant expression evaluation.  The default is 262144 (1<<18).
3174 @opindex fconstexpr-ops-limit
3175 @item -fconstexpr-ops-limit=@var{n}
3176 Set the maximum number of operations during a single constexpr evaluation.
3177 Even when number of iterations of a single loop is limited with the above limit,
3178 if there are several nested loops and each of them has many iterations but still
3179 smaller than the above limit, or if in a body of some loop or even outside
3180 of a loop too many expressions need to be evaluated, the resulting constexpr
3181 evaluation might take too long.
3182 The default is 33554432 (1<<25).
3184 @opindex fcontracts
3185 @item -fcontracts
3186 Enable experimental support for the C++ Contracts feature, as briefly
3187 added to and then removed from the C++20 working paper (N4820).  The
3188 implementation also includes proposed enhancements from papers P1290,
3189 P1332, and P1429.  This functionality is intended mostly for those
3190 interested in experimentation towards refining the feature to get it
3191 into shape for a future C++ standard.
3193 On violation of a checked contract, the violation handler is called.
3194 Users can replace the violation handler by defining
3195 @smallexample
3196 void
3197 handle_contract_violation (const std::experimental::contract_violation&);
3198 @end smallexample
3200 There are different sets of additional flags that can be used together
3201 to specify which contracts will be checked and how, for N4820
3202 contracts, P1332 contracts, or P1429 contracts; these sets cannot be
3203 used together.
3205 @table @gcctabopt
3206 @opindex fcontract-mode
3207 @item -fcontract-mode=[on|off]
3208 Control whether any contracts have any semantics at all.  Defaults to on.
3210 @opindex fcontract-assumption-mode
3211 @item -fcontract-assumption-mode=[on|off]
3212 [N4820] Control whether contracts with level @samp{axiom}
3213 should have the assume semantic.  Defaults to on.
3215 @opindex fcontract-build-level
3216 @item -fcontract-build-level=[off|default|audit]
3217 [N4820] Specify which level of contracts to generate checks
3218 for.  Defaults to @samp{default}.
3220 @opindex fcontract-continuation-mode
3221 @item -fcontract-continuation-mode=[on|off]
3222 [N4820] Control whether to allow the program to continue executing
3223 after a contract violation.  That is, do checked contracts have the
3224 @samp{maybe} semantic described below rather than the @samp{never}
3225 semantic.  Defaults to off.
3227 @opindex fcontract-role
3228 @item -fcontract-role=<name>:<default>,<audit>,<axiom>
3229 [P1332] Specify the concrete semantics for each contract level
3230 of a particular contract role.
3232 @item -fcontract-semantic=[default|audit|axiom]:<semantic>
3233 [P1429] Specify the concrete semantic for a particular
3234 contract level.
3236 @opindex fcontract-strict-declarations
3237 @item -fcontract-strict-declarations=[on|off]
3238 Control whether to reject adding contracts to a function after its
3239 first declaration.  Defaults to off.
3240 @end table
3242 The possible concrete semantics for that can be specified with
3243 @samp{-fcontract-role} or @samp{-fcontract-semantic} are:
3245 @table @code
3246 @item ignore
3247 This contract has no effect.
3249 @item assume
3250 This contract is treated like C++23 @code{[[assume]]}.
3252 @item check_never_continue
3253 @itemx never
3254 @itemx abort
3255 This contract is checked.  If it fails, the violation handler is
3256 called.  If the handler returns, @code{std::terminate} is called.
3258 @item check_maybe_continue
3259 @itemx maybe
3260 This contract is checked.  If it fails, the violation handler is
3261 called.  If the handler returns, execution continues normally.
3262 @end table
3264 @opindex fcoroutines
3265 @item -fcoroutines
3266 Enable support for the C++ coroutines extension (experimental).
3268 @opindex fno-elide-constructors
3269 @opindex felide-constructors
3270 @item -fno-elide-constructors
3271 The C++ standard allows an implementation to omit creating a temporary
3272 that is only used to initialize another object of the same type.
3273 Specifying this option disables that optimization, and forces G++ to
3274 call the copy constructor in all cases.  This option also causes G++
3275 to call trivial member functions which otherwise would be expanded inline.
3277 In C++17, the compiler is required to omit these temporaries, but this
3278 option still affects trivial member functions.
3280 @opindex fno-enforce-eh-specs
3281 @opindex fenforce-eh-specs
3282 @item -fno-enforce-eh-specs
3283 Don't generate code to check for violation of exception specifications
3284 at run time.  This option violates the C++ standard, but may be useful
3285 for reducing code size in production builds, much like defining
3286 @code{NDEBUG}.  This does not give user code permission to throw
3287 exceptions in violation of the exception specifications; the compiler
3288 still optimizes based on the specifications, so throwing an
3289 unexpected exception results in undefined behavior at run time.
3291 @opindex fextern-tls-init
3292 @opindex fno-extern-tls-init
3293 @item -fextern-tls-init
3294 @itemx -fno-extern-tls-init
3295 The C++11 and OpenMP standards allow @code{thread_local} and
3296 @code{threadprivate} variables to have dynamic (runtime)
3297 initialization.  To support this, any use of such a variable goes
3298 through a wrapper function that performs any necessary initialization.
3299 When the use and definition of the variable are in the same
3300 translation unit, this overhead can be optimized away, but when the
3301 use is in a different translation unit there is significant overhead
3302 even if the variable doesn't actually need dynamic initialization.  If
3303 the programmer can be sure that no use of the variable in a
3304 non-defining TU needs to trigger dynamic initialization (either
3305 because the variable is statically initialized, or a use of the
3306 variable in the defining TU will be executed before any uses in
3307 another TU), they can avoid this overhead with the
3308 @option{-fno-extern-tls-init} option.
3310 On targets that support symbol aliases, the default is
3311 @option{-fextern-tls-init}.  On targets that do not support symbol
3312 aliases, the default is @option{-fno-extern-tls-init}.
3314 @opindex ffold-simple-inlines
3315 @opindex fno-fold-simple-inlines
3316 @item -ffold-simple-inlines
3317 @itemx -fno-fold-simple-inlines
3318 Permit the C++ frontend to fold calls to @code{std::move}, @code{std::forward},
3319 @code{std::addressof} and @code{std::as_const}.  In contrast to inlining, this
3320 means no debug information will be generated for such calls.  Since these
3321 functions are rarely interesting to debug, this flag is enabled by default
3322 unless @option{-fno-inline} is active.
3324 @opindex fno-gnu-keywords
3325 @opindex fgnu-keywords
3326 @item -fno-gnu-keywords
3327 Do not recognize @code{typeof} as a keyword, so that code can use this
3328 word as an identifier.  You can use the keyword @code{__typeof__} instead.
3329 This option is implied by the strict ISO C++ dialects: @option{-ansi},
3330 @option{-std=c++98}, @option{-std=c++11}, etc.
3332 @opindex fimplicit-constexpr
3333 @item -fimplicit-constexpr
3334 Make inline functions implicitly constexpr, if they satisfy the
3335 requirements for a constexpr function.  This option can be used in
3336 C++14 mode or later.  This can result in initialization changing from
3337 dynamic to static and other optimizations.
3339 @opindex fno-implicit-templates
3340 @opindex fimplicit-templates
3341 @item -fno-implicit-templates
3342 Never emit code for non-inline templates that are instantiated
3343 implicitly (i.e.@: by use); only emit code for explicit instantiations.
3344 If you use this option, you must take care to structure your code to
3345 include all the necessary explicit instantiations to avoid getting
3346 undefined symbols at link time.
3347 @xref{Template Instantiation}, for more information.
3349 @opindex fno-implicit-inline-templates
3350 @opindex fimplicit-inline-templates
3351 @item -fno-implicit-inline-templates
3352 Don't emit code for implicit instantiations of inline templates, either.
3353 The default is to handle inlines differently so that compiles with and
3354 without optimization need the same set of explicit instantiations.
3356 @opindex fno-implement-inlines
3357 @opindex fimplement-inlines
3358 @item -fno-implement-inlines
3359 To save space, do not emit out-of-line copies of inline functions
3360 controlled by @code{#pragma implementation}.  This causes linker
3361 errors if these functions are not inlined everywhere they are called.
3363 @opindex fmodules-ts
3364 @opindex fno-modules-ts
3365 @item -fmodules-ts
3366 @itemx -fno-modules-ts
3367 Enable support for C++20 modules (@pxref{C++ Modules}).  The
3368 @option{-fno-modules-ts} is usually not needed, as that is the
3369 default.  Even though this is a C++20 feature, it is not currently
3370 implicitly enabled by selecting that standard version.
3372 @opindex fmodule-header
3373 @item -fmodule-header
3374 @itemx -fmodule-header=user
3375 @itemx -fmodule-header=system
3376 Compile a header file to create an importable header unit.
3378 @opindex fmodule-implicit-inline
3379 @item -fmodule-implicit-inline
3380 Member functions defined in their class definitions are not implicitly
3381 inline for modular code.  This is different to traditional C++
3382 behavior, for good reasons.  However, it may result in a difficulty
3383 during code porting.  This option makes such function definitions
3384 implicitly inline.  It does however generate an ABI incompatibility,
3385 so you must use it everywhere or nowhere.  (Such definitions outside
3386 of a named module remain implicitly inline, regardless.)
3388 @opindex fno-module-lazy
3389 @opindex fmodule-lazy
3390 @item -fno-module-lazy
3391 Disable lazy module importing and module mapper creation.
3393 @vindex CXX_MODULE_MAPPER @r{environment variable}
3394 @opindex fmodule-mapper
3395 @item -fmodule-mapper=@r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
3396 @itemx -fmodule-mapper=|@var{program}@r{[}?@var{ident}@r{]} @var{args...}
3397 @itemx -fmodule-mapper==@var{socket}@r{[}?@var{ident}@r{]}
3398 @itemx -fmodule-mapper=<>@r{[}@var{inout}@r{]}@r{[}?@var{ident}@r{]}
3399 @itemx -fmodule-mapper=<@var{in}>@var{out}@r{[}?@var{ident}@r{]}
3400 @itemx -fmodule-mapper=@var{file}@r{[}?@var{ident}@r{]}
3401 An oracle to query for module name to filename mappings.  If
3402 unspecified the @env{CXX_MODULE_MAPPER} environment variable is used,
3403 and if that is unset, an in-process default is provided.
3405 @opindex fmodule-only
3406 @item -fmodule-only
3407 Only emit the Compiled Module Interface, inhibiting any object file.
3409 @opindex fms-extensions
3410 @item -fms-extensions
3411 Disable Wpedantic warnings about constructs used in MFC, such as implicit
3412 int and getting a pointer to member function via non-standard syntax.
3414 @opindex fnew-inheriting-ctors
3415 @item -fnew-inheriting-ctors
3416 Enable the P0136 adjustment to the semantics of C++11 constructor
3417 inheritance.  This is part of C++17 but also considered to be a Defect
3418 Report against C++11 and C++14.  This flag is enabled by default
3419 unless @option{-fabi-version=10} or lower is specified.
3421 @opindex fnew-ttp-matching
3422 @item -fnew-ttp-matching
3423 Enable the P0522 resolution to Core issue 150, template template
3424 parameters and default arguments: this allows a template with default
3425 template arguments as an argument for a template template parameter
3426 with fewer template parameters.  This flag is enabled by default for
3427 @option{-std=c++17}.
3429 @opindex fno-nonansi-builtins
3430 @opindex fnonansi-builtins
3431 @item -fno-nonansi-builtins
3432 Disable built-in declarations of functions that are not mandated by
3433 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
3434 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
3436 @opindex fnothrow-opt
3437 @item -fnothrow-opt
3438 Treat a @code{throw()} exception specification as if it were a
3439 @code{noexcept} specification to reduce or eliminate the text size
3440 overhead relative to a function with no exception specification.  If
3441 the function has local variables of types with non-trivial
3442 destructors, the exception specification actually makes the
3443 function smaller because the EH cleanups for those variables can be
3444 optimized away.  The semantic effect is that an exception thrown out of
3445 a function with such an exception specification results in a call
3446 to @code{terminate} rather than @code{unexpected}.
3448 @opindex fno-operator-names
3449 @opindex foperator-names
3450 @item -fno-operator-names
3451 Do not treat the operator name keywords @code{and}, @code{bitand},
3452 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
3453 synonyms as keywords.
3455 @opindex fno-optional-diags
3456 @opindex foptional-diags
3457 @item -fno-optional-diags
3458 Disable diagnostics that the standard says a compiler does not need to
3459 issue.  Currently, the only such diagnostic issued by G++ is the one for
3460 a name having multiple meanings within a class.
3462 @opindex fpermissive
3463 @item -fpermissive
3464 Downgrade some diagnostics about nonconformant code from errors to
3465 warnings.  Thus, using @option{-fpermissive} allows some
3466 nonconforming code to compile.
3468 @opindex fno-pretty-templates
3469 @opindex fpretty-templates
3470 @item -fno-pretty-templates
3471 When an error message refers to a specialization of a function
3472 template, the compiler normally prints the signature of the
3473 template followed by the template arguments and any typedefs or
3474 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
3475 rather than @code{void f(int)}) so that it's clear which template is
3476 involved.  When an error message refers to a specialization of a class
3477 template, the compiler omits any template arguments that match
3478 the default template arguments for that template.  If either of these
3479 behaviors make it harder to understand the error message rather than
3480 easier, you can use @option{-fno-pretty-templates} to disable them.
3482 @opindex fno-rtti
3483 @opindex frtti
3484 @item -fno-rtti
3485 Disable generation of information about every class with virtual
3486 functions for use by the C++ run-time type identification features
3487 (@code{dynamic_cast} and @code{typeid}).  If you don't use those parts
3488 of the language, you can save some space by using this flag.  Note that
3489 exception handling uses the same information, but G++ generates it as
3490 needed. The @code{dynamic_cast} operator can still be used for casts that
3491 do not require run-time type information, i.e.@: casts to @code{void *} or to
3492 unambiguous base classes.
3494 Mixing code compiled with @option{-frtti} with that compiled with
3495 @option{-fno-rtti} may not work.  For example, programs may
3496 fail to link if a class compiled with @option{-fno-rtti} is used as a base 
3497 for a class compiled with @option{-frtti}.  
3499 @opindex fsized-deallocation
3500 @item -fsized-deallocation
3501 Enable the built-in global declarations
3502 @smallexample
3503 void operator delete (void *, std::size_t) noexcept;
3504 void operator delete[] (void *, std::size_t) noexcept;
3505 @end smallexample
3506 as introduced in C++14.  This is useful for user-defined replacement
3507 deallocation functions that, for example, use the size of the object
3508 to make deallocation faster.  Enabled by default under
3509 @option{-std=c++14} and above.  The flag @option{-Wsized-deallocation}
3510 warns about places that might want to add a definition.
3512 @opindex fstrict-enums
3513 @item -fstrict-enums
3514 Allow the compiler to optimize using the assumption that a value of
3515 enumerated type can only be one of the values of the enumeration (as
3516 defined in the C++ standard; basically, a value that can be
3517 represented in the minimum number of bits needed to represent all the
3518 enumerators).  This assumption may not be valid if the program uses a
3519 cast to convert an arbitrary integer value to the enumerated type.
3520 This option has no effect for an enumeration type with a fixed underlying
3521 type.
3523 @opindex fstrong-eval-order
3524 @item -fstrong-eval-order
3525 Evaluate member access, array subscripting, and shift expressions in
3526 left-to-right order, and evaluate assignment in right-to-left order,
3527 as adopted for C++17.  Enabled by default with @option{-std=c++17}.
3528 @option{-fstrong-eval-order=some} enables just the ordering of member
3529 access and shift expressions, and is the default without
3530 @option{-std=c++17}.
3532 @opindex ftemplate-backtrace-limit
3533 @item -ftemplate-backtrace-limit=@var{n}
3534 Set the maximum number of template instantiation notes for a single
3535 warning or error to @var{n}.  The default value is 10.
3537 @opindex ftemplate-depth
3538 @item -ftemplate-depth=@var{n}
3539 Set the maximum instantiation depth for template classes to @var{n}.
3540 A limit on the template instantiation depth is needed to detect
3541 endless recursions during template class instantiation.  ANSI/ISO C++
3542 conforming programs must not rely on a maximum depth greater than 17
3543 (changed to 1024 in C++11).  The default value is 900, as the compiler
3544 can run out of stack space before hitting 1024 in some situations.
3546 @opindex fno-threadsafe-statics
3547 @opindex fthreadsafe-statics
3548 @item -fno-threadsafe-statics
3549 Do not emit the extra code to use the routines specified in the C++
3550 ABI for thread-safe initialization of local statics.  You can use this
3551 option to reduce code size slightly in code that doesn't need to be
3552 thread-safe.
3554 @opindex fuse-cxa-atexit
3555 @item -fuse-cxa-atexit
3556 Register destructors for objects with static storage duration with the
3557 @code{__cxa_atexit} function rather than the @code{atexit} function.
3558 This option is required for fully standards-compliant handling of static
3559 destructors, but only works if your C library supports
3560 @code{__cxa_atexit}.
3562 @opindex fno-use-cxa-get-exception-ptr
3563 @opindex fuse-cxa-get-exception-ptr
3564 @item -fno-use-cxa-get-exception-ptr
3565 Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
3566 causes @code{std::uncaught_exception} to be incorrect, but is necessary
3567 if the runtime routine is not available.
3569 @opindex fvisibility-inlines-hidden
3570 @item -fvisibility-inlines-hidden
3571 This switch declares that the user does not attempt to compare
3572 pointers to inline functions or methods where the addresses of the two functions
3573 are taken in different shared objects.
3575 The effect of this is that GCC may, effectively, mark inline methods with
3576 @code{__attribute__ ((visibility ("hidden")))} so that they do not
3577 appear in the export table of a DSO and do not require a PLT indirection
3578 when used within the DSO@.  Enabling this option can have a dramatic effect
3579 on load and link times of a DSO as it massively reduces the size of the
3580 dynamic export table when the library makes heavy use of templates.
3582 The behavior of this switch is not quite the same as marking the
3583 methods as hidden directly, because it does not affect static variables
3584 local to the function or cause the compiler to deduce that
3585 the function is defined in only one shared object.
3587 You may mark a method as having a visibility explicitly to negate the
3588 effect of the switch for that method.  For example, if you do want to
3589 compare pointers to a particular inline method, you might mark it as
3590 having default visibility.  Marking the enclosing class with explicit
3591 visibility has no effect.
3593 Explicitly instantiated inline methods are unaffected by this option
3594 as their linkage might otherwise cross a shared library boundary.
3595 @xref{Template Instantiation}.
3597 @opindex fvisibility-ms-compat
3598 @item -fvisibility-ms-compat
3599 This flag attempts to use visibility settings to make GCC's C++
3600 linkage model compatible with that of Microsoft Visual Studio.
3602 The flag makes these changes to GCC's linkage model:
3604 @enumerate
3605 @item
3606 It sets the default visibility to @code{hidden}, like
3607 @option{-fvisibility=hidden}.
3609 @item
3610 Types, but not their members, are not hidden by default.
3612 @item
3613 The One Definition Rule is relaxed for types without explicit
3614 visibility specifications that are defined in more than one
3615 shared object: those declarations are permitted if they are
3616 permitted when this option is not used.
3617 @end enumerate
3619 In new code it is better to use @option{-fvisibility=hidden} and
3620 export those classes that are intended to be externally visible.
3621 Unfortunately it is possible for code to rely, perhaps accidentally,
3622 on the Visual Studio behavior.
3624 Among the consequences of these changes are that static data members
3625 of the same type with the same name but defined in different shared
3626 objects are different, so changing one does not change the other;
3627 and that pointers to function members defined in different shared
3628 objects may not compare equal.  When this flag is given, it is a
3629 violation of the ODR to define types with the same name differently.
3631 @opindex fno-weak
3632 @opindex fweak
3633 @item -fno-weak
3634 Do not use weak symbol support, even if it is provided by the linker.
3635 By default, G++ uses weak symbols if they are available.  This
3636 option exists only for testing, and should not be used by end-users;
3637 it results in inferior code and has no benefits.  This option may
3638 be removed in a future release of G++.
3640 @opindex fext-numeric-literals
3641 @opindex fno-ext-numeric-literals
3642 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3643 Accept imaginary, fixed-point, or machine-defined
3644 literal number suffixes as GNU extensions.
3645 When this option is turned off these suffixes are treated
3646 as C++11 user-defined literal numeric suffixes.
3647 This is on by default for all pre-C++11 dialects and all GNU dialects:
3648 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3649 @option{-std=gnu++14}.
3650 This option is off by default
3651 for ISO C++11 onwards (@option{-std=c++11}, ...).
3653 @opindex nostdinc++
3654 @item -nostdinc++
3655 Do not search for header files in the standard directories specific to
3656 C++, but do still search the other standard directories.  (This option
3657 is used when building the C++ library.)
3659 @opindex flang-info-include-translate
3660 @opindex flang-info-include-translate-not
3661 @item -flang-info-include-translate
3662 @itemx -flang-info-include-translate-not
3663 @itemx -flang-info-include-translate=@var{header}
3664 Inform of include translation events.  The first will note accepted
3665 include translations, the second will note declined include
3666 translations.  The @var{header} form will inform of include
3667 translations relating to that specific header.  If @var{header} is of
3668 the form @code{"user"} or @code{<system>} it will be resolved to a
3669 specific user or system header using the include path.
3671 @opindex flang-info-module-cmi
3672 @item -flang-info-module-cmi
3673 @itemx -flang-info-module-cmi=@var{module}
3674 Inform of Compiled Module Interface pathnames.  The first will note
3675 all read CMI pathnames.  The @var{module} form will not reading a
3676 specific module's CMI.  @var{module} may be a named module or a
3677 header-unit (the latter indicated by either being a pathname containing
3678 directory separators or enclosed in @code{<>} or @code{""}).
3680 @opindex stdlib
3681 @item -stdlib=@var{libstdc++,libc++}
3682 When G++ is configured to support this option, it allows specification of
3683 alternate C++ runtime libraries.  Two options are available: @var{libstdc++}
3684 (the default, native C++ runtime for G++) and @var{libc++} which is the
3685 C++ runtime installed on some operating systems (e.g. Darwin versions from
3686 Darwin11 onwards).  The option switches G++ to use the headers from the
3687 specified library and to emit @code{-lstdc++} or @code{-lc++} respectively,
3688 when a C++ runtime is required for linking.
3689 @end table
3691 In addition, these warning options have meanings only for C++ programs:
3693 @table @gcctabopt
3694 @opindex Wabi-tag
3695 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3696 Warn when a type with an ABI tag is used in a context that does not
3697 have that ABI tag.  See @ref{C++ Attributes} for more information
3698 about ABI tags.
3700 @opindex Wcomma-subscript
3701 @opindex Wno-comma-subscript
3702 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3703 Warn about uses of a comma expression within a subscripting expression.
3704 This usage was deprecated in C++20 and is going to be removed in C++23.
3705 However, a comma expression wrapped in @code{( )} is not deprecated.  Example:
3707 @smallexample
3708 @group
3709 void f(int *a, int b, int c) @{
3710     a[b,c];     // deprecated in C++20, invalid in C++23
3711     a[(b,c)];   // OK
3713 @end group
3714 @end smallexample
3716 In C++23 it is valid to have comma separated expressions in a subscript
3717 when an overloaded subscript operator is found and supports the right
3718 number and types of arguments.  G++ will accept the formerly valid syntax
3719 for code that is not valid in C++23 but used to be valid but deprecated
3720 in C++20 with a pedantic warning that can be disabled with
3721 @option{-Wno-comma-subscript}.
3723 Enabled by default with @option{-std=c++20} unless @option{-Wno-deprecated},
3724 and with @option{-std=c++23} regardless of @option{-Wno-deprecated}.
3726 This warning is upgraded to an error by @option{-pedantic-errors} in
3727 C++23 mode or later.
3729 @opindex Wctad-maybe-unsupported
3730 @opindex Wno-ctad-maybe-unsupported
3731 @item -Wctad-maybe-unsupported @r{(C++ and Objective-C++ only)}
3732 Warn when performing class template argument deduction (CTAD) on a type with
3733 no explicitly written deduction guides.  This warning will point out cases
3734 where CTAD succeeded only because the compiler synthesized the implicit
3735 deduction guides, which might not be what the programmer intended.  Certain
3736 style guides allow CTAD only on types that specifically "opt-in"; i.e., on
3737 types that are designed to support CTAD.  This warning can be suppressed with
3738 the following pattern:
3740 @smallexample
3741 struct allow_ctad_t; // any name works
3742 template <typename T> struct S @{
3743   S(T) @{ @}
3745 // Guide with incomplete parameter type will never be considered.
3746 S(allow_ctad_t) -> S<void>;
3747 @end smallexample
3749 @opindex Wctor-dtor-privacy
3750 @opindex Wno-ctor-dtor-privacy
3751 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3752 Warn when a class seems unusable because all the constructors or
3753 destructors in that class are private, and it has neither friends nor
3754 public static member functions.  Also warn if there are no non-private
3755 methods, and there's at least one private member function that isn't
3756 a constructor or destructor.
3758 @opindex Wdangling-reference
3759 @opindex Wno-dangling-reference
3760 @item -Wdangling-reference @r{(C++ and Objective-C++ only)}
3761 Warn when a reference is bound to a temporary whose lifetime has ended.
3762 For example:
3764 @smallexample
3765 int n = 1;
3766 const int& r = std::max(n - 1, n + 1); // r is dangling
3767 @end smallexample
3769 In the example above, two temporaries are created, one for each
3770 argument, and a reference to one of the temporaries is returned.
3771 However, both temporaries are destroyed at the end of the full
3772 expression, so the reference @code{r} is dangling.  This warning
3773 also detects dangling references in member initializer lists:
3775 @smallexample
3776 const int& f(const int& i) @{ return i; @}
3777 struct S @{
3778   const int &r; // r is dangling
3779   S() : r(f(10)) @{ @}
3781 @end smallexample
3783 Member functions are checked as well, but only their object argument:
3785 @smallexample
3786 struct S @{
3787    const S& self () @{ return *this; @}
3789 const S& s = S().self(); // s is dangling
3790 @end smallexample
3792 Certain functions are safe in this respect, for example @code{std::use_facet}:
3793 they take and return a reference, but they don't return one of its arguments,
3794 which can fool the warning.  Such functions can be excluded from the warning
3795 by wrapping them in a @code{#pragma}:
3797 @smallexample
3798 #pragma GCC diagnostic push
3799 #pragma GCC diagnostic ignored "-Wdangling-reference"
3800 const T& foo (const T&) @{ @dots{} @}
3801 #pragma GCC diagnostic pop
3802 @end smallexample
3804 @option{-Wdangling-reference} also warns about code like
3806 @smallexample
3807 auto p = std::minmax(1, 2);
3808 @end smallexample
3810 where @code{std::minmax} returns @code{std::pair<const int&, const int&>}, and
3811 both references dangle after the end of the full expression that contains
3812 the call to @code{std::minmax}.
3814 This warning is enabled by @option{-Wall}.
3816 @opindex Wdelete-non-virtual-dtor
3817 @opindex Wno-delete-non-virtual-dtor
3818 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3819 Warn when @code{delete} is used to destroy an instance of a class that
3820 has virtual functions and non-virtual destructor. It is unsafe to delete
3821 an instance of a derived class through a pointer to a base class if the
3822 base class does not have a virtual destructor.  This warning is enabled
3823 by @option{-Wall}.
3825 @opindex Wdeprecated-copy
3826 @opindex Wno-deprecated-copy
3827 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3828 Warn that the implicit declaration of a copy constructor or copy
3829 assignment operator is deprecated if the class has a user-provided
3830 copy constructor or copy assignment operator, in C++11 and up.  This
3831 warning is enabled by @option{-Wextra}.  With
3832 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3833 user-provided destructor.
3835 @opindex Wdeprecated-enum-enum-conversion
3836 @opindex Wno-deprecated-enum-enum-conversion
3837 @item -Wno-deprecated-enum-enum-conversion @r{(C++ and Objective-C++ only)}
3838 Disable the warning about the case when the usual arithmetic conversions
3839 are applied on operands where one is of enumeration type and the other is
3840 of a different enumeration type.  This conversion was deprecated in C++20.
3841 For example:
3843 @smallexample
3844 enum E1 @{ e @};
3845 enum E2 @{ f @};
3846 int k = f - e;
3847 @end smallexample
3849 @option{-Wdeprecated-enum-enum-conversion} is enabled by default with
3850 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3851 by @option{-Wenum-conversion}.
3853 @opindex Wdeprecated-enum-float-conversion
3854 @opindex Wno-deprecated-enum-float-conversion
3855 @item -Wno-deprecated-enum-float-conversion @r{(C++ and Objective-C++ only)}
3856 Disable the warning about the case when the usual arithmetic conversions
3857 are applied on operands where one is of enumeration type and the other is
3858 of a floating-point type.  This conversion was deprecated in C++20.  For
3859 example:
3861 @smallexample
3862 enum E1 @{ e @};
3863 enum E2 @{ f @};
3864 bool b = e <= 3.7;
3865 @end smallexample
3867 @option{-Wdeprecated-enum-float-conversion} is enabled by default with
3868 @option{-std=c++20}.  In pre-C++20 dialects, this warning can be enabled
3869 by @option{-Wenum-conversion}.
3871 @opindex Welaborated-enum-base
3872 @opindex Wno-elaborated-enum-base
3873 @item -Wno-elaborated-enum-base
3874 For C++11 and above, warn if an (invalid) additional enum-base is used
3875 in an elaborated-type-specifier.  That is, if an enum with given
3876 underlying type and no enumerator list is used in a declaration other
3877 than just a standalone declaration of the enum.  Enabled by default.  This
3878 warning is upgraded to an error with -pedantic-errors.
3880 @opindex Winit-list-lifetime
3881 @opindex Wno-init-list-lifetime
3882 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3883 Do not warn about uses of @code{std::initializer_list} that are likely
3884 to result in dangling pointers.  Since the underlying array for an
3885 @code{initializer_list} is handled like a normal C++ temporary object,
3886 it is easy to inadvertently keep a pointer to the array past the end
3887 of the array's lifetime.  For example:
3889 @itemize @bullet
3890 @item
3891 If a function returns a temporary @code{initializer_list}, or a local
3892 @code{initializer_list} variable, the array's lifetime ends at the end
3893 of the return statement, so the value returned has a dangling pointer.
3895 @item
3896 If a new-expression creates an @code{initializer_list}, the array only
3897 lives until the end of the enclosing full-expression, so the
3898 @code{initializer_list} in the heap has a dangling pointer.
3900 @item
3901 When an @code{initializer_list} variable is assigned from a
3902 brace-enclosed initializer list, the temporary array created for the
3903 right side of the assignment only lives until the end of the
3904 full-expression, so at the next statement the @code{initializer_list}
3905 variable has a dangling pointer.
3907 @smallexample
3908 // li's initial underlying array lives as long as li
3909 std::initializer_list<int> li = @{ 1,2,3 @};
3910 // assignment changes li to point to a temporary array
3911 li = @{ 4, 5 @};
3912 // now the temporary is gone and li has a dangling pointer
3913 int i = li.begin()[0] // undefined behavior
3914 @end smallexample
3916 @item
3917 When a list constructor stores the @code{begin} pointer from the
3918 @code{initializer_list} argument, this doesn't extend the lifetime of
3919 the array, so if a class variable is constructed from a temporary
3920 @code{initializer_list}, the pointer is left dangling by the end of
3921 the variable declaration statement.
3923 @end itemize
3925 @opindex Winvalid-constexpr
3926 @opindex Wno-invalid-constexpr
3927 @item -Winvalid-constexpr
3929 Warn when a function never produces a constant expression.  In C++20
3930 and earlier, for every @code{constexpr} function and function template,
3931 there must be at least one set of function arguments in at least one
3932 instantiation such that an invocation of the function or constructor
3933 could be an evaluated subexpression of a core constant expression.
3934 C++23 removed this restriction, so it's possible to have a function
3935 or a function template marked @code{constexpr} for which no invocation
3936 satisfies the requirements of a core constant expression.
3938 This warning is enabled as a pedantic warning by default in C++20 and
3939 earlier.  In C++23, @option{-Winvalid-constexpr} can be turned on, in
3940 which case it will be an ordinary warning.  For example:
3942 @smallexample
3943 void f (int& i);
3944 constexpr void
3945 g (int& i)
3947   // Warns by default in C++20, in C++23 only with -Winvalid-constexpr.
3948   f(i);
3950 @end smallexample
3952 @opindex Winvalid-imported-macros
3953 @opindex Wno-invalid-imported-macros
3954 @item -Winvalid-imported-macros
3955 Verify all imported macro definitions are valid at the end of
3956 compilation.  This is not enabled by default, as it requires
3957 additional processing to determine.  It may be useful when preparing
3958 sets of header-units to ensure consistent macros.
3960 @opindex Wliteral-suffix
3961 @opindex Wno-literal-suffix
3962 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3963 Do not warn when a string or character literal is followed by a
3964 ud-suffix which does not begin with an underscore.  As a conforming
3965 extension, GCC treats such suffixes as separate preprocessing tokens
3966 in order to maintain backwards compatibility with code that uses
3967 formatting macros from @code{<inttypes.h>}.  For example:
3969 @smallexample
3970 #define __STDC_FORMAT_MACROS
3971 #include <inttypes.h>
3972 #include <stdio.h>
3974 int main() @{
3975   int64_t i64 = 123;
3976   printf("My int64: %" PRId64"\n", i64);
3978 @end smallexample
3980 In this case, @code{PRId64} is treated as a separate preprocessing token.
3982 This option also controls warnings when a user-defined literal
3983 operator is declared with a literal suffix identifier that doesn't
3984 begin with an underscore. Literal suffix identifiers that don't begin
3985 with an underscore are reserved for future standardization.
3987 These warnings are enabled by default.
3989 @opindex Wnarrowing
3990 @opindex Wno-narrowing
3991 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3992 For C++11 and later standards, narrowing conversions are diagnosed by default,
3993 as required by the standard.  A narrowing conversion from a constant produces
3994 an error, and a narrowing conversion from a non-constant produces a warning,
3995 but @option{-Wno-narrowing} suppresses the diagnostic.
3996 Note that this does not affect the meaning of well-formed code;
3997 narrowing conversions are still considered ill-formed in SFINAE contexts.
3999 With @option{-Wnarrowing} in C++98, warn when a narrowing
4000 conversion prohibited by C++11 occurs within
4001 @samp{@{ @}}, e.g.
4003 @smallexample
4004 int i = @{ 2.2 @}; // error: narrowing from double to int
4005 @end smallexample
4007 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
4009 @opindex Wnoexcept
4010 @opindex Wno-noexcept
4011 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
4012 Warn when a noexcept-expression evaluates to false because of a call
4013 to a function that does not have a non-throwing exception
4014 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
4015 the compiler to never throw an exception.
4017 @opindex Wnoexcept-type
4018 @opindex Wno-noexcept-type
4019 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
4020 Warn if the C++17 feature making @code{noexcept} part of a function
4021 type changes the mangled name of a symbol relative to C++14.  Enabled
4022 by @option{-Wabi} and @option{-Wc++17-compat}.
4024 As an example:
4026 @smallexample
4027 template <class T> void f(T t) @{ t(); @};
4028 void g() noexcept;
4029 void h() @{ f(g); @} 
4030 @end smallexample
4032 @noindent
4033 In C++14, @code{f} calls @code{f<void(*)()>}, but in
4034 C++17 it calls @code{f<void(*)()noexcept>}.
4036 @opindex Wclass-memaccess
4037 @opindex Wno-class-memaccess
4038 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
4039 Warn when the destination of a call to a raw memory function such as
4040 @code{memset} or @code{memcpy} is an object of class type, and when writing
4041 into such an object might bypass the class non-trivial or deleted constructor
4042 or copy assignment, violate const-correctness or encapsulation, or corrupt
4043 virtual table pointers.  Modifying the representation of such objects may
4044 violate invariants maintained by member functions of the class.  For example,
4045 the call to @code{memset} below is undefined because it modifies a non-trivial
4046 class object and is, therefore, diagnosed.  The safe way to either initialize
4047 or clear the storage of objects of such types is by using the appropriate
4048 constructor or assignment operator, if one is available.
4049 @smallexample
4050 std::string str = "abc";
4051 memset (&str, 0, sizeof str);
4052 @end smallexample
4053 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
4054 Explicitly casting the pointer to the class object to @code{void *} or
4055 to a type that can be safely accessed by the raw memory function suppresses
4056 the warning.
4058 @opindex Wnon-virtual-dtor
4059 @opindex Wno-non-virtual-dtor
4060 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
4061 Warn when a class has virtual functions and an accessible non-virtual
4062 destructor itself or in an accessible polymorphic base class, in which
4063 case it is possible but unsafe to delete an instance of a derived
4064 class through a pointer to the class itself or base class.  This
4065 warning is automatically enabled if @option{-Weffc++} is specified.
4066 The @option{-Wdelete-non-virtual-dtor} option (enabled by @option{-Wall})
4067 should be preferred because it warns about the unsafe cases without false
4068 positives.
4070 @opindex Wregister
4071 @opindex Wno-register
4072 @item -Wregister @r{(C++ and Objective-C++ only)}
4073 Warn on uses of the @code{register} storage class specifier, except
4074 when it is part of the GNU @ref{Explicit Register Variables} extension.
4075 The use of the @code{register} keyword as storage class specifier has
4076 been deprecated in C++11 and removed in C++17.
4077 Enabled by default with @option{-std=c++17}.
4079 @opindex Wreorder
4080 @opindex Wno-reorder
4081 @cindex reordering, warning
4082 @cindex warning for reordering of member initializers
4083 @item -Wreorder @r{(C++ and Objective-C++ only)}
4084 Warn when the order of member initializers given in the code does not
4085 match the order in which they must be executed.  For instance:
4087 @smallexample
4088 struct A @{
4089   int i;
4090   int j;
4091   A(): j (0), i (1) @{ @}
4093 @end smallexample
4095 @noindent
4096 The compiler rearranges the member initializers for @code{i}
4097 and @code{j} to match the declaration order of the members, emitting
4098 a warning to that effect.  This warning is enabled by @option{-Wall}.
4100 @opindex Wpessimizing-move
4101 @opindex Wno-pessimizing-move
4102 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
4103 This warning warns when a call to @code{std::move} prevents copy
4104 elision.  A typical scenario when copy elision can occur is when returning in
4105 a function with a class return type, when the expression being returned is the
4106 name of a non-volatile automatic object, and is not a function parameter, and
4107 has the same type as the function return type.
4109 @smallexample
4110 struct T @{
4111 @dots{}
4113 T fn()
4115   T t;
4116   @dots{}
4117   return std::move (t);
4119 @end smallexample
4121 But in this example, the @code{std::move} call prevents copy elision.
4123 This warning is enabled by @option{-Wall}.
4125 @opindex Wredundant-move
4126 @opindex Wno-redundant-move
4127 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
4128 This warning warns about redundant calls to @code{std::move}; that is, when
4129 a move operation would have been performed even without the @code{std::move}
4130 call.  This happens because the compiler is forced to treat the object as if
4131 it were an rvalue in certain situations such as returning a local variable,
4132 where copy elision isn't applicable.  Consider:
4134 @smallexample
4135 struct T @{
4136 @dots{}
4138 T fn(T t)
4140   @dots{}
4141   return std::move (t);
4143 @end smallexample
4145 Here, the @code{std::move} call is redundant.  Because G++ implements Core
4146 Issue 1579, another example is:
4148 @smallexample
4149 struct T @{ // convertible to U
4150 @dots{}
4152 struct U @{
4153 @dots{}
4155 U fn()
4157   T t;
4158   @dots{}
4159   return std::move (t);
4161 @end smallexample
4162 In this example, copy elision isn't applicable because the type of the
4163 expression being returned and the function return type differ, yet G++
4164 treats the return value as if it were designated by an rvalue.
4166 This warning is enabled by @option{-Wextra}.
4168 @opindex Wrange-loop-construct
4169 @opindex Wno-range-loop-construct
4170 @item -Wrange-loop-construct @r{(C++ and Objective-C++ only)}
4171 This warning warns when a C++ range-based for-loop is creating an unnecessary
4172 copy.  This can happen when the range declaration is not a reference, but
4173 probably should be.  For example:
4175 @smallexample
4176 struct S @{ char arr[128]; @};
4177 void fn () @{
4178   S arr[5];
4179   for (const auto x : arr) @{ @dots{} @}
4181 @end smallexample
4183 It does not warn when the type being copied is a trivially-copyable type whose
4184 size is less than 64 bytes.
4186 This warning also warns when a loop variable in a range-based for-loop is
4187 initialized with a value of a different type resulting in a copy.  For example:
4189 @smallexample
4190 void fn() @{
4191   int arr[10];
4192   for (const double &x : arr) @{ @dots{} @}
4194 @end smallexample
4196 In the example above, in every iteration of the loop a temporary value of
4197 type @code{double} is created and destroyed, to which the reference
4198 @code{const double &} is bound.
4200 This warning is enabled by @option{-Wall}.
4202 @opindex Wredundant-tags
4203 @opindex Wno-redundant-tags
4204 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
4205 Warn about redundant class-key and enum-key in references to class types
4206 and enumerated types in contexts where the key can be eliminated without
4207 causing an ambiguity.  For example:
4209 @smallexample
4210 struct foo;
4211 struct foo *p;   // warn that keyword struct can be eliminated
4212 @end smallexample
4214 @noindent
4215 On the other hand, in this example there is no warning:
4217 @smallexample
4218 struct foo;
4219 void foo ();   // "hides" struct foo
4220 void bar (struct foo&);  // no warning, keyword struct is necessary
4221 @end smallexample
4223 @opindex Wsubobject-linkage
4224 @opindex Wno-subobject-linkage
4225 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
4226 Do not warn
4227 if a class type has a base or a field whose type uses the anonymous
4228 namespace or depends on a type with no linkage.  If a type A depends on
4229 a type B with no or internal linkage, defining it in multiple
4230 translation units would be an ODR violation because the meaning of B
4231 is different in each translation unit.  If A only appears in a single
4232 translation unit, the best way to silence the warning is to give it
4233 internal linkage by putting it in an anonymous namespace as well.  The
4234 compiler doesn't give this warning for types defined in the main .C
4235 file, as those are unlikely to have multiple definitions.
4236 @option{-Wsubobject-linkage} is enabled by default.
4238 @opindex Weffc++
4239 @opindex Wno-effc++
4240 @item -Weffc++ @r{(C++ and Objective-C++ only)}
4241 Warn about violations of the following style guidelines from Scott Meyers'
4242 @cite{Effective C++} series of books:
4244 @itemize @bullet
4245 @item
4246 Define a copy constructor and an assignment operator for classes
4247 with dynamically-allocated memory.
4249 @item
4250 Prefer initialization to assignment in constructors.
4252 @item
4253 Have @code{operator=} return a reference to @code{*this}.
4255 @item
4256 Don't try to return a reference when you must return an object.
4258 @item
4259 Distinguish between prefix and postfix forms of increment and
4260 decrement operators.
4262 @item
4263 Never overload @code{&&}, @code{||}, or @code{,}.
4265 @end itemize
4267 This option also enables @option{-Wnon-virtual-dtor}, which is also
4268 one of the effective C++ recommendations.  However, the check is
4269 extended to warn about the lack of virtual destructor in accessible
4270 non-polymorphic bases classes too.
4272 When selecting this option, be aware that the standard library
4273 headers do not obey all of these guidelines; use @samp{grep -v}
4274 to filter out those warnings.
4276 @opindex Wexceptions
4277 @opindex Wno-exceptions
4278 @item -Wno-exceptions @r{(C++ and Objective-C++ only)}
4279 Disable the warning about the case when an exception handler is shadowed by
4280 another handler, which can point out a wrong ordering of exception handlers.
4282 @opindex Wstrict-null-sentinel
4283 @opindex Wno-strict-null-sentinel
4284 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
4285 Warn about the use of an uncasted @code{NULL} as sentinel.  When
4286 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
4287 to @code{__null}.  Although it is a null pointer constant rather than a
4288 null pointer, it is guaranteed to be of the same size as a pointer.
4289 But this use is not portable across different compilers.
4291 @opindex Wno-non-template-friend
4292 @opindex Wnon-template-friend
4293 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
4294 Disable warnings when non-template friend functions are declared
4295 within a template.  In very old versions of GCC that predate implementation
4296 of the ISO standard, declarations such as 
4297 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
4298 could be interpreted as a particular specialization of a template
4299 function; the warning exists to diagnose compatibility problems, 
4300 and is enabled by default.
4302 @opindex Wold-style-cast
4303 @opindex Wno-old-style-cast
4304 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
4305 Warn if an old-style (C-style) cast to a non-void type is used within
4306 a C++ program.  The new-style casts (@code{dynamic_cast},
4307 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
4308 less vulnerable to unintended effects and much easier to search for.
4310 @opindex Woverloaded-virtual
4311 @opindex Wno-overloaded-virtual
4312 @cindex overloaded virtual function, warning
4313 @cindex warning for overloaded virtual function
4314 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
4315 @itemx -Woverloaded-virtual=@var{n}
4316 Warn when a function declaration hides virtual functions from a
4317 base class.  For example, in:
4319 @smallexample
4320 struct A @{
4321   virtual void f();
4324 struct B: public A @{
4325   void f(int); // does not override
4327 @end smallexample
4329 the @code{A} class version of @code{f} is hidden in @code{B}, and code
4330 like:
4332 @smallexample
4333 B* b;
4334 b->f();
4335 @end smallexample
4337 @noindent
4338 fails to compile.
4340 In cases where the different signatures are not an accident, the
4341 simplest solution is to add a using-declaration to the derived class
4342 to un-hide the base function, e.g. add @code{using A::f;} to @code{B}.
4344 The optional level suffix controls the behavior when all the
4345 declarations in the derived class override virtual functions in the
4346 base class, even if not all of the base functions are overridden:
4348 @smallexample
4349 struct C @{
4350   virtual void f();
4351   virtual void f(int);
4354 struct D: public C @{
4355   void f(int); // does override
4357 @end smallexample
4359 This pattern is less likely to be a mistake; if D is only used
4360 virtually, the user might have decided that the base class semantics
4361 for some of the overloads are fine.
4363 At level 1, this case does not warn; at level 2, it does.
4364 @option{-Woverloaded-virtual} by itself selects level 2.  Level 1 is
4365 included in @option{-Wall}.
4367 @opindex Wno-pmf-conversions
4368 @opindex Wpmf-conversions
4369 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
4370 Disable the diagnostic for converting a bound pointer to member function
4371 to a plain pointer.
4373 @opindex Wsign-promo
4374 @opindex Wno-sign-promo
4375 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
4376 Warn when overload resolution chooses a promotion from unsigned or
4377 enumerated type to a signed type, over a conversion to an unsigned type of
4378 the same size.  Previous versions of G++ tried to preserve
4379 unsignedness, but the standard mandates the current behavior.
4381 @opindex Wtemplates
4382 @opindex Wno-templates
4383 @item -Wtemplates @r{(C++ and Objective-C++ only)}
4384 Warn when a primary template declaration is encountered.  Some coding
4385 rules disallow templates, and this may be used to enforce that rule.
4386 The warning is inactive inside a system header file, such as the STL, so
4387 one can still use the STL.  One may also instantiate or specialize
4388 templates.
4390 @opindex Wmismatched-new-delete
4391 @opindex Wno-mismatched-new-delete
4392 @item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)}
4393 Warn for mismatches between calls to @code{operator new} or @code{operator
4394 delete} and the corresponding call to the allocation or deallocation function.
4395 This includes invocations of C++ @code{operator delete} with pointers
4396 returned from either mismatched forms of @code{operator new}, or from other
4397 functions that allocate objects for which the @code{operator delete} isn't
4398 a suitable deallocator, as well as calls to other deallocation functions
4399 with pointers returned from @code{operator new} for which the deallocation
4400 function isn't suitable.
4402 For example, the @code{delete} expression in the function below is diagnosed
4403 because it doesn't match the array form of the @code{new} expression
4404 the pointer argument was returned from.  Similarly, the call to @code{free}
4405 is also diagnosed.
4407 @smallexample
4408 void f ()
4410   int *a = new int[n];
4411   delete a;   // warning: mismatch in array forms of expressions
4413   char *p = new char[n];
4414   free (p);   // warning: mismatch between new and free
4416 @end smallexample
4418 The related option @option{-Wmismatched-dealloc} diagnoses mismatches
4419 involving allocation and deallocation functions other than @code{operator
4420 new} and @code{operator delete}.
4422 @option{-Wmismatched-new-delete} is included in @option{-Wall}.
4424 @opindex Wmismatched-tags
4425 @opindex Wno-mismatched-tags
4426 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
4427 Warn for declarations of structs, classes, and class templates and their
4428 specializations with a class-key that does not match either the definition
4429 or the first declaration if no definition is provided.
4431 For example, the declaration of @code{struct Object} in the argument list
4432 of @code{draw} triggers the warning.  To avoid it, either remove the redundant
4433 class-key @code{struct} or replace it with @code{class} to match its definition.
4434 @smallexample
4435 class Object @{
4436 public:
4437   virtual ~Object () = 0;
4439 void draw (struct Object*);
4440 @end smallexample
4442 It is not wrong to declare a class with the class-key @code{struct} as
4443 the example above shows.  The @option{-Wmismatched-tags} option is intended
4444 to help achieve a consistent style of class declarations.  In code that is
4445 intended to be portable to Windows-based compilers the warning helps prevent
4446 unresolved references due to the difference in the mangling of symbols
4447 declared with different class-keys.  The option can be used either on its
4448 own or in conjunction with @option{-Wredundant-tags}.
4450 @opindex Wmultiple-inheritance
4451 @opindex Wno-multiple-inheritance
4452 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
4453 Warn when a class is defined with multiple direct base classes.  Some
4454 coding rules disallow multiple inheritance, and this may be used to
4455 enforce that rule.  The warning is inactive inside a system header file,
4456 such as the STL, so one can still use the STL.  One may also define
4457 classes that indirectly use multiple inheritance.
4459 @opindex Wvirtual-inheritance
4460 @opindex Wno-virtual-inheritance
4461 @item -Wvirtual-inheritance
4462 Warn when a class is defined with a virtual direct base class.  Some
4463 coding rules disallow multiple inheritance, and this may be used to
4464 enforce that rule.  The warning is inactive inside a system header file,
4465 such as the STL, so one can still use the STL.  One may also define
4466 classes that indirectly use virtual inheritance.
4468 @opindex Wvirtual-move-assign
4469 @opindex Wno-virtual-move-assign
4470 @item -Wno-virtual-move-assign
4471 Suppress warnings about inheriting from a virtual base with a
4472 non-trivial C++11 move assignment operator.  This is dangerous because
4473 if the virtual base is reachable along more than one path, it is
4474 moved multiple times, which can mean both objects end up in the
4475 moved-from state.  If the move assignment operator is written to avoid
4476 moving from a moved-from object, this warning can be disabled.
4478 @opindex Wnamespaces
4479 @opindex Wno-namespaces
4480 @item -Wnamespaces
4481 Warn when a namespace definition is opened.  Some coding rules disallow
4482 namespaces, and this may be used to enforce that rule.  The warning is
4483 inactive inside a system header file, such as the STL, so one can still
4484 use the STL.  One may also use using directives and qualified names.
4486 @opindex Wterminate
4487 @opindex Wno-terminate
4488 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
4489 Disable the warning about a throw-expression that will immediately
4490 result in a call to @code{terminate}.
4492 @opindex Wvexing-parse
4493 @opindex Wno-vexing-parse
4494 @item -Wno-vexing-parse @r{(C++ and Objective-C++ only)}
4495 Warn about the most vexing parse syntactic ambiguity.  This warns about
4496 the cases when a declaration looks like a variable definition, but the
4497 C++ language requires it to be interpreted as a function declaration.
4498 For instance:
4500 @smallexample
4501 void f(double a) @{
4502   int i();        // extern int i (void);
4503   int n(int(a));  // extern int n (int);
4505 @end smallexample
4507 Another example:
4509 @smallexample
4510 struct S @{ S(int); @};
4511 void f(double a) @{
4512   S x(int(a));   // extern struct S x (int);
4513   S y(int());    // extern struct S y (int (*) (void));
4514   S z();         // extern struct S z (void);
4516 @end smallexample
4518 The warning will suggest options how to deal with such an ambiguity; e.g.,
4519 it can suggest removing the parentheses or using braces instead.
4521 This warning is enabled by default.
4523 @opindex Wno-class-conversion
4524 @opindex Wclass-conversion
4525 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
4526 Do not warn when a conversion function converts an
4527 object to the same type, to a base class of that type, or to void; such
4528 a conversion function will never be called.
4530 @opindex Wvolatile
4531 @opindex Wno-volatile
4532 @item -Wvolatile @r{(C++ and Objective-C++ only)}
4533 Warn about deprecated uses of the @code{volatile} qualifier.  This includes
4534 postfix and prefix @code{++} and @code{--} expressions of
4535 @code{volatile}-qualified types, using simple assignments where the left
4536 operand is a @code{volatile}-qualified non-class type for their value,
4537 compound assignments where the left operand is a @code{volatile}-qualified
4538 non-class type, @code{volatile}-qualified function return type,
4539 @code{volatile}-qualified parameter type, and structured bindings of a
4540 @code{volatile}-qualified type.  This usage was deprecated in C++20.
4542 Enabled by default with @option{-std=c++20}.
4544 @opindex Wzero-as-null-pointer-constant
4545 @opindex Wno-zero-as-null-pointer-constant
4546 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4547 Warn when a literal @samp{0} is used as null pointer constant.  This can
4548 be useful to facilitate the conversion to @code{nullptr} in C++11.
4550 @opindex Waligned-new
4551 @opindex Wno-aligned-new
4552 @item -Waligned-new
4553 Warn about a new-expression of a type that requires greater alignment
4554 than the @code{alignof(std::max_align_t)} but uses an allocation
4555 function without an explicit alignment parameter. This option is
4556 enabled by @option{-Wall}.
4558 Normally this only warns about global allocation functions, but
4559 @option{-Waligned-new=all} also warns about class member allocation
4560 functions.
4562 @opindex Wplacement-new
4563 @opindex Wno-placement-new
4564 @item -Wno-placement-new
4565 @itemx -Wplacement-new=@var{n}
4566 Warn about placement new expressions with undefined behavior, such as
4567 constructing an object in a buffer that is smaller than the type of
4568 the object.  For example, the placement new expression below is diagnosed
4569 because it attempts to construct an array of 64 integers in a buffer only
4570 64 bytes large.
4571 @smallexample
4572 char buf [64];
4573 new (buf) int[64];
4574 @end smallexample
4575 This warning is enabled by default.
4577 @table @gcctabopt
4578 @item -Wplacement-new=1
4579 This is the default warning level of @option{-Wplacement-new}.  At this
4580 level the warning is not issued for some strictly undefined constructs that
4581 GCC allows as extensions for compatibility with legacy code.  For example,
4582 the following @code{new} expression is not diagnosed at this level even
4583 though it has undefined behavior according to the C++ standard because
4584 it writes past the end of the one-element array.
4585 @smallexample
4586 struct S @{ int n, a[1]; @};
4587 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4588 new (s->a)int [32]();
4589 @end smallexample
4591 @item -Wplacement-new=2
4592 At this level, in addition to diagnosing all the same constructs as at level
4593 1, a diagnostic is also issued for placement new expressions that construct
4594 an object in the last member of structure whose type is an array of a single
4595 element and whose size is less than the size of the object being constructed.
4596 While the previous example would be diagnosed, the following construct makes
4597 use of the flexible member array extension to avoid the warning at level 2.
4598 @smallexample
4599 struct S @{ int n, a[]; @};
4600 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4601 new (s->a)int [32]();
4602 @end smallexample
4604 @end table
4606 @opindex Wcatch-value
4607 @opindex Wno-catch-value
4608 @item -Wcatch-value
4609 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
4610 Warn about catch handlers that do not catch via reference.
4611 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
4612 warn about polymorphic class types that are caught by value.
4613 With @option{-Wcatch-value=2} warn about all class types that are caught
4614 by value. With @option{-Wcatch-value=3} warn about all types that are
4615 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
4617 @opindex Wconditionally-supported
4618 @opindex Wno-conditionally-supported
4619 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4620 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4622 @opindex Wdelete-incomplete
4623 @opindex Wno-delete-incomplete
4624 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
4625 Do not warn when deleting a pointer to incomplete type, which may cause
4626 undefined behavior at runtime.  This warning is enabled by default.
4628 @opindex Wextra-semi
4629 @opindex Wno-extra-semi
4630 @item -Wextra-semi @r{(C++, Objective-C++ only)}
4631 Warn about redundant semicolons after in-class function definitions.
4633 @opindex Winaccessible-base
4634 @opindex Wno-inaccessible-base
4635 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
4636 This option controls warnings
4637 when a base class is inaccessible in a class derived from it due to
4638 ambiguity.  The warning is enabled by default.
4639 Note that the warning for ambiguous virtual
4640 bases is enabled by the @option{-Wextra} option.
4641 @smallexample
4642 @group
4643 struct A @{ int a; @};
4645 struct B : A @{ @};
4647 struct C : B, A @{ @};
4648 @end group
4649 @end smallexample
4651 @opindex Winherited-variadic-ctor
4652 @opindex Wno-inherited-variadic-ctor
4653 @item -Wno-inherited-variadic-ctor
4654 Suppress warnings about use of C++11 inheriting constructors when the
4655 base class inherited from has a C variadic constructor; the warning is
4656 on by default because the ellipsis is not inherited.
4658 @opindex Wno-invalid-offsetof
4659 @opindex Winvalid-offsetof
4660 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4661 Suppress warnings from applying the @code{offsetof} macro to a non-POD
4662 type.  According to the 2014 ISO C++ standard, applying @code{offsetof}
4663 to a non-standard-layout type is undefined.  In existing C++ implementations,
4664 however, @code{offsetof} typically gives meaningful results.
4665 This flag is for users who are aware that they are
4666 writing nonportable code and who have deliberately chosen to ignore the
4667 warning about it.
4669 The restrictions on @code{offsetof} may be relaxed in a future version
4670 of the C++ standard.
4672 @opindex Wsized-deallocation
4673 @opindex Wno-sized-deallocation
4674 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
4675 Warn about a definition of an unsized deallocation function
4676 @smallexample
4677 void operator delete (void *) noexcept;
4678 void operator delete[] (void *) noexcept;
4679 @end smallexample
4680 without a definition of the corresponding sized deallocation function
4681 @smallexample
4682 void operator delete (void *, std::size_t) noexcept;
4683 void operator delete[] (void *, std::size_t) noexcept;
4684 @end smallexample
4685 or vice versa.  Enabled by @option{-Wextra} along with
4686 @option{-fsized-deallocation}.
4688 @opindex Wno-suggest-final-types
4689 @opindex Wsuggest-final-types
4690 @item -Wsuggest-final-types
4691 Warn about types with virtual methods where code quality would be improved
4692 if the type were declared with the C++11 @code{final} specifier,
4693 or, if possible,
4694 declared in an anonymous namespace. This allows GCC to more aggressively
4695 devirtualize the polymorphic calls. This warning is more effective with
4696 link-time optimization,
4697 where the information about the class hierarchy graph is
4698 more complete.
4700 @opindex Wno-suggest-final-methods
4701 @opindex Wsuggest-final-methods
4702 @item -Wsuggest-final-methods
4703 Warn about virtual methods where code quality would be improved if the method
4704 were declared with the C++11 @code{final} specifier,
4705 or, if possible, its type were
4706 declared in an anonymous namespace or with the @code{final} specifier.
4707 This warning is
4708 more effective with link-time optimization, where the information about the
4709 class hierarchy graph is more complete. It is recommended to first consider
4710 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4711 annotations.
4713 @opindex Wsuggest-override
4714 @opindex Wno-suggest-override
4715 @item -Wsuggest-override
4716 Warn about overriding virtual functions that are not marked with the
4717 @code{override} keyword.
4719 @opindex Wuse-after-free
4720 @opindex Wno-use-after-free
4721 @item -Wuse-after-free
4722 @itemx -Wuse-after-free=@var{n}
4723 Warn about uses of pointers to dynamically allocated objects that have
4724 been rendered indeterminate by a call to a deallocation function.
4725 The warning is enabled at all optimization levels but may yield different
4726 results with optimization than without.
4728 @table @gcctabopt
4729 @item -Wuse-after-free=1
4730 At level 1 the warning attempts to diagnose only unconditional uses
4731 of pointers made indeterminate by a deallocation call or a successful
4732 call to @code{realloc}, regardless of whether or not the call resulted
4733 in an actual reallocatio of memory.  This includes double-@code{free}
4734 calls as well as uses in arithmetic and relational expressions.  Although
4735 undefined, uses of indeterminate pointers in equality (or inequality)
4736 expressions are not diagnosed at this level.
4737 @item -Wuse-after-free=2
4738 At level 2, in addition to unconditional uses, the warning also diagnoses
4739 conditional uses of pointers made indeterminate by a deallocation call.
4740 As at level 2, uses in equality (or inequality) expressions are not
4741 diagnosed.  For example, the second call to @code{free} in the following
4742 function is diagnosed at this level:
4743 @smallexample
4744 struct A @{ int refcount; void *data; @};
4746 void release (struct A *p)
4748   int refcount = --p->refcount;
4749   free (p);
4750   if (refcount == 0)
4751     free (p->data);   // warning: p may be used after free
4753 @end smallexample
4754 @item -Wuse-after-free=3
4755 At level 3, the warning also diagnoses uses of indeterminate pointers in
4756 equality expressions.  All uses of indeterminate pointers are undefined
4757 but equality tests sometimes appear after calls to @code{realloc} as
4758 an attempt to determine whether the call resulted in relocating the object
4759 to a different address.  They are diagnosed at a separate level to aid
4760 legacy code gradually transition to safe alternatives.  For example,
4761 the equality test in the function below is diagnosed at this level:
4762 @smallexample
4763 void adjust_pointers (int**, int);
4765 void grow (int **p, int n)
4767   int **q = (int**)realloc (p, n *= 2);
4768   if (q == p)
4769     return;
4770   adjust_pointers ((int**)q, n);
4772 @end smallexample
4773 To avoid the warning at this level, store offsets into allocated memory
4774 instead of pointers.  This approach obviates needing to adjust the stored
4775 pointers after reallocation.
4776 @end table
4778 @option{-Wuse-after-free=2} is included in @option{-Wall}.
4780 @opindex Wuseless-cast
4781 @opindex Wno-useless-cast
4782 @item -Wuseless-cast @r{(C, Objective-C, C++ and Objective-C++ only)}
4783 Warn when an expression is cast to its own type.  This warning does not
4784 occur when a class object is converted to a non-reference type as that
4785 is a way to create a temporary:
4787 @smallexample
4788 struct S @{ @};
4789 void g (S&&);
4790 void f (S&& arg)
4792   g (S(arg)); // make arg prvalue so that it can bind to S&&
4794 @end smallexample
4796 @opindex Wconversion-null
4797 @opindex Wno-conversion-null
4798 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4799 Do not warn for conversions between @code{NULL} and non-pointer
4800 types. @option{-Wconversion-null} is enabled by default.
4802 @end table
4804 @node Objective-C and Objective-C++ Dialect Options
4805 @section Options Controlling Objective-C and Objective-C++ Dialects
4807 @cindex compiler options, Objective-C and Objective-C++
4808 @cindex Objective-C and Objective-C++ options, command-line
4809 @cindex options, Objective-C and Objective-C++
4810 (NOTE: This manual does not describe the Objective-C and Objective-C++
4811 languages themselves.  @xref{Standards,,Language Standards
4812 Supported by GCC}, for references.)
4814 This section describes the command-line options that are only meaningful
4815 for Objective-C and Objective-C++ programs.  You can also use most of
4816 the language-independent GNU compiler options.
4817 For example, you might compile a file @file{some_class.m} like this:
4819 @smallexample
4820 gcc -g -fgnu-runtime -O -c some_class.m
4821 @end smallexample
4823 @noindent
4824 In this example, @option{-fgnu-runtime} is an option meant only for
4825 Objective-C and Objective-C++ programs; you can use the other options with
4826 any language supported by GCC@.
4828 Note that since Objective-C is an extension of the C language, Objective-C
4829 compilations may also use options specific to the C front-end (e.g.,
4830 @option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
4831 C++-specific options (e.g., @option{-Wabi}).
4833 Here is a list of options that are @emph{only} for compiling Objective-C
4834 and Objective-C++ programs:
4836 @table @gcctabopt
4837 @opindex fconstant-string-class
4838 @item -fconstant-string-class=@var{class-name}
4839 Use @var{class-name} as the name of the class to instantiate for each
4840 literal string specified with the syntax @code{@@"@dots{}"}.  The default
4841 class name is @code{NXConstantString} if the GNU runtime is being used, and
4842 @code{NSConstantString} if the NeXT runtime is being used (see below).  On
4843 Darwin / macOS platforms, the @option{-fconstant-cfstrings} option, if
4844 also present, overrides the @option{-fconstant-string-class} setting and cause
4845 @code{@@"@dots{}"} literals to be laid out as constant CoreFoundation strings.
4846 Note that @option{-fconstant-cfstrings} is an alias for the target-specific
4847 @option{-mconstant-cfstrings} equivalent.
4849 @opindex fgnu-runtime
4850 @item -fgnu-runtime
4851 Generate object code compatible with the standard GNU Objective-C
4852 runtime.  This is the default for most types of systems.
4854 @opindex fnext-runtime
4855 @item -fnext-runtime
4856 Generate output compatible with the NeXT runtime.  This is the default
4857 for NeXT-based systems, including Darwin / macOS.  The macro
4858 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
4859 used.
4861 @opindex fno-nil-receivers
4862 @opindex fnil-receivers
4863 @item -fno-nil-receivers
4864 Assume that all Objective-C message dispatches (@code{[receiver
4865 message:arg]}) in this translation unit ensure that the receiver is
4866 not @code{nil}.  This allows for more efficient entry points in the
4867 runtime to be used.  This option is only available in conjunction with
4868 the NeXT runtime and ABI version 0 or 1.
4870 @opindex fobjc-abi-version
4871 @item -fobjc-abi-version=@var{n}
4872 Use version @var{n} of the Objective-C ABI for the selected runtime.
4873 This option is currently supported only for the NeXT runtime.  In that
4874 case, Version 0 is the traditional (32-bit) ABI without support for
4875 properties and other Objective-C 2.0 additions.  Version 1 is the
4876 traditional (32-bit) ABI with support for properties and other
4877 Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
4878 nothing is specified, the default is Version 0 on 32-bit target
4879 machines, and Version 2 on 64-bit target machines.
4881 @opindex fobjc-call-cxx-cdtors
4882 @item -fobjc-call-cxx-cdtors
4883 For each Objective-C class, check if any of its instance variables is a
4884 C++ object with a non-trivial default constructor.  If so, synthesize a
4885 special @code{- (id) .cxx_construct} instance method which runs
4886 non-trivial default constructors on any such instance variables, in order,
4887 and then return @code{self}.  Similarly, check if any instance variable
4888 is a C++ object with a non-trivial destructor, and if so, synthesize a
4889 special @code{- (void) .cxx_destruct} method which runs
4890 all such default destructors, in reverse order.
4892 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
4893 methods thusly generated only operate on instance variables
4894 declared in the current Objective-C class, and not those inherited
4895 from superclasses.  It is the responsibility of the Objective-C
4896 runtime to invoke all such methods in an object's inheritance
4897 hierarchy.  The @code{- (id) .cxx_construct} methods are invoked
4898 by the runtime immediately after a new object instance is allocated;
4899 the @code{- (void) .cxx_destruct} methods are invoked immediately
4900 before the runtime deallocates an object instance.
4902 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
4903 support for invoking the @code{- (id) .cxx_construct} and
4904 @code{- (void) .cxx_destruct} methods.
4906 @opindex fobjc-direct-dispatch
4907 @item -fobjc-direct-dispatch
4908 Allow fast jumps to the message dispatcher.  On Darwin this is
4909 accomplished via the comm page.
4911 @opindex fobjc-exceptions
4912 @item -fobjc-exceptions
4913 Enable syntactic support for structured exception handling in
4914 Objective-C, similar to what is offered by C++.  This option
4915 is required to use the Objective-C keywords @code{@@try},
4916 @code{@@throw}, @code{@@catch}, @code{@@finally} and
4917 @code{@@synchronized}.  This option is available with both the GNU
4918 runtime and the NeXT runtime (but not available in conjunction with
4919 the NeXT runtime on Mac OS X 10.2 and earlier).
4921 @opindex fobjc-gc
4922 @item -fobjc-gc
4923 Enable garbage collection (GC) in Objective-C and Objective-C++
4924 programs.  This option is only available with the NeXT runtime; the
4925 GNU runtime has a different garbage collection implementation that
4926 does not require special compiler flags.
4928 @opindex fobjc-nilcheck
4929 @item -fobjc-nilcheck
4930 For the NeXT runtime with version 2 of the ABI, check for a nil
4931 receiver in method invocations before doing the actual method call.
4932 This is the default and can be disabled using
4933 @option{-fno-objc-nilcheck}.  Class methods and super calls are never
4934 checked for nil in this way no matter what this flag is set to.
4935 Currently this flag does nothing when the GNU runtime, or an older
4936 version of the NeXT runtime ABI, is used.
4938 @opindex fobjc-std
4939 @item -fobjc-std=objc1
4940 Conform to the language syntax of Objective-C 1.0, the language
4941 recognized by GCC 4.0.  This only affects the Objective-C additions to
4942 the C/C++ language; it does not affect conformance to C/C++ standards,
4943 which is controlled by the separate C/C++ dialect option flags.  When
4944 this option is used with the Objective-C or Objective-C++ compiler,
4945 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
4946 This is useful if you need to make sure that your Objective-C code can
4947 be compiled with older versions of GCC@.
4949 @opindex freplace-objc-classes
4950 @item -freplace-objc-classes
4951 Emit a special marker instructing @command{ld(1)} not to statically link in
4952 the resulting object file, and allow @command{dyld(1)} to load it in at
4953 run time instead.  This is used in conjunction with the Fix-and-Continue
4954 debugging mode, where the object file in question may be recompiled and
4955 dynamically reloaded in the course of program execution, without the need
4956 to restart the program itself.  Currently, Fix-and-Continue functionality
4957 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
4958 and later.
4960 @opindex fzero-link
4961 @item -fzero-link
4962 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
4963 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
4964 compile time) with static class references that get initialized at load time,
4965 which improves run-time performance.  Specifying the @option{-fzero-link} flag
4966 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
4967 to be retained.  This is useful in Zero-Link debugging mode, since it allows
4968 for individual class implementations to be modified during program execution.
4969 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
4970 regardless of command-line options.
4972 @opindex fno-local-ivars
4973 @opindex flocal-ivars
4974 @item -fno-local-ivars
4975 By default instance variables in Objective-C can be accessed as if
4976 they were local variables from within the methods of the class they're
4977 declared in.  This can lead to shadowing between instance variables
4978 and other variables declared either locally inside a class method or
4979 globally with the same name.  Specifying the @option{-fno-local-ivars}
4980 flag disables this behavior thus avoiding variable shadowing issues.
4982 @opindex fivar-visibility
4983 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
4984 Set the default instance variable visibility to the specified option
4985 so that instance variables declared outside the scope of any access
4986 modifier directives default to the specified visibility.
4988 @opindex gen-decls
4989 @item -gen-decls
4990 Dump interface declarations for all classes seen in the source file to a
4991 file named @file{@var{sourcename}.decl}.
4993 @opindex Wassign-intercept
4994 @opindex Wno-assign-intercept
4995 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
4996 Warn whenever an Objective-C assignment is being intercepted by the
4997 garbage collector.
4999 @opindex Wproperty-assign-default
5000 @opindex Wno-property-assign-default
5001 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
5002 Do not warn if a property for an Objective-C object has no assign
5003 semantics specified.
5005 @opindex Wno-protocol
5006 @opindex Wprotocol
5007 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
5008 If a class is declared to implement a protocol, a warning is issued for
5009 every method in the protocol that is not implemented by the class.  The
5010 default behavior is to issue a warning for every method not explicitly
5011 implemented in the class, even if a method implementation is inherited
5012 from the superclass.  If you use the @option{-Wno-protocol} option, then
5013 methods inherited from the superclass are considered to be implemented,
5014 and no warning is issued for them.
5016 @opindex Wobjc-root-class
5017 @item -Wobjc-root-class @r{(Objective-C and Objective-C++ only)}
5018 Warn if a class interface lacks a superclass. Most classes will inherit
5019 from @code{NSObject} (or @code{Object}) for example.  When declaring
5020 classes intended to be root classes, the warning can be suppressed by
5021 marking their interfaces with @code{__attribute__((objc_root_class))}.
5023 @opindex Wselector
5024 @opindex Wno-selector
5025 @item -Wselector @r{(Objective-C and Objective-C++ only)}
5026 Warn if multiple methods of different types for the same selector are
5027 found during compilation.  The check is performed on the list of methods
5028 in the final stage of compilation.  Additionally, a check is performed
5029 for each selector appearing in a @code{@@selector(@dots{})}
5030 expression, and a corresponding method for that selector has been found
5031 during compilation.  Because these checks scan the method table only at
5032 the end of compilation, these warnings are not produced if the final
5033 stage of compilation is not reached, for example because an error is
5034 found during compilation, or because the @option{-fsyntax-only} option is
5035 being used.
5037 @opindex Wstrict-selector-match
5038 @opindex Wno-strict-selector-match
5039 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
5040 Warn if multiple methods with differing argument and/or return types are
5041 found for a given selector when attempting to send a message using this
5042 selector to a receiver of type @code{id} or @code{Class}.  When this flag
5043 is off (which is the default behavior), the compiler omits such warnings
5044 if any differences found are confined to types that share the same size
5045 and alignment.
5047 @opindex Wundeclared-selector
5048 @opindex Wno-undeclared-selector
5049 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
5050 Warn if a @code{@@selector(@dots{})} expression referring to an
5051 undeclared selector is found.  A selector is considered undeclared if no
5052 method with that name has been declared before the
5053 @code{@@selector(@dots{})} expression, either explicitly in an
5054 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
5055 an @code{@@implementation} section.  This option always performs its
5056 checks as soon as a @code{@@selector(@dots{})} expression is found,
5057 while @option{-Wselector} only performs its checks in the final stage of
5058 compilation.  This also enforces the coding style convention
5059 that methods and selectors must be declared before being used.
5061 @opindex print-objc-runtime-info
5062 @item -print-objc-runtime-info
5063 Generate C header describing the largest structure that is passed by
5064 value, if any.
5066 @end table
5068 @node Diagnostic Message Formatting Options
5069 @section Options to Control Diagnostic Messages Formatting
5070 @cindex options to control diagnostics formatting
5071 @cindex diagnostic messages
5072 @cindex message formatting
5074 Traditionally, diagnostic messages have been formatted irrespective of
5075 the output device's aspect (e.g.@: its width, @dots{}).  You can use the
5076 options described below
5077 to control the formatting algorithm for diagnostic messages, 
5078 e.g.@: how many characters per line, how often source location
5079 information should be reported.  Note that some language front ends may not
5080 honor these options.
5082 @table @gcctabopt
5083 @opindex fmessage-length
5084 @item -fmessage-length=@var{n}
5085 Try to format error messages so that they fit on lines of about
5086 @var{n} characters.  If @var{n} is zero, then no line-wrapping is
5087 done; each error message appears on a single line.  This is the
5088 default for all front ends.
5090 Note - this option also affects the display of the @samp{#error} and
5091 @samp{#warning} pre-processor directives, and the @samp{deprecated}
5092 function/type/variable attribute.  It does not however affect the
5093 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
5095 @item -fdiagnostics-plain-output
5096 This option requests that diagnostic output look as plain as possible, which
5097 may be useful when running @command{dejagnu} or other utilities that need to
5098 parse diagnostics output and prefer that it remain more stable over time.
5099 @option{-fdiagnostics-plain-output} is currently equivalent to the following
5100 options:
5101 @gccoptlist{-fno-diagnostics-show-caret
5102 -fno-diagnostics-show-line-numbers
5103 -fdiagnostics-color=never
5104 -fdiagnostics-urls=never
5105 -fdiagnostics-path-format=separate-events
5106 -fdiagnostics-text-art-charset=none}
5107 In the future, if GCC changes the default appearance of its diagnostics, the
5108 corresponding option to disable the new behavior will be added to this list.
5110 @opindex fdiagnostics-show-location
5111 @item -fdiagnostics-show-location=once
5112 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
5113 reporter to emit source location information @emph{once}; that is, in
5114 case the message is too long to fit on a single physical line and has to
5115 be wrapped, the source location won't be emitted (as prefix) again,
5116 over and over, in subsequent continuation lines.  This is the default
5117 behavior.
5119 @item -fdiagnostics-show-location=every-line
5120 Only meaningful in line-wrapping mode.  Instructs the diagnostic
5121 messages reporter to emit the same source location information (as
5122 prefix) for physical lines that result from the process of breaking
5123 a message which is too long to fit on a single line.
5125 @opindex fdiagnostics-color
5126 @cindex highlight, color
5127 @vindex GCC_COLORS @r{environment variable}
5128 @item -fdiagnostics-color[=@var{WHEN}]
5129 @itemx -fno-diagnostics-color
5130 Use color in diagnostics.  @var{WHEN} is @samp{never}, @samp{always},
5131 or @samp{auto}.  The default depends on how the compiler has been configured,
5132 it can be any of the above @var{WHEN} options or also @samp{never}
5133 if @env{GCC_COLORS} environment variable isn't present in the environment,
5134 and @samp{auto} otherwise.
5135 @samp{auto} makes GCC use color only when the standard error is a terminal,
5136 and when not executing in an emacs shell.
5137 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
5138 aliases for @option{-fdiagnostics-color=always} and
5139 @option{-fdiagnostics-color=never}, respectively.
5141 The colors are defined by the environment variable @env{GCC_COLORS}.
5142 Its value is a colon-separated list of capabilities and Select Graphic
5143 Rendition (SGR) substrings. SGR commands are interpreted by the
5144 terminal or terminal emulator.  (See the section in the documentation
5145 of your text terminal for permitted values and their meanings as
5146 character attributes.)  These substring values are integers in decimal
5147 representation and can be concatenated with semicolons.
5148 Common values to concatenate include
5149 @samp{1} for bold,
5150 @samp{4} for underline,
5151 @samp{5} for blink,
5152 @samp{7} for inverse,
5153 @samp{39} for default foreground color,
5154 @samp{30} to @samp{37} for foreground colors,
5155 @samp{90} to @samp{97} for 16-color mode foreground colors,
5156 @samp{38;5;0} to @samp{38;5;255}
5157 for 88-color and 256-color modes foreground colors,
5158 @samp{49} for default background color,
5159 @samp{40} to @samp{47} for background colors,
5160 @samp{100} to @samp{107} for 16-color mode background colors,
5161 and @samp{48;5;0} to @samp{48;5;255}
5162 for 88-color and 256-color modes background colors.
5164 The default @env{GCC_COLORS} is
5165 @smallexample
5166 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
5167 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
5168 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
5169 type-diff=01;32:fnname=01;32:targs=35
5170 @end smallexample
5171 @noindent
5172 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
5173 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
5174 @samp{01} is bold, and @samp{31} is red.
5175 Setting @env{GCC_COLORS} to the empty string disables colors.
5176 Supported capabilities are as follows.
5178 @table @code
5179 @vindex error GCC_COLORS @r{capability}
5180 @item error=
5181 SGR substring for error: markers.
5183 @vindex warning GCC_COLORS @r{capability}
5184 @item warning=
5185 SGR substring for warning: markers.
5187 @vindex note GCC_COLORS @r{capability}
5188 @item note=
5189 SGR substring for note: markers.
5191 @vindex path GCC_COLORS @r{capability}
5192 @item path=
5193 SGR substring for colorizing paths of control-flow events as printed
5194 via @option{-fdiagnostics-path-format=}, such as the identifiers of
5195 individual events and lines indicating interprocedural calls and returns.
5197 @vindex range1 GCC_COLORS @r{capability}
5198 @item range1=
5199 SGR substring for first additional range.
5201 @vindex range2 GCC_COLORS @r{capability}
5202 @item range2=
5203 SGR substring for second additional range.
5205 @vindex locus GCC_COLORS @r{capability}
5206 @item locus=
5207 SGR substring for location information, @samp{file:line} or
5208 @samp{file:line:column} etc.
5210 @vindex quote GCC_COLORS @r{capability}
5211 @item quote=
5212 SGR substring for information printed within quotes.
5214 @vindex fnname GCC_COLORS @r{capability}
5215 @item fnname=
5216 SGR substring for names of C++ functions.
5218 @vindex targs GCC_COLORS @r{capability}
5219 @item targs=
5220 SGR substring for C++ function template parameter bindings.
5222 @vindex fixit-insert GCC_COLORS @r{capability}
5223 @item fixit-insert=
5224 SGR substring for fix-it hints suggesting text to
5225 be inserted or replaced.
5227 @vindex fixit-delete GCC_COLORS @r{capability}
5228 @item fixit-delete=
5229 SGR substring for fix-it hints suggesting text to
5230 be deleted.
5232 @vindex diff-filename GCC_COLORS @r{capability}
5233 @item diff-filename=
5234 SGR substring for filename headers within generated patches.
5236 @vindex diff-hunk GCC_COLORS @r{capability}
5237 @item diff-hunk=
5238 SGR substring for the starts of hunks within generated patches.
5240 @vindex diff-delete GCC_COLORS @r{capability}
5241 @item diff-delete=
5242 SGR substring for deleted lines within generated patches.
5244 @vindex diff-insert GCC_COLORS @r{capability}
5245 @item diff-insert=
5246 SGR substring for inserted lines within generated patches.
5248 @vindex type-diff GCC_COLORS @r{capability}
5249 @item type-diff=
5250 SGR substring for highlighting mismatching types within template
5251 arguments in the C++ frontend.
5252 @end table
5254 @opindex fdiagnostics-urls
5255 @cindex urls
5256 @vindex GCC_URLS @r{environment variable}
5257 @vindex TERM_URLS @r{environment variable}
5258 @item -fdiagnostics-urls[=@var{WHEN}]
5259 Use escape sequences to embed URLs in diagnostics.  For example, when
5260 @option{-fdiagnostics-show-option} emits text showing the command-line
5261 option controlling a diagnostic, embed a URL for documentation of that
5262 option.
5264 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
5265 @samp{auto} makes GCC use URL escape sequences only when the standard error
5266 is a terminal, and when not executing in an emacs shell or any graphical
5267 terminal which is known to be incompatible with this feature, see below.
5269 The default depends on how the compiler has been configured.
5270 It can be any of the above @var{WHEN} options.
5272 GCC can also be configured (via the
5273 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
5274 so that the default is affected by environment variables.
5275 Under such a configuration, GCC defaults to using @samp{auto}
5276 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
5277 present and non-empty in the environment of the compiler, or @samp{never}
5278 if neither are.
5280 However, even with @option{-fdiagnostics-urls=always} the behavior is
5281 dependent on those environment variables:
5282 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
5283 diagnostics.  If set to @samp{st}, URLs use ST escape sequences.
5284 If set to @samp{bel}, the default, URLs use BEL escape sequences.
5285 Any other non-empty value enables the feature.
5286 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
5287 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
5288 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
5290 At this time GCC tries to detect also a few terminals that are known to
5291 not implement the URL feature, and have bugs or at least had bugs in
5292 some versions that are still in use, where the URL escapes are likely
5293 to misbehave, i.e. print garbage on the screen.
5294 That list is currently xfce4-terminal, certain known to be buggy
5295 gnome-terminal versions, the linux console, and mingw.
5296 This check can be skipped with the @option{-fdiagnostics-urls=always}.
5298 @opindex fno-diagnostics-show-option
5299 @opindex fdiagnostics-show-option
5300 @item -fno-diagnostics-show-option
5301 By default, each diagnostic emitted includes text indicating the
5302 command-line option that directly controls the diagnostic (if such an
5303 option is known to the diagnostic machinery).  Specifying the
5304 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
5306 @opindex fno-diagnostics-show-caret
5307 @opindex fdiagnostics-show-caret
5308 @item -fno-diagnostics-show-caret
5309 By default, each diagnostic emitted includes the original source line
5310 and a caret @samp{^} indicating the column.  This option suppresses this
5311 information.  The source line is truncated to @var{n} characters, if
5312 the @option{-fmessage-length=n} option is given.  When the output is done
5313 to the terminal, the width is limited to the width given by the
5314 @env{COLUMNS} environment variable or, if not set, to the terminal width.
5316 @opindex fno-diagnostics-show-labels
5317 @opindex fdiagnostics-show-labels
5318 @item -fno-diagnostics-show-labels
5319 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5320 diagnostics can label ranges of source code with pertinent information, such
5321 as the types of expressions:
5323 @smallexample
5324     printf ("foo %s bar", long_i + long_j);
5325                  ~^       ~~~~~~~~~~~~~~~
5326                   |              |
5327                   char *         long int
5328 @end smallexample
5330 This option suppresses the printing of these labels (in the example above,
5331 the vertical bars and the ``char *'' and ``long int'' text).
5333 @opindex fno-diagnostics-show-cwe
5334 @opindex fdiagnostics-show-cwe
5335 @item -fno-diagnostics-show-cwe
5336 Diagnostic messages can optionally have an associated
5337 @uref{https://cwe.mitre.org/index.html, CWE} identifier.
5338 GCC itself only provides such metadata for some of the @option{-fanalyzer}
5339 diagnostics.  GCC plugins may also provide diagnostics with such metadata.
5340 By default, if this information is present, it will be printed with
5341 the diagnostic.  This option suppresses the printing of this metadata.
5343 @opindex fno-diagnostics-show-rules
5344 @opindex fdiagnostics-show-rules
5345 @item -fno-diagnostics-show-rules
5346 Diagnostic messages can optionally have rules associated with them, such
5347 as from a coding standard, or a specification.
5348 GCC itself does not do this for any of its diagnostics, but plugins may do so.
5349 By default, if this information is present, it will be printed with
5350 the diagnostic.  This option suppresses the printing of this metadata.
5352 @opindex fno-diagnostics-show-line-numbers
5353 @opindex fdiagnostics-show-line-numbers
5354 @item -fno-diagnostics-show-line-numbers
5355 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
5356 a left margin is printed, showing line numbers.  This option suppresses this
5357 left margin.
5359 @opindex fdiagnostics-minimum-margin-width
5360 @item -fdiagnostics-minimum-margin-width=@var{width}
5361 This option controls the minimum width of the left margin printed by
5362 @option{-fdiagnostics-show-line-numbers}.  It defaults to 6.
5364 @opindex fdiagnostics-parseable-fixits
5365 @item -fdiagnostics-parseable-fixits
5366 Emit fix-it hints in a machine-parseable format, suitable for consumption
5367 by IDEs.  For each fix-it, a line will be printed after the relevant
5368 diagnostic, starting with the string ``fix-it:''.  For example:
5370 @smallexample
5371 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
5372 @end smallexample
5374 The location is expressed as a half-open range, expressed as a count of
5375 bytes, starting at byte 1 for the initial column.  In the above example,
5376 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
5377 given string:
5379 @smallexample
5380 00000000011111111112222222222
5381 12345678901234567890123456789
5382   gtk_widget_showall (dlg);
5383   ^^^^^^^^^^^^^^^^^^
5384   gtk_widget_show_all
5385 @end smallexample
5387 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
5388 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
5389 (e.g. vertical tab as ``\013'').
5391 An empty replacement string indicates that the given range is to be removed.
5392 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
5393 be inserted at the given position.
5395 @opindex fdiagnostics-generate-patch
5396 @item -fdiagnostics-generate-patch
5397 Print fix-it hints to stderr in unified diff format, after any diagnostics
5398 are printed.  For example:
5400 @smallexample
5401 --- test.c
5402 +++ test.c
5403 @@ -42,5 +42,5 @@
5405  void show_cb(GtkDialog *dlg)
5406  @{
5407 -  gtk_widget_showall(dlg);
5408 +  gtk_widget_show_all(dlg);
5409  @}
5411 @end smallexample
5413 The diff may or may not be colorized, following the same rules
5414 as for diagnostics (see @option{-fdiagnostics-color}).
5416 @opindex fdiagnostics-show-template-tree
5417 @item -fdiagnostics-show-template-tree
5419 In the C++ frontend, when printing diagnostics showing mismatching
5420 template types, such as:
5422 @smallexample
5423   could not convert 'std::map<int, std::vector<double> >()'
5424     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5425 @end smallexample
5427 the @option{-fdiagnostics-show-template-tree} flag enables printing a
5428 tree-like structure showing the common and differing parts of the types,
5429 such as:
5431 @smallexample
5432   map<
5433     [...],
5434     vector<
5435       [double != float]>>
5436 @end smallexample
5438 The parts that differ are highlighted with color (``double'' and
5439 ``float'' in this case).
5441 @opindex fno-elide-type
5442 @opindex felide-type
5443 @item -fno-elide-type
5444 By default when the C++ frontend prints diagnostics showing mismatching
5445 template types, common parts of the types are printed as ``[...]'' to
5446 simplify the error message.  For example:
5448 @smallexample
5449   could not convert 'std::map<int, std::vector<double> >()'
5450     from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
5451 @end smallexample
5453 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
5454 This flag also affects the output of the
5455 @option{-fdiagnostics-show-template-tree} flag.
5457 @opindex fdiagnostics-path-format
5458 @item -fdiagnostics-path-format=@var{KIND}
5459 Specify how to print paths of control-flow events for diagnostics that
5460 have such a path associated with them.
5462 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
5463 the default.
5465 @samp{none} means to not print diagnostic paths.
5467 @samp{separate-events} means to print a separate ``note'' diagnostic for
5468 each event within the diagnostic.  For example:
5470 @smallexample
5471 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
5472 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
5473 test.c:27:3: note: (2) when 'i < count'
5474 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5475 @end smallexample
5477 @samp{inline-events} means to print the events ``inline'' within the source
5478 code.  This view attempts to consolidate the events into runs of
5479 sufficiently-close events, printing them as labelled ranges within the source.
5481 For example, the same events as above might be printed as:
5483 @smallexample
5484   'test': events 1-3
5485     |
5486     |   25 |   list = PyList_New(0);
5487     |      |          ^~~~~~~~~~~~~
5488     |      |          |
5489     |      |          (1) when 'PyList_New' fails, returning NULL
5490     |   26 |
5491     |   27 |   for (i = 0; i < count; i++) @{
5492     |      |   ~~~
5493     |      |   |
5494     |      |   (2) when 'i < count'
5495     |   28 |     item = PyLong_FromLong(random());
5496     |   29 |     PyList_Append(list, item);
5497     |      |     ~~~~~~~~~~~~~~~~~~~~~~~~~
5498     |      |     |
5499     |      |     (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
5500     |
5501 @end smallexample
5503 Interprocedural control flow is shown by grouping the events by stack frame,
5504 and using indentation to show how stack frames are nested, pushed, and popped.
5506 For example:
5508 @smallexample
5509   'test': events 1-2
5510     |
5511     |  133 | @{
5512     |      | ^
5513     |      | |
5514     |      | (1) entering 'test'
5515     |  134 |   boxed_int *obj = make_boxed_int (i);
5516     |      |                    ~~~~~~~~~~~~~~~~~~
5517     |      |                    |
5518     |      |                    (2) calling 'make_boxed_int'
5519     |
5520     +--> 'make_boxed_int': events 3-4
5521            |
5522            |  120 | @{
5523            |      | ^
5524            |      | |
5525            |      | (3) entering 'make_boxed_int'
5526            |  121 |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
5527            |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5528            |      |                                    |
5529            |      |                                    (4) calling 'wrapped_malloc'
5530            |
5531            +--> 'wrapped_malloc': events 5-6
5532                   |
5533                   |    7 | @{
5534                   |      | ^
5535                   |      | |
5536                   |      | (5) entering 'wrapped_malloc'
5537                   |    8 |   return malloc (size);
5538                   |      |          ~~~~~~~~~~~~~
5539                   |      |          |
5540                   |      |          (6) calling 'malloc'
5541                   |
5542     <-------------+
5543     |
5544  'test': event 7
5545     |
5546     |  138 |   free_boxed_int (obj);
5547     |      |   ^~~~~~~~~~~~~~~~~~~~
5548     |      |   |
5549     |      |   (7) calling 'free_boxed_int'
5550     |
5551 (etc)
5552 @end smallexample
5554 @opindex fdiagnostics-show-path-depths
5555 @item -fdiagnostics-show-path-depths
5556 This option provides additional information when printing control-flow paths
5557 associated with a diagnostic.
5559 If this is option is provided then the stack depth will be printed for
5560 each run of events within @option{-fdiagnostics-path-format=inline-events}.
5561 If provided with @option{-fdiagnostics-path-format=separate-events}, then
5562 the stack depth and function declaration will be appended when printing
5563 each event.
5565 This is intended for use by GCC developers and plugin developers when
5566 debugging diagnostics that report interprocedural control flow.
5568 @opindex fno-show-column
5569 @opindex fshow-column
5570 @item -fno-show-column
5571 Do not print column numbers in diagnostics.  This may be necessary if
5572 diagnostics are being scanned by a program that does not understand the
5573 column numbers, such as @command{dejagnu}.
5575 @opindex fdiagnostics-column-unit
5576 @item -fdiagnostics-column-unit=@var{UNIT}
5577 Select the units for the column number.  This affects traditional diagnostics
5578 (in the absence of @option{-fno-show-column}), as well as JSON format
5579 diagnostics if requested.
5581 The default @var{UNIT}, @samp{display}, considers the number of display
5582 columns occupied by each character.  This may be larger than the number
5583 of bytes required to encode the character, in the case of tab
5584 characters, or it may be smaller, in the case of multibyte characters.
5585 For example, the character ``GREEK SMALL LETTER PI (U+03C0)'' occupies one
5586 display column, and its UTF-8 encoding requires two bytes; the character
5587 ``SLIGHTLY SMILING FACE (U+1F642)'' occupies two display columns, and
5588 its UTF-8 encoding requires four bytes.
5590 Setting @var{UNIT} to @samp{byte} changes the column number to the raw byte
5591 count in all cases, as was traditionally output by GCC prior to version 11.1.0.
5593 @opindex fdiagnostics-column-origin
5594 @item -fdiagnostics-column-origin=@var{ORIGIN}
5595 Select the origin for column numbers, i.e. the column number assigned to the
5596 first column.  The default value of 1 corresponds to traditional GCC
5597 behavior and to the GNU style guide.  Some utilities may perform better with an
5598 origin of 0; any non-negative value may be specified.
5600 @opindex fdiagnostics-escape-format
5601 @item -fdiagnostics-escape-format=@var{FORMAT}
5602 When GCC prints pertinent source lines for a diagnostic it normally attempts
5603 to print the source bytes directly.  However, some diagnostics relate to encoding
5604 issues in the source file, such as malformed UTF-8, or issues with Unicode
5605 normalization.  These diagnostics are flagged so that GCC will escape bytes
5606 that are not printable ASCII when printing their pertinent source lines.
5608 This option controls how such bytes should be escaped.
5610 The default @var{FORMAT}, @samp{unicode} displays Unicode characters that
5611 are not printable ASCII in the form @samp{<U+XXXX>}, and bytes that do not
5612 correspond to a Unicode character validly-encoded in UTF-8-encoded will be
5613 displayed as hexadecimal in the form @samp{<XX>}.
5615 For example, a source line containing the string @samp{before} followed by the
5616 Unicode character U+03C0 (``GREEK SMALL LETTER PI'', with UTF-8 encoding
5617 0xCF 0x80) followed by the byte 0xBF (a stray UTF-8 trailing byte), followed by
5618 the string @samp{after} will be printed for such a diagnostic as:
5620 @smallexample
5621  before<U+03C0><BF>after
5622 @end smallexample
5624 Setting @var{FORMAT} to @samp{bytes} will display all non-printable-ASCII bytes
5625 in the form @samp{<XX>}, thus showing the underlying encoding of non-ASCII
5626 Unicode characters.  For the example above, the following will be printed:
5628 @smallexample
5629  before<CF><80><BF>after
5630 @end smallexample
5632 @opindex fdiagnostics-text-art-charset
5633 @item -fdiagnostics-text-art-charset=@var{CHARSET}
5634 Some diagnostics can contain ``text art'' diagrams: visualizations created
5635 from text, intended to be viewed in a monospaced font.
5637 This option selects which characters should be used for printing such
5638 diagrams, if any.  @var{CHARSET} is @samp{none}, @samp{ascii}, @samp{unicode},
5639 or @samp{emoji}.
5641 The @samp{none} value suppresses the printing of such diagrams.
5642 The @samp{ascii} value will ensure that such diagrams are pure ASCII
5643 (``ASCII art'').  The @samp{unicode} value will allow for conservative use of
5644 unicode drawing characters (such as box-drawing characters).  The @samp{emoji}
5645 value further adds the possibility of emoji in the output (such as emitting
5646 U+26A0 WARNING SIGN followed by U+FE0F VARIATION SELECTOR-16 to select the
5647 emoji variant of the character).
5649 The default is @samp{emoji}.
5651 @opindex fdiagnostics-format
5652 @item -fdiagnostics-format=@var{FORMAT}
5653 Select a different format for printing diagnostics.
5654 @var{FORMAT} is @samp{text}, @samp{sarif-stderr}, @samp{sarif-file},
5655 @samp{json}, @samp{json-stderr}, or @samp{json-file}.
5657 The default is @samp{text}.
5659 The @samp{sarif-stderr} and @samp{sarif-file} formats both emit
5660 diagnostics in SARIF Version 2.1.0 format, either to stderr, or to a file
5661 named @file{@var{source}.sarif}, respectively.
5663 The @samp{json} format is a synonym for @samp{json-stderr}.
5664 The @samp{json-stderr} and @samp{json-file} formats are identical, apart from
5665 where the JSON is emitted to - with the former, the JSON is emitted to stderr,
5666 whereas with @samp{json-file} it is written to @file{@var{source}.gcc.json}.
5668 The emitted JSON consists of a top-level JSON array containing JSON objects
5669 representing the diagnostics.  The JSON is emitted as one line, without
5670 formatting; the examples below have been formatted for clarity.
5672 Diagnostics can have child diagnostics.  For example, this error and note:
5674 @smallexample
5675 misleading-indentation.c:15:3: warning: this 'if' clause does not
5676   guard... [-Wmisleading-indentation]
5677    15 |   if (flag)
5678       |   ^~
5679 misleading-indentation.c:17:5: note: ...this statement, but the latter
5680   is misleadingly indented as if it were guarded by the 'if'
5681    17 |     y = 2;
5682       |     ^
5683 @end smallexample
5685 @noindent
5686 might be printed in JSON form (after formatting) like this:
5688 @smallexample
5690     @{
5691         "kind": "warning",
5692         "locations": [
5693             @{
5694                 "caret": @{
5695                     "display-column": 3,
5696                     "byte-column": 3,
5697                     "column": 3,
5698                     "file": "misleading-indentation.c",
5699                     "line": 15
5700                 @},
5701                 "finish": @{
5702                     "display-column": 4,
5703                     "byte-column": 4,
5704                     "column": 4,
5705                     "file": "misleading-indentation.c",
5706                     "line": 15
5707                 @}
5708             @}
5709         ],
5710         "message": "this \u2018if\u2019 clause does not guard...",
5711         "option": "-Wmisleading-indentation",
5712         "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
5713         "children": [
5714             @{
5715                 "kind": "note",
5716                 "locations": [
5717                     @{
5718                         "caret": @{
5719                             "display-column": 5,
5720                             "byte-column": 5,
5721                             "column": 5,
5722                             "file": "misleading-indentation.c",
5723                             "line": 17
5724                         @}
5725                     @}
5726                 ],
5727                 "escape-source": false,
5728                 "message": "...this statement, but the latter is @dots{}"
5729             @}
5730         ]
5731         "escape-source": false,
5732         "column-origin": 1,
5733     @}
5735 @end smallexample
5737 @noindent
5738 where the @code{note} is a child of the @code{warning}.
5740 A diagnostic has a @code{kind}.  If this is @code{warning}, then there is
5741 an @code{option} key describing the command-line option controlling the
5742 warning.
5744 A diagnostic can contain zero or more locations.  Each location has an
5745 optional @code{label} string and up to three positions within it: a
5746 @code{caret} position and optional @code{start} and @code{finish} positions.
5747 A position is described by a @code{file} name, a @code{line} number, and
5748 three numbers indicating a column position:
5749 @itemize @bullet
5751 @item
5752 @code{display-column} counts display columns, accounting for tabs and
5753 multibyte characters.
5755 @item
5756 @code{byte-column} counts raw bytes.
5758 @item
5759 @code{column} is equal to one of
5760 the previous two, as dictated by the @option{-fdiagnostics-column-unit}
5761 option.
5763 @end itemize
5764 All three columns are relative to the origin specified by
5765 @option{-fdiagnostics-column-origin}, which is typically equal to 1 but may
5766 be set, for instance, to 0 for compatibility with other utilities that
5767 number columns from 0.  The column origin is recorded in the JSON output in
5768 the @code{column-origin} tag.  In the remaining examples below, the extra
5769 column number outputs have been omitted for brevity.
5771 For example, this error:
5773 @smallexample
5774 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
5775    'struct s'@} and 'T' @{aka 'struct t'@})
5776    64 |   return callee_4a () + callee_4b ();
5777       |          ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
5778       |          |              |
5779       |          |              T @{aka struct t@}
5780       |          S @{aka struct s@}
5781 @end smallexample
5783 @noindent
5784 has three locations.  Its primary location is at the ``+'' token at column
5785 23.  It has two secondary locations, describing the left and right-hand sides
5786 of the expression, which have labels.  It might be printed in JSON form as:
5788 @smallexample
5789     @{
5790         "children": [],
5791         "kind": "error",
5792         "locations": [
5793             @{
5794                 "caret": @{
5795                     "column": 23, "file": "bad-binary-ops.c", "line": 64
5796                 @}
5797             @},
5798             @{
5799                 "caret": @{
5800                     "column": 10, "file": "bad-binary-ops.c", "line": 64
5801                 @},
5802                 "finish": @{
5803                     "column": 21, "file": "bad-binary-ops.c", "line": 64
5804                 @},
5805                 "label": "S @{aka struct s@}"
5806             @},
5807             @{
5808                 "caret": @{
5809                     "column": 25, "file": "bad-binary-ops.c", "line": 64
5810                 @},
5811                 "finish": @{
5812                     "column": 36, "file": "bad-binary-ops.c", "line": 64
5813                 @},
5814                 "label": "T @{aka struct t@}"
5815             @}
5816         ],
5817         "escape-source": false,
5818         "message": "invalid operands to binary + @dots{}"
5819     @}
5820 @end smallexample
5822 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
5823 consisting of half-open intervals, similar to the output of
5824 @option{-fdiagnostics-parseable-fixits}.  For example, this diagnostic
5825 with a replacement fix-it hint:
5827 @smallexample
5828 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
5829   mean 'color'?
5830     8 |   return ptr->colour;
5831       |               ^~~~~~
5832       |               color
5833 @end smallexample
5835 @noindent
5836 might be printed in JSON form as:
5838 @smallexample
5839     @{
5840         "children": [],
5841         "fixits": [
5842             @{
5843                 "next": @{
5844                     "column": 21,
5845                     "file": "demo.c",
5846                     "line": 8
5847                 @},
5848                 "start": @{
5849                     "column": 15,
5850                     "file": "demo.c",
5851                     "line": 8
5852                 @},
5853                 "string": "color"
5854             @}
5855         ],
5856         "kind": "error",
5857         "locations": [
5858             @{
5859                 "caret": @{
5860                     "column": 15,
5861                     "file": "demo.c",
5862                     "line": 8
5863                 @},
5864                 "finish": @{
5865                     "column": 20,
5866                     "file": "demo.c",
5867                     "line": 8
5868                 @}
5869             @}
5870         ],
5871         "escape-source": false,
5872         "message": "\u2018struct s\u2019 has no member named @dots{}"
5873     @}
5874 @end smallexample
5876 @noindent
5877 where the fix-it hint suggests replacing the text from @code{start} up
5878 to but not including @code{next} with @code{string}'s value.  Deletions
5879 are expressed via an empty value for @code{string}, insertions by
5880 having @code{start} equal @code{next}.
5882 If the diagnostic has a path of control-flow events associated with it,
5883 it has a @code{path} array of objects representing the events.  Each
5884 event object has a @code{description} string, a @code{location} object,
5885 along with a @code{function} string and a @code{depth} number for
5886 representing interprocedural paths.  The @code{function} represents the
5887 current function at that event, and the @code{depth} represents the
5888 stack depth relative to some baseline: the higher, the more frames are
5889 within the stack.
5891 For example, the intraprocedural example shown for
5892 @option{-fdiagnostics-path-format=} might have this JSON for its path:
5894 @smallexample
5895     "path": [
5896         @{
5897             "depth": 0,
5898             "description": "when 'PyList_New' fails, returning NULL",
5899             "function": "test",
5900             "location": @{
5901                 "column": 10,
5902                 "file": "test.c",
5903                 "line": 25
5904             @}
5905         @},
5906         @{
5907             "depth": 0,
5908             "description": "when 'i < count'",
5909             "function": "test",
5910             "location": @{
5911                 "column": 3,
5912                 "file": "test.c",
5913                 "line": 27
5914             @}
5915         @},
5916         @{
5917             "depth": 0,
5918             "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
5919             "function": "test",
5920             "location": @{
5921                 "column": 5,
5922                 "file": "test.c",
5923                 "line": 29
5924             @}
5925         @}
5926     ]
5927 @end smallexample
5929 Diagnostics have a boolean attribute @code{escape-source}, hinting whether
5930 non-ASCII bytes should be escaped when printing the pertinent lines of
5931 source code (@code{true} for diagnostics involving source encoding issues).
5933 @end table
5935 @node Warning Options
5936 @section Options to Request or Suppress Warnings
5937 @cindex options to control warnings
5938 @cindex warning messages
5939 @cindex messages, warning
5940 @cindex suppressing warnings
5942 Warnings are diagnostic messages that report constructions that
5943 are not inherently erroneous but that are risky or suggest there
5944 may have been an error.
5946 The following language-independent options do not enable specific
5947 warnings but control the kinds of diagnostics produced by GCC@.
5949 @table @gcctabopt
5950 @cindex syntax checking
5951 @opindex fsyntax-only
5952 @item -fsyntax-only
5953 Check the code for syntax errors, but don't do anything beyond that.
5955 @opindex fmax-errors
5956 @item -fmax-errors=@var{n}
5957 Limits the maximum number of error messages to @var{n}, at which point
5958 GCC bails out rather than attempting to continue processing the source
5959 code.  If @var{n} is 0 (the default), there is no limit on the number
5960 of error messages produced.  If @option{-Wfatal-errors} is also
5961 specified, then @option{-Wfatal-errors} takes precedence over this
5962 option.
5964 @opindex w
5965 @item -w
5966 Inhibit all warning messages.
5968 @opindex Werror
5969 @opindex Wno-error
5970 @item -Werror
5971 Make all warnings into errors.
5973 @opindex Werror=
5974 @opindex Wno-error=
5975 @item -Werror=
5976 Make the specified warning into an error.  The specifier for a warning
5977 is appended; for example @option{-Werror=switch} turns the warnings
5978 controlled by @option{-Wswitch} into errors.  This switch takes a
5979 negative form, to be used to negate @option{-Werror} for specific
5980 warnings; for example @option{-Wno-error=switch} makes
5981 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
5982 is in effect.
5984 The warning message for each controllable warning includes the
5985 option that controls the warning.  That option can then be used with
5986 @option{-Werror=} and @option{-Wno-error=} as described above.
5987 (Printing of the option in the warning message can be disabled using the
5988 @option{-fno-diagnostics-show-option} flag.)
5990 Note that specifying @option{-Werror=}@var{foo} automatically implies
5991 @option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
5992 imply anything.
5994 @opindex Wfatal-errors
5995 @opindex Wno-fatal-errors
5996 @item -Wfatal-errors
5997 This option causes the compiler to abort compilation on the first error
5998 occurred rather than trying to keep going and printing further error
5999 messages.
6001 @end table
6003 You can request many specific warnings with options beginning with
6004 @samp{-W}, for example @option{-Wimplicit} to request warnings on
6005 implicit declarations.  Each of these specific warning options also
6006 has a negative form beginning @samp{-Wno-} to turn off warnings; for
6007 example, @option{-Wno-implicit}.  This manual lists only one of the
6008 two forms, whichever is not the default.  For further
6009 language-specific options also refer to @ref{C++ Dialect Options} and
6010 @ref{Objective-C and Objective-C++ Dialect Options}.
6011 Additional warnings can be produced by enabling the static analyzer;
6012 @xref{Static Analyzer Options}.
6014 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
6015 options, such as @option{-Wunused}, which may turn on further options,
6016 such as @option{-Wunused-value}. The combined effect of positive and
6017 negative forms is that more specific options have priority over less
6018 specific ones, independently of their position in the command-line. For
6019 options of the same specificity, the last one takes effect. Options
6020 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
6021 as if they appeared at the end of the command-line.
6023 When an unrecognized warning option is requested (e.g.,
6024 @option{-Wunknown-warning}), GCC emits a diagnostic stating
6025 that the option is not recognized.  However, if the @option{-Wno-} form
6026 is used, the behavior is slightly different: no diagnostic is
6027 produced for @option{-Wno-unknown-warning} unless other diagnostics
6028 are being produced.  This allows the use of new @option{-Wno-} options
6029 with old compilers, but if something goes wrong, the compiler
6030 warns that an unrecognized option is present.
6032 The effectiveness of some warnings depends on optimizations also being
6033 enabled. For example @option{-Wsuggest-final-types} is more effective
6034 with link-time optimization and some instances of other warnings may
6035 not be issued at all unless optimization is enabled.  While optimization
6036 in general improves the efficacy of control and data flow sensitive
6037 warnings, in some cases it may also cause false positives.
6039 @table @gcctabopt
6040 @opindex pedantic
6041 @opindex Wpedantic
6042 @opindex Wno-pedantic
6043 @item -Wpedantic
6044 @itemx -pedantic
6045 Issue all the warnings demanded by strict ISO C and ISO C++;
6046 diagnose all programs that use forbidden extensions, and some other
6047 programs that do not follow ISO C and ISO C++.  This follows the version
6048 of the ISO C or C++ standard specified by any @option{-std} option used.
6050 Valid ISO C and ISO C++ programs should compile properly with or without
6051 this option (though a rare few require @option{-ansi} or a
6052 @option{-std} option specifying the version of the standard)@.  However,
6053 without this option, certain GNU extensions and traditional C and C++
6054 features are supported as well.  With this option, they are diagnosed
6055 (or rejected with @option{-pedantic-errors}).
6057 @option{-Wpedantic} does not cause warning messages for use of the
6058 alternate keywords whose names begin and end with @samp{__}.  This alternate
6059 format can also be used to disable warnings for non-ISO @samp{__intN} types,
6060 i.e. @samp{__intN__}.
6061 Pedantic warnings are also disabled in the expression that follows
6062 @code{__extension__}.  However, only system header files should use
6063 these escape routes; application programs should avoid them.
6064 @xref{Alternate Keywords}.
6066 Some warnings about non-conforming programs are controlled by options
6067 other than @option{-Wpedantic}; in many cases they are implied by
6068 @option{-Wpedantic} but can be disabled separately by their specific
6069 option, e.g. @option{-Wpedantic -Wno-pointer-sign}.
6071 Where the standard specified with @option{-std} represents a GNU
6072 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
6073 corresponding @dfn{base standard}, the version of ISO C on which the GNU
6074 extended dialect is based.  Warnings from @option{-Wpedantic} are given
6075 where they are required by the base standard.  (It does not make sense
6076 for such warnings to be given only for features not in the specified GNU
6077 C dialect, since by definition the GNU dialects of C include all
6078 features the compiler supports with the given option, and there would be
6079 nothing to warn about.)
6081 @opindex pedantic-errors
6082 @item -pedantic-errors
6083 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
6084 requires a diagnostic, in some cases where there is undefined behavior
6085 at compile-time and in some other cases that do not prevent compilation
6086 of programs that are valid according to the standard. This is not
6087 equivalent to @option{-Werror=pedantic}: the latter option is unlikely to be
6088 useful, as it only makes errors of the diagnostics that are controlled by
6089 @option{-Wpedantic}, whereas this option also affects required diagnostics that
6090 are always enabled or controlled by options other than @option{-Wpedantic}.
6092 If you want the required diagnostics that are warnings by default to
6093 be errors instead, but don't also want to enable the @option{-Wpedantic}
6094 diagnostics, you can specify @option{-pedantic-errors -Wno-pedantic}
6095 (or @option{-pedantic-errors -Wno-error=pedantic} to enable them but
6096 only as warnings).
6098 Some required diagnostics are errors by default, but can be reduced to
6099 warnings using @option{-fpermissive} or their specific warning option,
6100 e.g. @option{-Wno-error=narrowing}.
6102 Some diagnostics for non-ISO practices are controlled by specific
6103 warning options other than @option{-Wpedantic}, but are also made
6104 errors by @option{-pedantic-errors}.  For instance:
6106 @gccoptlist{
6107 -Wattributes @r{(for standard attributes)}
6108 -Wchanges-meaning @r{(C++)}
6109 -Wcomma-subscript @r{(C++23 or later)}
6110 -Wdeclaration-after-statement @r{(C90 or earlier)}
6111 -Welaborated-enum-base @r{(C++11 or later)}
6112 -Wimplicit-int @r{(C99 or later)}
6113 -Wimplicit-function-declaration @r{(C99 or later)}
6114 -Wincompatible-pointer-types
6115 -Wint-conversion
6116 -Wlong-long @r{(C90 or earlier)}
6117 -Wmain
6118 -Wnarrowing @r{(C++11 or later)}
6119 -Wpointer-arith
6120 -Wpointer-sign
6121 -Wincompatible-pointer-types
6122 -Wregister @r{(C++17 or later)}
6123 -Wvla @r{(C90 or earlier)}
6124 -Wwrite-strings @r{(C++11 or later)}
6127 @opindex Wall
6128 @opindex Wno-all
6129 @item -Wall
6130 This enables all the warnings about constructions that some users
6131 consider questionable, and that are easy to avoid (or modify to
6132 prevent the warning), even in conjunction with macros.  This also
6133 enables some language-specific warnings described in @ref{C++ Dialect
6134 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
6136 @option{-Wall} turns on the following warning flags:
6138 @gccoptlist{-Waddress
6139 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)}
6140 -Warray-compare
6141 -Warray-parameter=2 @r{(C and Objective-C only)}
6142 -Wbool-compare
6143 -Wbool-operation
6144 -Wc++11-compat  -Wc++14-compat
6145 -Wcatch-value @r{(C++ and Objective-C++ only)}
6146 -Wchar-subscripts
6147 -Wcomment
6148 -Wdangling-pointer=2
6149 -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6150 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)}
6151 -Wenum-int-mismatch @r{(C and Objective-C only)}
6152 -Wformat
6153 -Wformat-overflow
6154 -Wformat-truncation
6155 -Wint-in-bool-context
6156 -Wimplicit @r{(C and Objective-C only)}
6157 -Wimplicit-int @r{(C and Objective-C only)}
6158 -Wimplicit-function-declaration @r{(C and Objective-C only)}
6159 -Winit-self @r{(only for C++)}
6160 -Wlogical-not-parentheses
6161 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}
6162 -Wmaybe-uninitialized
6163 -Wmemset-elt-size
6164 -Wmemset-transposed-args
6165 -Wmisleading-indentation @r{(only for C/C++)}
6166 -Wmismatched-dealloc
6167 -Wmismatched-new-delete @r{(only for C/C++)}
6168 -Wmissing-attributes
6169 -Wmissing-braces @r{(only for C/ObjC)}
6170 -Wmultistatement-macros
6171 -Wnarrowing @r{(only for C++)}
6172 -Wnonnull
6173 -Wnonnull-compare
6174 -Wopenmp-simd
6175 -Wparentheses
6176 -Wpessimizing-move @r{(only for C++)}
6177 -Wpointer-sign
6178 -Wrange-loop-construct @r{(only for C++)}
6179 -Wreorder
6180 -Wrestrict
6181 -Wreturn-type
6182 -Wself-move @r{(only for C++)}
6183 -Wsequence-point
6184 -Wsign-compare @r{(only in C++)}
6185 -Wsizeof-array-div
6186 -Wsizeof-pointer-div
6187 -Wsizeof-pointer-memaccess
6188 -Wstrict-aliasing
6189 -Wstrict-overflow=1
6190 -Wswitch
6191 -Wtautological-compare
6192 -Wtrigraphs
6193 -Wuninitialized
6194 -Wunknown-pragmas
6195 -Wunused-function
6196 -Wunused-label
6197 -Wunused-value
6198 -Wunused-variable
6199 -Wuse-after-free=2
6200 -Wvla-parameter @r{(C and Objective-C only)}
6201 -Wvolatile-register-var
6202 -Wzero-length-bounds}
6204 Note that some warning flags are not implied by @option{-Wall}.  Some of
6205 them warn about constructions that users generally do not consider
6206 questionable, but which occasionally you might wish to check for;
6207 others warn about constructions that are necessary or hard to avoid in
6208 some cases, and there is no simple way to modify the code to suppress
6209 the warning. Some of them are enabled by @option{-Wextra} but many of
6210 them must be enabled individually.
6212 @opindex W
6213 @opindex Wextra
6214 @opindex Wno-extra
6215 @item -Wextra
6216 This enables some extra warning flags that are not enabled by
6217 @option{-Wall}. (This option used to be called @option{-W}.  The older
6218 name is still supported, but the newer name is more descriptive.)
6220 @gccoptlist{-Wclobbered
6221 -Wcast-function-type
6222 -Wdeprecated-copy @r{(C++ only)}
6223 -Wempty-body
6224 -Wenum-conversion @r{(C only)}
6225 -Wignored-qualifiers
6226 -Wimplicit-fallthrough=3
6227 -Wmissing-field-initializers
6228 -Wmissing-parameter-type @r{(C only)}
6229 -Wold-style-declaration @r{(C only)}
6230 -Woverride-init
6231 -Wsign-compare @r{(C only)}
6232 -Wstring-compare
6233 -Wredundant-move @r{(only for C++)}
6234 -Wtype-limits
6235 -Wuninitialized
6236 -Wshift-negative-value @r{(in C++11 to C++17 and in C99 and newer)}
6237 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}
6238 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
6241 The option @option{-Wextra} also prints warning messages for the
6242 following cases:
6244 @itemize @bullet
6246 @item
6247 A pointer is compared against integer zero with @code{<}, @code{<=},
6248 @code{>}, or @code{>=}.
6250 @item
6251 (C++ only) An enumerator and a non-enumerator both appear in a
6252 conditional expression.
6254 @item
6255 (C++ only) Ambiguous virtual bases.
6257 @item
6258 (C++ only) Subscripting an array that has been declared @code{register}.
6260 @item
6261 (C++ only) Taking the address of a variable that has been declared
6262 @code{register}.
6264 @item
6265 (C++ only) A base class is not initialized in the copy constructor
6266 of a derived class.
6268 @end itemize
6270 @opindex Wabi
6271 @opindex Wno-abi
6272 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
6274 Warn about code affected by ABI changes.  This includes code that may
6275 not be compatible with the vendor-neutral C++ ABI as well as the psABI
6276 for the particular target.
6278 Since G++ now defaults to updating the ABI with each major release,
6279 normally @option{-Wabi} warns only about C++ ABI compatibility
6280 problems if there is a check added later in a release series for an
6281 ABI issue discovered since the initial release.  @option{-Wabi} warns
6282 about more things if an older ABI version is selected (with
6283 @option{-fabi-version=@var{n}}).
6285 @option{-Wabi} can also be used with an explicit version number to
6286 warn about C++ ABI compatibility with a particular @option{-fabi-version}
6287 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
6288 @option{-fabi-version=2}.
6290 If an explicit version number is provided and
6291 @option{-fabi-compat-version} is not specified, the version number
6292 from this option is used for compatibility aliases.  If no explicit
6293 version number is provided with this option, but
6294 @option{-fabi-compat-version} is specified, that version number is
6295 used for C++ ABI warnings.
6297 Although an effort has been made to warn about
6298 all such cases, there are probably some cases that are not warned about,
6299 even though G++ is generating incompatible code.  There may also be
6300 cases where warnings are emitted even though the code that is generated
6301 is compatible.
6303 You should rewrite your code to avoid these warnings if you are
6304 concerned about the fact that code generated by G++ may not be binary
6305 compatible with code generated by other compilers.
6307 Known incompatibilities in @option{-fabi-version=2} (which was the
6308 default from GCC 3.4 to 4.9) include:
6310 @itemize @bullet
6312 @item
6313 A template with a non-type template parameter of reference type was
6314 mangled incorrectly:
6315 @smallexample
6316 extern int N;
6317 template <int &> struct S @{@};
6318 void n (S<N>) @{2@}
6319 @end smallexample
6321 This was fixed in @option{-fabi-version=3}.
6323 @item
6324 SIMD vector types declared using @code{__attribute ((vector_size))} were
6325 mangled in a non-standard way that does not allow for overloading of
6326 functions taking vectors of different sizes.
6328 The mangling was changed in @option{-fabi-version=4}.
6330 @item
6331 @code{__attribute ((const))} and @code{noreturn} were mangled as type
6332 qualifiers, and @code{decltype} of a plain declaration was folded away.
6334 These mangling issues were fixed in @option{-fabi-version=5}.
6336 @item
6337 Scoped enumerators passed as arguments to a variadic function are
6338 promoted like unscoped enumerators, causing @code{va_arg} to complain.
6339 On most targets this does not actually affect the parameter passing
6340 ABI, as there is no way to pass an argument smaller than @code{int}.
6342 Also, the ABI changed the mangling of template argument packs,
6343 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
6344 a class scope function used as a template argument.
6346 These issues were corrected in @option{-fabi-version=6}.
6348 @item
6349 Lambdas in default argument scope were mangled incorrectly, and the
6350 ABI changed the mangling of @code{nullptr_t}.
6352 These issues were corrected in @option{-fabi-version=7}.
6354 @item
6355 When mangling a function type with function-cv-qualifiers, the
6356 un-qualified function type was incorrectly treated as a substitution
6357 candidate.
6359 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
6361 @item
6362 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
6363 unaligned accesses.  Note that this did not affect the ABI of a
6364 function with a @code{nullptr_t} parameter, as parameters have a
6365 minimum alignment.
6367 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
6369 @item
6370 Target-specific attributes that affect the identity of a type, such as
6371 ia32 calling conventions on a function type (stdcall, regparm, etc.),
6372 did not affect the mangled name, leading to name collisions when
6373 function pointers were used as template arguments.
6375 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
6377 @end itemize
6379 This option also enables warnings about psABI-related changes.
6380 The known psABI changes at this point include:
6382 @itemize @bullet
6384 @item
6385 For SysV/x86-64, unions with @code{long double} members are
6386 passed in memory as specified in psABI.  Prior to GCC 4.4, this was not
6387 the case.  For example:
6389 @smallexample
6390 union U @{
6391   long double ld;
6392   int i;
6394 @end smallexample
6396 @noindent
6397 @code{union U} is now always passed in memory.
6399 @end itemize
6401 @item -Wno-changes-meaning @r{(C++ and Objective-C++ only)}
6402 C++ requires that unqualified uses of a name within a class have the
6403 same meaning in the complete scope of the class, so declaring the name
6404 after using it is ill-formed:
6405 @smallexample
6406 struct A;
6407 struct B1 @{ A a; typedef A A; @}; // warning, 'A' changes meaning
6408 struct B2 @{ A a; struct A @{ @}; @}; // error, 'A' changes meaning
6409 @end smallexample
6410 By default, the B1 case is only a warning because the two declarations
6411 have the same type, while the B2 case is an error.  Both diagnostics
6412 can be disabled with @option{-Wno-changes-meaning}.  Alternately, the
6413 error case can be reduced to a warning with
6414 @option{-Wno-error=changes-meaning} or @option{-fpermissive}.
6416 Both diagnostics are also suppressed by @option{-fms-extensions}.
6418 @opindex Wchar-subscripts
6419 @opindex Wno-char-subscripts
6420 @item -Wchar-subscripts
6421 Warn if an array subscript has type @code{char}.  This is a common cause
6422 of error, as programmers often forget that this type is signed on some
6423 machines.
6424 This warning is enabled by @option{-Wall}.
6426 @opindex Wno-coverage-mismatch
6427 @opindex Wcoverage-mismatch
6428 @item -Wno-coverage-mismatch
6429 Warn if feedback profiles do not match when using the
6430 @option{-fprofile-use} option.
6431 If a source file is changed between compiling with @option{-fprofile-generate}
6432 and with @option{-fprofile-use}, the files with the profile feedback can fail
6433 to match the source file and GCC cannot use the profile feedback
6434 information.  By default, this warning is enabled and is treated as an
6435 error.  @option{-Wno-coverage-mismatch} can be used to disable the
6436 warning or @option{-Wno-error=coverage-mismatch} can be used to
6437 disable the error.  Disabling the error for this warning can result in
6438 poorly optimized code and is useful only in the
6439 case of very minor changes such as bug fixes to an existing code-base.
6440 Completely disabling the warning is not recommended.
6442 @opindex Wno-coverage-invalid-line-number
6443 @opindex Wcoverage-invalid-line-number
6444 @item -Wno-coverage-invalid-line-number
6445 Warn in case a function ends earlier than it begins due
6446 to an invalid linenum macros.  The warning is emitted only
6447 with @option{--coverage} enabled.
6449 By default, this warning is enabled and is treated as an
6450 error.  @option{-Wno-coverage-invalid-line-number} can be used to disable the
6451 warning or @option{-Wno-error=coverage-invalid-line-number} can be used to
6452 disable the error.
6454 @opindex Wno-cpp
6455 @opindex Wcpp
6456 @item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
6457 Suppress warning messages emitted by @code{#warning} directives.
6459 @opindex Wdouble-promotion
6460 @opindex Wno-double-promotion
6461 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
6462 Give a warning when a value of type @code{float} is implicitly
6463 promoted to @code{double}.  CPUs with a 32-bit ``single-precision''
6464 floating-point unit implement @code{float} in hardware, but emulate
6465 @code{double} in software.  On such a machine, doing computations
6466 using @code{double} values is much more expensive because of the
6467 overhead required for software emulation.
6469 It is easy to accidentally do computations with @code{double} because
6470 floating-point literals are implicitly of type @code{double}.  For
6471 example, in:
6472 @smallexample
6473 @group
6474 float area(float radius)
6476    return 3.14159 * radius * radius;
6478 @end group
6479 @end smallexample
6480 the compiler performs the entire computation with @code{double}
6481 because the floating-point literal is a @code{double}.
6483 @opindex Wduplicate-decl-specifier
6484 @opindex Wno-duplicate-decl-specifier
6485 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
6486 Warn if a declaration has duplicate @code{const}, @code{volatile},
6487 @code{restrict} or @code{_Atomic} specifier.  This warning is enabled by
6488 @option{-Wall}.
6490 @opindex Wformat
6491 @opindex Wno-format
6492 @opindex ffreestanding
6493 @opindex fno-builtin
6494 @opindex Wformat=
6495 @item -Wformat
6496 @itemx -Wformat=@var{n}
6497 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
6498 the arguments supplied have types appropriate to the format string
6499 specified, and that the conversions specified in the format string make
6500 sense.  This includes standard functions, and others specified by format
6501 attributes (@pxref{Function Attributes}), in the @code{printf},
6502 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
6503 not in the C standard) families (or other target-specific families).
6504 Which functions are checked without format attributes having been
6505 specified depends on the standard version selected, and such checks of
6506 functions without the attribute specified are disabled by
6507 @option{-ffreestanding} or @option{-fno-builtin}.
6509 The formats are checked against the format features supported by GNU
6510 libc version 2.2.  These include all ISO C90 and C99 features, as well
6511 as features from the Single Unix Specification and some BSD and GNU
6512 extensions.  Other library implementations may not support all these
6513 features; GCC does not support warning about features that go beyond a
6514 particular library's limitations.  However, if @option{-Wpedantic} is used
6515 with @option{-Wformat}, warnings are given about format features not
6516 in the selected standard version (but not for @code{strfmon} formats,
6517 since those are not in any version of the C standard).  @xref{C Dialect
6518 Options,,Options Controlling C Dialect}.
6520 @table @gcctabopt
6521 @opindex Wformat
6522 @opindex Wformat=1
6523 @item -Wformat=1
6524 @itemx -Wformat
6525 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
6526 @option{-Wno-format} is equivalent to @option{-Wformat=0}.  Since
6527 @option{-Wformat} also checks for null format arguments for several
6528 functions, @option{-Wformat} also implies @option{-Wnonnull}.  Some
6529 aspects of this level of format checking can be disabled by the
6530 options: @option{-Wno-format-contains-nul},
6531 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
6532 @option{-Wformat} is enabled by @option{-Wall}.
6534 @opindex Wformat=2
6535 @item -Wformat=2
6536 Enable @option{-Wformat} plus additional format checks.  Currently
6537 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
6538 -Wformat-y2k}.
6539 @end table
6541 @opindex Wno-format-contains-nul
6542 @opindex Wformat-contains-nul
6543 @item -Wno-format-contains-nul
6544 If @option{-Wformat} is specified, do not warn about format strings that
6545 contain NUL bytes.
6547 @opindex Wno-format-extra-args
6548 @opindex Wformat-extra-args
6549 @item -Wno-format-extra-args
6550 If @option{-Wformat} is specified, do not warn about excess arguments to a
6551 @code{printf} or @code{scanf} format function.  The C standard specifies
6552 that such arguments are ignored.
6554 Where the unused arguments lie between used arguments that are
6555 specified with @samp{$} operand number specifications, normally
6556 warnings are still given, since the implementation could not know what
6557 type to pass to @code{va_arg} to skip the unused arguments.  However,
6558 in the case of @code{scanf} formats, this option suppresses the
6559 warning if the unused arguments are all pointers, since the Single
6560 Unix Specification says that such unused arguments are allowed.
6562 @opindex Wformat-overflow
6563 @opindex Wno-format-overflow
6564 @item -Wformat-overflow
6565 @itemx -Wformat-overflow=@var{level}
6566 Warn about calls to formatted input/output functions such as @code{sprintf}
6567 and @code{vsprintf} that might overflow the destination buffer.  When the
6568 exact number of bytes written by a format directive cannot be determined
6569 at compile-time it is estimated based on heuristics that depend on the
6570 @var{level} argument and on optimization.  While enabling optimization
6571 will in most cases improve the accuracy of the warning, it may also
6572 result in false positives.
6574 @table @gcctabopt
6575 @opindex Wformat-overflow
6576 @opindex Wno-format-overflow
6577 @item -Wformat-overflow
6578 @itemx -Wformat-overflow=1
6579 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
6580 employs a conservative approach that warns only about calls that most
6581 likely overflow the buffer.  At this level, numeric arguments to format
6582 directives with unknown values are assumed to have the value of one, and
6583 strings of unknown length to be empty.  Numeric arguments that are known
6584 to be bounded to a subrange of their type, or string arguments whose output
6585 is bounded either by their directive's precision or by a finite set of
6586 string literals, are assumed to take on the value within the range that
6587 results in the most bytes on output.  For example, the call to @code{sprintf}
6588 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
6589 the terminating NUL character (@code{'\0'}) appended by the function
6590 to the destination buffer will be written past its end.  Increasing
6591 the size of the buffer by a single byte is sufficient to avoid the
6592 warning, though it may not be sufficient to avoid the overflow.
6594 @smallexample
6595 void f (int a, int b)
6597   char buf [13];
6598   sprintf (buf, "a = %i, b = %i\n", a, b);
6600 @end smallexample
6602 @item -Wformat-overflow=2
6603 Level @var{2} warns also about calls that might overflow the destination
6604 buffer given an argument of sufficient length or magnitude.  At level
6605 @var{2}, unknown numeric arguments are assumed to have the minimum
6606 representable value for signed types with a precision greater than 1, and
6607 the maximum representable value otherwise.  Unknown string arguments whose
6608 length cannot be assumed to be bounded either by the directive's precision,
6609 or by a finite set of string literals they may evaluate to, or the character
6610 array they may point to, are assumed to be 1 character long.
6612 At level @var{2}, the call in the example above is again diagnosed, but
6613 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
6614 @code{%i} directive will write some of its digits beyond the end of
6615 the destination buffer.  To make the call safe regardless of the values
6616 of the two variables, the size of the destination buffer must be increased
6617 to at least 34 bytes.  GCC includes the minimum size of the buffer in
6618 an informational note following the warning.
6620 An alternative to increasing the size of the destination buffer is to
6621 constrain the range of formatted values.  The maximum length of string
6622 arguments can be bounded by specifying the precision in the format
6623 directive.  When numeric arguments of format directives can be assumed
6624 to be bounded by less than the precision of their type, choosing
6625 an appropriate length modifier to the format specifier will reduce
6626 the required buffer size.  For example, if @var{a} and @var{b} in the
6627 example above can be assumed to be within the precision of
6628 the @code{short int} type then using either the @code{%hi} format
6629 directive or casting the argument to @code{short} reduces the maximum
6630 required size of the buffer to 24 bytes.
6632 @smallexample
6633 void f (int a, int b)
6635   char buf [23];
6636   sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
6638 @end smallexample
6639 @end table
6641 @opindex Wno-format-zero-length
6642 @opindex Wformat-zero-length
6643 @item -Wno-format-zero-length
6644 If @option{-Wformat} is specified, do not warn about zero-length formats.
6645 The C standard specifies that zero-length formats are allowed.
6647 @opindex Wformat-nonliteral
6648 @opindex Wno-format-nonliteral
6649 @item -Wformat-nonliteral
6650 If @option{-Wformat} is specified, also warn if the format string is not a
6651 string literal and so cannot be checked, unless the format function
6652 takes its format arguments as a @code{va_list}.
6654 @opindex Wformat-security
6655 @opindex Wno-format-security
6656 @item -Wformat-security
6657 If @option{-Wformat} is specified, also warn about uses of format
6658 functions that represent possible security problems.  At present, this
6659 warns about calls to @code{printf} and @code{scanf} functions where the
6660 format string is not a string literal and there are no format arguments,
6661 as in @code{printf (foo);}.  This may be a security hole if the format
6662 string came from untrusted input and contains @samp{%n}.  (This is
6663 currently a subset of what @option{-Wformat-nonliteral} warns about, but
6664 in future warnings may be added to @option{-Wformat-security} that are not
6665 included in @option{-Wformat-nonliteral}.)
6667 @opindex Wformat-signedness
6668 @opindex Wno-format-signedness
6669 @item -Wformat-signedness
6670 If @option{-Wformat} is specified, also warn if the format string
6671 requires an unsigned argument and the argument is signed and vice versa.
6673 @opindex Wformat-truncation
6674 @opindex Wno-format-truncation
6675 @item -Wformat-truncation
6676 @itemx -Wformat-truncation=@var{level}
6677 Warn about calls to formatted input/output functions such as @code{snprintf}
6678 and @code{vsnprintf} that might result in output truncation.  When the exact
6679 number of bytes written by a format directive cannot be determined at
6680 compile-time it is estimated based on heuristics that depend on
6681 the @var{level} argument and on optimization.  While enabling optimization
6682 will in most cases improve the accuracy of the warning, it may also result
6683 in false positives.  Except as noted otherwise, the option uses the same
6684 logic @option{-Wformat-overflow}.
6686 @table @gcctabopt
6687 @opindex Wformat-truncation
6688 @opindex Wno-format-truncation
6689 @item -Wformat-truncation
6690 @itemx -Wformat-truncation=1
6691 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
6692 employs a conservative approach that warns only about calls to bounded
6693 functions whose return value is unused and that will most likely result
6694 in output truncation.
6696 @item -Wformat-truncation=2
6697 Level @var{2} warns also about calls to bounded functions whose return
6698 value is used and that might result in truncation given an argument of
6699 sufficient length or magnitude.
6700 @end table
6702 @opindex Wformat-y2k
6703 @opindex Wno-format-y2k
6704 @item -Wformat-y2k
6705 If @option{-Wformat} is specified, also warn about @code{strftime}
6706 formats that may yield only a two-digit year.
6708 @opindex Wnonnull
6709 @opindex Wno-nonnull
6710 @item -Wnonnull
6711 Warn about passing a null pointer for arguments marked as
6712 requiring a non-null value by the @code{nonnull} function attribute.
6714 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
6715 can be disabled with the @option{-Wno-nonnull} option.
6717 @opindex Wnonnull-compare
6718 @opindex Wno-nonnull-compare
6719 @item -Wnonnull-compare
6720 Warn when comparing an argument marked with the @code{nonnull}
6721 function attribute against null inside the function.
6723 @option{-Wnonnull-compare} is included in @option{-Wall}.  It
6724 can be disabled with the @option{-Wno-nonnull-compare} option.
6726 @opindex Wnull-dereference
6727 @opindex Wno-null-dereference
6728 @item -Wnull-dereference
6729 Warn if the compiler detects paths that trigger erroneous or
6730 undefined behavior due to dereferencing a null pointer.  This option
6731 is only active when @option{-fdelete-null-pointer-checks} is active,
6732 which is enabled by optimizations in most targets.  The precision of
6733 the warnings depends on the optimization options used.
6735 @opindex Wnrvo
6736 @opindex Wno-nrvo
6737 @item -Wnrvo @r{(C++ and Objective-C++ only)}
6738 Warn if the compiler does not elide the copy from a local variable to
6739 the return value of a function in a context where it is allowed by
6740 [class.copy.elision].  This elision is commonly known as the Named
6741 Return Value Optimization.  For instance, in the example below the
6742 compiler cannot elide copies from both v1 and v2, so it elides neither.
6744 @smallexample
6745 std::vector<int> f()
6747   std::vector<int> v1, v2;
6748   // ...
6749   if (cond) return v1;
6750   else return v2; // warning: not eliding copy
6752 @end smallexample
6754 @opindex Winfinite-recursion
6755 @opindex Wno-infinite-recursion
6756 @item -Winfinite-recursion
6757 Warn about infinitely recursive calls.  The warning is effective at all
6758 optimization levels but requires optimization in order to detect infinite
6759 recursion in calls between two or more functions.
6760 @option{-Winfinite-recursion} is included in @option{-Wall}.
6762 Compare with @option{-Wanalyzer-infinite-recursion} which provides a
6763 similar diagnostic, but is implemented in a different way (as part of
6764 @option{-fanalyzer}).
6766 @opindex Winit-self
6767 @opindex Wno-init-self
6768 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
6769 Warn about uninitialized variables that are initialized with themselves.
6770 Note this option can only be used with the @option{-Wuninitialized} option.
6772 For example, GCC warns about @code{i} being uninitialized in the
6773 following snippet only when @option{-Winit-self} has been specified:
6774 @smallexample
6775 @group
6776 int f()
6778   int i = i;
6779   return i;
6781 @end group
6782 @end smallexample
6784 This warning is enabled by @option{-Wall} in C++.
6786 @opindex Wimplicit-int
6787 @opindex Wno-implicit-int
6788 @item -Wno-implicit-int @r{(C and Objective-C only)}
6789 This option controls warnings when a declaration does not specify a type.
6790 This warning is enabled by default in C99 and later dialects of C,
6791 and also by @option{-Wall}.
6793 This warning is upgraded to an error by @option{-pedantic-errors}.
6795 @opindex Wimplicit-function-declaration
6796 @opindex Wno-implicit-function-declaration
6797 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
6798 This option controls warnings when a function is used before being declared.
6799 This warning is enabled by default in C99 and later dialects of C,
6800 and also by @option{-Wall}.
6802 This warning is upgraded to an error by @option{-pedantic-errors}.
6804 @opindex Wimplicit
6805 @opindex Wno-implicit
6806 @item -Wimplicit @r{(C and Objective-C only)}
6807 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
6808 This warning is enabled by @option{-Wall}.
6810 @opindex Wimplicit-fallthrough
6811 @opindex Wno-implicit-fallthrough
6812 @item -Wimplicit-fallthrough
6813 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
6814 and @option{-Wno-implicit-fallthrough} is the same as
6815 @option{-Wimplicit-fallthrough=0}.
6817 @opindex Wimplicit-fallthrough=
6818 @item -Wimplicit-fallthrough=@var{n}
6819 Warn when a switch case falls through.  For example:
6821 @smallexample
6822 @group
6823 switch (cond)
6824   @{
6825   case 1:
6826     a = 1;
6827     break;
6828   case 2:
6829     a = 2;
6830   case 3:
6831     a = 3;
6832     break;
6833   @}
6834 @end group
6835 @end smallexample
6837 This warning does not warn when the last statement of a case cannot
6838 fall through, e.g. when there is a return statement or a call to function
6839 declared with the noreturn attribute.  @option{-Wimplicit-fallthrough=}
6840 also takes into account control flow statements, such as ifs, and only
6841 warns when appropriate.  E.g.@:
6843 @smallexample
6844 @group
6845 switch (cond)
6846   @{
6847   case 1:
6848     if (i > 3) @{
6849       bar (5);
6850       break;
6851     @} else if (i < 1) @{
6852       bar (0);
6853     @} else
6854       return;
6855   default:
6856     @dots{}
6857   @}
6858 @end group
6859 @end smallexample
6861 Since there are occasions where a switch case fall through is desirable,
6862 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
6863 to be used along with a null statement to suppress this warning that
6864 would normally occur:
6866 @smallexample
6867 @group
6868 switch (cond)
6869   @{
6870   case 1:
6871     bar (0);
6872     __attribute__ ((fallthrough));
6873   default:
6874     @dots{}
6875   @}
6876 @end group
6877 @end smallexample
6879 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
6880 warning using @code{[[fallthrough]];} instead of the GNU attribute.  In C++11
6881 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
6882 Instead of these attributes, it is also possible to add a fallthrough comment
6883 to silence the warning.  The whole body of the C or C++ style comment should
6884 match the given regular expressions listed below.  The option argument @var{n}
6885 specifies what kind of comments are accepted:
6887 @itemize @bullet
6889 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
6891 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
6892 expression, any comment is used as fallthrough comment.
6894 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
6895 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
6897 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
6898 following regular expressions:
6900 @itemize @bullet
6902 @item @code{-fallthrough}
6904 @item @code{@@fallthrough@@}
6906 @item @code{lint -fallthrough[ \t]*}
6908 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
6910 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6912 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
6914 @end itemize
6916 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
6917 following regular expressions:
6919 @itemize @bullet
6921 @item @code{-fallthrough}
6923 @item @code{@@fallthrough@@}
6925 @item @code{lint -fallthrough[ \t]*}
6927 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
6929 @end itemize
6931 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
6932 fallthrough comments, only attributes disable the warning.
6934 @end itemize
6936 The comment needs to be followed after optional whitespace and other comments
6937 by @code{case} or @code{default} keywords or by a user label that precedes some
6938 @code{case} or @code{default} label.
6940 @smallexample
6941 @group
6942 switch (cond)
6943   @{
6944   case 1:
6945     bar (0);
6946     /* FALLTHRU */
6947   default:
6948     @dots{}
6949   @}
6950 @end group
6951 @end smallexample
6953 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
6955 @opindex Wif-not-aligned
6956 @opindex Wno-if-not-aligned
6957 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
6958 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
6959 should be issued.  These warnings are enabled by default.
6961 @opindex Wignored-qualifiers
6962 @opindex Wno-ignored-qualifiers
6963 @item -Wignored-qualifiers @r{(C and C++ only)}
6964 Warn if the return type of a function has a type qualifier
6965 such as @code{const}.  For ISO C such a type qualifier has no effect,
6966 since the value returned by a function is not an lvalue.
6967 For C++, the warning is only emitted for scalar types or @code{void}.
6968 ISO C prohibits qualified @code{void} return types on function
6969 definitions, so such return types always receive a warning
6970 even without this option.
6972 This warning is also enabled by @option{-Wextra}.
6974 @opindex Wignored-attributes
6975 @opindex Wno-ignored-attributes
6976 @item -Wno-ignored-attributes @r{(C and C++ only)}
6977 This option controls warnings when an attribute is ignored.
6978 This is different from the
6979 @option{-Wattributes} option in that it warns whenever the compiler decides
6980 to drop an attribute, not that the attribute is either unknown, used in a
6981 wrong place, etc.  This warning is enabled by default.
6983 @opindex Wmain
6984 @opindex Wno-main
6985 @item -Wmain
6986 Warn if the type of @code{main} is suspicious.  @code{main} should be
6987 a function with external linkage, returning int, taking either zero
6988 arguments, two, or three arguments of appropriate types.  This warning
6989 is enabled by default in C++ and is enabled by either @option{-Wall}
6990 or @option{-Wpedantic}.
6992 This warning is upgraded to an error by @option{-pedantic-errors}.
6994 @opindex Wmisleading-indentation
6995 @opindex Wno-misleading-indentation
6996 @item -Wmisleading-indentation @r{(C and C++ only)}
6997 Warn when the indentation of the code does not reflect the block structure.
6998 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
6999 @code{for} clauses with a guarded statement that does not use braces,
7000 followed by an unguarded statement with the same indentation.
7002 In the following example, the call to ``bar'' is misleadingly indented as
7003 if it were guarded by the ``if'' conditional.
7005 @smallexample
7006   if (some_condition ())
7007     foo ();
7008     bar ();  /* Gotcha: this is not guarded by the "if".  */
7009 @end smallexample
7011 In the case of mixed tabs and spaces, the warning uses the
7012 @option{-ftabstop=} option to determine if the statements line up
7013 (defaulting to 8).
7015 The warning is not issued for code involving multiline preprocessor logic
7016 such as the following example.
7018 @smallexample
7019   if (flagA)
7020     foo (0);
7021 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
7022   if (flagB)
7023 #endif
7024     foo (1);
7025 @end smallexample
7027 The warning is not issued after a @code{#line} directive, since this
7028 typically indicates autogenerated code, and no assumptions can be made
7029 about the layout of the file that the directive references.
7031 This warning is enabled by @option{-Wall} in C and C++.
7033 @opindex Wmissing-attributes
7034 @opindex Wno-missing-attributes
7035 @item -Wmissing-attributes
7036 Warn when a declaration of a function is missing one or more attributes
7037 that a related function is declared with and whose absence may adversely
7038 affect the correctness or efficiency of generated code.  For example,
7039 the warning is issued for declarations of aliases that use attributes
7040 to specify less restrictive requirements than those of their targets.
7041 This typically represents a potential optimization opportunity.
7042 By contrast, the @option{-Wattribute-alias=2} option controls warnings
7043 issued when the alias is more restrictive than the target, which could
7044 lead to incorrect code generation.
7045 Attributes considered include @code{alloc_align}, @code{alloc_size},
7046 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
7047 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
7048 @code{returns_nonnull}, and @code{returns_twice}.
7050 In C++, the warning is issued when an explicit specialization of a primary
7051 template declared with attribute @code{alloc_align}, @code{alloc_size},
7052 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
7053 or @code{nonnull} is declared without it.  Attributes @code{deprecated},
7054 @code{error}, and @code{warning} suppress the warning.
7055 (@pxref{Function Attributes}).
7057 You can use the @code{copy} attribute to apply the same
7058 set of attributes to a declaration as that on another declaration without
7059 explicitly enumerating the attributes. This attribute can be applied
7060 to declarations of functions (@pxref{Common Function Attributes}),
7061 variables (@pxref{Common Variable Attributes}), or types
7062 (@pxref{Common Type Attributes}).
7064 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
7066 For example, since the declaration of the primary function template
7067 below makes use of both attribute @code{malloc} and @code{alloc_size}
7068 the declaration of the explicit specialization of the template is
7069 diagnosed because it is missing one of the attributes.
7071 @smallexample
7072 template <class T>
7073 T* __attribute__ ((malloc, alloc_size (1)))
7074 allocate (size_t);
7076 template <>
7077 void* __attribute__ ((malloc))   // missing alloc_size
7078 allocate<void> (size_t);
7079 @end smallexample
7081 @opindex Wmissing-braces
7082 @opindex Wno-missing-braces
7083 @item -Wmissing-braces
7084 Warn if an aggregate or union initializer is not fully bracketed.  In
7085 the following example, the initializer for @code{a} is not fully
7086 bracketed, but that for @code{b} is fully bracketed.
7088 @smallexample
7089 int a[2][2] = @{ 0, 1, 2, 3 @};
7090 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
7091 @end smallexample
7093 This warning is enabled by @option{-Wall}.
7095 @opindex Wmissing-include-dirs
7096 @opindex Wno-missing-include-dirs
7097 @item -Wmissing-include-dirs @r{(C, C++, Objective-C, Objective-C++ and Fortran only)}
7098 Warn if a user-supplied include directory does not exist. This option is disabled
7099 by default for C, C++, Objective-C and Objective-C++. For Fortran, it is partially
7100 enabled by default by warning for -I and -J, only.
7102 @opindex Wmissing-profile
7103 @opindex Wno-missing-profile
7104 @item -Wno-missing-profile
7105 This option controls warnings if feedback profiles are missing when using the
7106 @option{-fprofile-use} option.
7107 This option diagnoses those cases where a new function or a new file is added
7108 between compiling with @option{-fprofile-generate} and with
7109 @option{-fprofile-use}, without regenerating the profiles.
7110 In these cases, the profile feedback data files do not contain any
7111 profile feedback information for
7112 the newly added function or file respectively.  Also, in the case when profile
7113 count data (.gcda) files are removed, GCC cannot use any profile feedback
7114 information.  In all these cases, warnings are issued to inform you that a
7115 profile generation step is due.
7116 Ignoring the warning can result in poorly optimized code.
7117 @option{-Wno-missing-profile} can be used to
7118 disable the warning, but this is not recommended and should be done only
7119 when non-existent profile data is justified.
7121 @opindex Wmismatched-dealloc
7122 @opindex Wno-mismatched-dealloc
7123 @item -Wmismatched-dealloc
7125 Warn for calls to deallocation functions with pointer arguments returned
7126 from from allocations functions for which the former isn't a suitable
7127 deallocator.  A pair of functions can be associated as matching allocators
7128 and deallocators by use of attribute @code{malloc}.  Unless disabled by
7129 the @option{-fno-builtin} option the standard functions @code{calloc},
7130 @code{malloc}, @code{realloc}, and @code{free}, as well as the corresponding
7131 forms of C++ @code{operator new} and @code{operator delete} are implicitly
7132 associated as matching allocators and deallocators.  In the following
7133 example @code{mydealloc} is the deallocator for pointers returned from
7134 @code{myalloc}.
7136 @smallexample
7137 void mydealloc (void*);
7139 __attribute__ ((malloc (mydealloc, 1))) void*
7140 myalloc (size_t);
7142 void f (void)
7144   void *p = myalloc (32);
7145   // @dots{}use p@dots{}
7146   free (p);   // warning: not a matching deallocator for myalloc
7147   mydealloc (p);   // ok
7149 @end smallexample
7151 In C++, the related option @option{-Wmismatched-new-delete} diagnoses
7152 mismatches involving either @code{operator new} or @code{operator delete}.
7154 Option @option{-Wmismatched-dealloc} is included in @option{-Wall}.
7156 @opindex Wmultistatement-macros
7157 @opindex Wno-multistatement-macros
7158 @item -Wmultistatement-macros
7159 Warn about unsafe multiple statement macros that appear to be guarded
7160 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
7161 @code{while}, in which only the first statement is actually guarded after
7162 the macro is expanded.
7164 For example:
7166 @smallexample
7167 #define DOIT x++; y++
7168 if (c)
7169   DOIT;
7170 @end smallexample
7172 will increment @code{y} unconditionally, not just when @code{c} holds.
7173 The can usually be fixed by wrapping the macro in a do-while loop:
7174 @smallexample
7175 #define DOIT do @{ x++; y++; @} while (0)
7176 if (c)
7177   DOIT;
7178 @end smallexample
7180 This warning is enabled by @option{-Wall} in C and C++.
7182 @opindex Wparentheses
7183 @opindex Wno-parentheses
7184 @item -Wparentheses
7185 Warn if parentheses are omitted in certain contexts, such
7186 as when there is an assignment in a context where a truth value
7187 is expected, or when operators are nested whose precedence people
7188 often get confused about.
7190 Also warn if a comparison like @code{x<=y<=z} appears; this is
7191 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
7192 interpretation from that of ordinary mathematical notation.
7194 Also warn for dangerous uses of the GNU extension to
7195 @code{?:} with omitted middle operand. When the condition
7196 in the @code{?}: operator is a boolean expression, the omitted value is
7197 always 1.  Often programmers expect it to be a value computed
7198 inside the conditional expression instead.
7200 For C++ this also warns for some cases of unnecessary parentheses in
7201 declarations, which can indicate an attempt at a function call instead
7202 of a declaration:
7203 @smallexample
7205   // Declares a local variable called mymutex.
7206   std::unique_lock<std::mutex> (mymutex);
7207   // User meant std::unique_lock<std::mutex> lock (mymutex);
7209 @end smallexample
7211 This warning is enabled by @option{-Wall}.
7213 @opindex Wself-move
7214 @opindex Wno-self-move
7215 @item -Wno-self-move @r{(C++ and Objective-C++ only)}
7216 This warning warns when a value is moved to itself with @code{std::move}.
7217 Such a @code{std::move} typically has no effect.
7219 @smallexample
7220 struct T @{
7221 @dots{}
7223 void fn()
7225   T t;
7226   @dots{}
7227   t = std::move (t);
7229 @end smallexample
7231 This warning is enabled by @option{-Wall}.
7233 @opindex Wsequence-point
7234 @opindex Wno-sequence-point
7235 @item -Wsequence-point
7236 Warn about code that may have undefined semantics because of violations
7237 of sequence point rules in the C and C++ standards.
7239 The C and C++ standards define the order in which expressions in a C/C++
7240 program are evaluated in terms of @dfn{sequence points}, which represent
7241 a partial ordering between the execution of parts of the program: those
7242 executed before the sequence point, and those executed after it.  These
7243 occur after the evaluation of a full expression (one which is not part
7244 of a larger expression), after the evaluation of the first operand of a
7245 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
7246 function is called (but after the evaluation of its arguments and the
7247 expression denoting the called function), and in certain other places.
7248 Other than as expressed by the sequence point rules, the order of
7249 evaluation of subexpressions of an expression is not specified.  All
7250 these rules describe only a partial order rather than a total order,
7251 since, for example, if two functions are called within one expression
7252 with no sequence point between them, the order in which the functions
7253 are called is not specified.  However, the standards committee have
7254 ruled that function calls do not overlap.
7256 It is not specified when between sequence points modifications to the
7257 values of objects take effect.  Programs whose behavior depends on this
7258 have undefined behavior; the C and C++ standards specify that ``Between
7259 the previous and next sequence point an object shall have its stored
7260 value modified at most once by the evaluation of an expression.
7261 Furthermore, the prior value shall be read only to determine the value
7262 to be stored.''.  If a program breaks these rules, the results on any
7263 particular implementation are entirely unpredictable.
7265 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
7266 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
7267 diagnosed by this option, and it may give an occasional false positive
7268 result, but in general it has been found fairly effective at detecting
7269 this sort of problem in programs.
7271 The C++17 standard will define the order of evaluation of operands in
7272 more cases: in particular it requires that the right-hand side of an
7273 assignment be evaluated before the left-hand side, so the above
7274 examples are no longer undefined.  But this option will still warn
7275 about them, to help people avoid writing code that is undefined in C
7276 and earlier revisions of C++.
7278 The standard is worded confusingly, therefore there is some debate
7279 over the precise meaning of the sequence point rules in subtle cases.
7280 Links to discussions of the problem, including proposed formal
7281 definitions, may be found on the GCC readings page, at
7282 @uref{https://gcc.gnu.org/@/readings.html}.
7284 This warning is enabled by @option{-Wall} for C and C++.
7286 @opindex Wno-return-local-addr
7287 @opindex Wreturn-local-addr
7288 @item -Wno-return-local-addr
7289 Do not warn about returning a pointer (or in C++, a reference) to a
7290 variable that goes out of scope after the function returns.
7292 @opindex Wreturn-type
7293 @opindex Wno-return-type
7294 @item -Wreturn-type
7295 Warn whenever a function is defined with a return type that defaults
7296 to @code{int}.  Also warn about any @code{return} statement with no
7297 return value in a function whose return type is not @code{void}
7298 (falling off the end of the function body is considered returning
7299 without a value).
7301 For C only, warn about a @code{return} statement with an expression in a
7302 function whose return type is @code{void}, unless the expression type is
7303 also @code{void}.  As a GNU extension, the latter case is accepted
7304 without a warning unless @option{-Wpedantic} is used.  Attempting
7305 to use the return value of a non-@code{void} function other than @code{main}
7306 that flows off the end by reaching the closing curly brace that terminates
7307 the function is undefined.
7309 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
7310 than @code{main} results in undefined behavior even when the value of
7311 the function is not used.
7313 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
7315 @opindex Wshift-count-negative
7316 @opindex Wno-shift-count-negative
7317 @item -Wno-shift-count-negative
7318 Controls warnings if a shift count is negative.
7319 This warning is enabled by default.
7321 @opindex Wshift-count-overflow
7322 @opindex Wno-shift-count-overflow
7323 @item -Wno-shift-count-overflow
7324 Controls warnings if a shift count is greater than or equal to the bit width
7325 of the type.  This warning is enabled by default.
7327 @opindex Wshift-negative-value
7328 @opindex Wno-shift-negative-value
7329 @item -Wshift-negative-value
7330 Warn if left shifting a negative value.  This warning is enabled by
7331 @option{-Wextra} in C99 (and newer) and C++11 to C++17 modes.
7333 @opindex Wshift-overflow
7334 @opindex Wno-shift-overflow
7335 @item -Wno-shift-overflow
7336 @itemx -Wshift-overflow=@var{n}
7337 These options control warnings about left shift overflows.
7339 @table @gcctabopt
7340 @item -Wshift-overflow=1
7341 This is the warning level of @option{-Wshift-overflow} and is enabled
7342 by default in C99 and C++11 modes (and newer).  This warning level does
7343 not warn about left-shifting 1 into the sign bit.  (However, in C, such
7344 an overflow is still rejected in contexts where an integer constant expression
7345 is required.)  No warning is emitted in C++20 mode (and newer), as signed left
7346 shifts always wrap.
7348 @item -Wshift-overflow=2
7349 This warning level also warns about left-shifting 1 into the sign bit,
7350 unless C++14 mode (or newer) is active.
7351 @end table
7353 @opindex Wswitch
7354 @opindex Wno-switch
7355 @item -Wswitch
7356 Warn whenever a @code{switch} statement has an index of enumerated type
7357 and lacks a @code{case} for one or more of the named codes of that
7358 enumeration.  (The presence of a @code{default} label prevents this
7359 warning.)  @code{case} labels outside the enumeration range also
7360 provoke warnings when this option is used (even if there is a
7361 @code{default} label).
7362 This warning is enabled by @option{-Wall}.
7364 @opindex Wswitch-default
7365 @opindex Wno-switch-default
7366 @item -Wswitch-default
7367 Warn whenever a @code{switch} statement does not have a @code{default}
7368 case.
7370 @opindex Wswitch-enum
7371 @opindex Wno-switch-enum
7372 @item -Wswitch-enum
7373 Warn whenever a @code{switch} statement has an index of enumerated type
7374 and lacks a @code{case} for one or more of the named codes of that
7375 enumeration.  @code{case} labels outside the enumeration range also
7376 provoke warnings when this option is used.  The only difference
7377 between @option{-Wswitch} and this option is that this option gives a
7378 warning about an omitted enumeration code even if there is a
7379 @code{default} label.
7381 @opindex Wswitch-bool
7382 @opindex Wno-switch-bool
7383 @item -Wno-switch-bool
7384 Do not warn when a @code{switch} statement has an index of boolean type
7385 and the case values are outside the range of a boolean type.
7386 It is possible to suppress this warning by casting the controlling
7387 expression to a type other than @code{bool}.  For example:
7388 @smallexample
7389 @group
7390 switch ((int) (a == 4))
7391   @{
7392   @dots{}
7393   @}
7394 @end group
7395 @end smallexample
7396 This warning is enabled by default for C and C++ programs.
7398 @opindex Wswitch-outside-range
7399 @opindex Wno-switch-outside-range
7400 @item -Wno-switch-outside-range
7401 This option controls warnings when a @code{switch} case has a value
7402 that is outside of its
7403 respective type range.  This warning is enabled by default for
7404 C and C++ programs.
7406 @opindex Wswitch-unreachable
7407 @opindex Wno-switch-unreachable
7408 @item -Wno-switch-unreachable
7409 Do not warn when a @code{switch} statement contains statements between the
7410 controlling expression and the first case label, which will never be
7411 executed.  For example:
7412 @smallexample
7413 @group
7414 switch (cond)
7415   @{
7416    i = 15;
7417   @dots{}
7418    case 5:
7419   @dots{}
7420   @}
7421 @end group
7422 @end smallexample
7423 @option{-Wswitch-unreachable} does not warn if the statement between the
7424 controlling expression and the first case label is just a declaration:
7425 @smallexample
7426 @group
7427 switch (cond)
7428   @{
7429    int i;
7430   @dots{}
7431    case 5:
7432    i = 5;
7433   @dots{}
7434   @}
7435 @end group
7436 @end smallexample
7437 This warning is enabled by default for C and C++ programs.
7439 @opindex Wsync-nand
7440 @opindex Wno-sync-nand
7441 @item -Wsync-nand @r{(C and C++ only)}
7442 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
7443 built-in functions are used.  These functions changed semantics in GCC 4.4.
7445 @opindex Wtrivial-auto-var-init
7446 @opindex Wno-trivial-auto-var-init
7447 @item -Wtrivial-auto-var-init
7448 Warn when @code{-ftrivial-auto-var-init} cannot initialize the automatic
7449 variable.  A common situation is an automatic variable that is declared
7450 between the controlling expression and the first case label of a @code{switch}
7451 statement.
7453 @opindex Wunused-but-set-parameter
7454 @opindex Wno-unused-but-set-parameter
7455 @item -Wunused-but-set-parameter
7456 Warn whenever a function parameter is assigned to, but otherwise unused
7457 (aside from its declaration).
7459 To suppress this warning use the @code{unused} attribute
7460 (@pxref{Variable Attributes}).
7462 This warning is also enabled by @option{-Wunused} together with
7463 @option{-Wextra}.
7465 @opindex Wunused-but-set-variable
7466 @opindex Wno-unused-but-set-variable
7467 @item -Wunused-but-set-variable
7468 Warn whenever a local variable is assigned to, but otherwise unused
7469 (aside from its declaration).
7470 This warning is enabled by @option{-Wall}.
7472 To suppress this warning use the @code{unused} attribute
7473 (@pxref{Variable Attributes}).
7475 This warning is also enabled by @option{-Wunused}, which is enabled
7476 by @option{-Wall}.
7478 @opindex Wunused-function
7479 @opindex Wno-unused-function
7480 @item -Wunused-function
7481 Warn whenever a static function is declared but not defined or a
7482 non-inline static function is unused.
7483 This warning is enabled by @option{-Wall}.
7485 @opindex Wunused-label
7486 @opindex Wno-unused-label
7487 @item -Wunused-label
7488 Warn whenever a label is declared but not used.
7489 This warning is enabled by @option{-Wall}.
7491 To suppress this warning use the @code{unused} attribute
7492 (@pxref{Variable Attributes}).
7494 @opindex Wunused-local-typedefs
7495 @opindex Wno-unused-local-typedefs
7496 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
7497 Warn when a typedef locally defined in a function is not used.
7498 This warning is enabled by @option{-Wall}.
7500 @opindex Wunused-parameter
7501 @opindex Wno-unused-parameter
7502 @item -Wunused-parameter
7503 Warn whenever a function parameter is unused aside from its declaration.
7505 To suppress this warning use the @code{unused} attribute
7506 (@pxref{Variable Attributes}).
7508 @opindex Wunused-result
7509 @opindex Wno-unused-result
7510 @item -Wno-unused-result
7511 Do not warn if a caller of a function marked with attribute
7512 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
7513 its return value. The default is @option{-Wunused-result}.
7515 @opindex Wunused-variable
7516 @opindex Wno-unused-variable
7517 @item -Wunused-variable
7518 Warn whenever a local or static variable is unused aside from its
7519 declaration. This option implies @option{-Wunused-const-variable=1} for C,
7520 but not for C++. This warning is enabled by @option{-Wall}.
7522 To suppress this warning use the @code{unused} attribute
7523 (@pxref{Variable Attributes}).
7525 @opindex Wunused-const-variable
7526 @opindex Wno-unused-const-variable
7527 @item -Wunused-const-variable
7528 @itemx -Wunused-const-variable=@var{n}
7529 Warn whenever a constant static variable is unused aside from its declaration.
7530 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
7531 for C, but not for C++. In C this declares variable storage, but in C++ this
7532 is not an error since const variables take the place of @code{#define}s.
7534 To suppress this warning use the @code{unused} attribute
7535 (@pxref{Variable Attributes}).
7537 @table @gcctabopt
7538 @item -Wunused-const-variable=1
7539 This is the warning level that is enabled by @option{-Wunused-variable} for
7540 C.  It warns only about unused static const variables defined in the main
7541 compilation unit, but not about static const variables declared in any
7542 header included.
7544 @item -Wunused-const-variable=2
7545 This warning level also warns for unused constant static variables in
7546 headers (excluding system headers).  This is the warning level of
7547 @option{-Wunused-const-variable} and must be explicitly requested since
7548 in C++ this isn't an error and in C it might be harder to clean up all
7549 headers included.
7550 @end table
7552 @opindex Wunused-value
7553 @opindex Wno-unused-value
7554 @item -Wunused-value
7555 Warn whenever a statement computes a result that is explicitly not
7556 used. To suppress this warning cast the unused expression to
7557 @code{void}. This includes an expression-statement or the left-hand
7558 side of a comma expression that contains no side effects. For example,
7559 an expression such as @code{x[i,j]} causes a warning, while
7560 @code{x[(void)i,j]} does not.
7562 This warning is enabled by @option{-Wall}.
7564 @opindex Wunused
7565 @opindex Wno-unused
7566 @item -Wunused
7567 All the above @option{-Wunused} options combined.
7569 In order to get a warning about an unused function parameter, you must
7570 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
7571 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
7573 @opindex Wuninitialized
7574 @opindex Wno-uninitialized
7575 @item -Wuninitialized
7576 Warn if an object with automatic or allocated storage duration is used
7577 without having been initialized.  In C++, also warn if a non-static
7578 reference or non-static @code{const} member appears in a class without
7579 constructors.
7581 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7582 object to a @code{const}-qualified argument of a built-in function known to
7583 read the object is also diagnosed by this warning.
7584 (@option{-Wmaybe-uninitialized} is issued for ordinary functions.)
7586 If you want to warn about code that uses the uninitialized value of the
7587 variable in its own initializer, use the @option{-Winit-self} option.
7589 These warnings occur for individual uninitialized elements of
7590 structure, union or array variables as well as for variables that are
7591 uninitialized as a whole.  They do not occur for variables or elements
7592 declared @code{volatile}.  Because these warnings depend on
7593 optimization, the exact variables or elements for which there are
7594 warnings depend on the precise optimization options and version of GCC
7595 used.
7597 Note that there may be no warning about a variable that is used only
7598 to compute a value that itself is never used, because such
7599 computations may be deleted by data flow analysis before the warnings
7600 are printed.
7602 In C++, this warning also warns about using uninitialized objects in
7603 member-initializer-lists.  For example, GCC warns about @code{b} being
7604 uninitialized in the following snippet:
7606 @smallexample
7607 struct A @{
7608   int a;
7609   int b;
7610   A() : a(b) @{ @}
7612 @end smallexample
7614 @opindex Winvalid-memory-model
7615 @opindex Wno-invalid-memory-model
7616 @item -Wno-invalid-memory-model
7617 This option controls warnings
7618 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
7619 and the C11 atomic generic functions with a memory consistency argument
7620 that is either invalid for the operation or outside the range of values
7621 of the @code{memory_order} enumeration.  For example, since the
7622 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
7623 defined for the relaxed, release, and sequentially consistent memory
7624 orders the following code is diagnosed:
7626 @smallexample
7627 void store (int *i)
7629   __atomic_store_n (i, 0, memory_order_consume);
7631 @end smallexample
7633 @option{-Winvalid-memory-model} is enabled by default.
7635 @opindex Wmaybe-uninitialized
7636 @opindex Wno-maybe-uninitialized
7637 @item -Wmaybe-uninitialized
7638 For an object with automatic or allocated storage duration, if there exists
7639 a path from the function entry to a use of the object that is initialized,
7640 but there exist some other paths for which the object is not initialized,
7641 the compiler emits a warning if it cannot prove the uninitialized paths
7642 are not executed at run time.
7644 In addition, passing a pointer (or in C++, a reference) to an uninitialized
7645 object to a @code{const}-qualified function argument is also diagnosed by
7646 this warning.  (@option{-Wuninitialized} is issued for built-in functions
7647 known to read the object.)  Annotating the function with attribute
7648 @code{access (none)} indicates that the argument isn't used to access
7649 the object and avoids the warning (@pxref{Common Function Attributes}).
7651 These warnings are only possible in optimizing compilation, because otherwise
7652 GCC does not keep track of the state of variables.
7654 These warnings are made optional because GCC may not be able to determine when
7655 the code is correct in spite of appearing to have an error.  Here is one
7656 example of how this can happen:
7658 @smallexample
7659 @group
7661   int x;
7662   switch (y)
7663     @{
7664     case 1: x = 1;
7665       break;
7666     case 2: x = 4;
7667       break;
7668     case 3: x = 5;
7669     @}
7670   foo (x);
7672 @end group
7673 @end smallexample
7675 @noindent
7676 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
7677 always initialized, but GCC doesn't know this. To suppress the
7678 warning, you need to provide a default case with assert(0) or
7679 similar code.
7681 @cindex @code{longjmp} warnings
7682 This option also warns when a non-volatile automatic variable might be
7683 changed by a call to @code{longjmp}.
7684 The compiler sees only the calls to @code{setjmp}.  It cannot know
7685 where @code{longjmp} will be called; in fact, a signal handler could
7686 call it at any point in the code.  As a result, you may get a warning
7687 even when there is in fact no problem because @code{longjmp} cannot
7688 in fact be called at the place that would cause a problem.
7690 Some spurious warnings can be avoided if you declare all the functions
7691 you use that never return as @code{noreturn}.  @xref{Function
7692 Attributes}.
7694 This warning is enabled by @option{-Wall} or @option{-Wextra}.
7696 @opindex Wunknown-pragmas
7697 @opindex Wno-unknown-pragmas
7698 @cindex warning for unknown pragmas
7699 @cindex unknown pragmas, warning
7700 @cindex pragmas, warning of unknown
7701 @item -Wunknown-pragmas
7702 Warn when a @code{#pragma} directive is encountered that is not understood by 
7703 GCC@.  If this command-line option is used, warnings are even issued
7704 for unknown pragmas in system header files.  This is not the case if
7705 the warnings are only enabled by the @option{-Wall} command-line option.
7707 @opindex Wno-pragmas
7708 @opindex Wpragmas
7709 @item -Wno-pragmas
7710 Do not warn about misuses of pragmas, such as incorrect parameters,
7711 invalid syntax, or conflicts between pragmas.  See also
7712 @option{-Wunknown-pragmas}.
7714 @opindex Wno-prio-ctor-dtor
7715 @opindex Wprio-ctor-dtor
7716 @item -Wno-prio-ctor-dtor
7717 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
7718 The use of constructor and destructor attributes allow you to assign a
7719 priority to the constructor/destructor to control its order of execution
7720 before @code{main} is called or after it returns.  The priority values must be
7721 greater than 100 as the compiler reserves priority values between 0--100 for
7722 the implementation.
7724 @opindex Wstrict-aliasing
7725 @opindex Wno-strict-aliasing
7726 @item -Wstrict-aliasing
7727 This option is only active when @option{-fstrict-aliasing} is active.
7728 It warns about code that might break the strict aliasing rules that the
7729 compiler is using for optimization.  The warning does not catch all
7730 cases, but does attempt to catch the more common pitfalls.  It is
7731 included in @option{-Wall}.
7732 It is equivalent to @option{-Wstrict-aliasing=3}
7734 @opindex Wstrict-aliasing=n
7735 @item -Wstrict-aliasing=n
7736 This option is only active when @option{-fstrict-aliasing} is active.
7737 It warns about code that might break the strict aliasing rules that the
7738 compiler is using for optimization.
7739 Higher levels correspond to higher accuracy (fewer false positives).
7740 Higher levels also correspond to more effort, similar to the way @option{-O} 
7741 works.
7742 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
7744 Level 1: Most aggressive, quick, least accurate.
7745 Possibly useful when higher levels
7746 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
7747 false negatives.  However, it has many false positives.
7748 Warns for all pointer conversions between possibly incompatible types,
7749 even if never dereferenced.  Runs in the front end only.
7751 Level 2: Aggressive, quick, not too precise.
7752 May still have many false positives (not as many as level 1 though),
7753 and few false negatives (but possibly more than level 1).
7754 Unlike level 1, it only warns when an address is taken.  Warns about
7755 incomplete types.  Runs in the front end only.
7757 Level 3 (default for @option{-Wstrict-aliasing}):
7758 Should have very few false positives and few false
7759 negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
7760 Takes care of the common pun+dereference pattern in the front end:
7761 @code{*(int*)&some_float}.
7762 If optimization is enabled, it also runs in the back end, where it deals
7763 with multiple statement cases using flow-sensitive points-to information.
7764 Only warns when the converted pointer is dereferenced.
7765 Does not warn about incomplete types.
7767 @opindex Wstrict-overflow
7768 @opindex Wno-strict-overflow
7769 @item -Wstrict-overflow
7770 @itemx -Wstrict-overflow=@var{n}
7771 This option is only active when signed overflow is undefined.
7772 It warns about cases where the compiler optimizes based on the
7773 assumption that signed overflow does not occur.  Note that it does not
7774 warn about all cases where the code might overflow: it only warns
7775 about cases where the compiler implements some optimization.  Thus
7776 this warning depends on the optimization level.
7778 An optimization that assumes that signed overflow does not occur is
7779 perfectly safe if the values of the variables involved are such that
7780 overflow never does, in fact, occur.  Therefore this warning can
7781 easily give a false positive: a warning about code that is not
7782 actually a problem.  To help focus on important issues, several
7783 warning levels are defined.  No warnings are issued for the use of
7784 undefined signed overflow when estimating how many iterations a loop
7785 requires, in particular when determining whether a loop will be
7786 executed at all.
7788 @table @gcctabopt
7789 @item -Wstrict-overflow=1
7790 Warn about cases that are both questionable and easy to avoid.  For
7791 example the compiler simplifies
7792 @code{x + 1 > x} to @code{1}.  This level of
7793 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
7794 are not, and must be explicitly requested.
7796 @item -Wstrict-overflow=2
7797 Also warn about other cases where a comparison is simplified to a
7798 constant.  For example: @code{abs (x) >= 0}.  This can only be
7799 simplified when signed integer overflow is undefined, because
7800 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
7801 zero.  @option{-Wstrict-overflow} (with no level) is the same as
7802 @option{-Wstrict-overflow=2}.
7804 @item -Wstrict-overflow=3
7805 Also warn about other cases where a comparison is simplified.  For
7806 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
7808 @item -Wstrict-overflow=4
7809 Also warn about other simplifications not covered by the above cases.
7810 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
7812 @item -Wstrict-overflow=5
7813 Also warn about cases where the compiler reduces the magnitude of a
7814 constant involved in a comparison.  For example: @code{x + 2 > y} is
7815 simplified to @code{x + 1 >= y}.  This is reported only at the
7816 highest warning level because this simplification applies to many
7817 comparisons, so this warning level gives a very large number of
7818 false positives.
7819 @end table
7821 @opindex Wstring-compare
7822 @opindex Wno-string-compare
7823 @item -Wstring-compare
7824 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
7825 determined to be either zero or non-zero in tests for such equality
7826 owing to the length of one argument being greater than the size of
7827 the array the other argument is stored in (or the bound in the case
7828 of @code{strncmp}).  Such calls could be mistakes.  For example,
7829 the call to @code{strcmp} below is diagnosed because its result is
7830 necessarily non-zero irrespective of the contents of the array @code{a}.
7832 @smallexample
7833 extern char a[4];
7834 void f (char *d)
7836   strcpy (d, "string");
7837   @dots{}
7838   if (0 == strcmp (a, d))   // cannot be true
7839     puts ("a and d are the same");
7841 @end smallexample
7843 @option{-Wstring-compare} is enabled by @option{-Wextra}.
7845 @opindex Wstringop-overflow
7846 @opindex Wno-stringop-overflow
7847 @item -Wno-stringop-overflow
7848 @item -Wstringop-overflow
7849 @itemx -Wstringop-overflow=@var{type}
7850 Warn for calls to string manipulation functions such as @code{memcpy} and
7851 @code{strcpy} that are determined to overflow the destination buffer.  The
7852 optional argument is one greater than the type of Object Size Checking to
7853 perform to determine the size of the destination.  @xref{Object Size Checking}.
7854 The argument is meaningful only for functions that operate on character arrays
7855 but not for raw memory functions like @code{memcpy} which always make use
7856 of Object Size type-0.  The option also warns for calls that specify a size
7857 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
7858 The option produces the best results with optimization enabled but can detect
7859 a small subset of simple buffer overflows even without optimization in
7860 calls to the GCC built-in functions like @code{__builtin_memcpy} that
7861 correspond to the standard functions.  In any case, the option warns about
7862 just a subset of buffer overflows detected by the corresponding overflow
7863 checking built-ins.  For example, the option issues a warning for
7864 the @code{strcpy} call below because it copies at least 5 characters
7865 (the string @code{"blue"} including the terminating NUL) into the buffer
7866 of size 4.
7868 @smallexample
7869 enum Color @{ blue, purple, yellow @};
7870 const char* f (enum Color clr)
7872   static char buf [4];
7873   const char *str;
7874   switch (clr)
7875     @{
7876       case blue: str = "blue"; break;
7877       case purple: str = "purple"; break;
7878       case yellow: str = "yellow"; break;
7879     @}
7881   return strcpy (buf, str);   // warning here
7883 @end smallexample
7885 Option @option{-Wstringop-overflow=2} is enabled by default.
7887 @table @gcctabopt
7888 @opindex Wstringop-overflow
7889 @opindex Wno-stringop-overflow
7890 @item -Wstringop-overflow
7891 @itemx -Wstringop-overflow=1
7892 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
7893 to determine the sizes of destination objects.  At this setting the option
7894 does not warn for writes past the end of subobjects of larger objects accessed
7895 by pointers unless the size of the largest surrounding object is known.  When
7896 the destination may be one of several objects it is assumed to be the largest
7897 one of them.  On Linux systems, when optimization is enabled at this setting
7898 the option warns for the same code as when the @code{_FORTIFY_SOURCE} macro
7899 is defined to a non-zero value.
7901 @item -Wstringop-overflow=2
7902 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
7903 to determine the sizes of destination objects.  At this setting the option
7904 warns about overflows when writing to members of the largest complete
7905 objects whose exact size is known.  However, it does not warn for excessive
7906 writes to the same members of unknown objects referenced by pointers since
7907 they may point to arrays containing unknown numbers of elements.  This is
7908 the default setting of the option.
7910 @item -Wstringop-overflow=3
7911 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
7912 to determine the sizes of destination objects.  At this setting the option
7913 warns about overflowing the smallest object or data member.  This is the
7914 most restrictive setting of the option that may result in warnings for safe
7915 code.
7917 @item -Wstringop-overflow=4
7918 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
7919 to determine the sizes of destination objects.  At this setting the option
7920 warns about overflowing any data members, and when the destination is
7921 one of several objects it uses the size of the largest of them to decide
7922 whether to issue a warning.  Similarly to @option{-Wstringop-overflow=3} this
7923 setting of the option may result in warnings for benign code.
7924 @end table
7926 @opindex Wstringop-overread
7927 @opindex Wno-stringop-overread
7928 @item -Wno-stringop-overread
7929 Warn for calls to string manipulation functions such as @code{memchr}, or
7930 @code{strcpy} that are determined to read past the end of the source
7931 sequence.
7933 Option @option{-Wstringop-overread} is enabled by default.
7935 @opindex Wstringop-truncation
7936 @opindex Wno-stringop-truncation
7937 @item -Wno-stringop-truncation
7938 Do not warn for calls to bounded string manipulation functions
7939 such as @code{strncat},
7940 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
7941 or leave the destination unchanged.
7943 In the following example, the call to @code{strncat} specifies a bound that
7944 is less than the length of the source string.  As a result, the copy of
7945 the source will be truncated and so the call is diagnosed.  To avoid the
7946 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
7948 @smallexample
7949 void append (char *buf, size_t bufsize)
7951   strncat (buf, ".txt", 3);
7953 @end smallexample
7955 As another example, the following call to @code{strncpy} results in copying
7956 to @code{d} just the characters preceding the terminating NUL, without
7957 appending the NUL to the end.  Assuming the result of @code{strncpy} is
7958 necessarily a NUL-terminated string is a common mistake, and so the call
7959 is diagnosed.  To avoid the warning when the result is not expected to be
7960 NUL-terminated, call @code{memcpy} instead.
7962 @smallexample
7963 void copy (char *d, const char *s)
7965   strncpy (d, s, strlen (s));
7967 @end smallexample
7969 In the following example, the call to @code{strncpy} specifies the size
7970 of the destination buffer as the bound.  If the length of the source
7971 string is equal to or greater than this size the result of the copy will
7972 not be NUL-terminated.  Therefore, the call is also diagnosed.  To avoid
7973 the warning, specify @code{sizeof buf - 1} as the bound and set the last
7974 element of the buffer to @code{NUL}.
7976 @smallexample
7977 void copy (const char *s)
7979   char buf[80];
7980   strncpy (buf, s, sizeof buf);
7981   @dots{}
7983 @end smallexample
7985 In situations where a character array is intended to store a sequence
7986 of bytes with no terminating @code{NUL} such an array may be annotated
7987 with attribute @code{nonstring} to avoid this warning.  Such arrays,
7988 however, are not suitable arguments to functions that expect
7989 @code{NUL}-terminated strings.  To help detect accidental misuses of
7990 such arrays GCC issues warnings unless it can prove that the use is
7991 safe.  @xref{Common Variable Attributes}.
7993 @opindex Wstrict-flex-arrays
7994 @opindex Wno-strict-flex-arrays
7995 @item -Wstrict-flex-arrays
7996 Warn about inproper usages of flexible array members
7997 according to the @var{level} of the @code{strict_flex_array (@var{level})}
7998 attribute attached to the trailing array field of a structure if it's
7999 available, otherwise according to the @var{level} of the option
8000 @option{-fstrict-flex-arrays=@var{level}}.
8002 This option is effective only when @var{level} is bigger than 0.  Otherwise,
8003 it will be ignored with a warning.
8005 when @var{level}=1, warnings will be issued for a trailing array reference
8006 of a structure that have 2 or more elements if the trailing array is referenced
8007 as a flexible array member.
8009 when @var{level}=2, in addition to @var{level}=1, additional warnings will be
8010 issued for a trailing one-element array reference of a structure
8011 if the array is referenced as a flexible array member.
8013 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8014 issued for a trailing zero-length array reference of a structure
8015 if the array is referenced as a flexible array member.
8018 @opindex Wsuggest-attribute=
8019 @opindex Wno-suggest-attribute=
8020 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
8021 Warn for cases where adding an attribute may be beneficial. The
8022 attributes currently supported are listed below.
8024 @table @gcctabopt
8025 @opindex Wsuggest-attribute=pure
8026 @opindex Wno-suggest-attribute=pure
8027 @opindex Wsuggest-attribute=const
8028 @opindex Wno-suggest-attribute=const
8029 @opindex Wsuggest-attribute=noreturn
8030 @opindex Wno-suggest-attribute=noreturn
8031 @opindex Wmissing-noreturn
8032 @opindex Wno-missing-noreturn
8033 @opindex Wsuggest-attribute=malloc
8034 @opindex Wno-suggest-attribute=malloc
8035 @item -Wsuggest-attribute=pure
8036 @itemx -Wsuggest-attribute=const
8037 @itemx -Wsuggest-attribute=noreturn
8038 @itemx -Wmissing-noreturn
8039 @itemx -Wsuggest-attribute=malloc
8041 Warn about functions that might be candidates for attributes
8042 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
8043 only warns for functions visible in other compilation units or (in the case of
8044 @code{pure} and @code{const}) if it cannot prove that the function returns
8045 normally. A function returns normally if it doesn't contain an infinite loop or
8046 return abnormally by throwing, calling @code{abort} or trapping.  This analysis
8047 requires option @option{-fipa-pure-const}, which is enabled by default at
8048 @option{-O} and higher.  Higher optimization levels improve the accuracy
8049 of the analysis.
8051 @opindex Wsuggest-attribute=format
8052 @opindex Wmissing-format-attribute
8053 @opindex Wno-suggest-attribute=format
8054 @opindex Wno-missing-format-attribute
8055 @opindex Wformat
8056 @opindex Wno-format
8057 @item -Wsuggest-attribute=format
8058 @itemx -Wmissing-format-attribute
8060 Warn about function pointers that might be candidates for @code{format}
8061 attributes.  Note these are only possible candidates, not absolute ones.
8062 GCC guesses that function pointers with @code{format} attributes that
8063 are used in assignment, initialization, parameter passing or return
8064 statements should have a corresponding @code{format} attribute in the
8065 resulting type.  I.e.@: the left-hand side of the assignment or
8066 initialization, the type of the parameter variable, or the return type
8067 of the containing function respectively should also have a @code{format}
8068 attribute to avoid the warning.
8070 GCC also warns about function definitions that might be
8071 candidates for @code{format} attributes.  Again, these are only
8072 possible candidates.  GCC guesses that @code{format} attributes
8073 might be appropriate for any function that calls a function like
8074 @code{vprintf} or @code{vscanf}, but this might not always be the
8075 case, and some functions for which @code{format} attributes are
8076 appropriate may not be detected.
8078 @opindex Wsuggest-attribute=cold
8079 @opindex Wno-suggest-attribute=cold
8080 @item -Wsuggest-attribute=cold
8082 Warn about functions that might be candidates for @code{cold} attribute.  This
8083 is based on static detection and generally only warns about functions which
8084 always leads to a call to another @code{cold} function such as wrappers of
8085 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
8086 @end table
8088 @opindex Wno-alloc-zero
8089 @opindex Walloc-zero
8090 @item -Walloc-zero
8091 Warn about calls to allocation functions decorated with attribute
8092 @code{alloc_size} that specify zero bytes, including those to the built-in
8093 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
8094 @code{malloc}, and @code{realloc}.  Because the behavior of these functions
8095 when called with a zero size differs among implementations (and in the case
8096 of @code{realloc} has been deprecated) relying on it may result in subtle
8097 portability bugs and should be avoided.
8099 @opindex Walloc-size-larger-than=
8100 @opindex Wno-alloc-size-larger-than
8101 @item -Walloc-size-larger-than=@var{byte-size}
8102 Warn about calls to functions decorated with attribute @code{alloc_size}
8103 that attempt to allocate objects larger than the specified number of bytes,
8104 or where the result of the size computation in an integer type with infinite
8105 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
8106 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8107 Warnings controlled by the option can be disabled either by specifying
8108 @var{byte-size} of @samp{SIZE_MAX} or more or by
8109 @option{-Wno-alloc-size-larger-than}.
8110 @xref{Function Attributes}.
8112 @opindex Wno-alloc-size-larger-than
8113 @item -Wno-alloc-size-larger-than
8114 Disable @option{-Walloc-size-larger-than=} warnings.  The option is
8115 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
8116 larger.
8118 @opindex Wno-alloca
8119 @opindex Walloca
8120 @item -Walloca
8121 This option warns on all uses of @code{alloca} in the source.
8123 @opindex Walloca-larger-than=
8124 @opindex Wno-alloca-larger-than
8125 @item -Walloca-larger-than=@var{byte-size}
8126 This option warns on calls to @code{alloca} with an integer argument whose
8127 value is either zero, or that is not bounded by a controlling predicate
8128 that limits its value to at most @var{byte-size}.  It also warns for calls
8129 to @code{alloca} where the bound value is unknown.  Arguments of non-integer
8130 types are considered unbounded even if they appear to be constrained to
8131 the expected range.
8133 For example, a bounded case of @code{alloca} could be:
8135 @smallexample
8136 void func (size_t n)
8138   void *p;
8139   if (n <= 1000)
8140     p = alloca (n);
8141   else
8142     p = malloc (n);
8143   f (p);
8145 @end smallexample
8147 In the above example, passing @code{-Walloca-larger-than=1000} would not
8148 issue a warning because the call to @code{alloca} is known to be at most
8149 1000 bytes.  However, if @code{-Walloca-larger-than=500} were passed,
8150 the compiler would emit a warning.
8152 Unbounded uses, on the other hand, are uses of @code{alloca} with no
8153 controlling predicate constraining its integer argument.  For example:
8155 @smallexample
8156 void func ()
8158   void *p = alloca (n);
8159   f (p);
8161 @end smallexample
8163 If @code{-Walloca-larger-than=500} were passed, the above would trigger
8164 a warning, but this time because of the lack of bounds checking.
8166 Note, that even seemingly correct code involving signed integers could
8167 cause a warning:
8169 @smallexample
8170 void func (signed int n)
8172   if (n < 500)
8173     @{
8174       p = alloca (n);
8175       f (p);
8176     @}
8178 @end smallexample
8180 In the above example, @var{n} could be negative, causing a larger than
8181 expected argument to be implicitly cast into the @code{alloca} call.
8183 This option also warns when @code{alloca} is used in a loop.
8185 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
8186 but is usually only effective  when @option{-ftree-vrp} is active (default
8187 for @option{-O2} and above).
8189 See also @option{-Wvla-larger-than=}@samp{byte-size}.
8191 @opindex Wno-alloca-larger-than
8192 @item -Wno-alloca-larger-than
8193 Disable @option{-Walloca-larger-than=} warnings.  The option is
8194 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
8196 @opindex Warith-conversion
8197 @opindex Wno-arith-conversion
8198 @item -Warith-conversion
8199 Do warn about implicit conversions from arithmetic operations even
8200 when conversion of the operands to the same type cannot change their
8201 values.  This affects warnings from @option{-Wconversion},
8202 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
8204 @smallexample
8205 @group
8206 void f (char c, int i)
8208   c = c + i; // warns with @option{-Wconversion}
8209   c = c + 1; // only warns with @option{-Warith-conversion}
8211 @end group
8212 @end smallexample
8214 @opindex Wno-array-bounds
8215 @opindex Warray-bounds
8216 @item -Warray-bounds
8217 @itemx -Warray-bounds=@var{n}
8218 Warn about out of bounds subscripts or offsets into arrays.  This warning
8219 is enabled by @option{-Wall}.  It is more effective when @option{-ftree-vrp}
8220 is active (the default for @option{-O2} and above) but a subset of instances
8221 are issued even without optimization.
8223 By default, the trailing array of a structure will be treated as a flexible
8224 array member by @option{-Warray-bounds} or @option{-Warray-bounds=@var{n}}
8225 if it is declared as either a flexible array member per C99 standard onwards
8226 (@samp{[]}), a GCC zero-length array extension (@samp{[0]}), or an one-element
8227 array (@samp{[1]}). As a result, out of bounds subscripts or offsets into
8228 zero-length arrays or one-element arrays are not warned by default.
8230 You can add the option @option{-fstrict-flex-arrays} or
8231 @option{-fstrict-flex-arrays=@var{level}} to control how this
8232 option treat trailing array of a structure as a flexible array member:
8234 when @var{level}<=1, no change to the default behavior.
8236 when @var{level}=2, additional warnings will be issued for out of bounds
8237 subscripts or offsets into one-element arrays;
8239 when @var{level}=3, in addition to @var{level}=2, additional warnings will be
8240 issued for out of bounds subscripts or offsets into zero-length arrays.
8242 @table @gcctabopt
8243 @item -Warray-bounds=1
8244 This is the default warning level of @option{-Warray-bounds} and is enabled
8245 by @option{-Wall}; higher levels are not, and must be explicitly requested.
8247 @item -Warray-bounds=2
8248 This warning level also warns about the intermediate results of pointer
8249 arithmetic that may yield out of bounds values. This warning level may
8250 give a larger number of false positives and is deactivated by default.
8251 @end table
8253 @opindex Warray-compare
8254 @opindex Wno-array-compare
8255 @item -Warray-compare
8256 Warn about equality and relational comparisons between two operands of array
8257 type.  This comparison was deprecated in C++20.  For example:
8259 @smallexample
8260 int arr1[5];
8261 int arr2[5];
8262 bool same = arr1 == arr2;
8263 @end smallexample
8265 @option{-Warray-compare} is enabled by @option{-Wall}.
8267 @opindex Wno-array-parameter
8268 @item -Warray-parameter
8269 @itemx -Warray-parameter=@var{n}
8270 Warn about redeclarations of functions involving arguments of array or
8271 pointer types of inconsistent kinds or forms, and enable the detection
8272 of out-of-bounds accesses to such parameters by warnings such as
8273 @option{-Warray-bounds}.
8275 If the first function declaration uses the array form the bound specified
8276 in the array is assumed to be the minimum number of elements expected to
8277 be provided in calls to the function and the maximum number of elements
8278 accessed by it.  Failing to provide arguments of sufficient size or accessing
8279 more than the maximum number of elements may be diagnosed by warnings such
8280 as @option{-Warray-bounds}.  At level 1 the warning diagnoses inconsistencies
8281 involving array parameters declared using the @code{T[static N]} form.
8283 For example, the warning triggers for the following redeclarations because
8284 the first one allows an array of any size to be passed to @code{f} while
8285 the second one with the keyword @code{static} specifies that the array
8286 argument must have at least four elements.
8288 @smallexample
8289 void f (int[static 4]);
8290 void f (int[]);           // warning (inconsistent array form)
8292 void g (void)
8294   int *p = (int *)malloc (4);
8295   f (p);                  // warning (array too small)
8296   @dots{}
8298 @end smallexample
8300 At level 2 the warning also triggers for redeclarations involving any other
8301 inconsistency in array or pointer argument forms denoting array sizes.
8302 Pointers and arrays of unspecified bound are considered equivalent and do
8303 not trigger a warning.
8305 @smallexample
8306 void g (int*);
8307 void g (int[]);     // no warning
8308 void g (int[8]);    // warning (inconsistent array bound)
8309 @end smallexample
8311 @option{-Warray-parameter=2} is included in @option{-Wall}.  The
8312 @option{-Wvla-parameter} option triggers warnings for similar inconsistencies
8313 involving Variable Length Array arguments.
8315 @opindex Wattribute-alias
8316 @opindex Wno-attribute-alias
8317 @item -Wattribute-alias=@var{n}
8318 @itemx -Wno-attribute-alias
8319 Warn about declarations using the @code{alias} and similar attributes whose
8320 target is incompatible with the type of the alias.
8321 @xref{Function Attributes,,Declaring Attributes of Functions}.
8323 @table @gcctabopt
8324 @item -Wattribute-alias=1
8325 The default warning level of the @option{-Wattribute-alias} option diagnoses
8326 incompatibilities between the type of the alias declaration and that of its
8327 target.  Such incompatibilities are typically indicative of bugs.
8329 @item -Wattribute-alias=2
8331 At this level @option{-Wattribute-alias} also diagnoses cases where
8332 the attributes of the alias declaration are more restrictive than the
8333 attributes applied to its target.  These mismatches can potentially
8334 result in incorrect code generation.  In other cases they may be
8335 benign and could be resolved simply by adding the missing attribute to
8336 the target.  For comparison, see the @option{-Wmissing-attributes}
8337 option, which controls diagnostics when the alias declaration is less
8338 restrictive than the target, rather than more restrictive.
8340 Attributes considered include @code{alloc_align}, @code{alloc_size},
8341 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
8342 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
8343 @code{returns_nonnull}, and @code{returns_twice}.
8344 @end table
8346 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
8347 This is the default.  You can disable these warnings with either
8348 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
8350 @opindex Wbidi-chars=
8351 @opindex Wbidi-chars
8352 @opindex Wno-bidi-chars
8353 @item -Wbidi-chars=@r{[}none@r{|}unpaired@r{|}any@r{|}ucn@r{]}
8354 Warn about possibly misleading UTF-8 bidirectional control characters in
8355 comments, string literals, character constants, and identifiers.  Such
8356 characters can change left-to-right writing direction into right-to-left
8357 (and vice versa), which can cause confusion between the logical order and
8358 visual order.  This may be dangerous; for instance, it may seem that a piece
8359 of code is not commented out, whereas it in fact is.
8361 There are three levels of warning supported by GCC@.  The default is
8362 @option{-Wbidi-chars=unpaired}, which warns about improperly terminated
8363 bidi contexts.  @option{-Wbidi-chars=none} turns the warning off.
8364 @option{-Wbidi-chars=any} warns about any use of bidirectional control
8365 characters.
8367 By default, this warning does not warn about UCNs.  It is, however, possible
8368 to turn on such checking by using @option{-Wbidi-chars=unpaired,ucn} or
8369 @option{-Wbidi-chars=any,ucn}.  Using @option{-Wbidi-chars=ucn} is valid,
8370 and is equivalent to @option{-Wbidi-chars=unpaired,ucn}, if no previous
8371 @option{-Wbidi-chars=any} was specified.
8373 @opindex Wno-bool-compare
8374 @opindex Wbool-compare
8375 @item -Wbool-compare
8376 Warn about boolean expression compared with an integer value different from
8377 @code{true}/@code{false}.  For instance, the following comparison is
8378 always false:
8379 @smallexample
8380 int n = 5;
8381 @dots{}
8382 if ((n > 1) == 2) @{ @dots{} @}
8383 @end smallexample
8384 This warning is enabled by @option{-Wall}.
8386 @opindex Wno-bool-operation
8387 @opindex Wbool-operation
8388 @item -Wbool-operation
8389 Warn about suspicious operations on expressions of a boolean type.  For
8390 instance, bitwise negation of a boolean is very likely a bug in the program.
8391 For C, this warning also warns about incrementing or decrementing a boolean,
8392 which rarely makes sense.  (In C++, decrementing a boolean is always invalid.
8393 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
8395 This warning is enabled by @option{-Wall}.
8397 @opindex Wno-duplicated-branches
8398 @opindex Wduplicated-branches
8399 @item -Wduplicated-branches
8400 Warn when an if-else has identical branches.  This warning detects cases like
8401 @smallexample
8402 if (p != NULL)
8403   return 0;
8404 else
8405   return 0;
8406 @end smallexample
8407 It doesn't warn when both branches contain just a null statement.  This warning
8408 also warn for conditional operators:
8409 @smallexample
8410   int i = x ? *p : *p;
8411 @end smallexample
8413 @opindex Wno-duplicated-cond
8414 @opindex Wduplicated-cond
8415 @item -Wduplicated-cond
8416 Warn about duplicated conditions in an if-else-if chain.  For instance,
8417 warn for the following code:
8418 @smallexample
8419 if (p->q != NULL) @{ @dots{} @}
8420 else if (p->q != NULL) @{ @dots{} @}
8421 @end smallexample
8423 @opindex Wno-frame-address
8424 @opindex Wframe-address
8425 @item -Wframe-address
8426 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
8427 is called with an argument greater than 0.  Such calls may return indeterminate
8428 values or crash the program.  The warning is included in @option{-Wall}.
8430 @opindex Wno-discarded-qualifiers
8431 @opindex Wdiscarded-qualifiers
8432 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
8433 Do not warn if type qualifiers on pointers are being discarded.
8434 Typically, the compiler warns if a @code{const char *} variable is
8435 passed to a function that takes a @code{char *} parameter.  This option
8436 can be used to suppress such a warning.
8438 @opindex Wno-discarded-array-qualifiers
8439 @opindex Wdiscarded-array-qualifiers
8440 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
8441 Do not warn if type qualifiers on arrays which are pointer targets
8442 are being discarded.  Typically, the compiler warns if a
8443 @code{const int (*)[]} variable is passed to a function that
8444 takes a @code{int (*)[]} parameter.  This option can be used to
8445 suppress such a warning.
8447 @opindex Wno-incompatible-pointer-types
8448 @opindex Wincompatible-pointer-types
8449 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
8450 Do not warn when there is a conversion between pointers that have incompatible
8451 types.  This warning is for cases not covered by @option{-Wno-pointer-sign},
8452 which warns for pointer argument passing or assignment with different
8453 signedness.
8455 This warning is upgraded to an error by @option{-pedantic-errors}.
8457 @opindex Wno-int-conversion
8458 @opindex Wint-conversion
8459 @item -Wno-int-conversion @r{(C and Objective-C only)}
8460 Do not warn about incompatible integer to pointer and pointer to integer
8461 conversions.  This warning is about implicit conversions; for explicit
8462 conversions the warnings @option{-Wno-int-to-pointer-cast} and
8463 @option{-Wno-pointer-to-int-cast} may be used.
8465 This warning is upgraded to an error by @option{-pedantic-errors}.
8467 @opindex Wzero-length-bounds
8468 @opindex Wzero-length-bounds
8469 @item -Wzero-length-bounds
8470 Warn about accesses to elements of zero-length array members that might
8471 overlap other members of the same object.  Declaring interior zero-length
8472 arrays is discouraged because accesses to them are undefined.
8473 @xref{Zero Length}.
8475 For example, the first two stores in function @code{bad} are diagnosed
8476 because the array elements overlap the subsequent members @code{b} and
8477 @code{c}.  The third store is diagnosed by @option{-Warray-bounds}
8478 because it is beyond the bounds of the enclosing object.
8480 @smallexample
8481 struct X @{ int a[0]; int b, c; @};
8482 struct X x;
8484 void bad (void)
8486   x.a[0] = 0;   // -Wzero-length-bounds
8487   x.a[1] = 1;   // -Wzero-length-bounds
8488   x.a[2] = 2;   // -Warray-bounds
8490 @end smallexample
8492 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
8494 @opindex Wno-div-by-zero
8495 @opindex Wdiv-by-zero
8496 @item -Wno-div-by-zero
8497 Do not warn about compile-time integer division by zero.  Floating-point
8498 division by zero is not warned about, as it can be a legitimate way of
8499 obtaining infinities and NaNs.
8501 @opindex Wsystem-headers
8502 @opindex Wno-system-headers
8503 @cindex warnings from system headers
8504 @cindex system headers, warnings from
8505 @item -Wsystem-headers
8506 Print warning messages for constructs found in system header files.
8507 Warnings from system headers are normally suppressed, on the assumption
8508 that they usually do not indicate real problems and would only make the
8509 compiler output harder to read.  Using this command-line option tells
8510 GCC to emit warnings from system headers as if they occurred in user
8511 code.  However, note that using @option{-Wall} in conjunction with this
8512 option does @emph{not} warn about unknown pragmas in system
8513 headers---for that, @option{-Wunknown-pragmas} must also be used.
8515 @opindex Wtautological-compare
8516 @opindex Wno-tautological-compare
8517 @item -Wtautological-compare
8518 Warn if a self-comparison always evaluates to true or false.  This
8519 warning detects various mistakes such as:
8520 @smallexample
8521 int i = 1;
8522 @dots{}
8523 if (i > i) @{ @dots{} @}
8524 @end smallexample
8526 This warning also warns about bitwise comparisons that always evaluate
8527 to true or false, for instance:
8528 @smallexample
8529 if ((a & 16) == 10) @{ @dots{} @}
8530 @end smallexample
8531 will always be false.
8533 This warning is enabled by @option{-Wall}.
8535 @opindex Wtrampolines
8536 @opindex Wno-trampolines
8537 @item -Wtrampolines
8538 Warn about trampolines generated for pointers to nested functions.
8539 A trampoline is a small piece of data or code that is created at run
8540 time on the stack when the address of a nested function is taken, and is
8541 used to call the nested function indirectly.  For some targets, it is
8542 made up of data only and thus requires no special treatment.  But, for
8543 most targets, it is made up of code and thus requires the stack to be
8544 made executable in order for the program to work properly.
8546 @opindex Wfloat-equal
8547 @opindex Wno-float-equal
8548 @item -Wfloat-equal
8549 Warn if floating-point values are used in equality comparisons.
8551 The idea behind this is that sometimes it is convenient (for the
8552 programmer) to consider floating-point values as approximations to
8553 infinitely precise real numbers.  If you are doing this, then you need
8554 to compute (by analyzing the code, or in some other way) the maximum or
8555 likely maximum error that the computation introduces, and allow for it
8556 when performing comparisons (and when producing output, but that's a
8557 different problem).  In particular, instead of testing for equality, you
8558 should check to see whether the two values have ranges that overlap; and
8559 this is done with the relational operators, so equality comparisons are
8560 probably mistaken.
8562 @opindex Wtraditional
8563 @opindex Wno-traditional
8564 @item -Wtraditional @r{(C and Objective-C only)}
8565 Warn about certain constructs that behave differently in traditional and
8566 ISO C@.  Also warn about ISO C constructs that have no traditional C
8567 equivalent, and/or problematic constructs that should be avoided.
8569 @itemize @bullet
8570 @item
8571 Macro parameters that appear within string literals in the macro body.
8572 In traditional C macro replacement takes place within string literals,
8573 but in ISO C it does not.
8575 @item
8576 In traditional C, some preprocessor directives did not exist.
8577 Traditional preprocessors only considered a line to be a directive
8578 if the @samp{#} appeared in column 1 on the line.  Therefore
8579 @option{-Wtraditional} warns about directives that traditional C
8580 understands but ignores because the @samp{#} does not appear as the
8581 first character on the line.  It also suggests you hide directives like
8582 @code{#pragma} not understood by traditional C by indenting them.  Some
8583 traditional implementations do not recognize @code{#elif}, so this option
8584 suggests avoiding it altogether.
8586 @item
8587 A function-like macro that appears without arguments.
8589 @item
8590 The unary plus operator.
8592 @item
8593 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
8594 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
8595 constants.)  Note, these suffixes appear in macros defined in the system
8596 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
8597 Use of these macros in user code might normally lead to spurious
8598 warnings, however GCC's integrated preprocessor has enough context to
8599 avoid warning in these cases.
8601 @item
8602 A function declared external in one block and then used after the end of
8603 the block.
8605 @item
8606 A @code{switch} statement has an operand of type @code{long}.
8608 @item
8609 A non-@code{static} function declaration follows a @code{static} one.
8610 This construct is not accepted by some traditional C compilers.
8612 @item
8613 The ISO type of an integer constant has a different width or
8614 signedness from its traditional type.  This warning is only issued if
8615 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
8616 typically represent bit patterns, are not warned about.
8618 @item
8619 Usage of ISO string concatenation is detected.
8621 @item
8622 Initialization of automatic aggregates.
8624 @item
8625 Identifier conflicts with labels.  Traditional C lacks a separate
8626 namespace for labels.
8628 @item
8629 Initialization of unions.  If the initializer is zero, the warning is
8630 omitted.  This is done under the assumption that the zero initializer in
8631 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
8632 initializer warnings and relies on default initialization to zero in the
8633 traditional C case.
8635 @item
8636 Conversions by prototypes between fixed/floating-point values and vice
8637 versa.  The absence of these prototypes when compiling with traditional
8638 C causes serious problems.  This is a subset of the possible
8639 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
8641 @item
8642 Use of ISO C style function definitions.  This warning intentionally is
8643 @emph{not} issued for prototype declarations or variadic functions
8644 because these ISO C features appear in your code when using
8645 libiberty's traditional C compatibility macros, @code{PARAMS} and
8646 @code{VPARAMS}.  This warning is also bypassed for nested functions
8647 because that feature is already a GCC extension and thus not relevant to
8648 traditional C compatibility.
8649 @end itemize
8651 @opindex Wtraditional-conversion
8652 @opindex Wno-traditional-conversion
8653 @item -Wtraditional-conversion @r{(C and Objective-C only)}
8654 Warn if a prototype causes a type conversion that is different from what
8655 would happen to the same argument in the absence of a prototype.  This
8656 includes conversions of fixed point to floating and vice versa, and
8657 conversions changing the width or signedness of a fixed-point argument
8658 except when the same as the default promotion.
8660 @opindex Wdeclaration-after-statement
8661 @opindex Wno-declaration-after-statement
8662 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
8663 Warn when a declaration is found after a statement in a block.  This
8664 construct, known from C++, was introduced with ISO C99 and is by default
8665 allowed in GCC@.  It is not supported by ISO C90.  @xref{Mixed Labels and Declarations}.
8667 This warning is upgraded to an error by @option{-pedantic-errors}.
8669 @opindex Wshadow
8670 @opindex Wno-shadow
8671 @item -Wshadow
8672 Warn whenever a local variable or type declaration shadows another
8673 variable, parameter, type, class member (in C++), or instance variable
8674 (in Objective-C) or whenever a built-in function is shadowed.  Note
8675 that in C++, the compiler warns if a local variable shadows an
8676 explicit typedef, but not if it shadows a struct/class/enum.
8677 If this warning is enabled, it includes also all instances of
8678 local shadowing.  This means that @option{-Wno-shadow=local}
8679 and @option{-Wno-shadow=compatible-local} are ignored when
8680 @option{-Wshadow} is used.
8681 Same as @option{-Wshadow=global}.
8683 @opindex Wno-shadow-ivar
8684 @opindex Wshadow-ivar
8685 @item -Wno-shadow-ivar @r{(Objective-C only)}
8686 Do not warn whenever a local variable shadows an instance variable in an
8687 Objective-C method.
8689 @opindex Wshadow=global
8690 @item -Wshadow=global
8691 Warn for any shadowing.
8692 Same as @option{-Wshadow}.
8694 @opindex Wshadow=local
8695 @item -Wshadow=local
8696 Warn when a local variable shadows another local variable or parameter.
8698 @opindex Wshadow=compatible-local
8699 @item -Wshadow=compatible-local
8700 Warn when a local variable shadows another local variable or parameter
8701 whose type is compatible with that of the shadowing variable.  In C++,
8702 type compatibility here means the type of the shadowing variable can be
8703 converted to that of the shadowed variable.  The creation of this flag
8704 (in addition to @option{-Wshadow=local}) is based on the idea that when
8705 a local variable shadows another one of incompatible type, it is most
8706 likely intentional, not a bug or typo, as shown in the following example:
8708 @smallexample
8709 @group
8710 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
8712   for (int i = 0; i < N; ++i)
8713   @{
8714     ...
8715   @}
8716   ...
8718 @end group
8719 @end smallexample
8721 Since the two variable @code{i} in the example above have incompatible types,
8722 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
8723 Because their types are incompatible, if a programmer accidentally uses one
8724 in place of the other, type checking is expected to catch that and emit an
8725 error or warning.  Use of this flag instead of @option{-Wshadow=local} can
8726 possibly reduce the number of warnings triggered by intentional shadowing.
8727 Note that this also means that shadowing @code{const char *i} by
8728 @code{char *i} does not emit a warning.
8730 This warning is also enabled by @option{-Wshadow=local}.
8732 @opindex Wlarger-than=
8733 @opindex Wlarger-than-@var{byte-size}
8734 @item -Wlarger-than=@var{byte-size}
8735 Warn whenever an object is defined whose size exceeds @var{byte-size}.
8736 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8737 Warnings controlled by the option can be disabled either by specifying
8738 @var{byte-size} of @samp{SIZE_MAX} or more or by @option{-Wno-larger-than}.
8740 Also warn for calls to bounded functions such as @code{memchr} or
8741 @code{strnlen} that specify a bound greater than the largest possible
8742 object, which is @samp{PTRDIFF_MAX} bytes by default.  These warnings
8743 can only be disabled by @option{-Wno-larger-than}.
8745 @opindex Wno-larger-than
8746 @item -Wno-larger-than
8747 Disable @option{-Wlarger-than=} warnings.  The option is equivalent
8748 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
8750 @opindex Wframe-larger-than=
8751 @opindex Wno-frame-larger-than
8752 @item -Wframe-larger-than=@var{byte-size}
8753 Warn if the size of a function frame exceeds @var{byte-size}.
8754 The computation done to determine the stack frame size is approximate
8755 and not conservative.
8756 The actual requirements may be somewhat greater than @var{byte-size}
8757 even if you do not get a warning.  In addition, any space allocated
8758 via @code{alloca}, variable-length arrays, or related constructs
8759 is not included by the compiler when determining
8760 whether or not to issue a warning.
8761 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
8762 Warnings controlled by the option can be disabled either by specifying
8763 @var{byte-size} of @samp{SIZE_MAX} or more or by
8764 @option{-Wno-frame-larger-than}.
8766 @opindex Wno-frame-larger-than
8767 @item -Wno-frame-larger-than
8768 Disable @option{-Wframe-larger-than=} warnings.  The option is equivalent
8769 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
8771 @opindex Wfree-nonheap-object
8772 @opindex Wno-free-nonheap-object
8773 @item -Wfree-nonheap-object
8774 Warn when attempting to deallocate an object that was either not allocated
8775 on the heap, or by using a pointer that was not returned from a prior call
8776 to the corresponding allocation function.  For example, because the call
8777 to @code{stpcpy} returns a pointer to the terminating nul character and
8778 not to the beginning of the object, the call to @code{free} below is
8779 diagnosed.
8781 @smallexample
8782 void f (char *p)
8784   p = stpcpy (p, "abc");
8785   // ...
8786   free (p);   // warning
8788 @end smallexample
8790 @option{-Wfree-nonheap-object} is included in @option{-Wall}.
8792 @opindex Wstack-usage
8793 @opindex Wno-stack-usage
8794 @item -Wstack-usage=@var{byte-size}
8795 Warn if the stack usage of a function might exceed @var{byte-size}.
8796 The computation done to determine the stack usage is conservative.
8797 Any space allocated via @code{alloca}, variable-length arrays, or related
8798 constructs is included by the compiler when determining whether or not to
8799 issue a warning.
8801 The message is in keeping with the output of @option{-fstack-usage}.
8803 @itemize
8804 @item
8805 If the stack usage is fully static but exceeds the specified amount, it's:
8807 @smallexample
8808   warning: stack usage is 1120 bytes
8809 @end smallexample
8810 @item
8811 If the stack usage is (partly) dynamic but bounded, it's:
8813 @smallexample
8814   warning: stack usage might be 1648 bytes
8815 @end smallexample
8816 @item
8817 If the stack usage is (partly) dynamic and not bounded, it's:
8819 @smallexample
8820   warning: stack usage might be unbounded
8821 @end smallexample
8822 @end itemize
8824 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
8825 Warnings controlled by the option can be disabled either by specifying
8826 @var{byte-size} of @samp{SIZE_MAX} or more or by
8827 @option{-Wno-stack-usage}.
8829 @opindex Wno-stack-usage
8830 @item -Wno-stack-usage
8831 Disable @option{-Wstack-usage=} warnings.  The option is equivalent
8832 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
8834 @opindex Wunsafe-loop-optimizations
8835 @opindex Wno-unsafe-loop-optimizations
8836 @item -Wunsafe-loop-optimizations
8837 Warn if the loop cannot be optimized because the compiler cannot
8838 assume anything on the bounds of the loop indices.  With
8839 @option{-funsafe-loop-optimizations} warn if the compiler makes
8840 such assumptions.
8842 @opindex Wno-pedantic-ms-format
8843 @opindex Wpedantic-ms-format
8844 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
8845 When used in combination with @option{-Wformat}
8846 and @option{-pedantic} without GNU extensions, this option
8847 disables the warnings about non-ISO @code{printf} / @code{scanf} format
8848 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
8849 which depend on the MS runtime.
8851 @opindex Wpointer-arith
8852 @opindex Wno-pointer-arith
8853 @item -Wpointer-arith
8854 Warn about anything that depends on the ``size of'' a function type or
8855 of @code{void}.  GNU C assigns these types a size of 1, for
8856 convenience in calculations with @code{void *} pointers and pointers
8857 to functions.  In C++, warn also when an arithmetic operation involves
8858 @code{NULL}.  This warning is also enabled by @option{-Wpedantic}.
8860 This warning is upgraded to an error by @option{-pedantic-errors}.
8862 @opindex Wpointer-compare
8863 @opindex Wno-pointer-compare
8864 @item -Wno-pointer-compare
8865 Do not warn if a pointer is compared with a zero character constant.
8866 This usually
8867 means that the pointer was meant to be dereferenced.  For example:
8869 @smallexample
8870 const char *p = foo ();
8871 if (p == '\0')
8872   return 42;
8873 @end smallexample
8875 Note that the code above is invalid in C++11.
8877 This warning is enabled by default.
8879 @opindex Wtsan
8880 @opindex Wno-tsan
8881 @item -Wtsan
8882 Warn about unsupported features in ThreadSanitizer.
8884 ThreadSanitizer does not support @code{std::atomic_thread_fence} and
8885 can report false positives.
8887 This warning is enabled by default.
8889 @opindex Wtype-limits
8890 @opindex Wno-type-limits
8891 @item -Wtype-limits
8892 Warn if a comparison is always true or always false due to the limited
8893 range of the data type, but do not warn for constant expressions.  For
8894 example, warn if an unsigned variable is compared against zero with
8895 @code{<} or @code{>=}.  This warning is also enabled by
8896 @option{-Wextra}.
8898 @opindex Wabsolute-value
8899 @opindex Wno-absolute-value
8900 @item -Wabsolute-value @r{(C and Objective-C only)}
8901 Warn for calls to standard functions that compute the absolute value
8902 of an argument when a more appropriate standard function is available.
8903 For example, calling @code{abs(3.14)} triggers the warning because the
8904 appropriate function to call to compute the absolute value of a double
8905 argument is @code{fabs}.  The option also triggers warnings when the
8906 argument in a call to such a function has an unsigned type.  This
8907 warning can be suppressed with an explicit type cast and it is also
8908 enabled by @option{-Wextra}.
8910 @include cppwarnopts.texi
8912 @opindex Wbad-function-cast
8913 @opindex Wno-bad-function-cast
8914 @item -Wbad-function-cast @r{(C and Objective-C only)}
8915 Warn when a function call is cast to a non-matching type.
8916 For example, warn if a call to a function returning an integer type 
8917 is cast to a pointer type.
8919 @opindex Wc90-c99-compat
8920 @opindex Wno-c90-c99-compat
8921 @item -Wc90-c99-compat @r{(C and Objective-C only)}
8922 Warn about features not present in ISO C90, but present in ISO C99.
8923 For instance, warn about use of variable length arrays, @code{long long}
8924 type, @code{bool} type, compound literals, designated initializers, and so
8925 on.  This option is independent of the standards mode.  Warnings are disabled
8926 in the expression that follows @code{__extension__}.
8928 @opindex Wc99-c11-compat
8929 @opindex Wno-c99-c11-compat
8930 @item -Wc99-c11-compat @r{(C and Objective-C only)}
8931 Warn about features not present in ISO C99, but present in ISO C11.
8932 For instance, warn about use of anonymous structures and unions,
8933 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
8934 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
8935 and so on.  This option is independent of the standards mode.  Warnings are
8936 disabled in the expression that follows @code{__extension__}.
8938 @opindex Wc11-c2x-compat
8939 @opindex Wno-c11-c2x-compat
8940 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
8941 Warn about features not present in ISO C11, but present in ISO C2X.
8942 For instance, warn about omitting the string in @code{_Static_assert},
8943 use of @samp{[[]]} syntax for attributes, use of decimal
8944 floating-point types, and so on.  This option is independent of the
8945 standards mode.  Warnings are disabled in the expression that follows
8946 @code{__extension__}.
8948 When not compiling in C2X mode, these warnings are upgraded to errors
8949 by @option{-pedantic-errors}.
8951 @opindex Wc++-compat
8952 @opindex Wno-c++-compat
8953 @item -Wc++-compat @r{(C and Objective-C only)}
8954 Warn about ISO C constructs that are outside of the common subset of
8955 ISO C and ISO C++, e.g.@: request for implicit conversion from
8956 @code{void *} to a pointer to non-@code{void} type.
8958 @opindex Wc++11-compat
8959 @opindex Wno-c++11-compat
8960 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
8961 Warn about C++ constructs whose meaning differs between ISO C++ 1998
8962 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
8963 in ISO C++ 2011.  This warning turns on @option{-Wnarrowing} and is
8964 enabled by @option{-Wall}.
8966 @opindex Wc++14-compat
8967 @opindex Wno-c++14-compat
8968 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
8969 Warn about C++ constructs whose meaning differs between ISO C++ 2011
8970 and ISO C++ 2014.  This warning is enabled by @option{-Wall}.
8972 @opindex Wc++17-compat
8973 @opindex Wno-c++17-compat
8974 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
8975 Warn about C++ constructs whose meaning differs between ISO C++ 2014
8976 and ISO C++ 2017.  This warning is enabled by @option{-Wall}.
8978 @opindex Wc++20-compat
8979 @opindex Wno-c++20-compat
8980 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
8981 Warn about C++ constructs whose meaning differs between ISO C++ 2017
8982 and ISO C++ 2020.  This warning is enabled by @option{-Wall}.
8984 @opindex Wc++11-extensions
8985 @opindex Wno-c++11-extensions
8986 @item -Wno-c++11-extensions @r{(C++ and Objective-C++ only)}
8987 Do not warn about C++11 constructs in code being compiled using
8988 an older C++ standard.  Even without this option, some C++11 constructs
8989 will only be diagnosed if @option{-Wpedantic} is used.
8991 @opindex Wc++14-extensions
8992 @opindex Wno-c++14-extensions
8993 @item -Wno-c++14-extensions @r{(C++ and Objective-C++ only)}
8994 Do not warn about C++14 constructs in code being compiled using
8995 an older C++ standard.  Even without this option, some C++14 constructs
8996 will only be diagnosed if @option{-Wpedantic} is used.
8998 @opindex Wc++17-extensions
8999 @opindex Wno-c++17-extensions
9000 @item -Wno-c++17-extensions @r{(C++ and Objective-C++ only)}
9001 Do not warn about C++17 constructs in code being compiled using
9002 an older C++ standard.  Even without this option, some C++17 constructs
9003 will only be diagnosed if @option{-Wpedantic} is used.
9005 @opindex Wc++20-extensions
9006 @opindex Wno-c++20-extensions
9007 @item -Wno-c++20-extensions @r{(C++ and Objective-C++ only)}
9008 Do not warn about C++20 constructs in code being compiled using
9009 an older C++ standard.  Even without this option, some C++20 constructs
9010 will only be diagnosed if @option{-Wpedantic} is used.
9012 @opindex Wc++23-extensions
9013 @opindex Wno-c++23-extensions
9014 @item -Wno-c++23-extensions @r{(C++ and Objective-C++ only)}
9015 Do not warn about C++23 constructs in code being compiled using
9016 an older C++ standard.  Even without this option, some C++23 constructs
9017 will only be diagnosed if @option{-Wpedantic} is used.
9019 @opindex Wcast-qual
9020 @opindex Wno-cast-qual
9021 @item -Wcast-qual
9022 Warn whenever a pointer is cast so as to remove a type qualifier from
9023 the target type.  For example, warn if a @code{const char *} is cast
9024 to an ordinary @code{char *}.
9026 Also warn when making a cast that introduces a type qualifier in an
9027 unsafe way.  For example, casting @code{char **} to @code{const char **}
9028 is unsafe, as in this example:
9030 @smallexample
9031   /* p is char ** value.  */
9032   const char **q = (const char **) p;
9033   /* Assignment of readonly string to const char * is OK.  */
9034   *q = "string";
9035   /* Now char** pointer points to read-only memory.  */
9036   **p = 'b';
9037 @end smallexample
9039 @opindex Wcast-align
9040 @opindex Wno-cast-align
9041 @item -Wcast-align
9042 Warn whenever a pointer is cast such that the required alignment of the
9043 target is increased.  For example, warn if a @code{char *} is cast to
9044 an @code{int *} on machines where integers can only be accessed at
9045 two- or four-byte boundaries.
9047 @opindex Wcast-align=strict
9048 @item -Wcast-align=strict
9049 Warn whenever a pointer is cast such that the required alignment of the
9050 target is increased.  For example, warn if a @code{char *} is cast to
9051 an @code{int *} regardless of the target machine.
9053 @opindex Wcast-function-type
9054 @opindex Wno-cast-function-type
9055 @item -Wcast-function-type
9056 Warn when a function pointer is cast to an incompatible function pointer.
9057 In a cast involving function types with a variable argument list only
9058 the types of initial arguments that are provided are considered.
9059 Any parameter of pointer-type matches any other pointer-type.  Any benign
9060 differences in integral types are ignored, like @code{int} vs.@: @code{long}
9061 on ILP32 targets.  Likewise type qualifiers are ignored.  The function
9062 type @code{void (*) (void)} is special and matches everything, which can
9063 be used to suppress this warning.
9064 In a cast involving pointer to member types this warning warns whenever
9065 the type cast is changing the pointer to member type.
9066 This warning is enabled by @option{-Wextra}.
9068 @opindex Wwrite-strings
9069 @opindex Wno-write-strings
9070 @item -Wwrite-strings
9071 When compiling C, give string constants the type @code{const
9072 char[@var{length}]} so that copying the address of one into a
9073 non-@code{const} @code{char *} pointer produces a warning.  These
9074 warnings help you find at compile time code that can try to write
9075 into a string constant, but only if you have been very careful about
9076 using @code{const} in declarations and prototypes.  Otherwise, it is
9077 just a nuisance. This is why we did not make @option{-Wall} request
9078 these warnings.
9080 When compiling C++, warn about the deprecated conversion from string
9081 literals to @code{char *}.  This warning is enabled by default for C++
9082 programs.
9084 This warning is upgraded to an error by @option{-pedantic-errors} in
9085 C++11 mode or later.
9087 @opindex Wclobbered
9088 @opindex Wno-clobbered
9089 @item -Wclobbered
9090 Warn for variables that might be changed by @code{longjmp} or
9091 @code{vfork}.  This warning is also enabled by @option{-Wextra}.
9093 @opindex Wcomplain-wrong-lang
9094 @opindex Wno-complain-wrong-lang
9095 @item -Wno-complain-wrong-lang
9096 By default, language front ends complain when a command-line option is
9097 valid, but not applicable to that front end.
9098 This may be disabled with @option{-Wno-complain-wrong-lang},
9099 which is mostly useful when invoking a single compiler driver for
9100 multiple source files written in different languages, for example:
9102 @smallexample
9103 $ g++ -fno-rtti a.cc b.f90
9104 @end smallexample
9106 The driver @file{g++} invokes the C++ front end to compile @file{a.cc}
9107 and the Fortran front end to compile @file{b.f90}.
9108 The latter front end diagnoses
9109 @samp{f951: Warning: command-line option '-fno-rtti' is valid for C++/D/ObjC++ but not for Fortran},
9110 which may be disabled with @option{-Wno-complain-wrong-lang}.
9112 @opindex Wcompare-distinct-pointer-types
9113 @item -Wcompare-distinct-pointer-types @r{(C and Objective-C only)}
9114 Warn if pointers of distinct types are compared without a cast.  This
9115 warning is enabled by default.
9117 @opindex Wconversion
9118 @opindex Wno-conversion
9119 @item -Wconversion
9120 Warn for implicit conversions that may alter a value. This includes
9121 conversions between real and integer, like @code{abs (x)} when
9122 @code{x} is @code{double}; conversions between signed and unsigned,
9123 like @code{unsigned ui = -1}; and conversions to smaller types, like
9124 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
9125 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
9126 changed by the conversion like in @code{abs (2.0)}.  Warnings about
9127 conversions between signed and unsigned integers can be disabled by
9128 using @option{-Wno-sign-conversion}.
9130 For C++, also warn for confusing overload resolution for user-defined
9131 conversions; and conversions that never use a type conversion
9132 operator: conversions to @code{void}, the same type, a base class or a
9133 reference to them. Warnings about conversions between signed and
9134 unsigned integers are disabled by default in C++ unless
9135 @option{-Wsign-conversion} is explicitly enabled.
9137 Warnings about conversion from arithmetic on a small type back to that
9138 type are only given with @option{-Warith-conversion}.
9140 @opindex Wdangling-else
9141 @opindex Wno-dangling-else
9142 @item -Wdangling-else
9143 Warn about constructions where there may be confusion to which
9144 @code{if} statement an @code{else} branch belongs.  Here is an example of
9145 such a case:
9147 @smallexample
9148 @group
9150   if (a)
9151     if (b)
9152       foo ();
9153   else
9154     bar ();
9156 @end group
9157 @end smallexample
9159 In C/C++, every @code{else} branch belongs to the innermost possible
9160 @code{if} statement, which in this example is @code{if (b)}.  This is
9161 often not what the programmer expected, as illustrated in the above
9162 example by indentation the programmer chose.  When there is the
9163 potential for this confusion, GCC issues a warning when this flag
9164 is specified.  To eliminate the warning, add explicit braces around
9165 the innermost @code{if} statement so there is no way the @code{else}
9166 can belong to the enclosing @code{if}.  The resulting code
9167 looks like this:
9169 @smallexample
9170 @group
9172   if (a)
9173     @{
9174       if (b)
9175         foo ();
9176       else
9177         bar ();
9178     @}
9180 @end group
9181 @end smallexample
9183 This warning is enabled by @option{-Wparentheses}.
9185 @opindex Wdangling-pointer
9186 @opindex Wno-dangling-pointer
9187 @item -Wdangling-pointer
9188 @itemx -Wdangling-pointer=@var{n}
9189 Warn about uses of pointers (or C++ references) to objects with automatic
9190 storage duration after their lifetime has ended.  This includes local
9191 variables declared in nested blocks, compound literals and other unnamed
9192 temporary objects.  In addition, warn about storing the address of such
9193 objects in escaped pointers.  The warning is enabled at all optimization
9194 levels but may yield different results with optimization than without.
9196 @table @gcctabopt
9197 @item -Wdangling-pointer=1
9198 At level 1 the warning diagnoses only unconditional uses of dangling pointers.
9199 For example
9200 @smallexample
9201 int f (int c1, int c2, x)
9203   char *p = strchr ((char[])@{ c1, c2 @}, c3);
9204   // warning: dangling pointer to a compound literal
9205   return p ? *p : 'x';
9207 @end smallexample
9208 In the following function the store of the address of the local variable
9209 @code{x} in the escaped pointer @code{*p} also triggers the warning.
9210 @smallexample
9211 void g (int **p)
9213   int x = 7;
9214   // warning: storing the address of a local variable in *p
9215   *p = &x;
9217 @end smallexample
9219 @item -Wdangling-pointer=2
9220 At level 2, in addition to unconditional uses the warning also diagnoses
9221 conditional uses of dangling pointers.
9223 For example, because the array @var{a} in the following function is out of
9224 scope when the pointer @var{s} that was set to point is used, the warning
9225 triggers at this level.
9227 @smallexample
9228 void f (char *s)
9230   if (!s)
9231     @{
9232       char a[12] = "tmpname";
9233       s = a;
9234     @}
9235   // warning: dangling pointer to a may be used
9236   strcat (s, ".tmp");
9237   ...
9239 @end smallexample
9240 @end table
9242 @option{-Wdangling-pointer=2} is included in @option{-Wall}.
9244 @opindex Wdate-time
9245 @opindex Wno-date-time
9246 @item -Wdate-time
9247 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
9248 are encountered as they might prevent bit-wise-identical reproducible
9249 compilations.
9251 @opindex Wempty-body
9252 @opindex Wno-empty-body
9253 @item -Wempty-body
9254 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
9255 while} statement.  This warning is also enabled by @option{-Wextra}.
9257 @opindex Wendif-labels
9258 @opindex Wno-endif-labels
9259 @item -Wno-endif-labels
9260 Do not warn about stray tokens after @code{#else} and @code{#endif}.
9262 @opindex Wenum-compare
9263 @opindex Wno-enum-compare
9264 @item -Wenum-compare
9265 Warn about a comparison between values of different enumerated types.
9266 In C++ enumerated type mismatches in conditional expressions are also
9267 diagnosed and the warning is enabled by default.  In C this warning is 
9268 enabled by @option{-Wall}.
9270 @opindex Wenum-conversion
9271 @opindex Wno-enum-conversion
9272 @item -Wenum-conversion
9273 Warn when a value of enumerated type is implicitly converted to a 
9274 different enumerated type.  This warning is enabled by @option{-Wextra}
9275 in C@.
9277 @opindex Wenum-int-mismatch
9278 @opindex Wno-enum-int-mismatch
9279 @item -Wenum-int-mismatch @r{(C and Objective-C only)}
9280 Warn about mismatches between an enumerated type and an integer type in
9281 declarations.  For example:
9283 @smallexample
9284 enum E @{ l = -1, z = 0, g = 1 @};
9285 int foo(void);
9286 enum E foo(void);
9287 @end smallexample
9289 In C, an enumerated type is compatible with @code{char}, a signed
9290 integer type, or an unsigned integer type.  However, since the choice
9291 of the underlying type of an enumerated type is implementation-defined,
9292 such mismatches may cause portability issues.  In C++, such mismatches
9293 are an error.  In C, this warning is enabled by @option{-Wall} and
9294 @option{-Wc++-compat}.
9296 @opindex Wjump-misses-init
9297 @opindex Wno-jump-misses-init
9298 @item -Wjump-misses-init @r{(C, Objective-C only)}
9299 Warn if a @code{goto} statement or a @code{switch} statement jumps
9300 forward across the initialization of a variable, or jumps backward to a
9301 label after the variable has been initialized.  This only warns about
9302 variables that are initialized when they are declared.  This warning is
9303 only supported for C and Objective-C; in C++ this sort of branch is an
9304 error in any case.
9306 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
9307 can be disabled with the @option{-Wno-jump-misses-init} option.
9309 @opindex Wsign-compare
9310 @opindex Wno-sign-compare
9311 @cindex warning for comparison of signed and unsigned values
9312 @cindex comparison of signed and unsigned values, warning
9313 @cindex signed and unsigned values, comparison warning
9314 @item -Wsign-compare
9315 Warn when a comparison between signed and unsigned values could produce
9316 an incorrect result when the signed value is converted to unsigned.
9317 In C++, this warning is also enabled by @option{-Wall}.  In C, it is
9318 also enabled by @option{-Wextra}.
9320 @opindex Wsign-conversion
9321 @opindex Wno-sign-conversion
9322 @item -Wsign-conversion
9323 Warn for implicit conversions that may change the sign of an integer
9324 value, like assigning a signed integer expression to an unsigned
9325 integer variable. An explicit cast silences the warning. In C, this
9326 option is enabled also by @option{-Wconversion}.
9328 @opindex Wflex-array-member-not-at-end
9329 @opindex Wno-flex-array-member-not-at-end
9330 @item -Wflex-array-member-not-at-end @r{(C and C++ only)}
9331 Warn when a structure containing a C99 flexible array member as the last
9332 field is not at the end of another structure.
9333 This warning warns e.g. about
9335 @smallexample
9336 struct flex  @{ int length; char data[]; @};
9337 struct mid_flex @{ int m; struct flex flex_data; int n; @};
9338 @end smallexample
9340 @opindex Wfloat-conversion
9341 @opindex Wno-float-conversion
9342 @item -Wfloat-conversion
9343 Warn for implicit conversions that reduce the precision of a real value.
9344 This includes conversions from real to integer, and from higher precision
9345 real to lower precision real values.  This option is also enabled by
9346 @option{-Wconversion}.
9348 @opindex Wno-scalar-storage-order
9349 @opindex Wscalar-storage-order
9350 @item -Wno-scalar-storage-order
9351 Do not warn on suspicious constructs involving reverse scalar storage order.
9353 @opindex Wsizeof-array-div
9354 @opindex Wno-sizeof-array-div
9355 @item -Wsizeof-array-div
9356 Warn about divisions of two sizeof operators when the first one is applied
9357 to an array and the divisor does not equal the size of the array element.
9358 In such a case, the computation will not yield the number of elements in the
9359 array, which is likely what the user intended.  This warning warns e.g. about
9360 @smallexample
9361 int fn ()
9363   int arr[10];
9364   return sizeof (arr) / sizeof (short);
9366 @end smallexample
9368 This warning is enabled by @option{-Wall}.
9370 @opindex Wsizeof-pointer-div
9371 @opindex Wno-sizeof-pointer-div
9372 @item -Wsizeof-pointer-div
9373 Warn for suspicious divisions of two sizeof expressions that divide
9374 the pointer size by the element size, which is the usual way to compute
9375 the array size but won't work out correctly with pointers.  This warning
9376 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
9377 not an array, but a pointer.  This warning is enabled by @option{-Wall}.
9379 @opindex Wsizeof-pointer-memaccess
9380 @opindex Wno-sizeof-pointer-memaccess
9381 @item -Wsizeof-pointer-memaccess
9382 Warn for suspicious length parameters to certain string and memory built-in
9383 functions if the argument uses @code{sizeof}.  This warning triggers for
9384 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
9385 an array, but a pointer, and suggests a possible fix, or about
9386 @code{memcpy (&foo, ptr, sizeof (&foo));}.  @option{-Wsizeof-pointer-memaccess}
9387 also warns about calls to bounded string copy functions like @code{strncat}
9388 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
9389 the source array.  For example, in the following function the call to
9390 @code{strncat} specifies the size of the source string as the bound.  That
9391 is almost certainly a mistake and so the call is diagnosed.
9392 @smallexample
9393 void make_file (const char *name)
9395   char path[PATH_MAX];
9396   strncpy (path, name, sizeof path - 1);
9397   strncat (path, ".text", sizeof ".text");
9398   @dots{}
9400 @end smallexample
9402 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
9404 @opindex Wsizeof-array-argument
9405 @opindex Wno-sizeof-array-argument
9406 @item -Wno-sizeof-array-argument
9407 Do not warn when the @code{sizeof} operator is applied to a parameter that is
9408 declared as an array in a function definition.  This warning is enabled by
9409 default for C and C++ programs.
9411 @opindex Wmemset-elt-size
9412 @opindex Wno-memset-elt-size
9413 @item -Wmemset-elt-size
9414 Warn for suspicious calls to the @code{memset} built-in function, if the
9415 first argument references an array, and the third argument is a number
9416 equal to the number of elements, but not equal to the size of the array
9417 in memory.  This indicates that the user has omitted a multiplication by
9418 the element size.  This warning is enabled by @option{-Wall}.
9420 @opindex Wmemset-transposed-args
9421 @opindex Wno-memset-transposed-args
9422 @item -Wmemset-transposed-args
9423 Warn for suspicious calls to the @code{memset} built-in function where
9424 the second argument is not zero and the third argument is zero.  For
9425 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
9426 @code{memset (buf, 0, sizeof buf)} was meant instead.  The diagnostic
9427 is only emitted if the third argument is a literal zero.  Otherwise, if
9428 it is an expression that is folded to zero, or a cast of zero to some
9429 type, it is far less likely that the arguments have been mistakenly
9430 transposed and no warning is emitted.  This warning is enabled
9431 by @option{-Wall}.
9433 @opindex Waddress
9434 @opindex Wno-address
9435 @item -Waddress
9436 Warn about suspicious uses of address expressions. These include comparing
9437 the address of a function or a declared object to the null pointer constant
9438 such as in
9439 @smallexample
9440 void f (void);
9441 void g (void)
9443   if (!f)   // warning: expression evaluates to false
9444     abort ();
9446 @end smallexample
9447 comparisons of a pointer to a string literal, such as in
9448 @smallexample
9449 void f (const char *x)
9451   if (x == "abc")   // warning: expression evaluates to false
9452     puts ("equal");
9454 @end smallexample
9455 and tests of the results of pointer addition or subtraction for equality
9456 to null, such as in
9457 @smallexample
9458 void f (const int *p, int i)
9460   return p + i == NULL;
9462 @end smallexample
9463 Such uses typically indicate a programmer error: the address of most
9464 functions and objects necessarily evaluates to true (the exception are
9465 weak symbols), so their use in a conditional might indicate missing
9466 parentheses in a function call or a missing dereference in an array
9467 expression.  The subset of the warning for object pointers can be
9468 suppressed by casting the pointer operand to an integer type such
9469 as @code{intptr_t} or @code{uintptr_t}.
9470 Comparisons against string literals result in unspecified behavior
9471 and are not portable, and suggest the intent was to call @code{strcmp}.
9472 The warning is suppressed if the suspicious expression is the result
9473 of macro expansion.
9474 @option{-Waddress} warning is enabled by @option{-Wall}.
9476 @opindex Waddress-of-packed-member
9477 @opindex Wno-address-of-packed-member
9478 @item -Wno-address-of-packed-member
9479 Do not warn when the address of packed member of struct or union is taken,
9480 which usually results in an unaligned pointer value.  This is
9481 enabled by default.
9483 @opindex Wlogical-op
9484 @opindex Wno-logical-op
9485 @item -Wlogical-op
9486 Warn about suspicious uses of logical operators in expressions.
9487 This includes using logical operators in contexts where a
9488 bit-wise operator is likely to be expected.  Also warns when
9489 the operands of a logical operator are the same:
9490 @smallexample
9491 extern int a;
9492 if (a < 0 && a < 0) @{ @dots{} @}
9493 @end smallexample
9495 @opindex Wlogical-not-parentheses
9496 @opindex Wno-logical-not-parentheses
9497 @item -Wlogical-not-parentheses
9498 Warn about logical not used on the left hand side operand of a comparison.
9499 This option does not warn if the right operand is considered to be a boolean
9500 expression.  Its purpose is to detect suspicious code like the following:
9501 @smallexample
9502 int a;
9503 @dots{}
9504 if (!a > 1) @{ @dots{} @}
9505 @end smallexample
9507 It is possible to suppress the warning by wrapping the LHS into
9508 parentheses:
9509 @smallexample
9510 if ((!a) > 1) @{ @dots{} @}
9511 @end smallexample
9513 This warning is enabled by @option{-Wall}.
9515 @opindex Waggregate-return
9516 @opindex Wno-aggregate-return
9517 @item -Waggregate-return
9518 Warn if any functions that return structures or unions are defined or
9519 called.  (In languages where you can return an array, this also elicits
9520 a warning.)
9522 @opindex Wno-aggressive-loop-optimizations
9523 @opindex Waggressive-loop-optimizations
9524 @item -Wno-aggressive-loop-optimizations
9525 Warn if in a loop with constant number of iterations the compiler detects
9526 undefined behavior in some statement during one or more of the iterations.
9528 @opindex Wno-attributes
9529 @opindex Wattributes
9530 @item -Wno-attributes
9531 Do not warn if an unexpected @code{__attribute__} is used, such as
9532 unrecognized attributes, function attributes applied to variables,
9533 etc.  This does not stop errors for incorrect use of supported
9534 attributes.
9536 Warnings about ill-formed uses of standard attributes are upgraded to
9537 errors by @option{-pedantic-errors}.
9539 Additionally, using @option{-Wno-attributes=}, it is possible to suppress
9540 warnings about unknown scoped attributes (in C++11 and C2X).  For example,
9541 @option{-Wno-attributes=vendor::attr} disables warning about the following
9542 declaration:
9544 @smallexample
9545 [[vendor::attr]] void f();
9546 @end smallexample
9548 It is also possible to disable warning about all attributes in a namespace
9549 using @option{-Wno-attributes=vendor::} which prevents warning about both
9550 of these declarations:
9552 @smallexample
9553 [[vendor::safe]] void f();
9554 [[vendor::unsafe]] void f2();
9555 @end smallexample
9557 Note that @option{-Wno-attributes=} does not imply @option{-Wno-attributes}.
9559 @opindex Wno-builtin-declaration-mismatch
9560 @opindex Wbuiltin-declaration-mismatch
9561 @item -Wno-builtin-declaration-mismatch
9562 Warn if a built-in function is declared with an incompatible signature
9563 or as a non-function, or when a built-in function declared with a type
9564 that does not include a prototype is called with arguments whose promoted
9565 types do not match those expected by the function.  When @option{-Wextra}
9566 is specified, also warn when a built-in function that takes arguments is
9567 declared without a prototype.  The @option{-Wbuiltin-declaration-mismatch}
9568 warning is enabled by default.  To avoid the warning include the appropriate
9569 header to bring the prototypes of built-in functions into scope.
9571 For example, the call to @code{memset} below is diagnosed by the warning
9572 because the function expects a value of type @code{size_t} as its argument
9573 but the type of @code{32} is @code{int}.  With @option{-Wextra},
9574 the declaration of the function is diagnosed as well.
9575 @smallexample
9576 extern void* memset ();
9577 void f (void *d)
9579   memset (d, '\0', 32);
9581 @end smallexample
9583 @opindex Wno-builtin-macro-redefined
9584 @opindex Wbuiltin-macro-redefined
9585 @item -Wno-builtin-macro-redefined
9586 Do not warn if certain built-in macros are redefined.  This suppresses
9587 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
9588 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
9590 @opindex Wstrict-prototypes
9591 @opindex Wno-strict-prototypes
9592 @item -Wstrict-prototypes @r{(C and Objective-C only)}
9593 Warn if a function is declared or defined without specifying the
9594 argument types.  (An old-style function definition is permitted without
9595 a warning if preceded by a declaration that specifies the argument
9596 types.)
9598 @opindex Wold-style-declaration
9599 @opindex Wno-old-style-declaration
9600 @item -Wold-style-declaration @r{(C and Objective-C only)}
9601 Warn for obsolescent usages, according to the C Standard, in a
9602 declaration. For example, warn if storage-class specifiers like
9603 @code{static} are not the first things in a declaration.  This warning
9604 is also enabled by @option{-Wextra}.
9606 @opindex Wold-style-definition
9607 @opindex Wno-old-style-definition
9608 @item -Wold-style-definition @r{(C and Objective-C only)}
9609 Warn if an old-style function definition is used.  A warning is given
9610 even if there is a previous prototype.  A definition using @samp{()}
9611 is not considered an old-style definition in C2X mode, because it is
9612 equivalent to @samp{(void)} in that case, but is considered an
9613 old-style definition for older standards.
9615 @opindex Wmissing-parameter-type
9616 @opindex Wno-missing-parameter-type
9617 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
9618 A function parameter is declared without a type specifier in K&R-style
9619 functions:
9621 @smallexample
9622 void foo(bar) @{ @}
9623 @end smallexample
9625 This warning is also enabled by @option{-Wextra}.
9627 @opindex Wmissing-prototypes
9628 @opindex Wno-missing-prototypes
9629 @item -Wmissing-prototypes @r{(C and Objective-C only)}
9630 Warn if a global function is defined without a previous prototype
9631 declaration.  This warning is issued even if the definition itself
9632 provides a prototype.  Use this option to detect global functions
9633 that do not have a matching prototype declaration in a header file.
9634 This option is not valid for C++ because all function declarations
9635 provide prototypes and a non-matching declaration declares an
9636 overload rather than conflict with an earlier declaration.
9637 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
9639 @opindex Wmissing-variable-declarations
9640 @opindex Wno-missing-variable-declarations
9641 @item -Wmissing-variable-declarations @r{(C and Objective-C only)}
9642 Warn if a global variable is defined without a previous declaration.
9643 Use this option to detect global variables that do not have a matching
9644 extern declaration in a header file.
9646 @opindex Wmissing-declarations
9647 @opindex Wno-missing-declarations
9648 @item -Wmissing-declarations
9649 Warn if a global function is defined without a previous declaration.
9650 Do so even if the definition itself provides a prototype.
9651 Use this option to detect global functions that are not declared in
9652 header files.  In C, no warnings are issued for functions with previous
9653 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
9654 missing prototypes.  In C++, no warnings are issued for function templates,
9655 or for inline functions, or for functions in anonymous namespaces.
9657 @opindex Wmissing-field-initializers
9658 @opindex Wno-missing-field-initializers
9659 @opindex W
9660 @opindex Wextra
9661 @opindex Wno-extra
9662 @item -Wmissing-field-initializers
9663 Warn if a structure's initializer has some fields missing.  For
9664 example, the following code causes such a warning, because
9665 @code{x.h} is implicitly zero:
9667 @smallexample
9668 struct s @{ int f, g, h; @};
9669 struct s x = @{ 3, 4 @};
9670 @end smallexample
9672 @c It's unclear if this behavior is desirable.  See PR39589 and PR96868.
9673 In C this option does not warn about designated initializers, so the
9674 following modification does not trigger a warning:
9676 @smallexample
9677 struct s @{ int f, g, h; @};
9678 struct s x = @{ .f = 3, .g = 4 @};
9679 @end smallexample
9681 In C this option does not warn about the universal zero initializer
9682 @samp{@{ 0 @}}:
9684 @smallexample
9685 struct s @{ int f, g, h; @};
9686 struct s x = @{ 0 @};
9687 @end smallexample
9689 Likewise, in C++ this option does not warn about the empty @{ @}
9690 initializer, for example:
9692 @smallexample
9693 struct s @{ int f, g, h; @};
9694 s x = @{ @};
9695 @end smallexample
9697 This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
9698 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
9700 @opindex Wmissing-requires
9701 @opindex Wno-missing-requires
9702 @item -Wno-missing-requires
9704 By default, the compiler warns about a concept-id appearing as a C++20 simple-requirement:
9706 @smallexample
9707 bool satisfied = requires @{ C<T> @};
9708 @end smallexample
9710 Here @samp{satisfied} will be true if @samp{C<T>} is a valid
9711 expression, which it is for all T.  Presumably the user meant to write
9713 @smallexample
9714 bool satisfied = requires @{ requires C<T> @};
9715 @end smallexample
9717 so @samp{satisfied} is only true if concept @samp{C} is satisfied for
9718 type @samp{T}.
9720 This warning can be disabled with @option{-Wno-missing-requires}.
9722 @opindex Wmissing-template-keyword
9723 @opindex Wno-missing-template-keyword
9724 @item -Wno-missing-template-keyword
9726 The member access tokens ., -> and :: must be followed by the @code{template}
9727 keyword if the parent object is dependent and the member being named is a
9728 template.
9730 @smallexample
9731 template <class X>
9732 void DoStuff (X x)
9734   x.template DoSomeOtherStuff<X>(); // Good.
9735   x.DoMoreStuff<X>(); // Warning, x is dependent.
9737 @end smallexample
9739 In rare cases it is possible to get false positives. To silence this, wrap
9740 the expression in parentheses. For example, the following is treated as a
9741 template, even where m and N are integers:
9743 @smallexample
9744 void NotATemplate (my_class t)
9746   int N = 5;
9748   bool test = t.m < N > (0); // Treated as a template.
9749   test = (t.m < N) > (0); // Same meaning, but not treated as a template.
9751 @end smallexample
9753 This warning can be disabled with @option{-Wno-missing-template-keyword}.
9755 @opindex Wno-multichar
9756 @opindex Wmultichar
9757 @item -Wno-multichar
9758 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
9759 Usually they indicate a typo in the user's code, as they have
9760 implementation-defined values, and should not be used in portable code.
9762 @opindex Wnormalized=
9763 @opindex Wnormalized
9764 @opindex Wno-normalized
9765 @cindex NFC
9766 @cindex NFKC
9767 @cindex character set, input normalization
9768 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
9769 In ISO C and ISO C++, two identifiers are different if they are
9770 different sequences of characters.  However, sometimes when characters
9771 outside the basic ASCII character set are used, you can have two
9772 different character sequences that look the same.  To avoid confusion,
9773 the ISO 10646 standard sets out some @dfn{normalization rules} which
9774 when applied ensure that two sequences that look the same are turned into
9775 the same sequence.  GCC can warn you if you are using identifiers that
9776 have not been normalized; this option controls that warning.
9778 There are four levels of warning supported by GCC@.  The default is
9779 @option{-Wnormalized=nfc}, which warns about any identifier that is
9780 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
9781 recommended form for most uses.  It is equivalent to
9782 @option{-Wnormalized}.
9784 Unfortunately, there are some characters allowed in identifiers by
9785 ISO C and ISO C++ that, when turned into NFC, are not allowed in 
9786 identifiers.  That is, there's no way to use these symbols in portable
9787 ISO C or C++ and have all your identifiers in NFC@.
9788 @option{-Wnormalized=id} suppresses the warning for these characters.
9789 It is hoped that future versions of the standards involved will correct
9790 this, which is why this option is not the default.
9792 You can switch the warning off for all characters by writing
9793 @option{-Wnormalized=none} or @option{-Wno-normalized}.  You should
9794 only do this if you are using some other normalization scheme (like
9795 ``D''), because otherwise you can easily create bugs that are
9796 literally impossible to see.
9798 Some characters in ISO 10646 have distinct meanings but look identical
9799 in some fonts or display methodologies, especially once formatting has
9800 been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
9801 LETTER N'', displays just like a regular @code{n} that has been
9802 placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
9803 normalization scheme to convert all these into a standard form as
9804 well, and GCC warns if your code is not in NFKC if you use
9805 @option{-Wnormalized=nfkc}.  This warning is comparable to warning
9806 about every identifier that contains the letter O because it might be
9807 confused with the digit 0, and so is not the default, but may be
9808 useful as a local coding convention if the programming environment 
9809 cannot be fixed to display these characters distinctly.
9811 @opindex Wno-attribute-warning
9812 @opindex Wattribute-warning
9813 @item -Wno-attribute-warning
9814 Do not warn about usage of functions (@pxref{Function Attributes})
9815 declared with @code{warning} attribute.  By default, this warning is
9816 enabled.  @option{-Wno-attribute-warning} can be used to disable the
9817 warning or @option{-Wno-error=attribute-warning} can be used to
9818 disable the error when compiled with @option{-Werror} flag.
9820 @opindex Wno-deprecated
9821 @opindex Wdeprecated
9822 @item -Wno-deprecated
9823 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
9825 @opindex Wno-deprecated-declarations
9826 @opindex Wdeprecated-declarations
9827 @item -Wno-deprecated-declarations
9828 Do not warn about uses of functions (@pxref{Function Attributes}),
9829 variables (@pxref{Variable Attributes}), and types (@pxref{Type
9830 Attributes}) marked as deprecated by using the @code{deprecated}
9831 attribute.
9833 @opindex Wno-overflow
9834 @opindex Woverflow
9835 @item -Wno-overflow
9836 Do not warn about compile-time overflow in constant expressions.
9838 @opindex Wno-odr
9839 @opindex Wodr
9840 @item -Wno-odr
9841 Warn about One Definition Rule violations during link-time optimization.
9842 Enabled by default.
9844 @opindex Wopenacc-parallelism
9845 @opindex Wno-openacc-parallelism
9846 @cindex OpenACC accelerator programming
9847 @item -Wopenacc-parallelism
9848 Warn about potentially suboptimal choices related to OpenACC parallelism.
9850 @opindex Wopenmp-simd
9851 @opindex Wno-openmp-simd
9852 @item -Wopenmp-simd
9853 Warn if the vectorizer cost model overrides the OpenMP
9854 simd directive set by user.  The @option{-fsimd-cost-model=unlimited}
9855 option can be used to relax the cost model.
9857 @opindex Woverride-init
9858 @opindex Wno-override-init
9859 @opindex W
9860 @opindex Wextra
9861 @opindex Wno-extra
9862 @item -Woverride-init @r{(C and Objective-C only)}
9863 Warn if an initialized field without side effects is overridden when
9864 using designated initializers (@pxref{Designated Inits, , Designated
9865 Initializers}).
9867 This warning is included in @option{-Wextra}.  To get other
9868 @option{-Wextra} warnings without this one, use @option{-Wextra
9869 -Wno-override-init}.
9871 @opindex Woverride-init-side-effects
9872 @opindex Wno-override-init-side-effects
9873 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
9874 Do not warn if an initialized field with side effects is overridden when
9875 using designated initializers (@pxref{Designated Inits, , Designated
9876 Initializers}).  This warning is enabled by default.
9878 @opindex Wpacked
9879 @opindex Wno-packed
9880 @item -Wpacked
9881 Warn if a structure is given the packed attribute, but the packed
9882 attribute has no effect on the layout or size of the structure.
9883 Such structures may be mis-aligned for little benefit.  For
9884 instance, in this code, the variable @code{f.x} in @code{struct bar}
9885 is misaligned even though @code{struct bar} does not itself
9886 have the packed attribute:
9888 @smallexample
9889 @group
9890 struct foo @{
9891   int x;
9892   char a, b, c, d;
9893 @} __attribute__((packed));
9894 struct bar @{
9895   char z;
9896   struct foo f;
9898 @end group
9899 @end smallexample
9901 @opindex Wpacked-bitfield-compat
9902 @opindex Wno-packed-bitfield-compat
9903 @item -Wnopacked-bitfield-compat
9904 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
9905 on bit-fields of type @code{char}.  This was fixed in GCC 4.4 but
9906 the change can lead to differences in the structure layout.  GCC
9907 informs you when the offset of such a field has changed in GCC 4.4.
9908 For example there is no longer a 4-bit padding between field @code{a}
9909 and @code{b} in this structure:
9911 @smallexample
9912 struct foo
9914   char a:4;
9915   char b:8;
9916 @} __attribute__ ((packed));
9917 @end smallexample
9919 This warning is enabled by default.  Use
9920 @option{-Wno-packed-bitfield-compat} to disable this warning.
9922 @opindex Wpacked-not-aligned
9923 @opindex Wno-packed-not-aligned
9924 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
9925 Warn if a structure field with explicitly specified alignment in a
9926 packed struct or union is misaligned.  For example, a warning will
9927 be issued on @code{struct S}, like, @code{warning: alignment 1 of
9928 'struct S' is less than 8}, in this code:
9930 @smallexample
9931 @group
9932 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
9933 struct __attribute__ ((packed)) S @{
9934   struct S8 s8;
9936 @end group
9937 @end smallexample
9939 This warning is enabled by @option{-Wall}.
9941 @opindex Wpadded
9942 @opindex Wno-padded
9943 @item -Wpadded
9944 Warn if padding is included in a structure, either to align an element
9945 of the structure or to align the whole structure.  Sometimes when this
9946 happens it is possible to rearrange the fields of the structure to
9947 reduce the padding and so make the structure smaller.
9949 @opindex Wredundant-decls
9950 @opindex Wno-redundant-decls
9951 @item -Wredundant-decls
9952 Warn if anything is declared more than once in the same scope, even in
9953 cases where multiple declaration is valid and changes nothing.
9955 @opindex Wrestrict
9956 @opindex Wno-restrict
9957 @item -Wrestrict
9958 Warn when an object referenced by a @code{restrict}-qualified parameter
9959 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
9960 argument, or when copies between such objects overlap.  For example,
9961 the call to the @code{strcpy} function below attempts to truncate the string
9962 by replacing its initial characters with the last four.  However, because
9963 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
9964 the call is diagnosed.
9966 @smallexample
9967 void foo (void)
9969   char a[] = "abcd1234";
9970   strcpy (a, a + 4);
9971   @dots{}
9973 @end smallexample
9974 The @option{-Wrestrict} option detects some instances of simple overlap
9975 even without optimization but works best at @option{-O2} and above.  It
9976 is included in @option{-Wall}.
9978 @opindex Wnested-externs
9979 @opindex Wno-nested-externs
9980 @item -Wnested-externs @r{(C and Objective-C only)}
9981 Warn if an @code{extern} declaration is encountered within a function.
9983 @opindex Winline
9984 @opindex Wno-inline
9985 @item -Winline
9986 Warn if a function that is declared as inline cannot be inlined.
9987 Even with this option, the compiler does not warn about failures to
9988 inline functions declared in system headers.
9990 The compiler uses a variety of heuristics to determine whether or not
9991 to inline a function.  For example, the compiler takes into account
9992 the size of the function being inlined and the amount of inlining
9993 that has already been done in the current function.  Therefore,
9994 seemingly insignificant changes in the source program can cause the
9995 warnings produced by @option{-Winline} to appear or disappear.
9997 @opindex Winterference-size
9998 @item -Winterference-size
9999 Warn about use of C++17 @code{std::hardware_destructive_interference_size}
10000 without specifying its value with @option{--param destructive-interference-size}.
10001 Also warn about questionable values for that option.
10003 This variable is intended to be used for controlling class layout, to
10004 avoid false sharing in concurrent code:
10006 @smallexample
10007 struct independent_fields @{
10008   alignas(std::hardware_destructive_interference_size)
10009     std::atomic<int> one;
10010   alignas(std::hardware_destructive_interference_size)
10011     std::atomic<int> two;
10013 @end smallexample
10015 Here @samp{one} and @samp{two} are intended to be far enough apart
10016 that stores to one won't require accesses to the other to reload the
10017 cache line.
10019 By default, @option{--param destructive-interference-size} and
10020 @option{--param constructive-interference-size} are set based on the
10021 current @option{-mtune} option, typically to the L1 cache line size
10022 for the particular target CPU, sometimes to a range if tuning for a
10023 generic target.  So all translation units that depend on ABI
10024 compatibility for the use of these variables must be compiled with
10025 the same @option{-mtune} (or @option{-mcpu}).
10027 If ABI stability is important, such as if the use is in a header for a
10028 library, you should probably not use the hardware interference size
10029 variables at all.  Alternatively, you can force a particular value
10030 with @option{--param}.
10032 If you are confident that your use of the variable does not affect ABI
10033 outside a single build of your project, you can turn off the warning
10034 with @option{-Wno-interference-size}.
10036 @opindex Wint-in-bool-context
10037 @opindex Wno-int-in-bool-context
10038 @item -Wint-in-bool-context
10039 Warn for suspicious use of integer values where boolean values are expected,
10040 such as conditional expressions (?:) using non-boolean integer constants in
10041 boolean context, like @code{if (a <= b ? 2 : 3)}.  Or left shifting of signed
10042 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}.  Likewise
10043 for all kinds of multiplications regardless of the data type.
10044 This warning is enabled by @option{-Wall}.
10046 @opindex Wno-int-to-pointer-cast
10047 @opindex Wint-to-pointer-cast
10048 @item -Wno-int-to-pointer-cast
10049 Suppress warnings from casts to pointer type of an integer of a
10050 different size. In C++, casting to a pointer type of smaller size is
10051 an error. @option{Wint-to-pointer-cast} is enabled by default.
10054 @opindex Wno-pointer-to-int-cast
10055 @opindex Wpointer-to-int-cast
10056 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
10057 Suppress warnings from casts from a pointer to an integer type of a
10058 different size.
10060 @opindex Winvalid-pch
10061 @opindex Wno-invalid-pch
10062 @item -Winvalid-pch
10063 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
10064 the search path but cannot be used.
10066 @opindex Winvalid-utf8
10067 @opindex Wno-invalid-utf8
10068 @item -Winvalid-utf8
10069 Warn if an invalid UTF-8 character is found.
10070 This warning is on by default for C++23 if @option{-finput-charset=UTF-8}
10071 is used and turned into error with @option{-pedantic-errors}.
10073 @opindex Wunicode
10074 @opindex Wno-unicode
10075 @item -Wno-unicode
10076 Don't diagnose invalid forms of delimited or named escape sequences which are
10077 treated as separate tokens.  @option{Wunicode} is enabled by default.
10079 @opindex Wlong-long
10080 @opindex Wno-long-long
10081 @item -Wlong-long
10082 Warn if @code{long long} type is used.  This is enabled by either
10083 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
10084 modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
10086 This warning is upgraded to an error by @option{-pedantic-errors}.
10088 @opindex Wvariadic-macros
10089 @opindex Wno-variadic-macros
10090 @item -Wvariadic-macros
10091 Warn if variadic macros are used in ISO C90 mode, or if the GNU
10092 alternate syntax is used in ISO C99 mode.  This is enabled by either
10093 @option{-Wpedantic} or @option{-Wtraditional}.  To inhibit the warning
10094 messages, use @option{-Wno-variadic-macros}.
10096 @opindex Wvarargs
10097 @opindex Wno-varargs
10098 @item -Wno-varargs
10099 Do not warn upon questionable usage of the macros used to handle variable
10100 arguments like @code{va_start}.  These warnings are enabled by default.
10102 @opindex Wvector-operation-performance
10103 @opindex Wno-vector-operation-performance
10104 @item -Wvector-operation-performance
10105 Warn if vector operation is not implemented via SIMD capabilities of the
10106 architecture.  Mainly useful for the performance tuning.
10107 Vector operation can be implemented @code{piecewise}, which means that the
10108 scalar operation is performed on every vector element; 
10109 @code{in parallel}, which means that the vector operation is implemented
10110 using scalars of wider type, which normally is more performance efficient;
10111 and @code{as a single scalar}, which means that vector fits into a
10112 scalar type.
10114 @opindex Wvla
10115 @opindex Wno-vla
10116 @item -Wvla
10117 Warn if a variable-length array is used in the code.
10118 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
10119 the variable-length array.
10121 This warning is upgraded to an error by @option{-pedantic-errors}.
10123 @opindex Wvla-larger-than=
10124 @opindex Wno-vla-larger-than
10125 @item -Wvla-larger-than=@var{byte-size}
10126 If this option is used, the compiler warns for declarations of
10127 variable-length arrays whose size is either unbounded, or bounded
10128 by an argument that allows the array size to exceed @var{byte-size}
10129 bytes.  This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
10130 works, but with variable-length arrays.
10132 Note that GCC may optimize small variable-length arrays of a known
10133 value into plain arrays, so this warning may not get triggered for
10134 such arrays.
10136 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
10137 is typically only effective when @option{-ftree-vrp} is active (default
10138 for @option{-O2} and above).
10140 See also @option{-Walloca-larger-than=@var{byte-size}}.
10142 @opindex Wno-vla-larger-than
10143 @item -Wno-vla-larger-than
10144 Disable @option{-Wvla-larger-than=} warnings.  The option is equivalent
10145 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
10147 @opindex Wno-vla-parameter
10148 @item -Wvla-parameter
10149 Warn about redeclarations of functions involving arguments of Variable
10150 Length Array types of inconsistent kinds or forms, and enable the detection
10151 of out-of-bounds accesses to such parameters by warnings such as
10152 @option{-Warray-bounds}.
10154 If the first function declaration uses the VLA form the bound specified
10155 in the array is assumed to be the minimum number of elements expected to
10156 be provided in calls to the function and the maximum number of elements
10157 accessed by it.  Failing to provide arguments of sufficient size or
10158 accessing more than the maximum number of elements may be diagnosed.
10160 For example, the warning triggers for the following redeclarations because
10161 the first one allows an array of any size to be passed to @code{f} while
10162 the second one specifies that the array argument must have at least @code{n}
10163 elements.  In addition, calling @code{f} with the associated VLA bound
10164 parameter in excess of the actual VLA bound triggers a warning as well.
10166 @smallexample
10167 void f (int n, int[n]);
10168 // warning: argument 2 previously declared as a VLA
10169 void f (int, int[]);
10171 void g (int n)
10173     if (n > 4)
10174       return;
10175     int a[n];
10176     // warning: access to a by f may be out of bounds
10177     f (sizeof a, a);
10178   @dots{}
10181 @end smallexample
10183 @option{-Wvla-parameter} is included in @option{-Wall}.  The
10184 @option{-Warray-parameter} option triggers warnings for similar problems
10185 involving ordinary array arguments.
10187 @opindex Wvolatile-register-var
10188 @opindex Wno-volatile-register-var
10189 @item -Wvolatile-register-var
10190 Warn if a register variable is declared volatile.  The volatile
10191 modifier does not inhibit all optimizations that may eliminate reads
10192 and/or writes to register variables.  This warning is enabled by
10193 @option{-Wall}.
10195 @opindex Wxor-used-as-pow
10196 @opindex Wno-xor-used-as-pow
10197 @item -Wxor-used-as-pow @r{(C, C++, Objective-C and Objective-C++ only)}
10198 Warn about uses of @code{^}, the exclusive or operator, where it appears
10199 the user meant exponentiation.  Specifically, the warning occurs when the
10200 left-hand side is the decimal constant 2 or 10 and the right-hand side
10201 is also a decimal constant.
10203 In C and C++, @code{^} means exclusive or, whereas in some other languages
10204 (e.g. TeX and some versions of BASIC) it means exponentiation.
10206 This warning is enabled by default.  It can be silenced by converting one
10207 of the operands to hexadecimal.
10209 @opindex Wdisabled-optimization
10210 @opindex Wno-disabled-optimization
10211 @item -Wdisabled-optimization
10212 Warn if a requested optimization pass is disabled.  This warning does
10213 not generally indicate that there is anything wrong with your code; it
10214 merely indicates that GCC's optimizers are unable to handle the code
10215 effectively.  Often, the problem is that your code is too big or too
10216 complex; GCC refuses to optimize programs when the optimization
10217 itself is likely to take inordinate amounts of time.
10219 @opindex Wpointer-sign
10220 @opindex Wno-pointer-sign
10221 @item -Wpointer-sign @r{(C and Objective-C only)}
10222 Warn for pointer argument passing or assignment with different signedness.
10223 This option is only supported for C and Objective-C@.  It is implied by
10224 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
10225 @option{-Wno-pointer-sign}.
10227 This warning is upgraded to an error by @option{-pedantic-errors}.
10229 @opindex Wstack-protector
10230 @opindex Wno-stack-protector
10231 @item -Wstack-protector
10232 This option is only active when @option{-fstack-protector} is active.  It
10233 warns about functions that are not protected against stack smashing.
10235 @opindex Woverlength-strings
10236 @opindex Wno-overlength-strings
10237 @item -Woverlength-strings
10238 Warn about string constants that are longer than the ``minimum
10239 maximum'' length specified in the C standard.  Modern compilers
10240 generally allow string constants that are much longer than the
10241 standard's minimum limit, but very portable programs should avoid
10242 using longer strings.
10244 The limit applies @emph{after} string constant concatenation, and does
10245 not count the trailing NUL@.  In C90, the limit was 509 characters; in
10246 C99, it was raised to 4095.  C++98 does not specify a normative
10247 minimum maximum, so we do not diagnose overlength strings in C++@.
10249 This option is implied by @option{-Wpedantic}, and can be disabled with
10250 @option{-Wno-overlength-strings}.
10252 @opindex Wunsuffixed-float-constants
10253 @opindex Wno-unsuffixed-float-constants
10254 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
10256 Issue a warning for any floating constant that does not have
10257 a suffix.  When used together with @option{-Wsystem-headers} it
10258 warns about such constants in system header files.  This can be useful
10259 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
10260 from the decimal floating-point extension to C99.
10262 @opindex Wlto-type-mismatch
10263 @opindex Wno-lto-type-mismatch
10264 @item -Wno-lto-type-mismatch
10266 During the link-time optimization, do not warn about type mismatches in
10267 global declarations from different compilation units.
10268 Requires @option{-flto} to be enabled.  Enabled by default.
10270 @opindex Wdesignated-init
10271 @opindex Wno-designated-init
10272 @item -Wno-designated-init @r{(C and Objective-C only)}
10273 Suppress warnings when a positional initializer is used to initialize
10274 a structure that has been marked with the @code{designated_init}
10275 attribute.
10277 @end table
10279 @node Static Analyzer Options
10280 @section Options That Control Static Analysis
10282 @table @gcctabopt
10283 @opindex analyzer
10284 @opindex fanalyzer
10285 @opindex fno-analyzer
10286 @item -fanalyzer
10287 This option enables an static analysis of program flow which looks
10288 for ``interesting'' interprocedural paths through the
10289 code, and issues warnings for problems found on them.
10291 This analysis is much more expensive than other GCC warnings.
10293 In technical terms, it performs coverage-guided symbolic execution of
10294 the code being compiled.  It is neither sound nor complete: it can
10295 have false positives and false negatives.  It is a bug-finding tool,
10296 rather than a tool for proving program correctness.
10298 The analyzer is only suitable for use on C code in this release.
10300 Enabling this option effectively enables the following warnings:
10302 @gccoptlist{
10303 -Wanalyzer-allocation-size
10304 -Wanalyzer-deref-before-check
10305 -Wanalyzer-double-fclose
10306 -Wanalyzer-double-free
10307 -Wanalyzer-exposure-through-output-file
10308 -Wanalyzer-exposure-through-uninit-copy
10309 -Wanalyzer-fd-access-mode-mismatch
10310 -Wanalyzer-fd-double-close
10311 -Wanalyzer-fd-leak
10312 -Wanalyzer-fd-phase-mismatch
10313 -Wanalyzer-fd-type-mismatch
10314 -Wanalyzer-fd-use-after-close
10315 -Wanalyzer-fd-use-without-check
10316 -Wanalyzer-file-leak
10317 -Wanalyzer-free-of-non-heap
10318 -Wanalyzer-imprecise-fp-arithmetic
10319 -Wanalyzer-infinite-recursion
10320 -Wanalyzer-jump-through-null
10321 -Wanalyzer-malloc-leak
10322 -Wanalyzer-mismatching-deallocation
10323 -Wanalyzer-null-argument
10324 -Wanalyzer-null-dereference
10325 -Wanalyzer-out-of-bounds
10326 -Wanalyzer-overlapping-buffers
10327 -Wanalyzer-possible-null-argument
10328 -Wanalyzer-possible-null-dereference
10329 -Wanalyzer-putenv-of-auto-var
10330 -Wanalyzer-shift-count-negative
10331 -Wanalyzer-shift-count-overflow
10332 -Wanalyzer-stale-setjmp-buffer
10333 -Wanalyzer-unsafe-call-within-signal-handler
10334 -Wanalyzer-use-after-free
10335 -Wanalyzer-use-of-pointer-in-stale-stack-frame
10336 -Wanalyzer-use-of-uninitialized-value
10337 -Wanalyzer-va-arg-type-mismatch
10338 -Wanalyzer-va-list-exhausted
10339 -Wanalyzer-va-list-leak
10340 -Wanalyzer-va-list-use-after-va-end
10341 -Wanalyzer-write-to-const
10342 -Wanalyzer-write-to-string-literal
10344 @ignore
10345 -Wanalyzer-tainted-allocation-size
10346 -Wanalyzer-tainted-array-index
10347 -Wanalyzer-tainted-divisor
10348 -Wanalyzer-tainted-offset
10349 -Wanalyzer-tainted-size
10350 @end ignore
10352 This option is only available if GCC was configured with analyzer
10353 support enabled.
10355 @opindex Wanalyzer-too-complex
10356 @opindex Wno-analyzer-too-complex
10357 @item -Wanalyzer-too-complex
10358 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
10359 to attempt to explore the control flow and data flow in the program,
10360 but these can be defeated by sufficiently complicated code.
10362 By default, the analysis silently stops if the code is too
10363 complicated for the analyzer to fully explore and it reaches an internal
10364 limit.  The @option{-Wanalyzer-too-complex} option warns if this occurs.
10366 @opindex Wanalyzer-allocation-size
10367 @opindex Wno-analyzer-allocation-size
10368 @item -Wno-analyzer-allocation-size
10369 This warning requires @option{-fanalyzer}, which enables it;
10370 to disable it, use @option{-Wno-analyzer-allocation-size}.
10372 This diagnostic warns for paths through the code in which a pointer to
10373 a buffer is assigned to point at a buffer with a size that is not a
10374 multiple of @code{sizeof (*pointer)}.
10376 See @uref{https://cwe.mitre.org/data/definitions/131.html, CWE-131: Incorrect Calculation of Buffer Size}.
10378 @opindex Wanalyzer-deref-before-check
10379 @opindex Wno-analyzer-deref-before-check
10380 @item -Wno-analyzer-deref-before-check
10381 This warning requires @option{-fanalyzer}, which enables it; use
10382 @option{-Wno-analyzer-deref-before-check}
10383 to disable it.
10385 This diagnostic warns for paths through the code in which a pointer
10386 is checked for @code{NULL} *after* it has already been
10387 dereferenced, suggesting that the pointer could have been NULL.
10388 Such cases suggest that the check for NULL is either redundant,
10389 or that it needs to be moved to before the pointer is dereferenced.
10391 This diagnostic also considers values passed to a function argument
10392 marked with @code{__attribute__((nonnull))} as requiring a non-NULL
10393 value, and thus will complain if such values are checked for @code{NULL}
10394 after returning from such a function call.
10396 This diagnostic is unlikely to be reported when any level of optimization
10397 is enabled, as GCC's optimization logic will typically consider such
10398 checks for NULL as being redundant, and optimize them away before the
10399 analyzer "sees" them.  Hence optimization should be disabled when
10400 attempting to trigger this diagnostic.
10402 @opindex Wanalyzer-double-fclose
10403 @opindex Wno-analyzer-double-fclose
10404 @item -Wno-analyzer-double-fclose
10405 This warning requires @option{-fanalyzer}, which enables it; use
10406 @option{-Wno-analyzer-double-fclose} to disable it.
10408 This diagnostic warns for paths through the code in which a @code{FILE *}
10409 can have @code{fclose} called on it more than once.
10411 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10413 @opindex Wanalyzer-double-free
10414 @opindex Wno-analyzer-double-free
10415 @item -Wno-analyzer-double-free
10416 This warning requires @option{-fanalyzer}, which enables it; use
10417 @option{-Wno-analyzer-double-free} to disable it.
10419 This diagnostic warns for paths through the code in which a pointer
10420 can have a deallocator called on it more than once, either @code{free},
10421 or a deallocator referenced by attribute @code{malloc}.
10423 See @uref{https://cwe.mitre.org/data/definitions/415.html, CWE-415: Double Free}.
10425 @opindex Wanalyzer-exposure-through-output-file
10426 @opindex Wno-analyzer-exposure-through-output-file
10427 @item -Wno-analyzer-exposure-through-output-file
10428 This warning requires @option{-fanalyzer}, which enables it; use
10429 @option{-Wno-analyzer-exposure-through-output-file}
10430 to disable it.
10432 This diagnostic warns for paths through the code in which a
10433 security-sensitive value is written to an output file
10434 (such as writing a password to a log file).
10436 See @uref{https://cwe.mitre.org/data/definitions/532.html, CWE-532: Information Exposure Through Log Files}.
10438 @opindex Wanalyzer-exposure-through-uninit-copy
10439 @opindex Wno-analyzer-exposure-through-uninit-copy
10440 @item -Wanalyzer-exposure-through-uninit-copy
10441 This warning requires both @option{-fanalyzer} and the use of a plugin
10442 to specify a function that copies across a ``trust boundary''.  Use
10443 @option{-Wno-analyzer-exposure-through-uninit-copy} to disable it.
10445 This diagnostic warns for ``infoleaks'' - paths through the code in which
10446 uninitialized values are copied across a security boundary
10447 (such as code within an OS kernel that copies a partially-initialized
10448 struct on the stack to user space).
10450 See @uref{https://cwe.mitre.org/data/definitions/200.html, CWE-200: Exposure of Sensitive Information to an Unauthorized Actor}.
10452 @opindex Wanalyzer-fd-access-mode-mismatch
10453 @opindex Wno-analyzer-fd-access-mode-mismatch
10454 @item -Wno-analyzer-fd-access-mode-mismatch
10455 This warning requires @option{-fanalyzer}, which enables it; use
10456 @option{-Wno-analyzer-fd-access-mode-mismatch}
10457 to disable it.
10459 This diagnostic warns for paths through code in which a
10460 @code{read} on a write-only file descriptor is attempted, or vice versa.
10462 This diagnostic also warns for code paths in a which a function with attribute
10463 @code{fd_arg_read (N)} is called with a file descriptor opened with
10464 @code{O_WRONLY} at referenced argument @code{N} or a function with attribute
10465 @code{fd_arg_write (N)} is called with a file descriptor opened with
10466 @code{O_RDONLY} at referenced argument @var{N}.
10468 @opindex Wanalyzer-fd-double-close
10469 @opindex Wno-analyzer-fd-double-close
10470 @item -Wno-analyzer-fd-double-close
10471 This warning requires @option{-fanalyzer}, which enables it; use
10472 @option{-Wno-analyzer-fd-double-close}
10473 to disable it.
10475 This diagnostic warns for paths through code in which a
10476 file descriptor can be closed more than once.
10478 See @uref{https://cwe.mitre.org/data/definitions/1341.html, CWE-1341: Multiple Releases of Same Resource or Handle}.
10480 @opindex Wanalyzer-fd-leak
10481 @opindex Wno-analyzer-fd-leak
10482 @item -Wno-analyzer-fd-leak
10483 This warning requires @option{-fanalyzer}, which enables it; use
10484 @option{-Wno-analyzer-fd-leak}
10485 to disable it.
10487 This diagnostic warns for paths through code in which an
10488 open file descriptor is leaked.
10490 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10492 @opindex Wanalyzer-fd-phase-mismatch
10493 @opindex Wno-analyzer-fd-phase-mismatch
10494 @item -Wno-analyzer-fd-phase-mismatch
10495 This warning requires @option{-fanalyzer}, which enables it; use
10496 @option{-Wno-analyzer-fd-phase-mismatch}
10497 to disable it.
10499 This diagnostic warns for paths through code in which an operation is
10500 attempted in the wrong phase of a file descriptor's lifetime.
10501 For example, it will warn on attempts to call @code{accept} on a stream
10502 socket that has not yet had @code{listen} successfully called on it.
10504 See @uref{https://cwe.mitre.org/data/definitions/666.html, CWE-666: Operation on Resource in Wrong Phase of Lifetime}.
10506 @opindex Wanalyzer-fd-type-mismatch
10507 @opindex Wno-analyzer-fd-type-mismatch
10508 @item -Wno-analyzer-fd-type-mismatch
10509 This warning requires @option{-fanalyzer}, which enables it; use
10510 @option{-Wno-analyzer-fd-type-mismatch}
10511 to disable it.
10513 This diagnostic warns for paths through code in which an
10514 operation is attempted on the wrong type of file descriptor.
10515 For example, it will warn on attempts to use socket operations
10516 on a file descriptor obtained via @code{open}, or when attempting
10517 to use a stream socket operation on a datagram socket.
10519 @opindex Wanalyzer-fd-use-after-close
10520 @opindex Wno-analyzer-fd-use-after-close
10521 @item -Wno-analyzer-fd-use-after-close
10522 This warning requires @option{-fanalyzer}, which enables it; use
10523 @option{-Wno-analyzer-fd-use-after-close}
10524 to disable it.
10526 This diagnostic warns for paths through code in which a
10527 read or write is called on a closed file descriptor.
10529 This diagnostic also warns for paths through code in which
10530 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10531 or @code{fd_arg_write (N)} is called with a closed file descriptor at
10532 referenced argument @code{N}.
10534 @opindex Wanalyzer-fd-use-without-check
10535 @opindex Wno-analyzer-fd-use-without-check
10536 @item -Wno-analyzer-fd-use-without-check
10537 This warning requires @option{-fanalyzer}, which enables it; use
10538 @option{-Wno-analyzer-fd-use-without-check}
10539 to disable it.
10541 This diagnostic warns for paths through code in which a
10542 file descriptor is used without being checked for validity.
10544 This diagnostic also warns for paths through code in which
10545 a function with attribute @code{fd_arg (N)} or @code{fd_arg_read (N)}
10546 or @code{fd_arg_write (N)} is called with a file descriptor, at referenced
10547 argument @code{N}, without being checked for validity.
10549 @opindex Wanalyzer-file-leak
10550 @opindex Wno-analyzer-file-leak
10551 @item -Wno-analyzer-file-leak
10552 This warning requires @option{-fanalyzer}, which enables it; use
10553 @option{-Wno-analyzer-file-leak}
10554 to disable it.
10556 This diagnostic warns for paths through the code in which a
10557 @code{<stdio.h>} @code{FILE *} stream object is leaked.
10559 See @uref{https://cwe.mitre.org/data/definitions/775.html, CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime}.
10561 @opindex Wanalyzer-free-of-non-heap
10562 @opindex Wno-analyzer-free-of-non-heap
10563 @item -Wno-analyzer-free-of-non-heap
10564 This warning requires @option{-fanalyzer}, which enables it; use
10565 @option{-Wno-analyzer-free-of-non-heap}
10566 to disable it.
10568 This diagnostic warns for paths through the code in which @code{free}
10569 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
10571 See @uref{https://cwe.mitre.org/data/definitions/590.html, CWE-590: Free of Memory not on the Heap}.
10573 @opindex Wanalyzer-imprecise-fp-arithmetic
10574 @opindex Wno-analyzer-imprecise-fp-arithmetic
10575 @item -Wno-analyzer-imprecise-fp-arithmetic
10576 This warning requires @option{-fanalyzer}, which enables it; use
10577 @option{-Wno-analyzer-imprecise-fp-arithmetic}
10578 to disable it.
10580 This diagnostic warns for paths through the code in which floating-point
10581 arithmetic is used in locations where precise computation is needed.  This
10582 diagnostic only warns on use of floating-point operands inside the
10583 calculation of an allocation size at the moment.
10585 @opindex Wanalyzer-infinite-recursion
10586 @opindex Wno-analyzer-infinite-recursion
10587 @item -Wno-analyzer-infinite-recursion
10588 This warning requires @option{-fanalyzer}, which enables it; use
10589 @option{-Wno-analyzer-infinite-recursion} to disable it.
10591 This diagnostics warns for paths through the code which appear to
10592 lead to infinite recursion.
10594 Specifically, when the analyzer "sees" a recursive call, it will compare
10595 the state of memory at the entry to the new frame with that at the entry
10596 to the previous frame of that function on the stack.  The warning is
10597 issued if nothing in memory appears to be changing; any changes observed
10598 to parameters or globals are assumed to lead to termination of the
10599 recursion and thus suppress the warning.
10601 This diagnostic is likely to miss cases of infinite recursion that
10602 are convered to iteration by the optimizer before the analyzer "sees"
10603 them.  Hence optimization should be disabled when attempting to trigger
10604 this diagnostic.
10606 Compare with @option{-Winfinite-recursion}, which provides a similar
10607 diagnostic, but is implemented in a different way.
10609 @opindex Wanalyzer-jump-through-null
10610 @opindex Wno-analyzer-jump-through-null
10611 @item -Wno-analyzer-jump-through-null
10612 This warning requires @option{-fanalyzer}, which enables it; use
10613 @option{-Wno-analyzer-jump-through-null}
10614 to disable it.
10616 This diagnostic warns for paths through the code in which a @code{NULL}
10617 function pointer is called.
10619 @opindex Wanalyzer-malloc-leak
10620 @opindex Wno-analyzer-malloc-leak
10621 @item -Wno-analyzer-malloc-leak
10622 This warning requires @option{-fanalyzer}, which enables it; use
10623 @option{-Wno-analyzer-malloc-leak}
10624 to disable it.
10626 This diagnostic warns for paths through the code in which a
10627 pointer allocated via an allocator is leaked: either @code{malloc},
10628 or a function marked with attribute @code{malloc}.
10630 See @uref{https://cwe.mitre.org/data/definitions/401.html, CWE-401: Missing Release of Memory after Effective Lifetime}.
10632 @opindex Wanalyzer-mismatching-deallocation
10633 @opindex Wno-analyzer-mismatching-deallocation
10634 @item -Wno-analyzer-mismatching-deallocation
10635 This warning requires @option{-fanalyzer}, which enables it; use
10636 @option{-Wno-analyzer-mismatching-deallocation}
10637 to disable it.
10639 This diagnostic warns for paths through the code in which the
10640 wrong deallocation function is called on a pointer value, based on
10641 which function was used to allocate the pointer value.  The diagnostic
10642 will warn about mismatches between @code{free}, scalar @code{delete}
10643 and vector @code{delete[]}, and those marked as allocator/deallocator
10644 pairs using attribute @code{malloc}.
10646 See @uref{https://cwe.mitre.org/data/definitions/762.html, CWE-762: Mismatched Memory Management Routines}.
10648 @opindex Wanalyzer-out-of-bounds
10649 @opindex Wno-analyzer-out-of-bounds
10650 @item -Wno-analyzer-out-of-bounds
10651 This warning requires @option{-fanalyzer}, which enables it; use
10652 @option{-Wno-analyzer-out-of-bounds} to disable it.
10654 This diagnostic warns for paths through the code in which a buffer is
10655 definitely read or written out-of-bounds.  The diagnostic applies for
10656 cases where the analyzer is able to determine a constant offset and for
10657 accesses past the end of a buffer, also a constant capacity.  Further,
10658 the diagnostic does limited checking for accesses past the end when the
10659 offset as well as the capacity is symbolic.
10661 See @uref{https://cwe.mitre.org/data/definitions/119.html, CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer}.
10663 For cases where the analyzer is able, it will emit a text art diagram
10664 visualizing the spatial relationship between the memory region that the
10665 analyzer predicts would be accessed, versus the range of memory that is
10666 valid to access: whether they overlap, are touching, are close or far
10667 apart; which one is before or after in memory, the relative sizes
10668 involved, the direction of the access (read vs write), and, in some
10669 cases, the values of data involved.  This diagram can be suppressed
10670 using @option{-fdiagnostics-text-art-charset=none}.
10672 @opindex Wanalyzer-overlapping-buffers
10673 @opindex Wno-analyzer-overlapping-buffers
10674 @item -Wno-analyzer-overlapping-buffers
10675 This warning requires @option{-fanalyzer}, which enables it; use
10676 @option{-Wno-analyzer-overlapping-buffers} to disable it.
10678 This diagnostic warns for paths through the code in which overlapping
10679 buffers are passed to an API for which the behavior on such buffers
10680 is undefined.
10682 Specifically, the diagnostic occurs on calls to the following functions
10683 @itemize @bullet
10684 @item @code{memcpy}
10685 @item @code{strcat}
10686 @item @code{strcpy}
10687 @end itemize
10688 for cases where the buffers are known to overlap.
10690 @opindex Wanalyzer-possible-null-argument
10691 @opindex Wno-analyzer-possible-null-argument
10692 @item -Wno-analyzer-possible-null-argument
10693 This warning requires @option{-fanalyzer}, which enables it; use
10694 @option{-Wno-analyzer-possible-null-argument} to disable it.
10696 This diagnostic warns for paths through the code in which a
10697 possibly-NULL value is passed to a function argument marked
10698 with @code{__attribute__((nonnull))} as requiring a non-NULL
10699 value.
10701 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10703 @opindex Wanalyzer-possible-null-dereference
10704 @opindex Wno-analyzer-possible-null-dereference
10705 @item -Wno-analyzer-possible-null-dereference
10706 This warning requires @option{-fanalyzer}, which enables it; use
10707 @option{-Wno-analyzer-possible-null-dereference} to disable it.
10709 This diagnostic warns for paths through the code in which a
10710 possibly-NULL value is dereferenced.
10712 See @uref{https://cwe.mitre.org/data/definitions/690.html, CWE-690: Unchecked Return Value to NULL Pointer Dereference}.
10714 @opindex Wanalyzer-null-argument
10715 @opindex Wno-analyzer-null-argument
10716 @item -Wno-analyzer-null-argument
10717 This warning requires @option{-fanalyzer}, which enables it; use
10718 @option{-Wno-analyzer-null-argument} to disable it.
10720 This diagnostic warns for paths through the code in which a
10721 value known to be NULL is passed to a function argument marked
10722 with @code{__attribute__((nonnull))} as requiring a non-NULL
10723 value.
10725 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10727 @opindex Wanalyzer-null-dereference
10728 @opindex Wno-analyzer-null-dereference
10729 @item -Wno-analyzer-null-dereference
10730 This warning requires @option{-fanalyzer}, which enables it; use
10731 @option{-Wno-analyzer-null-dereference} to disable it.
10733 This diagnostic warns for paths through the code in which a
10734 value known to be NULL is dereferenced.
10736 See @uref{https://cwe.mitre.org/data/definitions/476.html, CWE-476: NULL Pointer Dereference}.
10738 @opindex Wanalyzer-putenv-of-auto-var
10739 @opindex Wno-analyzer-putenv-of-auto-var
10740 @item -Wno-analyzer-putenv-of-auto-var
10741 This warning requires @option{-fanalyzer}, which enables it; use
10742 @option{-Wno-analyzer-putenv-of-auto-var} to disable it.
10744 This diagnostic warns for paths through the code in which a
10745 call to @code{putenv} is passed a pointer to an automatic variable
10746 or an on-stack buffer.
10748 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}.
10750 @opindex Wanalyzer-shift-count-negative
10751 @opindex Wno-analyzer-shift-count-negative
10752 @item -Wno-analyzer-shift-count-negative
10753 This warning requires @option{-fanalyzer}, which enables it; use
10754 @option{-Wno-analyzer-shift-count-negative} to disable it.
10756 This diagnostic warns for paths through the code in which a
10757 shift is attempted with a negative count.  It is analogous to
10758 the @option{-Wshift-count-negative} diagnostic implemented in
10759 the C/C++ front ends, but is implemented based on analyzing
10760 interprocedural paths, rather than merely parsing the syntax tree.
10761 However, the analyzer does not prioritize detection of such paths, so
10762 false negatives are more likely relative to other warnings.
10764 @opindex Wanalyzer-shift-count-overflow
10765 @opindex Wno-analyzer-shift-count-overflow
10766 @item -Wno-analyzer-shift-count-overflow
10767 This warning requires @option{-fanalyzer}, which enables it; use
10768 @option{-Wno-analyzer-shift-count-overflow} to disable it.
10770 This diagnostic warns for paths through the code in which a
10771 shift is attempted with a count greater than or equal to the
10772 precision of the operand's type.  It is analogous to
10773 the @option{-Wshift-count-overflow} diagnostic implemented in
10774 the C/C++ front ends, but is implemented based on analyzing
10775 interprocedural paths, rather than merely parsing the syntax tree.
10776 However, the analyzer does not prioritize detection of such paths, so
10777 false negatives are more likely relative to other warnings.
10779 @opindex Wanalyzer-stale-setjmp-buffer
10780 @opindex Wno-analyzer-stale-setjmp-buffer
10781 @item -Wno-analyzer-stale-setjmp-buffer
10782 This warning requires @option{-fanalyzer}, which enables it; use
10783 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
10785 This diagnostic warns for paths through the code in which
10786 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
10787 to a @code{setjmp} call in a function that has returned.
10789 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
10790 location, it records the stack frame.  The stack frame becomes invalid
10791 when the function containing the @code{setjmp} call returns.  Attempting
10792 to rewind to it via @code{longjmp} would reference a stack frame that
10793 no longer exists, and likely lead to a crash (or worse).
10795 @opindex Wanalyzer-tainted-allocation-size
10796 @opindex Wno-analyzer-tainted-allocation-size
10797 @item -Wno-analyzer-tainted-allocation-size
10798 This warning requires both @option{-fanalyzer} and
10799 @option{-fanalyzer-checker=taint} to enable it;
10800 use @option{-Wno-analyzer-tainted-allocation-size} to disable it.
10802 This diagnostic warns for paths through the code in which a value
10803 that could be under an attacker's control is used as the size
10804 of an allocation without being sanitized, so that an attacker could
10805 inject an excessively large allocation and potentially cause a denial
10806 of service attack.
10808 See @uref{https://cwe.mitre.org/data/definitions/789.html, CWE-789: Memory Allocation with Excessive Size Value}.
10810 @opindex Wanalyzer-tainted-assertion
10811 @opindex Wno-analyzer-tainted-assertion
10812 @item -Wno-analyzer-tainted-assertion
10814 This warning requires both @option{-fanalyzer} and
10815 @option{-fanalyzer-checker=taint} to enable it;
10816 use @option{-Wno-analyzer-tainted-assertion} to disable it.
10818 This diagnostic warns for paths through the code in which a value
10819 that could be under an attacker's control is used as part of a
10820 condition without being first sanitized, and that condition guards a
10821 call to a function marked with attribute @code{noreturn}
10822 (such as the function @code{__builtin_unreachable}).  Such functions
10823 typically indicate abnormal termination of the program, such as for
10824 assertion failure handlers.  For example:
10826 @smallexample
10827 assert (some_tainted_value < SOME_LIMIT);
10828 @end smallexample
10830 In such cases:
10832 @itemize
10833 @item
10834 when assertion-checking is enabled: an attacker could trigger
10835 a denial of service by injecting an assertion failure
10837 @item
10838 when assertion-checking is disabled, such as by defining @code{NDEBUG},
10839 an attacker could inject data that subverts the process, since it
10840 presumably violates a precondition that is being assumed by the code.
10842 @end itemize
10844 Note that when assertion-checking is disabled, the assertions are
10845 typically removed by the preprocessor before the analyzer has a chance
10846 to "see" them, so this diagnostic can only generate warnings on builds
10847 in which assertion-checking is enabled.
10849 For the purpose of this warning, any function marked with attribute
10850 @code{noreturn} is considered as a possible assertion failure
10851 handler, including @code{__builtin_unreachable}.  Note that these functions
10852 are sometimes removed by the optimizer before the analyzer "sees" them.
10853 Hence optimization should be disabled when attempting to trigger this
10854 diagnostic.
10856 See @uref{https://cwe.mitre.org/data/definitions/617.html, CWE-617: Reachable Assertion}.
10858 The warning can also report problematic constructions such as
10860 @smallexample
10861 switch (some_tainted_value) @{
10862 case 0:
10863   /* [...etc; various valid cases omitted...] */
10864   break;
10866 default:
10867   __builtin_unreachable (); /* BUG: attacker can trigger this  */
10869 @end smallexample
10871 despite the above not being an assertion failure, strictly speaking.
10873 @opindex Wanalyzer-tainted-array-index
10874 @opindex Wno-analyzer-tainted-array-index
10875 @item -Wno-analyzer-tainted-array-index
10876 This warning requires both @option{-fanalyzer} and
10877 @option{-fanalyzer-checker=taint} to enable it;
10878 use @option{-Wno-analyzer-tainted-array-index} to disable it.
10880 This diagnostic warns for paths through the code in which a value
10881 that could be under an attacker's control is used as the index
10882 of an array access without being sanitized, so that an attacker
10883 could inject an out-of-bounds access.
10885 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10887 @opindex Wanalyzer-tainted-divisor
10888 @opindex Wno-analyzer-tainted-divisor
10889 @item -Wno-analyzer-tainted-divisor
10890 This warning requires both @option{-fanalyzer} and
10891 @option{-fanalyzer-checker=taint} to enable it;
10892 use @option{-Wno-analyzer-tainted-divisor} to disable it.
10894 This diagnostic warns for paths through the code in which a value
10895 that could be under an attacker's control is used as the divisor
10896 in a division or modulus operation without being sanitized, so that
10897 an attacker could inject a division-by-zero.
10899 See @uref{https://cwe.mitre.org/data/definitions/369.html, CWE-369: Divide By Zero}.
10901 @opindex Wanalyzer-tainted-offset
10902 @opindex Wno-analyzer-tainted-offset
10903 @item -Wno-analyzer-tainted-offset
10904 This warning requires both @option{-fanalyzer} and
10905 @option{-fanalyzer-checker=taint} to enable it;
10906 use @option{-Wno-analyzer-tainted-offset} to disable it.
10908 This diagnostic warns for paths through the code in which a value
10909 that could be under an attacker's control is used as a pointer offset
10910 without being sanitized, so that an attacker could inject an out-of-bounds
10911 access.
10913 See @uref{https://cwe.mitre.org/data/definitions/823.html, CWE-823: Use of Out-of-range Pointer Offset}.
10915 @opindex Wanalyzer-tainted-size
10916 @opindex Wno-analyzer-tainted-size
10917 @item -Wno-analyzer-tainted-size
10918 This warning requires both @option{-fanalyzer} and
10919 @option{-fanalyzer-checker=taint} to enable it;
10920 use @option{-Wno-analyzer-tainted-size} to disable it.
10922 This diagnostic warns for paths through the code in which a value
10923 that could be under an attacker's control is used as the size of
10924 an operation such as @code{memset} without being sanitized, so that an
10925 attacker could inject an out-of-bounds access.
10927 See @uref{https://cwe.mitre.org/data/definitions/129.html, CWE-129: Improper Validation of Array Index}.
10929 @opindex Wanalyzer-unsafe-call-within-signal-handler
10930 @opindex Wno-analyzer-unsafe-call-within-signal-handler
10931 @item -Wno-analyzer-unsafe-call-within-signal-handler
10932 This warning requires @option{-fanalyzer}, which enables it; use
10933 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
10935 This diagnostic warns for paths through the code in which a
10936 function known to be async-signal-unsafe (such as @code{fprintf}) is
10937 called from a signal handler.
10939 See @uref{https://cwe.mitre.org/data/definitions/479.html, CWE-479: Signal Handler Use of a Non-reentrant Function}.
10941 @opindex Wanalyzer-use-after-free
10942 @opindex Wno-analyzer-use-after-free
10943 @item -Wno-analyzer-use-after-free
10944 This warning requires @option{-fanalyzer}, which enables it; use
10945 @option{-Wno-analyzer-use-after-free} to disable it.
10947 This diagnostic warns for paths through the code in which a
10948 pointer is used after a deallocator is called on it: either @code{free},
10949 or a deallocator referenced by attribute @code{malloc}.
10951 See @uref{https://cwe.mitre.org/data/definitions/416.html, CWE-416: Use After Free}.
10953 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
10954 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
10955 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
10956 This warning requires @option{-fanalyzer}, which enables it; use
10957 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
10958 to disable it.
10960 This diagnostic warns for paths through the code in which a pointer
10961 is dereferenced that points to a variable in a stale stack frame.
10963 @opindex Wanalyzer-va-arg-type-mismatch
10964 @opindex Wno-analyzer-va-arg-type-mismatch
10965 @item -Wno-analyzer-va-arg-type-mismatch
10966 This warning requires @option{-fanalyzer}, which enables it; use
10967 @option{-Wno-analyzer-va-arg-type-mismatch}
10968 to disable it.
10970 This diagnostic warns for interprocedural paths through the code for which
10971 the analyzer detects an attempt to use @code{va_arg} to extract a value
10972 passed to a variadic call, but uses a type that does not match that of
10973 the expression passed to the call.
10975 See @uref{https://cwe.mitre.org/data/definitions/686.html, CWE-686: Function Call With Incorrect Argument Type}.
10977 @opindex Wanalyzer-va-list-exhausted
10978 @opindex Wno-analyzer-va-list-exhausted
10979 @item -Wno-analyzer-va-list-exhausted
10980 This warning requires @option{-fanalyzer}, which enables it; use
10981 @option{-Wno-analyzer-va-list-exhausted}
10982 to disable it.
10984 This diagnostic warns for interprocedural paths through the code for which
10985 the analyzer detects an attempt to use @code{va_arg} to access the next
10986 value passed to a variadic call, but all of the values in the
10987 @code{va_list} have already been consumed.
10989 See @uref{https://cwe.mitre.org/data/definitions/685.html, CWE-685: Function Call With Incorrect Number of Arguments}.
10991 @opindex Wanalyzer-va-list-leak
10992 @opindex Wno-analyzer-va-list-leak
10993 @item -Wno-analyzer-va-list-leak
10994 This warning requires @option{-fanalyzer}, which enables it; use
10995 @option{-Wno-analyzer-va-list-leak}
10996 to disable it.
10998 This diagnostic warns for interprocedural paths through the code for which
10999 the analyzer detects that @code{va_start} or @code{va_copy} has been called
11000 on a @code{va_list} without a corresponding call to @code{va_end}.
11002 @opindex Wanalyzer-va-list-use-after-va-end
11003 @opindex Wno-analyzer-va-list-use-after-va-end
11004 @item -Wno-analyzer-va-list-use-after-va-end
11005 This warning requires @option{-fanalyzer}, which enables it; use
11006 @option{-Wno-analyzer-va-list-use-after-va-end}
11007 to disable it.
11009 This diagnostic warns for interprocedural paths through the code for which
11010 the analyzer detects an attempt to use a @code{va_list}  after
11011 @code{va_end} has been called on it.
11012 @code{va_list}.
11014 @opindex Wanalyzer-write-to-const
11015 @opindex Wno-analyzer-write-to-const
11016 @item -Wno-analyzer-write-to-const
11017 This warning requires @option{-fanalyzer}, which enables it; use
11018 @option{-Wno-analyzer-write-to-const}
11019 to disable it.
11021 This diagnostic warns for paths through the code in which the analyzer
11022 detects an attempt to write through a pointer to a @code{const} object.
11023 However, the analyzer does not prioritize detection of such paths, so
11024 false negatives are more likely relative to other warnings.
11026 @opindex Wanalyzer-write-to-string-literal
11027 @opindex Wno-analyzer-write-to-string-literal
11028 @item -Wno-analyzer-write-to-string-literal
11029 This warning requires @option{-fanalyzer}, which enables it; use
11030 @option{-Wno-analyzer-write-to-string-literal}
11031 to disable it.
11033 This diagnostic warns for paths through the code in which the analyzer
11034 detects an attempt to write through a pointer to a string literal.
11035 However, the analyzer does not prioritize detection of such paths, so
11036 false negatives are more likely relative to other warnings.
11038 @opindex Wanalyzer-use-of-uninitialized-value
11039 @opindex Wno-analyzer-use-of-uninitialized-value
11040 @item -Wno-analyzer-use-of-uninitialized-value
11041 This warning requires @option{-fanalyzer}, which enables it; use
11042 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
11044 This diagnostic warns for paths through the code in which an uninitialized
11045 value is used.
11047 See @uref{https://cwe.mitre.org/data/definitions/457.html, CWE-457: Use of Uninitialized Variable}.
11049 @end table
11051 The analyzer has hardcoded knowledge about the behavior of the following
11052 memory-management functions:
11054 @itemize @bullet
11055 @item @code{alloca}
11056 @item The built-in functions @code{__builtin_alloc},
11057 @code{__builtin_alloc_with_align}, @item @code{__builtin_calloc},
11058 @code{__builtin_free}, @code{__builtin_malloc}, @code{__builtin_memcpy},
11059 @code{__builtin_memcpy_chk}, @code{__builtin_memset},
11060 @code{__builtin_memset_chk}, @code{__builtin_realloc},
11061 @code{__builtin_stack_restore}, and @code{__builtin_stack_save}
11062 @item @code{calloc}
11063 @item @code{free}
11064 @item @code{malloc}
11065 @item @code{memset}
11066 @item @code{operator delete}
11067 @item @code{operator delete []}
11068 @item @code{operator new}
11069 @item @code{operator new []}
11070 @item @code{realloc}
11071 @item @code{strdup}
11072 @item @code{strndup}
11073 @end itemize
11075 @noindent
11076 of the following functions for working with file descriptors:
11078 @itemize @bullet
11079 @item @code{open}
11080 @item @code{close}
11081 @item @code{creat}
11082 @item @code{dup}, @code{dup2} and @code{dup3}
11083 @item @code{isatty}
11084 @item @code{pipe}, and @code{pipe2}
11085 @item @code{read}
11086 @item @code{write}
11087 @item @code{socket}, @code{bind}, @code{listen}, @code{accept}, and @code{connect}
11088 @end itemize
11090 @noindent
11091 of the following functions for working with @code{<stdio.h>} streams:
11092 @itemize @bullet
11093 @item The built-in functions @code{__builtin_fprintf},
11094 @code{__builtin_fprintf_unlocked}, @code{__builtin_fputc},
11095 @code{__builtin_fputc_unlocked}, @code{__builtin_fputs},
11096 @code{__builtin_fputs_unlocked}, @code{__builtin_fwrite},
11097 @code{__builtin_fwrite_unlocked}, @code{__builtin_printf},
11098 @code{__builtin_printf_unlocked}, @code{__builtin_putc},
11099 @code{__builtin_putchar}, @code{__builtin_putchar_unlocked},
11100 @code{__builtin_putc_unlocked}, @code{__builtin_puts},
11101 @code{__builtin_puts_unlocked}, @code{__builtin_vfprintf}, and
11102 @code{__builtin_vprintf}
11103 @item @code{fopen}
11104 @item @code{fclose}
11105 @item @code{ferror}
11106 @item @code{fgets}
11107 @item @code{fgets_unlocked}
11108 @item @code{fileno}
11109 @item @code{fread}
11110 @item @code{getc}
11111 @item @code{getchar}
11112 @item @code{fprintf}
11113 @item @code{printf}
11114 @item @code{fwrite}
11115 @end itemize
11117 @noindent
11118 and of the following functions:
11120 @itemize @bullet
11121 @item The built-in functions @code{__builtin_expect},
11122 @code{__builtin_expect_with_probability}, @code{__builtin_strchr},
11123 @code{__builtin_strcpy}, @code{__builtin_strcpy_chk},
11124 @code{__builtin_strlen}, @code{__builtin_va_copy}, and
11125 @code{__builtin_va_start}
11126 @item The GNU extensions @code{error} and @code{error_at_line}
11127 @item @code{getpass}
11128 @item @code{longjmp}
11129 @item @code{putenv}
11130 @item @code{setjmp}
11131 @item @code{siglongjmp}
11132 @item @code{signal}
11133 @item @code{sigsetjmp}
11134 @item @code{strcat}
11135 @item @code{strchr}
11136 @item @code{strlen}
11137 @end itemize
11139 In addition, various functions with an @code{__analyzer_} prefix have
11140 special meaning to the analyzer, described in the GCC Internals manual.
11142 Pertinent parameters for controlling the exploration are:
11143 @itemize @bullet
11144 @item @option{--param analyzer-bb-explosion-factor=@var{value}}
11145 @item @option{--param analyzer-max-enodes-per-program-point=@var{value}}
11146 @item @option{--param analyzer-max-recursion-depth=@var{value}}
11147 @item @option{--param analyzer-min-snodes-for-call-summary=@var{value}}
11148 @end itemize
11150 The following options control the analyzer.
11152 @table @gcctabopt
11154 @opindex fanalyzer-call-summaries
11155 @opindex fno-analyzer-call-summaries
11156 @item -fanalyzer-call-summaries
11157 Simplify interprocedural analysis by computing the effect of certain calls,
11158 rather than exploring all paths through the function from callsite to each
11159 possible return.
11161 If enabled, call summaries are only used for functions with more than one
11162 call site, and that are sufficiently complicated (as per
11163 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
11165 @opindex fanalyzer-checker
11166 @item -fanalyzer-checker=@var{name}
11167 Restrict the analyzer to run just the named checker, and enable it.
11169 Some checkers are disabled by default (even with @option{-fanalyzer}),
11170 such as the @code{taint} checker that implements
11171 @option{-Wanalyzer-tainted-array-index}, and this option is required
11172 to enable them.
11174 @emph{Note:} currently, @option{-fanalyzer-checker=taint} disables the
11175 following warnings from @option{-fanalyzer}:
11177 @gccoptlist{
11178 -Wanalyzer-deref-before-check
11179 -Wanalyzer-double-fclose
11180 -Wanalyzer-double-free
11181 -Wanalyzer-exposure-through-output-file
11182 -Wanalyzer-fd-access-mode-mismatch
11183 -Wanalyzer-fd-double-close
11184 -Wanalyzer-fd-leak
11185 -Wanalyzer-fd-use-after-close
11186 -Wanalyzer-fd-use-without-check
11187 -Wanalyzer-file-leak
11188 -Wanalyzer-free-of-non-heap
11189 -Wanalyzer-malloc-leak
11190 -Wanalyzer-mismatching-deallocation
11191 -Wanalyzer-null-argument
11192 -Wanalyzer-null-dereference
11193 -Wanalyzer-possible-null-argument
11194 -Wanalyzer-possible-null-dereference
11195 -Wanalyzer-unsafe-call-within-signal-handler
11196 -Wanalyzer-use-after-free
11197 -Wanalyzer-va-list-leak
11198 -Wanalyzer-va-list-use-after-va-end
11201 @opindex fanalyzer-debug-text-art
11202 @opindex fno-analyzer-debug-text-art
11203 @item -fanalyzer-debug-text-art-headings
11204 This option is intended for analyzer developers.  If enabled,
11205 the analyzer will add extra annotations to any diagrams it generates.
11207 @opindex fanalyzer-feasibility
11208 @opindex fno-analyzer-feasibility
11209 @item -fno-analyzer-feasibility
11210 This option is intended for analyzer developers.
11212 By default the analyzer verifies that there is a feasible control flow path
11213 for each diagnostic it emits: that the conditions that hold are not mutually
11214 exclusive.  Diagnostics for which no feasible path can be found are rejected.
11215 This filtering can be suppressed with @option{-fno-analyzer-feasibility}, for
11216 debugging issues in this code.
11218 @opindex fanalyzer-fine-grained
11219 @opindex fno-analyzer-fine-grained
11220 @item -fanalyzer-fine-grained
11221 This option is intended for analyzer developers.
11223 Internally the analyzer builds an ``exploded graph'' that combines
11224 control flow graphs with data flow information.
11226 By default, an edge in this graph can contain the effects of a run
11227 of multiple statements within a basic block.  With
11228 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
11230 @opindex fanalyzer-show-duplicate-count
11231 @opindex fno-analyzer-show-duplicate-count
11232 @item -fanalyzer-show-duplicate-count
11233 This option is intended for analyzer developers: if multiple diagnostics
11234 have been detected as being duplicates of each other, it emits a note when
11235 reporting the best diagnostic, giving the number of additional diagnostics
11236 that were suppressed by the deduplication logic.
11238 @opindex fanalyzer-show-events-in-system-headers
11239 @opindex fno-analyzer-show-events-in-system-headers
11240 @item -fanalyzer-show-events-in-system-headers
11241 By default the analyzer emits simplified diagnostics paths by hiding
11242 events fully located within a system header.
11243 With @option{-fanalyzer-show-events-in-system-headers} such
11244 events are no longer suppressed.
11246 @opindex fanalyzer-state-merge
11247 @opindex fno-analyzer-state-merge
11248 @item -fno-analyzer-state-merge
11249 This option is intended for analyzer developers.
11251 By default the analyzer attempts to simplify analysis by merging
11252 sufficiently similar states at each program point as it builds its
11253 ``exploded graph''.  With @option{-fno-analyzer-state-merge} this
11254 merging can be suppressed, for debugging state-handling issues.
11256 @opindex fanalyzer-state-purge
11257 @opindex fno-analyzer-state-purge
11258 @item -fno-analyzer-state-purge
11259 This option is intended for analyzer developers.
11261 By default the analyzer attempts to simplify analysis by purging
11262 aspects of state at a program point that appear to no longer be relevant
11263 e.g. the values of locals that aren't accessed later in the function
11264 and which aren't relevant to leak analysis.
11266 With @option{-fno-analyzer-state-purge} this purging of state can
11267 be suppressed, for debugging state-handling issues.
11269 @opindex fanalyzer-suppress-followups
11270 @opindex fno-analyzer-suppress-followups
11271 @item -fno-analyzer-suppress-followups
11272 This option is intended for analyzer developers.
11274 By default the analyzer will stop exploring an execution path after
11275 encountering certain diagnostics, in order to avoid potentially issuing a
11276 cascade of follow-up diagnostics.
11278 The diagnostics that terminate analysis along a path are:
11280 @itemize
11281 @item @option{-Wanalyzer-null-argument}
11282 @item @option{-Wanalyzer-null-dereference}
11283 @item @option{-Wanalyzer-use-after-free}
11284 @item @option{-Wanalyzer-use-of-pointer-in-stale-stack-frame}
11285 @item @option{-Wanalyzer-use-of-uninitialized-value}
11286 @end itemize
11288 With @option{-fno-analyzer-suppress-followups} the analyzer will
11289 continue to explore such paths even after such diagnostics, which may
11290 be helpful for debugging issues in the analyzer, or for microbenchmarks
11291 for detecting undefined behavior.
11293 @opindex fanalyzer-transitivity
11294 @opindex fno-analyzer-transitivity
11295 @item -fanalyzer-transitivity
11296 This option enables transitivity of constraints within the analyzer.
11298 @opindex fanalyzer-undo-inlining
11299 @opindex fno-analyzer-undo-inlining
11300 @item -fno-analyzer-undo-inlining
11301 This option is intended for analyzer developers.
11303 @option{-fanalyzer} runs relatively late compared to other code analysis
11304 tools, and some optimizations have already been applied to the code.  In
11305 particular function inlining may have occurred, leading to the
11306 interprocedural execution paths emitted by the analyzer containing
11307 function frames that don't correspond to those in the original source
11308 code.
11310 By default the analyzer attempts to reconstruct the original function
11311 frames, and to emit events showing the inlined calls.
11313 With @option{-fno-analyzer-undo-inlining} this attempt to reconstruct
11314 the original frame information can be be disabled, which may be of help
11315 when debugging issues in the analyzer.
11317 @item -fanalyzer-verbose-edges
11318 This option is intended for analyzer developers.  It enables more
11319 verbose, lower-level detail in the descriptions of control flow
11320 within diagnostic paths.
11322 @item -fanalyzer-verbose-state-changes
11323 This option is intended for analyzer developers.  It enables more
11324 verbose, lower-level detail in the descriptions of events relating
11325 to state machines within diagnostic paths.
11327 @item -fanalyzer-verbosity=@var{level}
11328 This option controls the complexity of the control flow paths that are
11329 emitted for analyzer diagnostics.
11331 The @var{level} can be one of:
11333 @table @samp
11334 @item 0
11335 At this level, interprocedural call and return events are displayed,
11336 along with the most pertinent state-change events relating to
11337 a diagnostic.  For example, for a double-@code{free} diagnostic,
11338 both calls to @code{free} will be shown.
11340 @item 1
11341 As per the previous level, but also show events for the entry
11342 to each function.
11344 @item 2
11345 As per the previous level, but also show events relating to
11346 control flow that are significant to triggering the issue
11347 (e.g. ``true path taken'' at a conditional).
11349 This level is the default.
11351 @item 3
11352 As per the previous level, but show all control flow events, not
11353 just significant ones.
11355 @item 4
11356 This level is intended for analyzer developers; it adds various
11357 other events intended for debugging the analyzer.
11359 @end table
11361 @opindex fdump-analyzer
11362 @item -fdump-analyzer
11363 Dump internal details about what the analyzer is doing to
11364 @file{@var{file}.analyzer.txt}.
11365 @option{-fdump-analyzer-stderr} overrides this option.
11367 @opindex fdump-analyzer-stderr
11368 @item -fdump-analyzer-stderr
11369 Dump internal details about what the analyzer is doing to stderr.
11370 This option overrides @option{-fdump-analyzer}.
11372 @opindex fdump-analyzer-callgraph
11373 @item -fdump-analyzer-callgraph
11374 Dump a representation of the call graph suitable for viewing with
11375 GraphViz to @file{@var{file}.callgraph.dot}.
11377 @opindex fdump-analyzer-exploded-graph
11378 @item -fdump-analyzer-exploded-graph
11379 Dump a representation of the ``exploded graph'' suitable for viewing with
11380 GraphViz to @file{@var{file}.eg.dot}.
11381 Nodes are color-coded based on state-machine states to emphasize
11382 state changes.
11384 @opindex dump-analyzer-exploded-nodes
11385 @item -fdump-analyzer-exploded-nodes
11386 Emit diagnostics showing where nodes in the ``exploded graph'' are
11387 in relation to the program source.
11389 @opindex dump-analyzer-exploded-nodes-2
11390 @item -fdump-analyzer-exploded-nodes-2
11391 Dump a textual representation of the ``exploded graph'' to
11392 @file{@var{file}.eg.txt}.
11394 @opindex dump-analyzer-exploded-nodes-3
11395 @item -fdump-analyzer-exploded-nodes-3
11396 Dump a textual representation of the ``exploded graph'' to
11397 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
11398 This is typically a large number of dump files.
11400 @opindex fdump-analyzer-exploded-paths
11401 @item -fdump-analyzer-exploded-paths
11402 Dump a textual representation of the ``exploded path'' for each
11403 diagnostic to @file{@var{file}.@var{idx}.@var{kind}.epath.txt}.
11405 @opindex dump-analyzer-feasibility
11406 @item -fdump-analyzer-feasibility
11407 Dump internal details about the analyzer's search for feasible paths.
11408 The details are written in a form suitable for viewing with GraphViz
11409 to filenames of the form @file{@var{file}.*.fg.dot},
11410 @file{@var{file}.*.tg.dot}, and @file{@var{file}.*.fpath.txt}.
11412 @opindex fdump-analyzer-json
11413 @item -fdump-analyzer-json
11414 Dump a compressed JSON representation of analyzer internals to
11415 @file{@var{file}.analyzer.json.gz}.  The precise format is subject
11416 to change.
11418 @opindex fdump-analyzer-state-purge
11419 @item -fdump-analyzer-state-purge
11420 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
11421 ``supergraph'' suitable for viewing with GraphViz, but annotate the
11422 graph with information on what state will be purged at each node.
11423 The graph is written to @file{@var{file}.state-purge.dot}.
11425 @opindex fdump-analyzer-supergraph
11426 @item -fdump-analyzer-supergraph
11427 Dump representations of the ``supergraph'' suitable for viewing with
11428 GraphViz to @file{@var{file}.supergraph.dot} and to
11429 @file{@var{file}.supergraph-eg.dot}.  These show all of the
11430 control flow graphs in the program, with interprocedural edges for
11431 calls and returns.  The second dump contains annotations showing nodes
11432 in the ``exploded graph'' and diagnostics associated with them.
11434 @opindex fdump-analyzer-untracked
11435 @item -fdump-analyzer-untracked
11436 Emit custom warnings with internal details intended for analyzer developers.
11438 @end table
11440 @node Debugging Options
11441 @section Options for Debugging Your Program
11442 @cindex options, debugging
11443 @cindex debugging information options
11445 To tell GCC to emit extra information for use by a debugger, in almost 
11446 all cases you need only to add @option{-g} to your other options.  Some debug
11447 formats can co-exist (like DWARF with CTF) when each of them is enabled
11448 explicitly by adding the respective command line option to your other options.
11450 GCC allows you to use @option{-g} with
11451 @option{-O}.  The shortcuts taken by optimized code may occasionally
11452 be surprising: some variables you declared may not exist
11453 at all; flow of control may briefly move where you did not expect it;
11454 some statements may not be executed because they compute constant
11455 results or their values are already at hand; some statements may
11456 execute in different places because they have been moved out of loops.
11457 Nevertheless it is possible to debug optimized output.  This makes
11458 it reasonable to use the optimizer for programs that might have bugs.
11460 If you are not using some other optimization option, consider
11461 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.  
11462 With no @option{-O} option at all, some compiler passes that collect
11463 information useful for debugging do not run at all, so that
11464 @option{-Og} may result in a better debugging experience.
11466 @table @gcctabopt
11467 @opindex g
11468 @item -g
11469 Produce debugging information in the operating system's native format
11470 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
11471 information.
11473 On most systems that use stabs format, @option{-g} enables use of extra
11474 debugging information that only GDB can use; this extra information
11475 makes debugging work better in GDB but probably makes other debuggers
11476 crash or refuse to read the program.  If you want to control for certain whether
11477 to generate the extra information, use @option{-gvms} (see below).
11479 @opindex ggdb
11480 @item -ggdb
11481 Produce debugging information for use by GDB@.  This means to use the
11482 most expressive format available (DWARF, stabs, or the native format
11483 if neither of those are supported), including GDB extensions if at all
11484 possible.
11486 @opindex gdwarf
11487 @item -gdwarf
11488 @itemx -gdwarf-@var{version}
11489 Produce debugging information in DWARF format (if that is supported).
11490 The value of @var{version} may be either 2, 3, 4 or 5; the default
11491 version for most targets is 5 (with the exception of VxWorks, TPF and
11492 Darwin / macOS, which default to version 2, and AIX, which defaults
11493 to version 4).
11495 Note that with DWARF Version 2, some ports require and always
11496 use some non-conflicting DWARF 3 extensions in the unwind tables.
11498 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
11499 for maximum benefit. Version 5 requires GDB 8.0 or higher.
11501 GCC no longer supports DWARF Version 1, which is substantially
11502 different than Version 2 and later.  For historical reasons, some
11503 other DWARF-related options such as
11504 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
11505 in their names, but apply to all currently-supported versions of DWARF.
11507 @opindex gbtf
11508 @item -gbtf
11509 Request BTF debug information.  BTF is the default debugging format for the
11510 eBPF target.  On other targets, like x86, BTF debug information can be
11511 generated along with DWARF debug information when both of the debug formats are
11512 enabled explicitly via their respective command line options.
11514 @opindex gctf
11515 @item -gctf
11516 @itemx -gctf@var{level}
11517 Request CTF debug information and use level to specify how much CTF debug
11518 information should be produced.  If @option{-gctf} is specified
11519 without a value for level, the default level of CTF debug information is 2.
11521 CTF debug information can be generated along with DWARF debug information when
11522 both of the debug formats are enabled explicitly via their respective command
11523 line options.
11525 Level 0 produces no CTF debug information at all.  Thus, @option{-gctf0}
11526 negates @option{-gctf}.
11528 Level 1 produces CTF information for tracebacks only.  This includes callsite
11529 information, but does not include type information.
11531 Level 2 produces type information for entities (functions, data objects etc.)
11532 at file-scope or global-scope only.
11534 @opindex gvms
11535 @item -gvms
11536 Produce debugging information in Alpha/VMS debug format (if that is
11537 supported).  This is the format used by DEBUG on Alpha/VMS systems.
11539 @item -gcodeview
11540 @opindex gcodeview
11541 Produce debugging information in CodeView debug format (if that is
11542 supported).  This is the format used by Microsoft Visual C++ on
11543 Windows.
11545 @item -g@var{level}
11546 @itemx -ggdb@var{level}
11547 @itemx -gvms@var{level}
11548 Request debugging information and also use @var{level} to specify how
11549 much information.  The default level is 2.
11551 Level 0 produces no debug information at all.  Thus, @option{-g0} negates
11552 @option{-g}.
11554 Level 1 produces minimal information, enough for making backtraces in
11555 parts of the program that you don't plan to debug.  This includes
11556 descriptions of functions and external variables, and line number
11557 tables, but no information about local variables.
11559 Level 3 includes extra information, such as all the macro definitions
11560 present in the program.  Some debuggers support macro expansion when
11561 you use @option{-g3}.
11563 If you use multiple @option{-g} options, with or without level numbers,
11564 the last such option is the one that is effective.
11566 @option{-gdwarf} does not accept a concatenated debug level, to avoid
11567 confusion with @option{-gdwarf-@var{level}}.
11568 Instead use an additional @option{-g@var{level}} option to change the
11569 debug level for DWARF.
11571 @opindex feliminate-unused-debug-symbols
11572 @opindex fno-eliminate-unused-debug-symbols
11573 @item -fno-eliminate-unused-debug-symbols
11574 By default, no debug information is produced for symbols that are not actually
11575 used. Use this option if you want debug information for all symbols.
11577 @opindex femit-class-debug-always
11578 @item -femit-class-debug-always
11579 Instead of emitting debugging information for a C++ class in only one
11580 object file, emit it in all object files using the class.  This option
11581 should be used only with debuggers that are unable to handle the way GCC
11582 normally emits debugging information for classes because using this
11583 option increases the size of debugging information by as much as a
11584 factor of two.
11586 @opindex fmerge-debug-strings
11587 @opindex fno-merge-debug-strings
11588 @item -fno-merge-debug-strings
11589 Direct the linker to not merge together strings in the debugging
11590 information that are identical in different object files.  Merging is
11591 not supported by all assemblers or linkers.  Merging decreases the size
11592 of the debug information in the output file at the cost of increasing
11593 link processing time.  Merging is enabled by default.
11595 @opindex fdebug-prefix-map
11596 @item -fdebug-prefix-map=@var{old}=@var{new}
11597 When compiling files residing in directory @file{@var{old}}, record
11598 debugging information describing them as if the files resided in
11599 directory @file{@var{new}} instead.  This can be used to replace a
11600 build-time path with an install-time path in the debug info.  It can
11601 also be used to change an absolute path to a relative path by using
11602 @file{.} for @var{new}.  This can give more reproducible builds, which
11603 are location independent, but may require an extra command to tell GDB
11604 where to find the source files. See also @option{-ffile-prefix-map}
11605 and @option{-fcanon-prefix-map}.
11607 @opindex fvar-tracking
11608 @item -fvar-tracking
11609 Run variable tracking pass.  It computes where variables are stored at each
11610 position in code.  Better debugging information is then generated
11611 (if the debugging information format supports this information).
11613 It is enabled by default when compiling with optimization (@option{-Os},
11614 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
11615 the debug info format supports it.
11617 @opindex fvar-tracking-assignments
11618 @opindex fno-var-tracking-assignments
11619 @item -fvar-tracking-assignments
11620 Annotate assignments to user variables early in the compilation and
11621 attempt to carry the annotations over throughout the compilation all the
11622 way to the end, in an attempt to improve debug information while
11623 optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
11625 It can be enabled even if var-tracking is disabled, in which case
11626 annotations are created and maintained, but discarded at the end.
11627 By default, this flag is enabled together with @option{-fvar-tracking},
11628 except when selective scheduling is enabled.
11630 @opindex gsplit-dwarf
11631 @item -gsplit-dwarf
11632 If DWARF debugging information is enabled, separate as much debugging
11633 information as possible into a separate output file with the extension
11634 @file{.dwo}.  This option allows the build system to avoid linking files with
11635 debug information.  To be useful, this option requires a debugger capable of
11636 reading @file{.dwo} files.
11638 @opindex gdwarf32
11639 @opindex gdwarf64
11640 @item -gdwarf32
11641 @itemx -gdwarf64
11642 If DWARF debugging information is enabled, the @option{-gdwarf32} selects
11643 the 32-bit DWARF format and the @option{-gdwarf64} selects the 64-bit
11644 DWARF format.  The default is target specific, on most targets it is
11645 @option{-gdwarf32} though.  The 32-bit DWARF format is smaller, but
11646 can't support more than 2GiB of debug information in any of the DWARF
11647 debug information sections.  The 64-bit DWARF format allows larger debug
11648 information and might not be well supported by all consumers yet.
11650 @opindex gdescribe-dies
11651 @item -gdescribe-dies
11652 Add description attributes to some DWARF DIEs that have no name attribute,
11653 such as artificial variables, external references and call site
11654 parameter DIEs.
11656 @opindex gpubnames
11657 @item -gpubnames
11658 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
11660 @opindex ggnu-pubnames
11661 @item -ggnu-pubnames
11662 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
11663 suitable for conversion into a GDB@ index.  This option is only useful
11664 with a linker that can produce GDB@ index version 7.
11666 @opindex fdebug-types-section
11667 @opindex fno-debug-types-section
11668 @item -fdebug-types-section
11669 When using DWARF Version 4 or higher, type DIEs can be put into
11670 their own @code{.debug_types} section instead of making them part of the
11671 @code{.debug_info} section.  It is more efficient to put them in a separate
11672 comdat section since the linker can then remove duplicates.
11673 But not all DWARF consumers support @code{.debug_types} sections yet
11674 and on some objects @code{.debug_types} produces larger instead of smaller
11675 debugging information.
11677 @opindex grecord-gcc-switches
11678 @opindex gno-record-gcc-switches
11679 @item -grecord-gcc-switches
11680 @itemx -gno-record-gcc-switches
11681 This switch causes the command-line options used to invoke the
11682 compiler that may affect code generation to be appended to the
11683 DW_AT_producer attribute in DWARF debugging information.  The options
11684 are concatenated with spaces separating them from each other and from
11685 the compiler version.  
11686 It is enabled by default.
11687 See also @option{-frecord-gcc-switches} for another
11688 way of storing compiler options into the object file.  
11690 @opindex gstrict-dwarf
11691 @item -gstrict-dwarf
11692 Disallow using extensions of later DWARF standard version than selected
11693 with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
11694 DWARF extensions from later standard versions is allowed.
11696 @opindex gno-strict-dwarf
11697 @item -gno-strict-dwarf
11698 Allow using extensions of later DWARF standard version than selected with
11699 @option{-gdwarf-@var{version}}.
11701 @opindex gas-loc-support
11702 @item -gas-loc-support
11703 Inform the compiler that the assembler supports @code{.loc} directives.
11704 It may then use them for the assembler to generate DWARF2+ line number
11705 tables.
11707 This is generally desirable, because assembler-generated line-number
11708 tables are a lot more compact than those the compiler can generate
11709 itself.
11711 This option will be enabled by default if, at GCC configure time, the
11712 assembler was found to support such directives.
11714 @opindex gno-as-loc-support
11715 @item -gno-as-loc-support
11716 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
11717 line number tables are to be generated.
11719 @opindex gas-locview-support
11720 @item -gas-locview-support
11721 Inform the compiler that the assembler supports @code{view} assignment
11722 and reset assertion checking in @code{.loc} directives.
11724 This option will be enabled by default if, at GCC configure time, the
11725 assembler was found to support them.
11727 @item -gno-as-locview-support
11728 Force GCC to assign view numbers internally, if
11729 @option{-gvariable-location-views} are explicitly requested.
11731 @opindex gcolumn-info
11732 @opindex gno-column-info
11733 @item -gcolumn-info
11734 @itemx -gno-column-info
11735 Emit location column information into DWARF debugging information, rather
11736 than just file and line.
11737 This option is enabled by default.
11739 @opindex gstatement-frontiers
11740 @opindex gno-statement-frontiers
11741 @item -gstatement-frontiers
11742 @itemx -gno-statement-frontiers
11743 This option causes GCC to create markers in the internal representation
11744 at the beginning of statements, and to keep them roughly in place
11745 throughout compilation, using them to guide the output of @code{is_stmt}
11746 markers in the line number table.  This is enabled by default when
11747 compiling with optimization (@option{-Os}, @option{-O1}, @option{-O2},
11748 @dots{}), and outputting DWARF 2 debug information at the normal level.
11750 @opindex gvariable-location-views
11751 @opindex gvariable-location-views=incompat5
11752 @opindex gno-variable-location-views
11753 @item -gvariable-location-views
11754 @itemx -gvariable-location-views=incompat5
11755 @itemx -gno-variable-location-views
11756 Augment variable location lists with progressive view numbers implied
11757 from the line number table.  This enables debug information consumers to
11758 inspect state at certain points of the program, even if no instructions
11759 associated with the corresponding source locations are present at that
11760 point.  If the assembler lacks support for view numbers in line number
11761 tables, this will cause the compiler to emit the line number table,
11762 which generally makes them somewhat less compact.  The augmented line
11763 number tables and location lists are fully backward-compatible, so they
11764 can be consumed by debug information consumers that are not aware of
11765 these augmentations, but they won't derive any benefit from them either.
11767 This is enabled by default when outputting DWARF 2 debug information at
11768 the normal level, as long as there is assembler support,
11769 @option{-fvar-tracking-assignments} is enabled and
11770 @option{-gstrict-dwarf} is not.  When assembler support is not
11771 available, this may still be enabled, but it will force GCC to output
11772 internal line number tables, and if
11773 @option{-ginternal-reset-location-views} is not enabled, that will most
11774 certainly lead to silently mismatching location views.
11776 There is a proposed representation for view numbers that is not backward
11777 compatible with the location list format introduced in DWARF 5, that can
11778 be enabled with @option{-gvariable-location-views=incompat5}.  This
11779 option may be removed in the future, is only provided as a reference
11780 implementation of the proposed representation.  Debug information
11781 consumers are not expected to support this extended format, and they
11782 would be rendered unable to decode location lists using it.
11784 @opindex ginternal-reset-location-views
11785 @opindex gno-internal-reset-location-views
11786 @item -ginternal-reset-location-views
11787 @itemx -gno-internal-reset-location-views
11788 Attempt to determine location views that can be omitted from location
11789 view lists.  This requires the compiler to have very accurate insn
11790 length estimates, which isn't always the case, and it may cause
11791 incorrect view lists to be generated silently when using an assembler
11792 that does not support location view lists.  The GNU assembler will flag
11793 any such error as a @code{view number mismatch}.  This is only enabled
11794 on ports that define a reliable estimation function.
11796 @opindex ginline-points
11797 @opindex gno-inline-points
11798 @item -ginline-points
11799 @itemx -gno-inline-points
11800 Generate extended debug information for inlined functions.  Location
11801 view tracking markers are inserted at inlined entry points, so that
11802 address and view numbers can be computed and output in debug
11803 information.  This can be enabled independently of location views, in
11804 which case the view numbers won't be output, but it can only be enabled
11805 along with statement frontiers, and it is only enabled by default if
11806 location views are enabled.
11808 @opindex gz
11809 @item -gz@r{[}=@var{type}@r{]}
11810 Produce compressed debug sections in DWARF format, if that is supported.
11811 If @var{type} is not given, the default type depends on the capabilities
11812 of the assembler and linker used.  @var{type} may be one of
11813 @samp{none} (don't compress debug sections), or @samp{zlib} (use zlib
11814 compression in ELF gABI format).  If the linker doesn't support writing
11815 compressed debug sections, the option is rejected.  Otherwise, if the
11816 assembler does not support them, @option{-gz} is silently ignored when
11817 producing object files.
11819 @opindex femit-struct-debug-baseonly
11820 @item -femit-struct-debug-baseonly
11821 Emit debug information for struct-like types
11822 only when the base name of the compilation source file
11823 matches the base name of file in which the struct is defined.
11825 This option substantially reduces the size of debugging information,
11826 but at significant potential loss in type information to the debugger.
11827 See @option{-femit-struct-debug-reduced} for a less aggressive option.
11828 See @option{-femit-struct-debug-detailed} for more detailed control.
11830 This option works only with DWARF debug output.
11832 @opindex femit-struct-debug-reduced
11833 @item -femit-struct-debug-reduced
11834 Emit debug information for struct-like types
11835 only when the base name of the compilation source file
11836 matches the base name of file in which the type is defined,
11837 unless the struct is a template or defined in a system header.
11839 This option significantly reduces the size of debugging information,
11840 with some potential loss in type information to the debugger.
11841 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
11842 See @option{-femit-struct-debug-detailed} for more detailed control.
11844 This option works only with DWARF debug output.
11846 @opindex femit-struct-debug-detailed
11847 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
11848 Specify the struct-like types
11849 for which the compiler generates debug information.
11850 The intent is to reduce duplicate struct debug information
11851 between different object files within the same program.
11853 This option is a detailed version of
11854 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
11855 which serves for most needs.
11857 A specification has the syntax@*
11858 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
11860 The optional first word limits the specification to
11861 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
11862 A struct type is used directly when it is the type of a variable, member.
11863 Indirect uses arise through pointers to structs.
11864 That is, when use of an incomplete struct is valid, the use is indirect.
11865 An example is
11866 @samp{struct one direct; struct two * indirect;}.
11868 The optional second word limits the specification to
11869 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
11870 Generic structs are a bit complicated to explain.
11871 For C++, these are non-explicit specializations of template classes,
11872 or non-template classes within the above.
11873 Other programming languages have generics,
11874 but @option{-femit-struct-debug-detailed} does not yet implement them.
11876 The third word specifies the source files for those
11877 structs for which the compiler should emit debug information.
11878 The values @samp{none} and @samp{any} have the normal meaning.
11879 The value @samp{base} means that
11880 the base of name of the file in which the type declaration appears
11881 must match the base of the name of the main compilation file.
11882 In practice, this means that when compiling @file{foo.c}, debug information
11883 is generated for types declared in that file and @file{foo.h},
11884 but not other header files.
11885 The value @samp{sys} means those types satisfying @samp{base}
11886 or declared in system or compiler headers.
11888 You may need to experiment to determine the best settings for your application.
11890 The default is @option{-femit-struct-debug-detailed=all}.
11892 This option works only with DWARF debug output.
11894 @opindex fdwarf2-cfi-asm
11895 @opindex fno-dwarf2-cfi-asm
11896 @item -fno-dwarf2-cfi-asm
11897 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
11898 instead of using GAS @code{.cfi_*} directives.
11900 @opindex feliminate-unused-debug-types
11901 @opindex fno-eliminate-unused-debug-types
11902 @item -fno-eliminate-unused-debug-types
11903 Normally, when producing DWARF output, GCC avoids producing debug symbol 
11904 output for types that are nowhere used in the source file being compiled.
11905 Sometimes it is useful to have GCC emit debugging
11906 information for all types declared in a compilation
11907 unit, regardless of whether or not they are actually used
11908 in that compilation unit, for example 
11909 if, in the debugger, you want to cast a value to a type that is
11910 not actually used in your program (but is declared).  More often,
11911 however, this results in a significant amount of wasted space.
11912 @end table
11914 @node Optimize Options
11915 @section Options That Control Optimization
11916 @cindex optimize options
11917 @cindex options, optimization
11919 These options control various sorts of optimizations.
11921 Without any optimization option, the compiler's goal is to reduce the
11922 cost of compilation and to make debugging produce the expected
11923 results.  Statements are independent: if you stop the program with a
11924 breakpoint between statements, you can then assign a new value to any
11925 variable or change the program counter to any other statement in the
11926 function and get exactly the results you expect from the source
11927 code.
11929 Turning on optimization flags makes the compiler attempt to improve
11930 the performance and/or code size at the expense of compilation time
11931 and possibly the ability to debug the program.
11933 The compiler performs optimization based on the knowledge it has of the
11934 program.  Compiling multiple files at once to a single output file mode allows
11935 the compiler to use information gained from all of the files when compiling
11936 each of them.
11938 Not all optimizations are controlled directly by a flag.  Only
11939 optimizations that have a flag are listed in this section.
11941 Most optimizations are completely disabled at @option{-O0} or if an
11942 @option{-O} level is not set on the command line, even if individual
11943 optimization flags are specified.  Similarly, @option{-Og} suppresses
11944 many optimization passes.
11946 Depending on the target and how GCC was configured, a slightly different
11947 set of optimizations may be enabled at each @option{-O} level than
11948 those listed here.  You can invoke GCC with @option{-Q --help=optimizers}
11949 to find out the exact set of optimizations that are enabled at each level.
11950 @xref{Overall Options}, for examples.
11952 @table @gcctabopt
11953 @opindex O
11954 @opindex O1
11955 @item -O
11956 @itemx -O1
11957 Optimize.  Optimizing compilation takes somewhat more time, and a lot
11958 more memory for a large function.
11960 With @option{-O}, the compiler tries to reduce code size and execution
11961 time, without performing any optimizations that take a great deal of
11962 compilation time.
11964 @c Note that in addition to the default_options_table list in opts.cc,
11965 @c several optimization flags default to true but control optimization
11966 @c passes that are explicitly disabled at -O0.
11968 @option{-O} turns on the following optimization flags:
11970 @c Please keep the following list alphabetized.
11971 @gccoptlist{-fauto-inc-dec
11972 -fbranch-count-reg
11973 -fcombine-stack-adjustments
11974 -fcompare-elim
11975 -fcprop-registers
11976 -fdce
11977 -fdefer-pop
11978 -fdelayed-branch
11979 -fdse
11980 -fforward-propagate
11981 -fguess-branch-probability
11982 -fif-conversion
11983 -fif-conversion2
11984 -finline-functions-called-once
11985 -fipa-modref
11986 -fipa-profile
11987 -fipa-pure-const
11988 -fipa-reference
11989 -fipa-reference-addressable
11990 -fmerge-constants
11991 -fmove-loop-invariants
11992 -fmove-loop-stores
11993 -fomit-frame-pointer
11994 -freorder-blocks
11995 -fshrink-wrap
11996 -fshrink-wrap-separate
11997 -fsplit-wide-types
11998 -fssa-backprop
11999 -fssa-phiopt
12000 -ftree-bit-ccp
12001 -ftree-ccp
12002 -ftree-ch
12003 -ftree-coalesce-vars
12004 -ftree-copy-prop
12005 -ftree-dce
12006 -ftree-dominator-opts
12007 -ftree-dse
12008 -ftree-forwprop
12009 -ftree-fre
12010 -ftree-phiprop
12011 -ftree-pta
12012 -ftree-scev-cprop
12013 -ftree-sink
12014 -ftree-slsr
12015 -ftree-sra
12016 -ftree-ter
12017 -funit-at-a-time}
12019 @opindex O2
12020 @item -O2
12021 Optimize even more.  GCC performs nearly all supported optimizations
12022 that do not involve a space-speed tradeoff.
12023 As compared to @option{-O}, this option increases both compilation time
12024 and the performance of the generated code.
12026 @option{-O2} turns on all optimization flags specified by @option{-O1}.  It
12027 also turns on the following optimization flags:
12029 @c Please keep the following list alphabetized!
12030 @gccoptlist{-falign-functions  -falign-jumps
12031 -falign-labels  -falign-loops
12032 -fcaller-saves
12033 -fcode-hoisting
12034 -fcrossjumping
12035 -fcse-follow-jumps  -fcse-skip-blocks
12036 -fdelete-null-pointer-checks
12037 -fdevirtualize  -fdevirtualize-speculatively
12038 -fexpensive-optimizations
12039 -ffinite-loops
12040 -fgcse  -fgcse-lm
12041 -fhoist-adjacent-loads
12042 -finline-functions
12043 -finline-small-functions
12044 -findirect-inlining
12045 -fipa-bit-cp  -fipa-cp  -fipa-icf
12046 -fipa-ra  -fipa-sra  -fipa-vrp
12047 -fisolate-erroneous-paths-dereference
12048 -flra-remat
12049 -foptimize-sibling-calls
12050 -foptimize-strlen
12051 -fpartial-inlining
12052 -fpeephole2
12053 -freorder-blocks-algorithm=stc
12054 -freorder-blocks-and-partition  -freorder-functions
12055 -frerun-cse-after-loop
12056 -fschedule-insns  -fschedule-insns2
12057 -fsched-interblock  -fsched-spec
12058 -fstore-merging
12059 -fstrict-aliasing
12060 -fthread-jumps
12061 -ftree-builtin-call-dce
12062 -ftree-loop-vectorize
12063 -ftree-pre
12064 -ftree-slp-vectorize
12065 -ftree-switch-conversion  -ftree-tail-merge
12066 -ftree-vrp
12067 -fvect-cost-model=very-cheap}
12069 Please note the warning under @option{-fgcse} about
12070 invoking @option{-O2} on programs that use computed gotos.
12072 @opindex O3
12073 @item -O3
12074 Optimize yet more.  @option{-O3} turns on all optimizations specified
12075 by @option{-O2} and also turns on the following optimization flags:
12077 @c Please keep the following list alphabetized!
12078 @gccoptlist{-fgcse-after-reload
12079 -fipa-cp-clone
12080 -floop-interchange
12081 -floop-unroll-and-jam
12082 -fpeel-loops
12083 -fpredictive-commoning
12084 -fsplit-loops
12085 -fsplit-paths
12086 -ftree-loop-distribution
12087 -ftree-partial-pre
12088 -funswitch-loops
12089 -fvect-cost-model=dynamic
12090 -fversion-loops-for-strides}
12092 @opindex O0
12093 @item -O0
12094 Reduce compilation time and make debugging produce the expected
12095 results.  This is the default.
12097 @opindex Os
12098 @item -Os
12099 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations 
12100 except those that often increase code size:
12102 @gccoptlist{-falign-functions  -falign-jumps
12103 -falign-labels  -falign-loops
12104 -fprefetch-loop-arrays  -freorder-blocks-algorithm=stc}
12106 It also enables @option{-finline-functions}, causes the compiler to tune for
12107 code size rather than execution speed, and performs further optimizations
12108 designed to reduce code size.
12110 @opindex Ofast
12111 @item -Ofast
12112 Disregard strict standards compliance.  @option{-Ofast} enables all
12113 @option{-O3} optimizations.  It also enables optimizations that are not
12114 valid for all standard-compliant programs.
12115 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
12116 and the Fortran-specific @option{-fstack-arrays}, unless
12117 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
12118 It turns off @option{-fsemantic-interposition}.
12120 @opindex Og
12121 @item -Og
12122 Optimize debugging experience.  @option{-Og} should be the optimization
12123 level of choice for the standard edit-compile-debug cycle, offering
12124 a reasonable level of optimization while maintaining fast compilation
12125 and a good debugging experience.  It is a better choice than @option{-O0}
12126 for producing debuggable code because some compiler passes
12127 that collect debug information are disabled at @option{-O0}.
12129 Like @option{-O0}, @option{-Og} completely disables a number of 
12130 optimization passes so that individual options controlling them have
12131 no effect.  Otherwise @option{-Og} enables all @option{-O1} 
12132 optimization flags except for those that may interfere with debugging:
12134 @gccoptlist{-fbranch-count-reg  -fdelayed-branch
12135 -fdse  -fif-conversion  -fif-conversion2
12136 -finline-functions-called-once
12137 -fmove-loop-invariants  -fmove-loop-stores  -fssa-phiopt
12138 -ftree-bit-ccp  -ftree-dse  -ftree-pta  -ftree-sra}
12140 @opindex Oz
12141 @item -Oz
12142 Optimize aggressively for size rather than speed.  This may increase
12143 the number of instructions executed if those instructions require
12144 fewer bytes to encode.  @option{-Oz} behaves similarly to @option{-Os}
12145 including enabling most @option{-O2} optimizations.
12147 @end table
12149 If you use multiple @option{-O} options, with or without level numbers,
12150 the last such option is the one that is effective.
12152 Options of the form @option{-f@var{flag}} specify machine-independent
12153 flags.  Most flags have both positive and negative forms; the negative
12154 form of @option{-ffoo} is @option{-fno-foo}.  In the table
12155 below, only one of the forms is listed---the one you typically 
12156 use.  You can figure out the other form by either removing @samp{no-}
12157 or adding it.
12159 The following options control specific optimizations.  They are either
12160 activated by @option{-O} options or are related to ones that are.  You
12161 can use the following flags in the rare cases when ``fine-tuning'' of
12162 optimizations to be performed is desired.
12164 @table @gcctabopt
12165 @opindex fno-defer-pop
12166 @opindex fdefer-pop
12167 @item -fno-defer-pop
12168 For machines that must pop arguments after a function call, always pop 
12169 the arguments as soon as each function returns.  
12170 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
12171 this allows the compiler to let arguments accumulate on the stack for several
12172 function calls and pop them all at once.
12174 @opindex fforward-propagate
12175 @item -fforward-propagate
12176 Perform a forward propagation pass on RTL@.  The pass tries to combine two
12177 instructions and checks if the result can be simplified.  If loop unrolling
12178 is active, two passes are performed and the second is scheduled after
12179 loop unrolling.
12181 This option is enabled by default at optimization levels @option{-O1},
12182 @option{-O2}, @option{-O3}, @option{-Os}.
12184 @opindex ffp-contract
12185 @item -ffp-contract=@var{style}
12186 @option{-ffp-contract=off} disables floating-point expression contraction.
12187 @option{-ffp-contract=fast} enables floating-point expression contraction
12188 such as forming of fused multiply-add operations if the target has
12189 native support for them.
12190 @option{-ffp-contract=on} enables floating-point expression contraction
12191 if allowed by the language standard.  This is implemented for C and C++,
12192 where it enables contraction within one expression, but not across
12193 different statements.
12195 The default is @option{-ffp-contract=off} for C in a standards compliant mode
12196 (@option{-std=c11} or similar), @option{-ffp-contract=fast} otherwise.
12198 @opindex fomit-frame-pointer
12199 @item -fomit-frame-pointer
12200 Omit the frame pointer in functions that don't need one.  This avoids the
12201 instructions to save, set up and restore the frame pointer; on many targets
12202 it also makes an extra register available.
12204 On some targets this flag has no effect because the standard calling sequence
12205 always uses a frame pointer, so it cannot be omitted.
12207 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
12208 is used in all functions.  Several targets always omit the frame pointer in
12209 leaf functions.
12211 Enabled by default at @option{-O1} and higher.
12213 @opindex foptimize-sibling-calls
12214 @item -foptimize-sibling-calls
12215 Optimize sibling and tail recursive calls.
12217 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12219 @opindex foptimize-strlen
12220 @item -foptimize-strlen
12221 Optimize various standard C string functions (e.g.@: @code{strlen},
12222 @code{strchr} or @code{strcpy}) and
12223 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
12225 Enabled at levels @option{-O2}, @option{-O3}.
12227 @opindex fno-inline
12228 @opindex finline
12229 @item -fno-inline
12230 Do not expand any functions inline apart from those marked with
12231 the @code{always_inline} attribute.  This is the default when not
12232 optimizing.
12234 Single functions can be exempted from inlining by marking them
12235 with the @code{noinline} attribute.
12237 @opindex finline-small-functions
12238 @item -finline-small-functions
12239 Integrate functions into their callers when their body is smaller than expected
12240 function call code (so overall size of program gets smaller).  The compiler
12241 heuristically decides which functions are simple enough to be worth integrating
12242 in this way.  This inlining applies to all functions, even those not declared
12243 inline.
12245 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12247 @opindex findirect-inlining
12248 @item -findirect-inlining
12249 Inline also indirect calls that are discovered to be known at compile
12250 time thanks to previous inlining.  This option has any effect only
12251 when inlining itself is turned on by the @option{-finline-functions}
12252 or @option{-finline-small-functions} options.
12254 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12256 @opindex finline-functions
12257 @item -finline-functions
12258 Consider all functions for inlining, even if they are not declared inline.
12259 The compiler heuristically decides which functions are worth integrating
12260 in this way.
12262 If all calls to a given function are integrated, and the function is
12263 declared @code{static}, then the function is normally not output as
12264 assembler code in its own right.
12266 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.  Also enabled
12267 by @option{-fprofile-use} and @option{-fauto-profile}.
12269 @opindex finline-functions-called-once
12270 @item -finline-functions-called-once
12271 Consider all @code{static} functions called once for inlining into their
12272 caller even if they are not marked @code{inline}.  If a call to a given
12273 function is integrated, then the function is not output as assembler code
12274 in its own right.
12276 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
12277 but not @option{-Og}.
12279 @opindex fearly-inlining
12280 @item -fearly-inlining
12281 Inline functions marked by @code{always_inline} and functions whose body seems
12282 smaller than the function call overhead early before doing
12283 @option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
12284 makes profiling significantly cheaper and usually inlining faster on programs
12285 having large chains of nested wrapper functions.
12287 Enabled by default.
12289 @opindex fipa-sra
12290 @item -fipa-sra
12291 Perform interprocedural scalar replacement of aggregates, removal of
12292 unused parameters and replacement of parameters passed by reference
12293 by parameters passed by value.
12295 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
12297 @opindex finline-limit
12298 @item -finline-limit=@var{n}
12299 By default, GCC limits the size of functions that can be inlined.  This flag
12300 allows coarse control of this limit.  @var{n} is the size of functions that
12301 can be inlined in number of pseudo instructions.
12303 Inlining is actually controlled by a number of parameters, which may be
12304 specified individually by using @option{--param @var{name}=@var{value}}.
12305 The @option{-finline-limit=@var{n}} option sets some of these parameters
12306 as follows:
12308 @table @gcctabopt
12309 @item max-inline-insns-single
12310 is set to @var{n}/2.
12311 @item max-inline-insns-auto
12312 is set to @var{n}/2.
12313 @end table
12315 See below for a documentation of the individual
12316 parameters controlling inlining and for the defaults of these parameters.
12318 @emph{Note:} there may be no value to @option{-finline-limit} that results
12319 in default behavior.
12321 @emph{Note:} pseudo instruction represents, in this particular context, an
12322 abstract measurement of function's size.  In no way does it represent a count
12323 of assembly instructions and as such its exact meaning might change from one
12324 release to an another.
12326 @opindex fno-keep-inline-dllexport
12327 @opindex fkeep-inline-dllexport
12328 @item -fno-keep-inline-dllexport
12329 This is a more fine-grained version of @option{-fkeep-inline-functions},
12330 which applies only to functions that are declared using the @code{dllexport}
12331 attribute or declspec.  @xref{Function Attributes,,Declaring Attributes of
12332 Functions}.
12334 @opindex fkeep-inline-functions
12335 @item -fkeep-inline-functions
12336 In C, emit @code{static} functions that are declared @code{inline}
12337 into the object file, even if the function has been inlined into all
12338 of its callers.  This switch does not affect functions using the
12339 @code{extern inline} extension in GNU C90@.  In C++, emit any and all
12340 inline functions into the object file.
12342 @opindex fkeep-static-functions
12343 @item -fkeep-static-functions
12344 Emit @code{static} functions into the object file, even if the function
12345 is never used.
12347 @opindex fkeep-static-consts
12348 @item -fkeep-static-consts
12349 Emit variables declared @code{static const} when optimization isn't turned
12350 on, even if the variables aren't referenced.
12352 GCC enables this option by default.  If you want to force the compiler to
12353 check if a variable is referenced, regardless of whether or not
12354 optimization is turned on, use the @option{-fno-keep-static-consts} option.
12356 @opindex fmerge-constants
12357 @item -fmerge-constants
12358 Attempt to merge identical constants (string constants and floating-point
12359 constants) across compilation units.
12361 This option is the default for optimized compilation if the assembler and
12362 linker support it.  Use @option{-fno-merge-constants} to inhibit this
12363 behavior.
12365 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12367 @opindex fmerge-all-constants
12368 @item -fmerge-all-constants
12369 Attempt to merge identical constants and identical variables.
12371 This option implies @option{-fmerge-constants}.  In addition to
12372 @option{-fmerge-constants} this considers e.g.@: even constant initialized
12373 arrays or initialized constant variables with integral or floating-point
12374 types.  Languages like C or C++ require each variable, including multiple
12375 instances of the same variable in recursive calls, to have distinct locations,
12376 so using this option results in non-conforming
12377 behavior.
12379 @opindex fmodulo-sched
12380 @item -fmodulo-sched
12381 Perform swing modulo scheduling immediately before the first scheduling
12382 pass.  This pass looks at innermost loops and reorders their
12383 instructions by overlapping different iterations.
12385 @opindex fmodulo-sched-allow-regmoves
12386 @item -fmodulo-sched-allow-regmoves
12387 Perform more aggressive SMS-based modulo scheduling with register moves
12388 allowed.  By setting this flag certain anti-dependences edges are
12389 deleted, which triggers the generation of reg-moves based on the
12390 life-range analysis.  This option is effective only with
12391 @option{-fmodulo-sched} enabled.
12393 @opindex fno-branch-count-reg
12394 @opindex fbranch-count-reg
12395 @item -fno-branch-count-reg
12396 Disable the optimization pass that scans for opportunities to use 
12397 ``decrement and branch'' instructions on a count register instead of
12398 instruction sequences that decrement a register, compare it against zero, and
12399 then branch based upon the result.  This option is only meaningful on
12400 architectures that support such instructions, which include x86, PowerPC,
12401 IA-64 and S/390.  Note that the @option{-fno-branch-count-reg} option
12402 doesn't remove the decrement and branch instructions from the generated
12403 instruction stream introduced by other optimization passes.
12405 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
12406 except for @option{-Og}.
12408 @opindex fno-function-cse
12409 @opindex ffunction-cse
12410 @item -fno-function-cse
12411 Do not put function addresses in registers; make each instruction that
12412 calls a constant function contain the function's address explicitly.
12414 This option results in less efficient code, but some strange hacks
12415 that alter the assembler output may be confused by the optimizations
12416 performed when this option is not used.
12418 The default is @option{-ffunction-cse}
12420 @opindex fno-zero-initialized-in-bss
12421 @opindex fzero-initialized-in-bss
12422 @item -fno-zero-initialized-in-bss
12423 If the target supports a BSS section, GCC by default puts variables that
12424 are initialized to zero into BSS@.  This can save space in the resulting
12425 code.
12427 This option turns off this behavior because some programs explicitly
12428 rely on variables going to the data section---e.g., so that the
12429 resulting executable can find the beginning of that section and/or make
12430 assumptions based on that.
12432 The default is @option{-fzero-initialized-in-bss}.
12434 @opindex fthread-jumps
12435 @item -fthread-jumps
12436 Perform optimizations that check to see if a jump branches to a
12437 location where another comparison subsumed by the first is found.  If
12438 so, the first branch is redirected to either the destination of the
12439 second branch or a point immediately following it, depending on whether
12440 the condition is known to be true or false.
12442 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
12444 @opindex fsplit-wide-types
12445 @item -fsplit-wide-types
12446 When using a type that occupies multiple registers, such as @code{long
12447 long} on a 32-bit system, split the registers apart and allocate them
12448 independently.  This normally generates better code for those types,
12449 but may make debugging more difficult.
12451 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3},
12452 @option{-Os}.
12454 @opindex fsplit-wide-types-early
12455 @item -fsplit-wide-types-early
12456 Fully split wide types early, instead of very late.
12457 This option has no effect unless @option{-fsplit-wide-types} is turned on.
12459 This is the default on some targets.
12461 @opindex fcse-follow-jumps
12462 @item -fcse-follow-jumps
12463 In common subexpression elimination (CSE), scan through jump instructions
12464 when the target of the jump is not reached by any other path.  For
12465 example, when CSE encounters an @code{if} statement with an
12466 @code{else} clause, CSE follows the jump when the condition
12467 tested is false.
12469 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12471 @opindex fcse-skip-blocks
12472 @item -fcse-skip-blocks
12473 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
12474 follow jumps that conditionally skip over blocks.  When CSE
12475 encounters a simple @code{if} statement with no else clause,
12476 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
12477 body of the @code{if}.
12479 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12481 @opindex frerun-cse-after-loop
12482 @item -frerun-cse-after-loop
12483 Re-run common subexpression elimination after loop optimizations are
12484 performed.
12486 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12488 @opindex fgcse
12489 @item -fgcse
12490 Perform a global common subexpression elimination pass.
12491 This pass also performs global constant and copy propagation.
12493 @emph{Note:} When compiling a program using computed gotos, a GCC
12494 extension, you may get better run-time performance if you disable
12495 the global common subexpression elimination pass by adding
12496 @option{-fno-gcse} to the command line.
12498 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12500 @opindex fgcse-lm
12501 @item -fgcse-lm
12502 When @option{-fgcse-lm} is enabled, global common subexpression elimination
12503 attempts to move loads that are only killed by stores into themselves.  This
12504 allows a loop containing a load/store sequence to be changed to a load outside
12505 the loop, and a copy/store within the loop.
12507 Enabled by default when @option{-fgcse} is enabled.
12509 @opindex fgcse-sm
12510 @item -fgcse-sm
12511 When @option{-fgcse-sm} is enabled, a store motion pass is run after
12512 global common subexpression elimination.  This pass attempts to move
12513 stores out of loops.  When used in conjunction with @option{-fgcse-lm},
12514 loops containing a load/store sequence can be changed to a load before
12515 the loop and a store after the loop.
12517 Not enabled at any optimization level.
12519 @opindex fgcse-las
12520 @item -fgcse-las
12521 When @option{-fgcse-las} is enabled, the global common subexpression
12522 elimination pass eliminates redundant loads that come after stores to the
12523 same memory location (both partial and full redundancies).
12525 Not enabled at any optimization level.
12527 @opindex fgcse-after-reload
12528 @item -fgcse-after-reload
12529 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
12530 pass is performed after reload.  The purpose of this pass is to clean up
12531 redundant spilling.
12533 Enabled by @option{-O3}, @option{-fprofile-use} and @option{-fauto-profile}.
12535 @opindex faggressive-loop-optimizations
12536 @item -faggressive-loop-optimizations
12537 This option tells the loop optimizer to use language constraints to
12538 derive bounds for the number of iterations of a loop.  This assumes that
12539 loop code does not invoke undefined behavior by for example causing signed
12540 integer overflows or out-of-bound array accesses.  The bounds for the
12541 number of iterations of a loop are used to guide loop unrolling and peeling
12542 and loop exit test optimizations.
12543 This option is enabled by default.
12545 @opindex funconstrained-commons
12546 @item -funconstrained-commons
12547 This option tells the compiler that variables declared in common blocks
12548 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
12549 prevents certain optimizations that depend on knowing the array bounds.
12551 @opindex fcrossjumping
12552 @item -fcrossjumping
12553 Perform cross-jumping transformation.
12554 This transformation unifies equivalent code and saves code size.  The
12555 resulting code may or may not perform better than without cross-jumping.
12557 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12559 @opindex fauto-inc-dec
12560 @item -fauto-inc-dec
12561 Combine increments or decrements of addresses with memory accesses.
12562 This pass is always skipped on architectures that do not have
12563 instructions to support this.  Enabled by default at @option{-O1} and
12564 higher on architectures that support this.
12566 @opindex fdce
12567 @item -fdce
12568 Perform dead code elimination (DCE) on RTL@.
12569 Enabled by default at @option{-O1} and higher.
12571 @opindex fdse
12572 @item -fdse
12573 Perform dead store elimination (DSE) on RTL@.
12574 Enabled by default at @option{-O1} and higher.
12576 @opindex fif-conversion
12577 @item -fif-conversion
12578 Attempt to transform conditional jumps into branch-less equivalents.  This
12579 includes use of conditional moves, min, max, set flags and abs instructions, and
12580 some tricks doable by standard arithmetics.  The use of conditional execution
12581 on chips where it is available is controlled by @option{-fif-conversion2}.
12583 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12584 not with @option{-Og}.
12586 @opindex fif-conversion2
12587 @item -fif-conversion2
12588 Use conditional execution (where available) to transform conditional jumps into
12589 branch-less equivalents.
12591 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}, but
12592 not with @option{-Og}.
12594 @opindex fdeclone-ctor-dtor
12595 @item -fdeclone-ctor-dtor
12596 The C++ ABI requires multiple entry points for constructors and
12597 destructors: one for a base subobject, one for a complete object, and
12598 one for a virtual destructor that calls operator delete afterwards.
12599 For a hierarchy with virtual bases, the base and complete variants are
12600 clones, which means two copies of the function.  With this option, the
12601 base and complete variants are changed to be thunks that call a common
12602 implementation.
12604 Enabled by @option{-Os}.
12606 @opindex fdelete-null-pointer-checks
12607 @item -fdelete-null-pointer-checks
12608 Assume that programs cannot safely dereference null pointers, and that
12609 no code or data element resides at address zero.
12610 This option enables simple constant
12611 folding optimizations at all optimization levels.  In addition, other
12612 optimization passes in GCC use this flag to control global dataflow
12613 analyses that eliminate useless checks for null pointers; these assume
12614 that a memory access to address zero always results in a trap, so
12615 that if a pointer is checked after it has already been dereferenced,
12616 it cannot be null.
12618 Note however that in some environments this assumption is not true.
12619 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
12620 for programs that depend on that behavior.
12622 This option is enabled by default on most targets.  On Nios II ELF, it
12623 defaults to off.  On AVR and MSP430, this option is completely disabled.
12625 Passes that use the dataflow information
12626 are enabled independently at different optimization levels.
12628 @opindex fdevirtualize
12629 @item -fdevirtualize
12630 Attempt to convert calls to virtual functions to direct calls.  This
12631 is done both within a procedure and interprocedurally as part of
12632 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
12633 propagation (@option{-fipa-cp}).
12634 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12636 @opindex fdevirtualize-speculatively
12637 @item -fdevirtualize-speculatively
12638 Attempt to convert calls to virtual functions to speculative direct calls.
12639 Based on the analysis of the type inheritance graph, determine for a given call
12640 the set of likely targets. If the set is small, preferably of size 1, change
12641 the call into a conditional deciding between direct and indirect calls.  The
12642 speculative calls enable more optimizations, such as inlining.  When they seem
12643 useless after further optimization, they are converted back into original form.
12645 @opindex fdevirtualize-at-ltrans
12646 @item -fdevirtualize-at-ltrans
12647 Stream extra information needed for aggressive devirtualization when running
12648 the link-time optimizer in local transformation mode.  
12649 This option enables more devirtualization but
12650 significantly increases the size of streamed data. For this reason it is
12651 disabled by default.
12653 @opindex fexpensive-optimizations
12654 @item -fexpensive-optimizations
12655 Perform a number of minor optimizations that are relatively expensive.
12657 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12659 @opindex free
12660 @item -free
12661 Attempt to remove redundant extension instructions.  This is especially
12662 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
12663 registers after writing to their lower 32-bit half.
12665 Enabled for Alpha, AArch64, LoongArch, PowerPC, RISC-V, SPARC, h83000 and x86 at
12666 levels @option{-O2}, @option{-O3}, @option{-Os}.
12668 @opindex fno-lifetime-dse
12669 @opindex flifetime-dse
12670 @item -fno-lifetime-dse
12671 In C++ the value of an object is only affected by changes within its
12672 lifetime: when the constructor begins, the object has an indeterminate
12673 value, and any changes during the lifetime of the object are dead when
12674 the object is destroyed.  Normally dead store elimination will take
12675 advantage of this; if your code relies on the value of the object
12676 storage persisting beyond the lifetime of the object, you can use this
12677 flag to disable this optimization.  To preserve stores before the
12678 constructor starts (e.g.@: because your operator new clears the object
12679 storage) but still treat the object as dead after the destructor, you
12680 can use @option{-flifetime-dse=1}.  The default behavior can be
12681 explicitly selected with @option{-flifetime-dse=2}.
12682 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
12684 @opindex flive-range-shrinkage
12685 @item -flive-range-shrinkage
12686 Attempt to decrease register pressure through register live range
12687 shrinkage.  This is helpful for fast processors with small or moderate
12688 size register sets.
12690 @opindex fira-algorithm
12691 @item -fira-algorithm=@var{algorithm}
12692 Use the specified coloring algorithm for the integrated register
12693 allocator.  The @var{algorithm} argument can be @samp{priority}, which
12694 specifies Chow's priority coloring, or @samp{CB}, which specifies
12695 Chaitin-Briggs coloring.  Chaitin-Briggs coloring is not implemented
12696 for all architectures, but for those targets that do support it, it is
12697 the default because it generates better code.
12699 @opindex fira-region
12700 @item -fira-region=@var{region}
12701 Use specified regions for the integrated register allocator.  The
12702 @var{region} argument should be one of the following:
12704 @table @samp
12706 @item all
12707 Use all loops as register allocation regions.
12708 This can give the best results for machines with a small and/or
12709 irregular register set.
12711 @item mixed
12712 Use all loops except for loops with small register pressure 
12713 as the regions.  This value usually gives
12714 the best results in most cases and for most architectures,
12715 and is enabled by default when compiling with optimization for speed
12716 (@option{-O}, @option{-O2}, @dots{}).
12718 @item one
12719 Use all functions as a single region.  
12720 This typically results in the smallest code size, and is enabled by default for
12721 @option{-Os} or @option{-O0}.
12723 @end table
12725 @opindex fira-hoist-pressure
12726 @item -fira-hoist-pressure
12727 Use IRA to evaluate register pressure in the code hoisting pass for
12728 decisions to hoist expressions.  This option usually results in smaller
12729 code, but it can slow the compiler down.
12731 This option is enabled at level @option{-Os} for all targets.
12733 @opindex fira-loop-pressure
12734 @item -fira-loop-pressure
12735 Use IRA to evaluate register pressure in loops for decisions to move
12736 loop invariants.  This option usually results in generation
12737 of faster and smaller code on machines with large register files (>= 32
12738 registers), but it can slow the compiler down.
12740 This option is enabled at level @option{-O3} for some targets.
12742 @opindex fno-ira-share-save-slots
12743 @opindex fira-share-save-slots
12744 @item -fno-ira-share-save-slots
12745 Disable sharing of stack slots used for saving call-used hard
12746 registers living through a call.  Each hard register gets a
12747 separate stack slot, and as a result function stack frames are
12748 larger.
12750 @opindex fno-ira-share-spill-slots
12751 @opindex fira-share-spill-slots
12752 @item -fno-ira-share-spill-slots
12753 Disable sharing of stack slots allocated for pseudo-registers.  Each
12754 pseudo-register that does not get a hard register gets a separate
12755 stack slot, and as a result function stack frames are larger.
12757 @opindex flra-remat
12758 @item -flra-remat
12759 Enable CFG-sensitive rematerialization in LRA.  Instead of loading
12760 values of spilled pseudos, LRA tries to rematerialize (recalculate)
12761 values if it is profitable.
12763 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12765 @opindex fdelayed-branch
12766 @item -fdelayed-branch
12767 If supported for the target machine, attempt to reorder instructions
12768 to exploit instruction slots available after delayed branch
12769 instructions.
12771 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os},
12772 but not at @option{-Og}.
12774 @opindex fschedule-insns
12775 @item -fschedule-insns
12776 If supported for the target machine, attempt to reorder instructions to
12777 eliminate execution stalls due to required data being unavailable.  This
12778 helps machines that have slow floating point or memory load instructions
12779 by allowing other instructions to be issued until the result of the load
12780 or floating-point instruction is required.
12782 Enabled at levels @option{-O2}, @option{-O3}.
12784 @opindex fschedule-insns2
12785 @item -fschedule-insns2
12786 Similar to @option{-fschedule-insns}, but requests an additional pass of
12787 instruction scheduling after register allocation has been done.  This is
12788 especially useful on machines with a relatively small number of
12789 registers and where memory load instructions take more than one cycle.
12791 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12793 @opindex fno-sched-interblock
12794 @opindex fsched-interblock
12795 @item -fno-sched-interblock
12796 Disable instruction scheduling across basic blocks, which
12797 is normally enabled when scheduling before register allocation, i.e.@:
12798 with @option{-fschedule-insns} or at @option{-O2} or higher.
12800 @opindex fno-sched-spec
12801 @opindex fsched-spec
12802 @item -fno-sched-spec
12803 Disable speculative motion of non-load instructions, which
12804 is normally enabled when scheduling before register allocation, i.e.@:
12805 with @option{-fschedule-insns} or at @option{-O2} or higher.
12807 @opindex fsched-pressure
12808 @item -fsched-pressure
12809 Enable register pressure sensitive insn scheduling before register
12810 allocation.  This only makes sense when scheduling before register
12811 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
12812 @option{-O2} or higher.  Usage of this option can improve the
12813 generated code and decrease its size by preventing register pressure
12814 increase above the number of available hard registers and subsequent
12815 spills in register allocation.
12817 @opindex fsched-spec-load
12818 @item -fsched-spec-load
12819 Allow speculative motion of some load instructions.  This only makes
12820 sense when scheduling before register allocation, i.e.@: with
12821 @option{-fschedule-insns} or at @option{-O2} or higher.
12823 @opindex fsched-spec-load-dangerous
12824 @item -fsched-spec-load-dangerous
12825 Allow speculative motion of more load instructions.  This only makes
12826 sense when scheduling before register allocation, i.e.@: with
12827 @option{-fschedule-insns} or at @option{-O2} or higher.
12829 @opindex fsched-stalled-insns
12830 @item -fsched-stalled-insns
12831 @itemx -fsched-stalled-insns=@var{n}
12832 Define how many insns (if any) can be moved prematurely from the queue
12833 of stalled insns into the ready list during the second scheduling pass.
12834 @option{-fno-sched-stalled-insns} means that no insns are moved
12835 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
12836 on how many queued insns can be moved prematurely.
12837 @option{-fsched-stalled-insns} without a value is equivalent to
12838 @option{-fsched-stalled-insns=1}.
12840 @opindex fsched-stalled-insns-dep
12841 @item -fsched-stalled-insns-dep
12842 @itemx -fsched-stalled-insns-dep=@var{n}
12843 Define how many insn groups (cycles) are examined for a dependency
12844 on a stalled insn that is a candidate for premature removal from the queue
12845 of stalled insns.  This has an effect only during the second scheduling pass,
12846 and only if @option{-fsched-stalled-insns} is used.
12847 @option{-fno-sched-stalled-insns-dep} is equivalent to
12848 @option{-fsched-stalled-insns-dep=0}.
12849 @option{-fsched-stalled-insns-dep} without a value is equivalent to
12850 @option{-fsched-stalled-insns-dep=1}.
12852 @opindex fsched2-use-superblocks
12853 @item -fsched2-use-superblocks
12854 When scheduling after register allocation, use superblock scheduling.
12855 This allows motion across basic block boundaries,
12856 resulting in faster schedules.  This option is experimental, as not all machine
12857 descriptions used by GCC model the CPU closely enough to avoid unreliable
12858 results from the algorithm.
12860 This only makes sense when scheduling after register allocation, i.e.@: with
12861 @option{-fschedule-insns2} or at @option{-O2} or higher.
12863 @opindex fsched-group-heuristic
12864 @item -fsched-group-heuristic
12865 Enable the group heuristic in the scheduler.  This heuristic favors
12866 the instruction that belongs to a schedule group.  This is enabled
12867 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12868 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12870 @opindex fsched-critical-path-heuristic
12871 @item -fsched-critical-path-heuristic
12872 Enable the critical-path heuristic in the scheduler.  This heuristic favors
12873 instructions on the critical path.  This is enabled by default when
12874 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
12875 or @option{-fschedule-insns2} or at @option{-O2} or higher.
12877 @opindex fsched-spec-insn-heuristic
12878 @item -fsched-spec-insn-heuristic
12879 Enable the speculative instruction heuristic in the scheduler.  This
12880 heuristic favors speculative instructions with greater dependency weakness.
12881 This is enabled by default when scheduling is enabled, i.e.@:
12882 with @option{-fschedule-insns} or @option{-fschedule-insns2}
12883 or at @option{-O2} or higher.
12885 @opindex fsched-rank-heuristic
12886 @item -fsched-rank-heuristic
12887 Enable the rank heuristic in the scheduler.  This heuristic favors
12888 the instruction belonging to a basic block with greater size or frequency.
12889 This is enabled by default when scheduling is enabled, i.e.@:
12890 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12891 at @option{-O2} or higher.
12893 @opindex fsched-last-insn-heuristic
12894 @item -fsched-last-insn-heuristic
12895 Enable the last-instruction heuristic in the scheduler.  This heuristic
12896 favors the instruction that is less dependent on the last instruction
12897 scheduled.  This is enabled by default when scheduling is enabled,
12898 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12899 at @option{-O2} or higher.
12901 @opindex fsched-dep-count-heuristic
12902 @item -fsched-dep-count-heuristic
12903 Enable the dependent-count heuristic in the scheduler.  This heuristic
12904 favors the instruction that has more instructions depending on it.
12905 This is enabled by default when scheduling is enabled, i.e.@:
12906 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
12907 at @option{-O2} or higher.
12909 @opindex freschedule-modulo-scheduled-loops
12910 @item -freschedule-modulo-scheduled-loops
12911 Modulo scheduling is performed before traditional scheduling.  If a loop
12912 is modulo scheduled, later scheduling passes may change its schedule.  
12913 Use this option to control that behavior.
12915 @opindex fselective-scheduling
12916 @item -fselective-scheduling
12917 Schedule instructions using selective scheduling algorithm.  Selective
12918 scheduling runs instead of the first scheduler pass.
12920 @opindex fselective-scheduling2
12921 @item -fselective-scheduling2
12922 Schedule instructions using selective scheduling algorithm.  Selective
12923 scheduling runs instead of the second scheduler pass.
12925 @opindex fsel-sched-pipelining
12926 @item -fsel-sched-pipelining
12927 Enable software pipelining of innermost loops during selective scheduling.
12928 This option has no effect unless one of @option{-fselective-scheduling} or
12929 @option{-fselective-scheduling2} is turned on.
12931 @opindex fsel-sched-pipelining-outer-loops
12932 @item -fsel-sched-pipelining-outer-loops
12933 When pipelining loops during selective scheduling, also pipeline outer loops.
12934 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
12936 @opindex fsemantic-interposition
12937 @item -fsemantic-interposition
12938 Some object formats, like ELF, allow interposing of symbols by the 
12939 dynamic linker.
12940 This means that for symbols exported from the DSO, the compiler cannot perform
12941 interprocedural propagation, inlining and other optimizations in anticipation
12942 that the function or variable in question may change. While this feature is
12943 useful, for example, to rewrite memory allocation functions by a debugging
12944 implementation, it is expensive in the terms of code quality.
12945 With @option{-fno-semantic-interposition} the compiler assumes that 
12946 if interposition happens for functions the overwriting function will have 
12947 precisely the same semantics (and side effects). 
12948 Similarly if interposition happens
12949 for variables, the constructor of the variable will be the same. The flag
12950 has no effect for functions explicitly declared inline 
12951 (where it is never allowed for interposition to change semantics) 
12952 and for symbols explicitly declared weak.
12954 @opindex fshrink-wrap
12955 @item -fshrink-wrap
12956 Emit function prologues only before parts of the function that need it,
12957 rather than at the top of the function.  This flag is enabled by default at
12958 @option{-O} and higher.
12960 @opindex fshrink-wrap-separate
12961 @item -fshrink-wrap-separate
12962 Shrink-wrap separate parts of the prologue and epilogue separately, so that
12963 those parts are only executed when needed.
12964 This option is on by default, but has no effect unless @option{-fshrink-wrap}
12965 is also turned on and the target supports this.
12967 @opindex fcaller-saves
12968 @item -fcaller-saves
12969 Enable allocation of values to registers that are clobbered by
12970 function calls, by emitting extra instructions to save and restore the
12971 registers around such calls.  Such allocation is done only when it
12972 seems to result in better code.
12974 This option is always enabled by default on certain machines, usually
12975 those which have no call-preserved registers to use instead.
12977 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
12979 @opindex fcombine-stack-adjustments
12980 @item -fcombine-stack-adjustments
12981 Tracks stack adjustments (pushes and pops) and stack memory references
12982 and then tries to find ways to combine them.
12984 Enabled by default at @option{-O1} and higher.
12986 @opindex fipa-ra
12987 @item -fipa-ra
12988 Use caller save registers for allocation if those registers are not used by
12989 any called function.  In that case it is not necessary to save and restore
12990 them around calls.  This is only possible if called functions are part of
12991 same compilation unit as current function and they are compiled before it.
12993 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
12994 is disabled if generated code will be instrumented for profiling
12995 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
12996 exactly (this happens on targets that do not expose prologues
12997 and epilogues in RTL).
12999 @opindex fconserve-stack
13000 @item -fconserve-stack
13001 Attempt to minimize stack usage.  The compiler attempts to use less
13002 stack space, even if that makes the program slower.  This option
13003 implies setting the @option{large-stack-frame} parameter to 100
13004 and the @option{large-stack-frame-growth} parameter to 400.
13006 @opindex ftree-reassoc
13007 @item -ftree-reassoc
13008 Perform reassociation on trees.  This flag is enabled by default
13009 at @option{-O1} and higher.
13011 @opindex fcode-hoisting
13012 @item -fcode-hoisting
13013 Perform code hoisting.  Code hoisting tries to move the
13014 evaluation of expressions executed on all paths to the function exit
13015 as early as possible.  This is especially useful as a code size
13016 optimization, but it often helps for code speed as well.
13017 This flag is enabled by default at @option{-O2} and higher.
13019 @opindex ftree-pre
13020 @item -ftree-pre
13021 Perform partial redundancy elimination (PRE) on trees.  This flag is
13022 enabled by default at @option{-O2} and @option{-O3}.
13024 @opindex ftree-partial-pre
13025 @item -ftree-partial-pre
13026 Make partial redundancy elimination (PRE) more aggressive.  This flag is
13027 enabled by default at @option{-O3}.
13029 @opindex ftree-forwprop
13030 @item -ftree-forwprop
13031 Perform forward propagation on trees.  This flag is enabled by default
13032 at @option{-O1} and higher.
13034 @opindex ftree-fre
13035 @item -ftree-fre
13036 Perform full redundancy elimination (FRE) on trees.  The difference
13037 between FRE and PRE is that FRE only considers expressions
13038 that are computed on all paths leading to the redundant computation.
13039 This analysis is faster than PRE, though it exposes fewer redundancies.
13040 This flag is enabled by default at @option{-O1} and higher.
13042 @opindex ftree-phiprop
13043 @item -ftree-phiprop
13044 Perform hoisting of loads from conditional pointers on trees.  This
13045 pass is enabled by default at @option{-O1} and higher.
13047 @opindex fhoist-adjacent-loads
13048 @item -fhoist-adjacent-loads
13049 Speculatively hoist loads from both branches of an if-then-else if the
13050 loads are from adjacent locations in the same structure and the target
13051 architecture has a conditional move instruction.  This flag is enabled
13052 by default at @option{-O2} and higher.
13054 @opindex ftree-copy-prop
13055 @item -ftree-copy-prop
13056 Perform copy propagation on trees.  This pass eliminates unnecessary
13057 copy operations.  This flag is enabled by default at @option{-O1} and
13058 higher.
13060 @opindex fipa-pure-const
13061 @item -fipa-pure-const
13062 Discover which functions are pure or constant.
13063 Enabled by default at @option{-O1} and higher.
13065 @opindex fipa-reference
13066 @item -fipa-reference
13067 Discover which static variables do not escape the
13068 compilation unit.
13069 Enabled by default at @option{-O1} and higher.
13071 @opindex fipa-reference-addressable
13072 @item -fipa-reference-addressable
13073 Discover read-only, write-only and non-addressable static variables.
13074 Enabled by default at @option{-O1} and higher.
13076 @opindex fipa-stack-alignment
13077 @item -fipa-stack-alignment
13078 Reduce stack alignment on call sites if possible.
13079 Enabled by default.
13081 @opindex fipa-pta
13082 @item -fipa-pta
13083 Perform interprocedural pointer analysis and interprocedural modification
13084 and reference analysis.  This option can cause excessive memory and
13085 compile-time usage on large compilation units.  It is not enabled by
13086 default at any optimization level.
13088 @opindex fipa-profile
13089 @item -fipa-profile
13090 Perform interprocedural profile propagation.  The functions called only from
13091 cold functions are marked as cold. Also functions executed once (such as
13092 @code{cold}, @code{noreturn}, static constructors or destructors) are
13093 identified. Cold functions and loop less parts of functions executed once are
13094 then optimized for size.
13095 Enabled by default at @option{-O1} and higher.
13097 @opindex fipa-modref
13098 @item -fipa-modref
13099 Perform interprocedural mod/ref analysis.  This optimization analyzes the side
13100 effects of functions (memory locations that are modified or referenced) and
13101 enables better optimization across the function call boundary.  This flag is
13102 enabled by default at @option{-O1} and higher.
13104 @opindex fipa-cp
13105 @item -fipa-cp
13106 Perform interprocedural constant propagation.
13107 This optimization analyzes the program to determine when values passed
13108 to functions are constants and then optimizes accordingly.
13109 This optimization can substantially increase performance
13110 if the application has constants passed to functions.
13111 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
13112 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13114 @opindex fipa-cp-clone
13115 @item -fipa-cp-clone
13116 Perform function cloning to make interprocedural constant propagation stronger.
13117 When enabled, interprocedural constant propagation performs function cloning
13118 when externally visible function can be called with constant arguments.
13119 Because this optimization can create multiple copies of functions,
13120 it may significantly increase code size
13121 (see @option{--param ipa-cp-unit-growth=@var{value}}).
13122 This flag is enabled by default at @option{-O3}.
13123 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13125 @opindex fipa-bit-cp
13126 @item -fipa-bit-cp
13127 When enabled, perform interprocedural bitwise constant
13128 propagation. This flag is enabled by default at @option{-O2} and
13129 by @option{-fprofile-use} and @option{-fauto-profile}.
13130 It requires that @option{-fipa-cp} is enabled.  
13132 @opindex fipa-vrp
13133 @item -fipa-vrp
13134 When enabled, perform interprocedural propagation of value
13135 ranges. This flag is enabled by default at @option{-O2}. It requires
13136 that @option{-fipa-cp} is enabled.
13138 @opindex fipa-icf
13139 @item -fipa-icf
13140 Perform Identical Code Folding for functions and read-only variables.
13141 The optimization reduces code size and may disturb unwind stacks by replacing
13142 a function by equivalent one with a different name. The optimization works
13143 more effectively with link-time optimization enabled.
13145 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
13146 works on different levels and thus the optimizations are not same - there are
13147 equivalences that are found only by GCC and equivalences found only by Gold.
13149 This flag is enabled by default at @option{-O2} and @option{-Os}.
13151 @opindex flive-patching
13152 @item -flive-patching=@var{level}
13153 Control GCC's optimizations to produce output suitable for live-patching.
13155 If the compiler's optimization uses a function's body or information extracted
13156 from its body to optimize/change another function, the latter is called an
13157 impacted function of the former.  If a function is patched, its impacted
13158 functions should be patched too.
13160 The impacted functions are determined by the compiler's interprocedural
13161 optimizations.  For example, a caller is impacted when inlining a function
13162 into its caller,
13163 cloning a function and changing its caller to call this new clone,
13164 or extracting a function's pureness/constness information to optimize
13165 its direct or indirect callers, etc.
13167 Usually, the more IPA optimizations enabled, the larger the number of
13168 impacted functions for each function.  In order to control the number of
13169 impacted functions and more easily compute the list of impacted function,
13170 IPA optimizations can be partially enabled at two different levels.
13172 The @var{level} argument should be one of the following:
13174 @table @samp
13176 @item inline-clone
13178 Only enable inlining and cloning optimizations, which includes inlining,
13179 cloning, interprocedural scalar replacement of aggregates and partial inlining.
13180 As a result, when patching a function, all its callers and its clones'
13181 callers are impacted, therefore need to be patched as well.
13183 @option{-flive-patching=inline-clone} disables the following optimization flags:
13184 @gccoptlist{-fwhole-program  -fipa-pta  -fipa-reference  -fipa-ra
13185 -fipa-icf  -fipa-icf-functions  -fipa-icf-variables
13186 -fipa-bit-cp  -fipa-vrp  -fipa-pure-const
13187 -fipa-reference-addressable
13188 -fipa-stack-alignment -fipa-modref}
13190 @item inline-only-static
13192 Only enable inlining of static functions.
13193 As a result, when patching a static function, all its callers are impacted
13194 and so need to be patched as well.
13196 In addition to all the flags that @option{-flive-patching=inline-clone}
13197 disables,
13198 @option{-flive-patching=inline-only-static} disables the following additional
13199 optimization flags:
13200 @gccoptlist{-fipa-cp-clone  -fipa-sra  -fpartial-inlining  -fipa-cp}
13202 @end table
13204 When @option{-flive-patching} is specified without any value, the default value
13205 is @var{inline-clone}.
13207 This flag is disabled by default.
13209 Note that @option{-flive-patching} is not supported with link-time optimization
13210 (@option{-flto}).
13212 @opindex fisolate-erroneous-paths-dereference
13213 @item -fisolate-erroneous-paths-dereference
13214 Detect paths that trigger erroneous or undefined behavior due to
13215 dereferencing a null pointer.  Isolate those paths from the main control
13216 flow and turn the statement with erroneous or undefined behavior into a trap.
13217 This flag is enabled by default at @option{-O2} and higher and depends on
13218 @option{-fdelete-null-pointer-checks} also being enabled.
13220 @opindex fisolate-erroneous-paths-attribute
13221 @item -fisolate-erroneous-paths-attribute
13222 Detect paths that trigger erroneous or undefined behavior due to a null value
13223 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
13224 attribute.  Isolate those paths from the main control flow and turn the
13225 statement with erroneous or undefined behavior into a trap.  This is not
13226 currently enabled, but may be enabled by @option{-O2} in the future.
13228 @opindex ftree-sink
13229 @item -ftree-sink
13230 Perform forward store motion on trees.  This flag is
13231 enabled by default at @option{-O1} and higher.
13233 @opindex ftree-bit-ccp
13234 @item -ftree-bit-ccp
13235 Perform sparse conditional bit constant propagation on trees and propagate
13236 pointer alignment information.
13237 This pass only operates on local scalar variables and is enabled by default
13238 at @option{-O1} and higher, except for @option{-Og}.
13239 It requires that @option{-ftree-ccp} is enabled.
13241 @opindex ftree-ccp
13242 @item -ftree-ccp
13243 Perform sparse conditional constant propagation (CCP) on trees.  This
13244 pass only operates on local scalar variables and is enabled by default
13245 at @option{-O1} and higher.
13247 @opindex fssa-backprop
13248 @item -fssa-backprop
13249 Propagate information about uses of a value up the definition chain
13250 in order to simplify the definitions.  For example, this pass strips
13251 sign operations if the sign of a value never matters.  The flag is
13252 enabled by default at @option{-O1} and higher.
13254 @opindex fssa-phiopt
13255 @item -fssa-phiopt
13256 Perform pattern matching on SSA PHI nodes to optimize conditional
13257 code.  This pass is enabled by default at @option{-O1} and higher,
13258 except for @option{-Og}.
13260 @opindex ftree-switch-conversion
13261 @item -ftree-switch-conversion
13262 Perform conversion of simple initializations in a switch to
13263 initializations from a scalar array.  This flag is enabled by default
13264 at @option{-O2} and higher.
13266 @opindex ftree-tail-merge
13267 @item -ftree-tail-merge
13268 Look for identical code sequences.  When found, replace one with a jump to the
13269 other.  This optimization is known as tail merging or cross jumping.  This flag
13270 is enabled by default at @option{-O2} and higher.  The compilation time
13271 in this pass can
13272 be limited using @option{max-tail-merge-comparisons} parameter and
13273 @option{max-tail-merge-iterations} parameter.
13275 @opindex ftree-dce
13276 @item -ftree-dce
13277 Perform dead code elimination (DCE) on trees.  This flag is enabled by
13278 default at @option{-O1} and higher.
13280 @opindex ftree-builtin-call-dce
13281 @item -ftree-builtin-call-dce
13282 Perform conditional dead code elimination (DCE) for calls to built-in functions
13283 that may set @code{errno} but are otherwise free of side effects.  This flag is
13284 enabled by default at @option{-O2} and higher if @option{-Os} is not also
13285 specified.
13287 @opindex ffinite-loops
13288 @opindex fno-finite-loops
13289 @item -ffinite-loops
13290 Assume that a loop with an exit will eventually take the exit and not loop
13291 indefinitely.  This allows the compiler to remove loops that otherwise have
13292 no side-effects, not considering eventual endless looping as such.
13294 This option is enabled by default at @option{-O2} for C++ with -std=c++11
13295 or higher.
13297 @opindex ftree-dominator-opts
13298 @item -ftree-dominator-opts
13299 Perform a variety of simple scalar cleanups (constant/copy
13300 propagation, redundancy elimination, range propagation and expression
13301 simplification) based on a dominator tree traversal.  This also
13302 performs jump threading (to reduce jumps to jumps). This flag is
13303 enabled by default at @option{-O1} and higher.
13305 @opindex ftree-dse
13306 @item -ftree-dse
13307 Perform dead store elimination (DSE) on trees.  A dead store is a store into
13308 a memory location that is later overwritten by another store without
13309 any intervening loads.  In this case the earlier store can be deleted.  This
13310 flag is enabled by default at @option{-O1} and higher.
13312 @opindex ftree-ch
13313 @item -ftree-ch
13314 Perform loop header copying on trees.  This is beneficial since it increases
13315 effectiveness of code motion optimizations.  It also saves one jump.  This flag
13316 is enabled by default at @option{-O1} and higher.  It is not enabled
13317 for @option{-Os}, since it usually increases code size.
13319 @opindex ftree-loop-optimize
13320 @item -ftree-loop-optimize
13321 Perform loop optimizations on trees.  This flag is enabled by default
13322 at @option{-O1} and higher.
13324 @opindex ftree-loop-linear
13325 @opindex floop-strip-mine
13326 @opindex floop-block
13327 @item -ftree-loop-linear
13328 @itemx -floop-strip-mine
13329 @itemx -floop-block
13330 Perform loop nest optimizations.  Same as
13331 @option{-floop-nest-optimize}.  To use this code transformation, GCC has
13332 to be configured with @option{--with-isl} to enable the Graphite loop
13333 transformation infrastructure.
13335 @opindex fgraphite-identity
13336 @item -fgraphite-identity
13337 Enable the identity transformation for graphite.  For every SCoP we generate
13338 the polyhedral representation and transform it back to gimple.  Using
13339 @option{-fgraphite-identity} we can check the costs or benefits of the
13340 GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
13341 are also performed by the code generator isl, like index splitting and
13342 dead code elimination in loops.
13344 @opindex floop-nest-optimize
13345 @item -floop-nest-optimize
13346 Enable the isl based loop nest optimizer.  This is a generic loop nest
13347 optimizer based on the Pluto optimization algorithms.  It calculates a loop
13348 structure optimized for data-locality and parallelism.  This option
13349 is experimental.
13351 @opindex floop-parallelize-all
13352 @item -floop-parallelize-all
13353 Use the Graphite data dependence analysis to identify loops that can
13354 be parallelized.  Parallelize all the loops that can be analyzed to
13355 not contain loop carried dependences without checking that it is
13356 profitable to parallelize the loops.
13358 @opindex ftree-coalesce-vars
13359 @item -ftree-coalesce-vars
13360 While transforming the program out of the SSA representation, attempt to
13361 reduce copying by coalescing versions of different user-defined
13362 variables, instead of just compiler temporaries.  This may severely
13363 limit the ability to debug an optimized program compiled with
13364 @option{-fno-var-tracking-assignments}.  In the negated form, this flag
13365 prevents SSA coalescing of user variables.  This option is enabled by
13366 default if optimization is enabled, and it does very little otherwise.
13368 @opindex ftree-loop-if-convert
13369 @item -ftree-loop-if-convert
13370 Attempt to transform conditional jumps in the innermost loops to
13371 branch-less equivalents.  The intent is to remove control-flow from
13372 the innermost loops in order to improve the ability of the
13373 vectorization pass to handle these loops.  This is enabled by default
13374 if vectorization is enabled.
13376 @opindex ftree-loop-distribution
13377 @item -ftree-loop-distribution
13378 Perform loop distribution.  This flag can improve cache performance on
13379 big loop bodies and allow further loop optimizations, like
13380 parallelization or vectorization, to take place.  For example, the loop
13381 @smallexample
13382 DO I = 1, N
13383   A(I) = B(I) + C
13384   D(I) = E(I) * F
13385 ENDDO
13386 @end smallexample
13387 is transformed to
13388 @smallexample
13389 DO I = 1, N
13390    A(I) = B(I) + C
13391 ENDDO
13392 DO I = 1, N
13393    D(I) = E(I) * F
13394 ENDDO
13395 @end smallexample
13396 This flag is enabled by default at @option{-O3}.
13397 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13399 @opindex ftree-loop-distribute-patterns
13400 @item -ftree-loop-distribute-patterns
13401 Perform loop distribution of patterns that can be code generated with
13402 calls to a library.  This flag is enabled by default at @option{-O2} and
13403 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
13405 This pass distributes the initialization loops and generates a call to
13406 memset zero.  For example, the loop
13407 @smallexample
13408 DO I = 1, N
13409   A(I) = 0
13410   B(I) = A(I) + I
13411 ENDDO
13412 @end smallexample
13413 is transformed to
13414 @smallexample
13415 DO I = 1, N
13416    A(I) = 0
13417 ENDDO
13418 DO I = 1, N
13419    B(I) = A(I) + I
13420 ENDDO
13421 @end smallexample
13422 and the initialization loop is transformed into a call to memset zero.
13423 This flag is enabled by default at @option{-O3}.
13424 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13426 @opindex floop-interchange
13427 @item -floop-interchange
13428 Perform loop interchange outside of graphite.  This flag can improve cache
13429 performance on loop nest and allow further loop optimizations, like
13430 vectorization, to take place.  For example, the loop
13431 @smallexample
13432 for (int i = 0; i < N; i++)
13433   for (int j = 0; j < N; j++)
13434     for (int k = 0; k < N; k++)
13435       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13436 @end smallexample
13437 is transformed to
13438 @smallexample
13439 for (int i = 0; i < N; i++)
13440   for (int k = 0; k < N; k++)
13441     for (int j = 0; j < N; j++)
13442       c[i][j] = c[i][j] + a[i][k]*b[k][j];
13443 @end smallexample
13444 This flag is enabled by default at @option{-O3}.
13445 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13447 @opindex floop-unroll-and-jam
13448 @item -floop-unroll-and-jam
13449 Apply unroll and jam transformations on feasible loops.  In a loop
13450 nest this unrolls the outer loop by some factor and fuses the resulting
13451 multiple inner loops.  This flag is enabled by default at @option{-O3}.
13452 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13454 @opindex ftree-loop-im
13455 @item -ftree-loop-im
13456 Perform loop invariant motion on trees.  This pass moves only invariants that
13457 are hard to handle at RTL level (function calls, operations that expand to
13458 nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
13459 operands of conditions that are invariant out of the loop, so that we can use
13460 just trivial invariantness analysis in loop unswitching.  The pass also includes
13461 store motion.
13463 @opindex ftree-loop-ivcanon
13464 @item -ftree-loop-ivcanon
13465 Create a canonical counter for number of iterations in loops for which
13466 determining number of iterations requires complicated analysis.  Later
13467 optimizations then may determine the number easily.  Useful especially
13468 in connection with unrolling.
13470 @opindex ftree-scev-cprop
13471 @item -ftree-scev-cprop
13472 Perform final value replacement.  If a variable is modified in a loop
13473 in such a way that its value when exiting the loop can be determined using
13474 only its initial value and the number of loop iterations, replace uses of
13475 the final value by such a computation, provided it is sufficiently cheap.
13476 This reduces data dependencies and may allow further simplifications.
13477 Enabled by default at @option{-O1} and higher.
13479 @opindex fivopts
13480 @item -fivopts
13481 Perform induction variable optimizations (strength reduction, induction
13482 variable merging and induction variable elimination) on trees.
13484 @opindex ftree-parallelize-loops
13485 @item -ftree-parallelize-loops=n
13486 Parallelize loops, i.e., split their iteration space to run in n threads.
13487 This is only possible for loops whose iterations are independent
13488 and can be arbitrarily reordered.  The optimization is only
13489 profitable on multiprocessor machines, for loops that are CPU-intensive,
13490 rather than constrained e.g.@: by memory bandwidth.  This option
13491 implies @option{-pthread}, and thus is only supported on targets
13492 that have support for @option{-pthread}.
13494 @opindex ftree-pta
13495 @item -ftree-pta
13496 Perform function-local points-to analysis on trees.  This flag is
13497 enabled by default at @option{-O1} and higher, except for @option{-Og}.
13499 @opindex ftree-sra
13500 @item -ftree-sra
13501 Perform scalar replacement of aggregates.  This pass replaces structure
13502 references with scalars to prevent committing structures to memory too
13503 early.  This flag is enabled by default at @option{-O1} and higher,
13504 except for @option{-Og}.
13506 @opindex fstore-merging
13507 @item -fstore-merging
13508 Perform merging of narrow stores to consecutive memory addresses.  This pass
13509 merges contiguous stores of immediate values narrower than a word into fewer
13510 wider stores to reduce the number of instructions.  This is enabled by default
13511 at @option{-O2} and higher as well as @option{-Os}.
13513 @opindex ftree-ter
13514 @item -ftree-ter
13515 Perform temporary expression replacement during the SSA->normal phase.  Single
13516 use/single def temporaries are replaced at their use location with their
13517 defining expression.  This results in non-GIMPLE code, but gives the expanders
13518 much more complex trees to work on resulting in better RTL generation.  This is
13519 enabled by default at @option{-O1} and higher.
13521 @opindex ftree-slsr
13522 @item -ftree-slsr
13523 Perform straight-line strength reduction on trees.  This recognizes related
13524 expressions involving multiplications and replaces them by less expensive
13525 calculations when possible.  This is enabled by default at @option{-O1} and
13526 higher.
13528 @opindex ftree-vectorize
13529 @item -ftree-vectorize
13530 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
13531 and @option{-ftree-slp-vectorize} if not explicitly specified.
13533 @opindex ftree-loop-vectorize
13534 @item -ftree-loop-vectorize
13535 Perform loop vectorization on trees. This flag is enabled by default at
13536 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13537 and @option{-fauto-profile}.
13539 @opindex ftree-slp-vectorize
13540 @item -ftree-slp-vectorize
13541 Perform basic block vectorization on trees. This flag is enabled by default at
13542 @option{-O2} and by @option{-ftree-vectorize}, @option{-fprofile-use},
13543 and @option{-fauto-profile}.
13545 @opindex ftrivial-auto-var-init
13546 @item -ftrivial-auto-var-init=@var{choice}
13547 Initialize automatic variables with either a pattern or with zeroes to increase
13548 the security and predictability of a program by preventing uninitialized memory
13549 disclosure and use.
13550 GCC still considers an automatic variable that doesn't have an explicit
13551 initializer as uninitialized, @option{-Wuninitialized} and
13552 @option{-Wanalyzer-use-of-uninitialized-value} will still report
13553 warning messages on such automatic variables and the compiler will
13554 perform optimization as if the variable were uninitialized.
13555 With this option, GCC will also initialize any padding of automatic variables
13556 that have structure or union types to zeroes.
13557 However, the current implementation cannot initialize automatic variables that
13558 are declared between the controlling expression and the first case of a
13559 @code{switch} statement.  Using @option{-Wtrivial-auto-var-init} to report all
13560 such cases.
13562 The three values of @var{choice} are:
13564 @itemize @bullet
13565 @item
13566 @samp{uninitialized} doesn't initialize any automatic variables.
13567 This is C and C++'s default.
13569 @item
13570 @samp{pattern} Initialize automatic variables with values which will likely
13571 transform logic bugs into crashes down the line, are easily recognized in a
13572 crash dump and without being values that programmers can rely on for useful
13573 program semantics.
13574 The current value is byte-repeatable pattern with byte "0xFE".
13575 The values used for pattern initialization might be changed in the future.
13577 @item
13578 @samp{zero} Initialize automatic variables with zeroes.
13579 @end itemize
13581 The default is @samp{uninitialized}.
13583 You can control this behavior for a specific variable by using the variable
13584 attribute @code{uninitialized} (@pxref{Variable Attributes}).
13586 @opindex fvect-cost-model
13587 @item -fvect-cost-model=@var{model}
13588 Alter the cost model used for vectorization.  The @var{model} argument
13589 should be one of @samp{unlimited}, @samp{dynamic}, @samp{cheap} or
13590 @samp{very-cheap}.
13591 With the @samp{unlimited} model the vectorized code-path is assumed
13592 to be profitable while with the @samp{dynamic} model a runtime check
13593 guards the vectorized code-path to enable it only for iteration
13594 counts that will likely execute faster than when executing the original
13595 scalar loop.  The @samp{cheap} model disables vectorization of
13596 loops where doing so would be cost prohibitive for example due to
13597 required runtime checks for data dependence or alignment but otherwise
13598 is equal to the @samp{dynamic} model.  The @samp{very-cheap} model only
13599 allows vectorization if the vector code would entirely replace the
13600 scalar code that is being vectorized.  For example, if each iteration
13601 of a vectorized loop would only be able to handle exactly four iterations
13602 of the scalar loop, the @samp{very-cheap} model would only allow
13603 vectorization if the scalar iteration count is known to be a multiple
13604 of four.
13606 The default cost model depends on other optimization flags and is
13607 either @samp{dynamic} or @samp{cheap}.
13609 @opindex fsimd-cost-model
13610 @item -fsimd-cost-model=@var{model}
13611 Alter the cost model used for vectorization of loops marked with the OpenMP
13612 simd directive.  The @var{model} argument should be one of
13613 @samp{unlimited}, @samp{dynamic}, @samp{cheap}.  All values of @var{model}
13614 have the same meaning as described in @option{-fvect-cost-model} and by
13615 default a cost model defined with @option{-fvect-cost-model} is used.
13617 @opindex ftree-vrp
13618 @item -ftree-vrp
13619 Perform Value Range Propagation on trees.  This is similar to the
13620 constant propagation pass, but instead of values, ranges of values are
13621 propagated.  This allows the optimizers to remove unnecessary range
13622 checks like array bound checks and null pointer checks.  This is
13623 enabled by default at @option{-O2} and higher.  Null pointer check
13624 elimination is only done if @option{-fdelete-null-pointer-checks} is
13625 enabled.
13627 @opindex fsplit-paths
13628 @item -fsplit-paths
13629 Split paths leading to loop backedges.  This can improve dead code
13630 elimination and common subexpression elimination.  This is enabled by
13631 default at @option{-O3} and above.
13633 @opindex fsplit-ivs-in-unroller
13634 @item -fsplit-ivs-in-unroller
13635 Enables expression of values of induction variables in later iterations
13636 of the unrolled loop using the value in the first iteration.  This breaks
13637 long dependency chains, thus improving efficiency of the scheduling passes.
13639 A combination of @option{-fweb} and CSE is often sufficient to obtain the
13640 same effect.  However, that is not reliable in cases where the loop body
13641 is more complicated than a single basic block.  It also does not work at all
13642 on some architectures due to restrictions in the CSE pass.
13644 This optimization is enabled by default.
13646 @opindex fvariable-expansion-in-unroller
13647 @item -fvariable-expansion-in-unroller
13648 With this option, the compiler creates multiple copies of some
13649 local variables when unrolling a loop, which can result in superior code.
13651 This optimization is enabled by default for PowerPC targets, but disabled
13652 by default otherwise.
13654 @opindex fpartial-inlining
13655 @item -fpartial-inlining
13656 Inline parts of functions.  This option has any effect only
13657 when inlining itself is turned on by the @option{-finline-functions}
13658 or @option{-finline-small-functions} options.
13660 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13662 @opindex fpredictive-commoning
13663 @item -fpredictive-commoning
13664 Perform predictive commoning optimization, i.e., reusing computations
13665 (especially memory loads and stores) performed in previous
13666 iterations of loops.
13668 This option is enabled at level @option{-O3}.
13669 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
13671 @opindex fprefetch-loop-arrays
13672 @item -fprefetch-loop-arrays
13673 If supported by the target machine, generate instructions to prefetch
13674 memory to improve the performance of loops that access large arrays.
13676 This option may generate better or worse code; results are highly
13677 dependent on the structure of loops within the source code.
13679 Disabled at level @option{-Os}.
13681 @opindex fno-printf-return-value
13682 @opindex fprintf-return-value
13683 @item -fno-printf-return-value
13684 Do not substitute constants for known return value of formatted output
13685 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
13686 @code{vsnprintf} (but not @code{printf} of @code{fprintf}).  This
13687 transformation allows GCC to optimize or even eliminate branches based
13688 on the known return value of these functions called with arguments that
13689 are either constant, or whose values are known to be in a range that
13690 makes determining the exact return value possible.  For example, when
13691 @option{-fprintf-return-value} is in effect, both the branch and the
13692 body of the @code{if} statement (but not the call to @code{snprint})
13693 can be optimized away when @code{i} is a 32-bit or smaller integer
13694 because the return value is guaranteed to be at most 8.
13696 @smallexample
13697 char buf[9];
13698 if (snprintf (buf, "%08x", i) >= sizeof buf)
13699   @dots{}
13700 @end smallexample
13702 The @option{-fprintf-return-value} option relies on other optimizations
13703 and yields best results with @option{-O2} and above.  It works in tandem
13704 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
13705 options.  The @option{-fprintf-return-value} option is enabled by default.
13707 @opindex fno-peephole
13708 @opindex fpeephole
13709 @opindex fno-peephole2
13710 @opindex fpeephole2
13711 @item -fno-peephole
13712 @itemx -fno-peephole2
13713 Disable any machine-specific peephole optimizations.  The difference
13714 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
13715 are implemented in the compiler; some targets use one, some use the
13716 other, a few use both.
13718 @option{-fpeephole} is enabled by default.
13719 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13721 @opindex fno-guess-branch-probability
13722 @opindex fguess-branch-probability
13723 @item -fno-guess-branch-probability
13724 Do not guess branch probabilities using heuristics.
13726 GCC uses heuristics to guess branch probabilities if they are
13727 not provided by profiling feedback (@option{-fprofile-arcs}).  These
13728 heuristics are based on the control flow graph.  If some branch probabilities
13729 are specified by @code{__builtin_expect}, then the heuristics are
13730 used to guess branch probabilities for the rest of the control flow graph,
13731 taking the @code{__builtin_expect} info into account.  The interactions
13732 between the heuristics and @code{__builtin_expect} can be complex, and in
13733 some cases, it may be useful to disable the heuristics so that the effects
13734 of @code{__builtin_expect} are easier to understand.
13736 It is also possible to specify expected probability of the expression
13737 with @code{__builtin_expect_with_probability} built-in function.
13739 The default is @option{-fguess-branch-probability} at levels
13740 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
13742 @opindex freorder-blocks
13743 @item -freorder-blocks
13744 Reorder basic blocks in the compiled function in order to reduce number of
13745 taken branches and improve code locality.
13747 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
13749 @opindex freorder-blocks-algorithm
13750 @item -freorder-blocks-algorithm=@var{algorithm}
13751 Use the specified algorithm for basic block reordering.  The
13752 @var{algorithm} argument can be @samp{simple}, which does not increase
13753 code size (except sometimes due to secondary effects like alignment),
13754 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
13755 put all often executed code together, minimizing the number of branches
13756 executed by making extra copies of code.
13758 The default is @samp{simple} at levels @option{-O1}, @option{-Os}, and
13759 @samp{stc} at levels @option{-O2}, @option{-O3}.
13761 @opindex freorder-blocks-and-partition
13762 @item -freorder-blocks-and-partition
13763 In addition to reordering basic blocks in the compiled function, in order
13764 to reduce number of taken branches, partitions hot and cold basic blocks
13765 into separate sections of the assembly and @file{.o} files, to improve
13766 paging and cache locality performance.
13768 This optimization is automatically turned off in the presence of
13769 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
13770 section attribute and on any architecture that does not support named
13771 sections.  When @option{-fsplit-stack} is used this option is not
13772 enabled by default (to avoid linker errors), but may be enabled
13773 explicitly (if using a working linker).
13775 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
13777 @opindex freorder-functions
13778 @item -freorder-functions
13779 Reorder functions in the object file in order to
13780 improve code locality.  This is implemented by using special
13781 subsections @code{.text.hot} for most frequently executed functions and
13782 @code{.text.unlikely} for unlikely executed functions.  Reordering is done by
13783 the linker so object file format must support named sections and linker must
13784 place them in a reasonable way.
13786 This option isn't effective unless you either provide profile feedback
13787 (see @option{-fprofile-arcs} for details) or manually annotate functions with 
13788 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
13790 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
13792 @opindex fstrict-aliasing
13793 @item -fstrict-aliasing
13794 Allow the compiler to assume the strictest aliasing rules applicable to
13795 the language being compiled.  For C (and C++), this activates
13796 optimizations based on the type of expressions.  In particular, an
13797 object of one type is assumed never to reside at the same address as an
13798 object of a different type, unless the types are almost the same.  For
13799 example, an @code{unsigned int} can alias an @code{int}, but not a
13800 @code{void*} or a @code{double}.  A character type may alias any other
13801 type.
13803 @anchor{Type-punning}Pay special attention to code like this:
13804 @smallexample
13805 union a_union @{
13806   int i;
13807   double d;
13810 int f() @{
13811   union a_union t;
13812   t.d = 3.0;
13813   return t.i;
13815 @end smallexample
13816 The practice of reading from a different union member than the one most
13817 recently written to (called ``type-punning'') is common.  Even with
13818 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
13819 is accessed through the union type.  So, the code above works as
13820 expected.  @xref{Structures unions enumerations and bit-fields
13821 implementation}.  However, this code might not:
13822 @smallexample
13823 int f() @{
13824   union a_union t;
13825   int* ip;
13826   t.d = 3.0;
13827   ip = &t.i;
13828   return *ip;
13830 @end smallexample
13832 Similarly, access by taking the address, casting the resulting pointer
13833 and dereferencing the result has undefined behavior, even if the cast
13834 uses a union type, e.g.:
13835 @smallexample
13836 int f() @{
13837   double d = 3.0;
13838   return ((union a_union *) &d)->i;
13840 @end smallexample
13842 The @option{-fstrict-aliasing} option is enabled at levels
13843 @option{-O2}, @option{-O3}, @option{-Os}.
13845 @opindex fipa-strict-aliasing
13846 @item -fipa-strict-aliasing
13847 Controls whether rules of @option{-fstrict-aliasing} are applied across
13848 function boundaries.  Note that if multiple functions gets inlined into a
13849 single function the memory accesses are no longer considered to be crossing a
13850 function boundary.
13852 The @option{-fipa-strict-aliasing} option is enabled by default and is
13853 effective only in combination with @option{-fstrict-aliasing}.
13855 @opindex falign-functions
13856 @item -falign-functions
13857 @itemx -falign-functions=@var{n}
13858 @itemx -falign-functions=@var{n}:@var{m}
13859 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
13860 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
13861 Align the start of functions to the next power-of-two greater than or
13862 equal to @var{n}, skipping up to @var{m}-1 bytes.  This ensures that at
13863 least the first @var{m} bytes of the function can be fetched by the CPU
13864 without crossing an @var{n}-byte alignment boundary.
13866 If @var{m} is not specified, it defaults to @var{n}.
13868 Examples: @option{-falign-functions=32} aligns functions to the next
13869 32-byte boundary, @option{-falign-functions=24} aligns to the next
13870 32-byte boundary only if this can be done by skipping 23 bytes or less,
13871 @option{-falign-functions=32:7} aligns to the next
13872 32-byte boundary only if this can be done by skipping 6 bytes or less.
13874 The second pair of @var{n2}:@var{m2} values allows you to specify
13875 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
13876 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
13877 otherwise aligns to the next 32-byte boundary if this can be done
13878 by skipping 2 bytes or less.
13879 If @var{m2} is not specified, it defaults to @var{n2}.
13881 Some assemblers only support this flag when @var{n} is a power of two;
13882 in that case, it is rounded up.
13884 @option{-fno-align-functions} and @option{-falign-functions=1} are
13885 equivalent and mean that functions are not aligned.
13887 If @var{n} is not specified or is zero, use a machine-dependent default.
13888 The maximum allowed @var{n} option value is 65536.
13890 Enabled at levels @option{-O2}, @option{-O3}.
13892 @item -flimit-function-alignment
13893 If this option is enabled, the compiler tries to avoid unnecessarily
13894 overaligning functions. It attempts to instruct the assembler to align
13895 by the amount specified by @option{-falign-functions}, but not to
13896 skip more bytes than the size of the function.
13898 @opindex falign-labels
13899 @item -falign-labels
13900 @itemx -falign-labels=@var{n}
13901 @itemx -falign-labels=@var{n}:@var{m}
13902 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
13903 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
13904 Align all branch targets to a power-of-two boundary.
13906 Parameters of this option are analogous to the @option{-falign-functions} option.
13907 @option{-fno-align-labels} and @option{-falign-labels=1} are
13908 equivalent and mean that labels are not aligned.
13910 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
13911 are greater than this value, then their values are used instead.
13913 If @var{n} is not specified or is zero, use a machine-dependent default
13914 which is very likely to be @samp{1}, meaning no alignment.
13915 The maximum allowed @var{n} option value is 65536.
13917 Enabled at levels @option{-O2}, @option{-O3}.
13919 @opindex falign-loops
13920 @item -falign-loops
13921 @itemx -falign-loops=@var{n}
13922 @itemx -falign-loops=@var{n}:@var{m}
13923 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
13924 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
13925 Align loops to a power-of-two boundary.  If the loops are executed
13926 many times, this makes up for any execution of the dummy padding
13927 instructions.
13929 If @option{-falign-labels} is greater than this value, then its value
13930 is used instead.
13932 Parameters of this option are analogous to the @option{-falign-functions} option.
13933 @option{-fno-align-loops} and @option{-falign-loops=1} are
13934 equivalent and mean that loops are not aligned.
13935 The maximum allowed @var{n} option value is 65536.
13937 If @var{n} is not specified or is zero, use a machine-dependent default.
13939 Enabled at levels @option{-O2}, @option{-O3}.
13941 @opindex falign-jumps
13942 @item -falign-jumps
13943 @itemx -falign-jumps=@var{n}
13944 @itemx -falign-jumps=@var{n}:@var{m}
13945 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
13946 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
13947 Align branch targets to a power-of-two boundary, for branch targets
13948 where the targets can only be reached by jumping.  In this case,
13949 no dummy operations need be executed.
13951 If @option{-falign-labels} is greater than this value, then its value
13952 is used instead.
13954 Parameters of this option are analogous to the @option{-falign-functions} option.
13955 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
13956 equivalent and mean that loops are not aligned.
13958 If @var{n} is not specified or is zero, use a machine-dependent default.
13959 The maximum allowed @var{n} option value is 65536.
13961 Enabled at levels @option{-O2}, @option{-O3}.
13963 @opindex fno-allocation-dce
13964 @item -fno-allocation-dce
13965 Do not remove unused C++ allocations in dead code elimination.
13967 @opindex fallow-store-data-races
13968 @item -fallow-store-data-races
13969 Allow the compiler to perform optimizations that may introduce new data races
13970 on stores, without proving that the variable cannot be concurrently accessed
13971 by other threads.  Does not affect optimization of local data.  It is safe to
13972 use this option if it is known that global data will not be accessed by
13973 multiple threads.
13975 Examples of optimizations enabled by @option{-fallow-store-data-races} include
13976 hoisting or if-conversions that may cause a value that was already in memory
13977 to be re-written with that same value.  Such re-writing is safe in a single
13978 threaded context but may be unsafe in a multi-threaded context.  Note that on
13979 some processors, if-conversions may be required in order to enable
13980 vectorization.
13982 Enabled at level @option{-Ofast}.
13984 @opindex funit-at-a-time
13985 @item -funit-at-a-time
13986 This option is left for compatibility reasons. @option{-funit-at-a-time}
13987 has no effect, while @option{-fno-unit-at-a-time} implies
13988 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
13990 Enabled by default.
13992 @opindex fno-toplevel-reorder
13993 @opindex ftoplevel-reorder
13994 @item -fno-toplevel-reorder
13995 Do not reorder top-level functions, variables, and @code{asm}
13996 statements.  Output them in the same order that they appear in the
13997 input file.  When this option is used, unreferenced static variables
13998 are not removed.  This option is intended to support existing code
13999 that relies on a particular ordering.  For new code, it is better to
14000 use attributes when possible.
14002 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
14003 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
14004 Additionally @option{-fno-toplevel-reorder} implies
14005 @option{-fno-section-anchors}.
14007 @opindex funreachable-traps
14008 @item -funreachable-traps
14009 With this option, the compiler turns calls to
14010 @code{__builtin_unreachable} into traps, instead of using them for
14011 optimization.  This also affects any such calls implicitly generated
14012 by the compiler.
14014 This option has the same effect as @option{-fsanitize=unreachable
14015 -fsanitize-trap=unreachable}, but does not affect the values of those
14016 options.  If @option{-fsanitize=unreachable} is enabled, that option
14017 takes priority over this one.
14019 This option is enabled by default at @option{-O0} and @option{-Og}.
14021 @opindex fweb
14022 @item -fweb
14023 Constructs webs as commonly used for register allocation purposes and assign
14024 each web individual pseudo register.  This allows the register allocation pass
14025 to operate on pseudos directly, but also strengthens several other optimization
14026 passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
14027 however, make debugging impossible, since variables no longer stay in a
14028 ``home register''.
14030 Enabled by default with @option{-funroll-loops}.
14032 @opindex fwhole-program
14033 @item -fwhole-program
14034 Assume that the current compilation unit represents the whole program being
14035 compiled.  All public functions and variables with the exception of @code{main}
14036 and those merged by attribute @code{externally_visible} become static functions
14037 and in effect are optimized more aggressively by interprocedural optimizers.
14039 With @option{-flto} this option has a limited use.  In most cases the
14040 precise list of symbols used or exported from the binary is known the
14041 resolution info passed to the link-time optimizer by the linker plugin.  It is
14042 still useful if no linker plugin is used or during incremental link step when
14043 final code is produced (with @option{-flto}
14044 @option{-flinker-output=nolto-rel}).
14046 @opindex flto
14047 @item -flto[=@var{n}]
14048 This option runs the standard link-time optimizer.  When invoked
14049 with source code, it generates GIMPLE (one of GCC's internal
14050 representations) and writes it to special ELF sections in the object
14051 file.  When the object files are linked together, all the function
14052 bodies are read from these ELF sections and instantiated as if they
14053 had been part of the same translation unit.
14055 To use the link-time optimizer, @option{-flto} and optimization
14056 options should be specified at compile time and during the final link.
14057 It is recommended that you compile all the files participating in the
14058 same link with the same options and also specify those options at
14059 link time.  
14060 For example:
14062 @smallexample
14063 gcc -c -O2 -flto foo.c
14064 gcc -c -O2 -flto bar.c
14065 gcc -o myprog -flto -O2 foo.o bar.o
14066 @end smallexample
14068 The first two invocations to GCC save a bytecode representation
14069 of GIMPLE into special ELF sections inside @file{foo.o} and
14070 @file{bar.o}.  The final invocation reads the GIMPLE bytecode from
14071 @file{foo.o} and @file{bar.o}, merges the two files into a single
14072 internal image, and compiles the result as usual.  Since both
14073 @file{foo.o} and @file{bar.o} are merged into a single image, this
14074 causes all the interprocedural analyses and optimizations in GCC to
14075 work across the two files as if they were a single one.  This means,
14076 for example, that the inliner is able to inline functions in
14077 @file{bar.o} into functions in @file{foo.o} and vice-versa.
14079 Another (simpler) way to enable link-time optimization is:
14081 @smallexample
14082 gcc -o myprog -flto -O2 foo.c bar.c
14083 @end smallexample
14085 The above generates bytecode for @file{foo.c} and @file{bar.c},
14086 merges them together into a single GIMPLE representation and optimizes
14087 them as usual to produce @file{myprog}.
14089 The important thing to keep in mind is that to enable link-time
14090 optimizations you need to use the GCC driver to perform the link step.
14091 GCC automatically performs link-time optimization if any of the
14092 objects involved were compiled with the @option{-flto} command-line option.  
14093 You can always override
14094 the automatic decision to do link-time optimization
14095 by passing @option{-fno-lto} to the link command.
14097 To make whole program optimization effective, it is necessary to make
14098 certain whole program assumptions.  The compiler needs to know
14099 what functions and variables can be accessed by libraries and runtime
14100 outside of the link-time optimized unit.  When supported by the linker,
14101 the linker plugin (see @option{-fuse-linker-plugin}) passes information
14102 to the compiler about used and externally visible symbols.  When
14103 the linker plugin is not available, @option{-fwhole-program} should be
14104 used to allow the compiler to make these assumptions, which leads
14105 to more aggressive optimization decisions.
14107 When a file is compiled with @option{-flto} without
14108 @option{-fuse-linker-plugin}, the generated object file is larger than
14109 a regular object file because it contains GIMPLE bytecodes and the usual
14110 final code (see @option{-ffat-lto-objects}).  This means that
14111 object files with LTO information can be linked as normal object
14112 files; if @option{-fno-lto} is passed to the linker, no
14113 interprocedural optimizations are applied.  Note that when
14114 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
14115 but you cannot perform a regular, non-LTO link on them.
14117 When producing the final binary, GCC only
14118 applies link-time optimizations to those files that contain bytecode.
14119 Therefore, you can mix and match object files and libraries with
14120 GIMPLE bytecodes and final object code.  GCC automatically selects
14121 which files to optimize in LTO mode and which files to link without
14122 further processing.
14124 Generally, options specified at link time override those
14125 specified at compile time, although in some cases GCC attempts to infer
14126 link-time options from the settings used to compile the input files.
14128 If you do not specify an optimization level option @option{-O} at
14129 link time, then GCC uses the highest optimization level 
14130 used when compiling the object files.  Note that it is generally 
14131 ineffective to specify an optimization level option only at link time and 
14132 not at compile time, for two reasons.  First, compiling without 
14133 optimization suppresses compiler passes that gather information 
14134 needed for effective optimization at link time.  Second, some early
14135 optimization passes can be performed only at compile time and 
14136 not at link time.
14138 There are some code generation flags preserved by GCC when
14139 generating bytecodes, as they need to be used during the final link.
14140 Currently, the following options and their settings are taken from
14141 the first object file that explicitly specifies them: 
14142 @option{-fcommon}, @option{-fexceptions}, @option{-fnon-call-exceptions},
14143 @option{-fgnu-tm} and all the @option{-m} target flags.
14145 The following options @option{-fPIC}, @option{-fpic}, @option{-fpie} and
14146 @option{-fPIE} are combined based on the following scheme:
14148 @smallexample
14149 @option{-fPIC} + @option{-fpic} = @option{-fpic}
14150 @option{-fPIC} + @option{-fno-pic} = @option{-fno-pic}
14151 @option{-fpic/-fPIC} + (no option) = (no option)
14152 @option{-fPIC} + @option{-fPIE} = @option{-fPIE}
14153 @option{-fpic} + @option{-fPIE} = @option{-fpie}
14154 @option{-fPIC/-fpic} + @option{-fpie} = @option{-fpie}
14155 @end smallexample
14157 Certain ABI-changing flags are required to match in all compilation units,
14158 and trying to override this at link time with a conflicting value
14159 is ignored.  This includes options such as @option{-freg-struct-return}
14160 and @option{-fpcc-struct-return}. 
14162 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
14163 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
14164 are passed through to the link stage and merged conservatively for
14165 conflicting translation units.  Specifically
14166 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
14167 precedence; and for example @option{-ffp-contract=off} takes precedence
14168 over @option{-ffp-contract=fast}.  You can override them at link time.
14170 Diagnostic options such as @option{-Wstringop-overflow} are passed
14171 through to the link stage and their setting matches that of the
14172 compile-step at function granularity.  Note that this matters only
14173 for diagnostics emitted during optimization.  Note that code
14174 transforms such as inlining can lead to warnings being enabled
14175 or disabled for regions if code not consistent with the setting
14176 at compile time.
14178 When you need to pass options to the assembler via @option{-Wa} or
14179 @option{-Xassembler} make sure to either compile such translation
14180 units with @option{-fno-lto} or consistently use the same assembler
14181 options on all translation units.  You can alternatively also
14182 specify assembler options at LTO link time.
14184 To enable debug info generation you need to supply @option{-g} at
14185 compile time.  If any of the input files at link time were built
14186 with debug info generation enabled the link will enable debug info
14187 generation as well.  Any elaborate debug info settings
14188 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
14189 at the linker command line and mixing different settings in different
14190 translation units is discouraged.
14192 If LTO encounters objects with C linkage declared with incompatible
14193 types in separate translation units to be linked together (undefined
14194 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
14195 issued.  The behavior is still undefined at run time.  Similar
14196 diagnostics may be raised for other languages.
14198 Another feature of LTO is that it is possible to apply interprocedural
14199 optimizations on files written in different languages:
14201 @smallexample
14202 gcc -c -flto foo.c
14203 g++ -c -flto bar.cc
14204 gfortran -c -flto baz.f90
14205 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
14206 @end smallexample
14208 Notice that the final link is done with @command{g++} to get the C++
14209 runtime libraries and @option{-lgfortran} is added to get the Fortran
14210 runtime libraries.  In general, when mixing languages in LTO mode, you
14211 should use the same link command options as when mixing languages in a
14212 regular (non-LTO) compilation.
14214 If object files containing GIMPLE bytecode are stored in a library archive, say
14215 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
14216 are using a linker with plugin support.  To create static libraries suitable
14217 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
14218 and @command{ranlib}; 
14219 to show the symbols of object files with GIMPLE bytecode, use
14220 @command{gcc-nm}.  Those commands require that @command{ar}, @command{ranlib}
14221 and @command{nm} have been compiled with plugin support.  At link time, use the
14222 flag @option{-fuse-linker-plugin} to ensure that the library participates in
14223 the LTO optimization process:
14225 @smallexample
14226 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
14227 @end smallexample
14229 With the linker plugin enabled, the linker extracts the needed
14230 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
14231 to make them part of the aggregated GIMPLE image to be optimized.
14233 If you are not using a linker with plugin support and/or do not
14234 enable the linker plugin, then the objects inside @file{libfoo.a}
14235 are extracted and linked as usual, but they do not participate
14236 in the LTO optimization process.  In order to make a static library suitable
14237 for both LTO optimization and usual linkage, compile its object files with
14238 @option{-flto} @option{-ffat-lto-objects}.
14240 Link-time optimizations do not require the presence of the whole program to
14241 operate.  If the program does not require any symbols to be exported, it is
14242 possible to combine @option{-flto} and @option{-fwhole-program} to allow
14243 the interprocedural optimizers to use more aggressive assumptions which may
14244 lead to improved optimization opportunities.
14245 Use of @option{-fwhole-program} is not needed when linker plugin is
14246 active (see @option{-fuse-linker-plugin}).
14248 The current implementation of LTO makes no
14249 attempt to generate bytecode that is portable between different
14250 types of hosts.  The bytecode files are versioned and there is a
14251 strict version check, so bytecode files generated in one version of
14252 GCC do not work with an older or newer version of GCC.
14254 Link-time optimization does not work well with generation of debugging
14255 information on systems other than those using a combination of ELF and
14256 DWARF.
14258 If you specify the optional @var{n}, the optimization and code
14259 generation done at link time is executed in parallel using @var{n}
14260 parallel jobs by utilizing an installed @command{make} program.  The
14261 environment variable @env{MAKE} may be used to override the program
14262 used.
14264 You can also specify @option{-flto=jobserver} to use GNU make's
14265 job server mode to determine the number of parallel jobs. This
14266 is useful when the Makefile calling GCC is already executing in parallel.
14267 You must prepend a @samp{+} to the command recipe in the parent Makefile
14268 for this to work.  This option likely only works if @env{MAKE} is
14269 GNU make.  Even without the option value, GCC tries to automatically
14270 detect a running GNU make's job server.
14272 Use @option{-flto=auto} to use GNU make's job server, if available,
14273 or otherwise fall back to autodetection of the number of CPU threads
14274 present in your system.
14276 @opindex flto-partition
14277 @item -flto-partition=@var{alg}
14278 Specify the partitioning algorithm used by the link-time optimizer.
14279 The value is either @samp{1to1} to specify a partitioning mirroring
14280 the original source files or @samp{balanced} to specify partitioning
14281 into equally sized chunks (whenever possible) or @samp{max} to create
14282 new partition for every symbol where possible.  Specifying @samp{none}
14283 as an algorithm disables partitioning and streaming completely. 
14284 The default value is @samp{balanced}. While @samp{1to1} can be used
14285 as an workaround for various code ordering issues, the @samp{max}
14286 partitioning is intended for internal testing only.
14287 The value @samp{one} specifies that exactly one partition should be
14288 used while the value @samp{none} bypasses partitioning and executes
14289 the link-time optimization step directly from the WPA phase.
14291 @opindex flto-compression-level
14292 @item -flto-compression-level=@var{n}
14293 This option specifies the level of compression used for intermediate
14294 language written to LTO object files, and is only meaningful in
14295 conjunction with LTO mode (@option{-flto}).  GCC currently supports two
14296 LTO compression algorithms. For zstd, valid values are 0 (no compression)
14297 to 19 (maximum compression), while zlib supports values from 0 to 9.
14298 Values outside this range are clamped to either minimum or maximum
14299 of the supported values.  If the option is not given,
14300 a default balanced compression setting is used.
14302 @opindex fuse-linker-plugin
14303 @item -fuse-linker-plugin
14304 Enables the use of a linker plugin during link-time optimization.  This
14305 option relies on plugin support in the linker, which is available in gold
14306 or in GNU ld 2.21 or newer.
14308 This option enables the extraction of object files with GIMPLE bytecode out
14309 of library archives. This improves the quality of optimization by exposing
14310 more code to the link-time optimizer.  This information specifies what
14311 symbols can be accessed externally (by non-LTO object or during dynamic
14312 linking).  Resulting code quality improvements on binaries (and shared
14313 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
14314 See @option{-flto} for a description of the effect of this flag and how to
14315 use it.
14317 This option is enabled by default when LTO support in GCC is enabled
14318 and GCC was configured for use with
14319 a linker supporting plugins (GNU ld 2.21 or newer or gold).
14321 @opindex ffat-lto-objects
14322 @item -ffat-lto-objects
14323 Fat LTO objects are object files that contain both the intermediate language
14324 and the object code. This makes them usable for both LTO linking and normal
14325 linking. This option is effective only when compiling with @option{-flto}
14326 and is ignored at link time.
14328 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
14329 requires the complete toolchain to be aware of LTO. It requires a linker with
14330 linker plugin support for basic functionality.  Additionally,
14331 @command{nm}, @command{ar} and @command{ranlib}
14332 need to support linker plugins to allow a full-featured build environment
14333 (capable of building static libraries etc).  GCC provides the @command{gcc-ar},
14334 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
14335 to these tools. With non fat LTO makefiles need to be modified to use them.
14337 Note that modern binutils provide plugin auto-load mechanism.
14338 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
14339 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
14340 @command{gcc-ranlib}).
14342 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
14343 support.
14345 @opindex fcompare-elim
14346 @item -fcompare-elim
14347 After register allocation and post-register allocation instruction splitting,
14348 identify arithmetic instructions that compute processor flags similar to a
14349 comparison operation based on that arithmetic.  If possible, eliminate the
14350 explicit comparison operation.
14352 This pass only applies to certain targets that cannot explicitly represent
14353 the comparison operation before register allocation is complete.
14355 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14357 @opindex fcprop-registers
14358 @item -fcprop-registers
14359 After register allocation and post-register allocation instruction splitting,
14360 perform a copy-propagation pass to try to reduce scheduling dependencies
14361 and occasionally eliminate the copy.
14363 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3}, @option{-Os}.
14365 @opindex fprofile-correction
14366 @item -fprofile-correction
14367 Profiles collected using an instrumented binary for multi-threaded programs may
14368 be inconsistent due to missed counter updates. When this option is specified,
14369 GCC uses heuristics to correct or smooth out such inconsistencies. By
14370 default, GCC emits an error message when an inconsistent profile is detected.
14372 This option is enabled by @option{-fauto-profile}.
14374 @opindex fprofile-partial-training
14375 @item -fprofile-partial-training
14376 With @code{-fprofile-use} all portions of programs not executed during train
14377 run are optimized agressively for size rather than speed.  In some cases it is
14378 not practical to train all possible hot paths in the program. (For
14379 example, program may contain functions specific for a given hardware and
14380 trianing may not cover all hardware configurations program is run on.)  With
14381 @code{-fprofile-partial-training} profile feedback will be ignored for all
14382 functions not executed during the train run leading them to be optimized as if
14383 they were compiled without profile feedback. This leads to better performance
14384 when train run is not representative but also leads to significantly bigger
14385 code.
14387 @opindex fprofile-use
14388 @item -fprofile-use
14389 @itemx -fprofile-use=@var{path}
14390 Enable profile feedback-directed optimizations, 
14391 and the following optimizations, many of which
14392 are generally profitable only with profile feedback available:
14394 @gccoptlist{-fbranch-probabilities  -fprofile-values
14395 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14396 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14397 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14398 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14399 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14400 -fprofile-reorder-functions}
14402 Before you can use this option, you must first generate profiling information.
14403 @xref{Instrumentation Options}, for information about the
14404 @option{-fprofile-generate} option.
14406 By default, GCC emits an error message if the feedback profiles do not
14407 match the source code.  This error can be turned into a warning by using
14408 @option{-Wno-error=coverage-mismatch}.  Note this may result in poorly
14409 optimized code.  Additionally, by default, GCC also emits a warning message if
14410 the feedback profiles do not exist (see @option{-Wmissing-profile}).
14412 If @var{path} is specified, GCC looks at the @var{path} to find
14413 the profile feedback data files. See @option{-fprofile-dir}.
14415 @opindex fauto-profile
14416 @item -fauto-profile
14417 @itemx -fauto-profile=@var{path}
14418 Enable sampling-based feedback-directed optimizations, 
14419 and the following optimizations,
14420 many of which are generally profitable only with profile feedback available:
14422 @gccoptlist{-fbranch-probabilities  -fprofile-values
14423 -funroll-loops  -fpeel-loops  -ftracer  -fvpt
14424 -finline-functions  -fipa-cp  -fipa-cp-clone  -fipa-bit-cp
14425 -fpredictive-commoning  -fsplit-loops  -funswitch-loops
14426 -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize
14427 -fvect-cost-model=dynamic  -ftree-loop-distribute-patterns
14428 -fprofile-correction}
14430 @var{path} is the name of a file containing AutoFDO profile information.
14431 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
14433 Producing an AutoFDO profile data file requires running your program
14434 with the @command{perf} utility on a supported GNU/Linux target system.
14435 For more information, see @uref{https://perf.wiki.kernel.org/}.
14437 E.g.
14438 @smallexample
14439 perf record -e br_inst_retired:near_taken -b -o perf.data \
14440     -- your_program
14441 @end smallexample
14443 Then use the @command{create_gcov} tool to convert the raw profile data
14444 to a format that can be used by GCC.@  You must also supply the 
14445 unstripped binary for your program to this tool.  
14446 See @uref{https://github.com/google/autofdo}.
14448 E.g.
14449 @smallexample
14450 create_gcov --binary=your_program.unstripped --profile=perf.data \
14451     --gcov=profile.afdo
14452 @end smallexample
14453 @end table
14455 The following options control compiler behavior regarding floating-point 
14456 arithmetic.  These options trade off between speed and
14457 correctness.  All must be specifically enabled.
14459 @table @gcctabopt
14460 @opindex ffloat-store
14461 @item -ffloat-store
14462 Do not store floating-point variables in registers, and inhibit other
14463 options that might change whether a floating-point value is taken from a
14464 register or memory.
14466 @cindex floating-point precision
14467 This option prevents undesirable excess precision on machines such as
14468 the 68000 where the floating registers (of the 68881) keep more
14469 precision than a @code{double} is supposed to have.  Similarly for the
14470 x86 architecture.  For most programs, the excess precision does only
14471 good, but a few programs rely on the precise definition of IEEE floating
14472 point.  Use @option{-ffloat-store} for such programs, after modifying
14473 them to store all pertinent intermediate computations into variables.
14475 @opindex fexcess-precision
14476 @item -fexcess-precision=@var{style}
14477 This option allows further control over excess precision on machines
14478 where floating-point operations occur in a format with more precision or
14479 range than the IEEE standard and interchange floating-point types.  By
14480 default, @option{-fexcess-precision=fast} is in effect; this means that
14481 operations may be carried out in a wider precision than the types specified
14482 in the source if that would result in faster code, and it is unpredictable
14483 when rounding to the types specified in the source code takes place.
14484 When compiling C or C++, if @option{-fexcess-precision=standard} is specified
14485 then excess precision follows the rules specified in ISO C99 or C++; in particular,
14486 both casts and assignments cause values to be rounded to their
14487 semantic types (whereas @option{-ffloat-store} only affects
14488 assignments).  This option is enabled by default for C or C++ if a strict
14489 conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
14490 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
14491 regardless of whether a strict conformance option is used.
14493 @opindex mfpmath
14494 @option{-fexcess-precision=standard} is not implemented for languages
14495 other than C or C++.  On the x86, it has no effect if @option{-mfpmath=sse}
14496 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
14497 semantics apply without excess precision, and in the latter, rounding
14498 is unpredictable.
14500 @opindex ffast-math
14501 @item -ffast-math
14502 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
14503 @option{-ffinite-math-only}, @option{-fno-rounding-math},
14504 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
14505 @option{-fexcess-precision=fast}.
14507 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
14509 This option is not turned on by any @option{-O} option besides
14510 @option{-Ofast} since it can result in incorrect output for programs
14511 that depend on an exact implementation of IEEE or ISO rules/specifications
14512 for math functions. It may, however, yield faster code for programs
14513 that do not require the guarantees of these specifications.
14515 @opindex fno-math-errno
14516 @opindex fmath-errno
14517 @item -fno-math-errno
14518 Do not set @code{errno} after calling math functions that are executed
14519 with a single instruction, e.g., @code{sqrt}.  A program that relies on
14520 IEEE exceptions for math error handling may want to use this flag
14521 for speed while maintaining IEEE arithmetic compatibility.
14523 This option is not turned on by any @option{-O} option since
14524 it can result in incorrect output for programs that depend on
14525 an exact implementation of IEEE or ISO rules/specifications for
14526 math functions. It may, however, yield faster code for programs
14527 that do not require the guarantees of these specifications.
14529 The default is @option{-fmath-errno}.
14531 On Darwin systems, the math library never sets @code{errno}.  There is
14532 therefore no reason for the compiler to consider the possibility that
14533 it might, and @option{-fno-math-errno} is the default.
14535 @opindex funsafe-math-optimizations
14536 @item -funsafe-math-optimizations
14538 Allow optimizations for floating-point arithmetic that (a) assume
14539 that arguments and results are valid and (b) may violate IEEE or
14540 ANSI standards.  When used at link time, it may include libraries
14541 or startup files that change the default FPU control word or other
14542 similar optimizations.
14544 This option is not turned on by any @option{-O} option since
14545 it can result in incorrect output for programs that depend on
14546 an exact implementation of IEEE or ISO rules/specifications for
14547 math functions. It may, however, yield faster code for programs
14548 that do not require the guarantees of these specifications.
14549 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
14550 @option{-fassociative-math} and @option{-freciprocal-math}.
14552 The default is @option{-fno-unsafe-math-optimizations}.
14554 @opindex fassociative-math
14555 @item -fassociative-math
14557 Allow re-association of operands in series of floating-point operations.
14558 This violates the ISO C and C++ language standard by possibly changing
14559 computation result.  NOTE: re-ordering may change the sign of zero as
14560 well as ignore NaNs and inhibit or create underflow or overflow (and
14561 thus cannot be used on code that relies on rounding behavior like
14562 @code{(x + 2**52) - 2**52}.  May also reorder floating-point comparisons
14563 and thus may not be used when ordered comparisons are required.
14564 This option requires that both @option{-fno-signed-zeros} and
14565 @option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
14566 much sense with @option{-frounding-math}. For Fortran the option
14567 is automatically enabled when both @option{-fno-signed-zeros} and
14568 @option{-fno-trapping-math} are in effect.
14570 The default is @option{-fno-associative-math}.
14572 @opindex freciprocal-math
14573 @item -freciprocal-math
14575 Allow the reciprocal of a value to be used instead of dividing by
14576 the value if this enables optimizations.  For example @code{x / y}
14577 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
14578 is subject to common subexpression elimination.  Note that this loses
14579 precision and increases the number of flops operating on the value.
14581 The default is @option{-fno-reciprocal-math}.
14583 @opindex ffinite-math-only
14584 @item -ffinite-math-only
14585 Allow optimizations for floating-point arithmetic that assume
14586 that arguments and results are not NaNs or +-Infs.
14588 This option is not turned on by any @option{-O} option since
14589 it can result in incorrect output for programs that depend on
14590 an exact implementation of IEEE or ISO rules/specifications for
14591 math functions. It may, however, yield faster code for programs
14592 that do not require the guarantees of these specifications.
14594 The default is @option{-fno-finite-math-only}.
14596 @opindex fno-signed-zeros
14597 @opindex fsigned-zeros
14598 @item -fno-signed-zeros
14599 Allow optimizations for floating-point arithmetic that ignore the
14600 signedness of zero.  IEEE arithmetic specifies the behavior of
14601 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
14602 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
14603 This option implies that the sign of a zero result isn't significant.
14605 The default is @option{-fsigned-zeros}.
14607 @opindex fno-trapping-math
14608 @opindex ftrapping-math
14609 @item -fno-trapping-math
14610 Compile code assuming that floating-point operations cannot generate
14611 user-visible traps.  These traps include division by zero, overflow,
14612 underflow, inexact result and invalid operation.  This option requires
14613 that @option{-fno-signaling-nans} be in effect.  Setting this option may
14614 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
14616 This option should never be turned on by any @option{-O} option since
14617 it can result in incorrect output for programs that depend on
14618 an exact implementation of IEEE or ISO rules/specifications for
14619 math functions.
14621 The default is @option{-ftrapping-math}.
14623 Future versions of GCC may provide finer control of this setting
14624 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14625 will be used along with @option{-frounding-math} to specify the
14626 default state for @code{FENV_ACCESS}.
14628 @opindex frounding-math
14629 @item -frounding-math
14630 Disable transformations and optimizations that assume default floating-point
14631 rounding behavior.  This is round-to-zero for all floating point
14632 to integer conversions, and round-to-nearest for all other arithmetic
14633 truncations.  This option should be specified for programs that change
14634 the FP rounding mode dynamically, or that may be executed with a
14635 non-default rounding mode.  This option disables constant folding of
14636 floating-point expressions at compile time (which may be affected by
14637 rounding mode) and arithmetic transformations that are unsafe in the
14638 presence of sign-dependent rounding modes.
14640 The default is @option{-fno-rounding-math}.
14642 This option is experimental and does not currently guarantee to
14643 disable all GCC optimizations that are affected by rounding mode.
14644 Future versions of GCC may provide finer control of this setting
14645 using C99's @code{FENV_ACCESS} pragma.  This command-line option
14646 will be used along with @option{-ftrapping-math} to specify the
14647 default state for @code{FENV_ACCESS}.
14649 @opindex fsignaling-nans
14650 @item -fsignaling-nans
14651 Compile code assuming that IEEE signaling NaNs may generate user-visible
14652 traps during floating-point operations.  Setting this option disables
14653 optimizations that may change the number of exceptions visible with
14654 signaling NaNs.  This option implies @option{-ftrapping-math}.
14656 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
14657 be defined.
14659 The default is @option{-fno-signaling-nans}.
14661 This option is experimental and does not currently guarantee to
14662 disable all GCC optimizations that affect signaling NaN behavior.
14664 @opindex fno-fp-int-builtin-inexact
14665 @opindex ffp-int-builtin-inexact
14666 @item -fno-fp-int-builtin-inexact
14667 Do not allow the built-in functions @code{ceil}, @code{floor},
14668 @code{round} and @code{trunc}, and their @code{float} and @code{long
14669 double} variants, to generate code that raises the ``inexact''
14670 floating-point exception for noninteger arguments.  ISO C99 and C11
14671 allow these functions to raise the ``inexact'' exception, but ISO/IEC
14672 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
14673 ISO C2X, does not allow these functions to do so.
14675 The default is @option{-ffp-int-builtin-inexact}, allowing the
14676 exception to be raised, unless C2X or a later C standard is selected.
14677 This option does nothing unless @option{-ftrapping-math} is in effect.
14679 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
14680 generate a call to a library function then the ``inexact'' exception
14681 may be raised if the library implementation does not follow TS 18661.
14683 @opindex fsingle-precision-constant
14684 @item -fsingle-precision-constant
14685 Treat floating-point constants as single precision instead of
14686 implicitly converting them to double-precision constants.
14688 @opindex fcx-limited-range
14689 @item -fcx-limited-range
14690 When enabled, this option states that a range reduction step is not
14691 needed when performing complex division.  Also, there is no checking
14692 whether the result of a complex multiplication or division is @code{NaN
14693 + I*NaN}, with an attempt to rescue the situation in that case.  The
14694 default is @option{-fno-cx-limited-range}, but is enabled by
14695 @option{-ffast-math}.
14697 This option controls the default setting of the ISO C99
14698 @code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
14699 all languages.
14701 @opindex fcx-fortran-rules
14702 @item -fcx-fortran-rules
14703 Complex multiplication and division follow Fortran rules.  Range
14704 reduction is done as part of complex division, but there is no checking
14705 whether the result of a complex multiplication or division is @code{NaN
14706 + I*NaN}, with an attempt to rescue the situation in that case.
14708 The default is @option{-fno-cx-fortran-rules}.
14710 @end table
14712 The following options control optimizations that may improve
14713 performance, but are not enabled by any @option{-O} options.  This
14714 section includes experimental options that may produce broken code.
14716 @table @gcctabopt
14717 @opindex fbranch-probabilities
14718 @item -fbranch-probabilities
14719 After running a program compiled with @option{-fprofile-arcs}
14720 (@pxref{Instrumentation Options}),
14721 you can compile it a second time using
14722 @option{-fbranch-probabilities}, to improve optimizations based on
14723 the number of times each branch was taken.  When a program
14724 compiled with @option{-fprofile-arcs} exits, it saves arc execution
14725 counts to a file called @file{@var{sourcename}.gcda} for each source
14726 file.  The information in this data file is very dependent on the
14727 structure of the generated code, so you must use the same source code
14728 and the same optimization options for both compilations.
14729 See details about the file naming in @option{-fprofile-arcs}.
14731 With @option{-fbranch-probabilities}, GCC puts a
14732 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
14733 These can be used to improve optimization.  Currently, they are only
14734 used in one place: in @file{reorg.cc}, instead of guessing which path a
14735 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
14736 exactly determine which path is taken more often.
14738 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14740 @opindex fprofile-values
14741 @item -fprofile-values
14742 If combined with @option{-fprofile-arcs}, it adds code so that some
14743 data about values of expressions in the program is gathered.
14745 With @option{-fbranch-probabilities}, it reads back the data gathered
14746 from profiling values of expressions for usage in optimizations.
14748 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
14749 @option{-fauto-profile}.
14751 @opindex fprofile-reorder-functions
14752 @item -fprofile-reorder-functions
14753 Function reordering based on profile instrumentation collects
14754 first time of execution of a function and orders these functions
14755 in ascending order.
14757 Enabled with @option{-fprofile-use}.
14759 @opindex fvpt
14760 @item -fvpt
14761 If combined with @option{-fprofile-arcs}, this option instructs the compiler
14762 to add code to gather information about values of expressions.
14764 With @option{-fbranch-probabilities}, it reads back the data gathered
14765 and actually performs the optimizations based on them.
14766 Currently the optimizations include specialization of division operations
14767 using the knowledge about the value of the denominator.
14769 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
14771 @opindex frename-registers
14772 @item -frename-registers
14773 Attempt to avoid false dependencies in scheduled code by making use
14774 of registers left over after register allocation.  This optimization
14775 most benefits processors with lots of registers.  Depending on the
14776 debug information format adopted by the target, however, it can
14777 make debugging impossible, since variables no longer stay in
14778 a ``home register''.
14780 Enabled by default with @option{-funroll-loops}.
14782 @opindex fschedule-fusion
14783 @item -fschedule-fusion
14784 Performs a target dependent pass over the instruction stream to schedule
14785 instructions of same type together because target machine can execute them
14786 more efficiently if they are adjacent to each other in the instruction flow.
14788 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
14790 @opindex ftracer
14791 @item -ftracer
14792 Perform tail duplication to enlarge superblock size.  This transformation
14793 simplifies the control flow of the function allowing other optimizations to do
14794 a better job.
14796 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14798 @opindex funroll-loops
14799 @item -funroll-loops
14800 Unroll loops whose number of iterations can be determined at compile time or
14801 upon entry to the loop.  @option{-funroll-loops} implies
14802 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
14803 It also turns on complete loop peeling (i.e.@: complete removal of loops with
14804 a small constant number of iterations).  This option makes code larger, and may
14805 or may not make it run faster.
14807 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14809 @opindex funroll-all-loops
14810 @item -funroll-all-loops
14811 Unroll all loops, even if their number of iterations is uncertain when
14812 the loop is entered.  This usually makes programs run more slowly.
14813 @option{-funroll-all-loops} implies the same options as
14814 @option{-funroll-loops}.
14816 @opindex fpeel-loops
14817 @item -fpeel-loops
14818 Peels loops for which there is enough information that they do not
14819 roll much (from profile feedback or static analysis).  It also turns on
14820 complete loop peeling (i.e.@: complete removal of loops with small constant
14821 number of iterations).
14823 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
14825 @opindex fmove-loop-invariants
14826 @item -fmove-loop-invariants
14827 Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
14828 at level @option{-O1} and higher, except for @option{-Og}.
14830 @opindex fmove-loop-stores
14831 @item -fmove-loop-stores
14832 Enables the loop store motion pass in the GIMPLE loop optimizer.  This
14833 moves invariant stores to after the end of the loop in exchange for
14834 carrying the stored value in a register across the iteration.
14835 Note for this option to have an effect @option{-ftree-loop-im} has to
14836 be enabled as well.  Enabled at level @option{-O1} and higher, except
14837 for @option{-Og}.
14839 @opindex fsplit-loops
14840 @item -fsplit-loops
14841 Split a loop into two if it contains a condition that's always true
14842 for one side of the iteration space and false for the other.
14844 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14846 @opindex funswitch-loops
14847 @item -funswitch-loops
14848 Move branches with loop invariant conditions out of the loop, with duplicates
14849 of the loop on both branches (modified according to result of the condition).
14851 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14853 @opindex fversion-loops-for-strides
14854 @item -fversion-loops-for-strides
14855 If a loop iterates over an array with a variable stride, create another
14856 version of the loop that assumes the stride is always one.  For example:
14858 @smallexample
14859 for (int i = 0; i < n; ++i)
14860   x[i * stride] = @dots{};
14861 @end smallexample
14863 becomes:
14865 @smallexample
14866 if (stride == 1)
14867   for (int i = 0; i < n; ++i)
14868     x[i] = @dots{};
14869 else
14870   for (int i = 0; i < n; ++i)
14871     x[i * stride] = @dots{};
14872 @end smallexample
14874 This is particularly useful for assumed-shape arrays in Fortran where
14875 (for example) it allows better vectorization assuming contiguous accesses.
14876 This flag is enabled by default at @option{-O3}.
14877 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
14879 @opindex ffunction-sections
14880 @opindex fdata-sections
14881 @item -ffunction-sections
14882 @itemx -fdata-sections
14883 Place each function or data item into its own section in the output
14884 file if the target supports arbitrary sections.  The name of the
14885 function or the name of the data item determines the section's name
14886 in the output file.
14888 Use these options on systems where the linker can perform optimizations to
14889 improve locality of reference in the instruction space.  Most systems using the
14890 ELF object format have linkers with such optimizations.  On AIX, the linker
14891 rearranges sections (CSECTs) based on the call graph.  The performance impact
14892 varies.
14894 Together with a linker garbage collection (linker @option{--gc-sections}
14895 option) these options may lead to smaller statically-linked executables (after
14896 stripping).
14898 On ELF/DWARF systems these options do not degenerate the quality of the debug
14899 information.  There could be issues with other object files/debug info formats.
14901 Only use these options when there are significant benefits from doing so.  When
14902 you specify these options, the assembler and linker create larger object and
14903 executable files and are also slower.  These options affect code generation.
14904 They prevent optimizations by the compiler and assembler using relative
14905 locations inside a translation unit since the locations are unknown until
14906 link time.  An example of such an optimization is relaxing calls to short call
14907 instructions.
14909 @opindex fstdarg-opt
14910 @item -fstdarg-opt
14911 Optimize the prologue of variadic argument functions with respect to usage of
14912 those arguments.
14914 @opindex fsection-anchors
14915 @item -fsection-anchors
14916 Try to reduce the number of symbolic address calculations by using
14917 shared ``anchor'' symbols to address nearby objects.  This transformation
14918 can help to reduce the number of GOT entries and GOT accesses on some
14919 targets.
14921 For example, the implementation of the following function @code{foo}:
14923 @smallexample
14924 static int a, b, c;
14925 int foo (void) @{ return a + b + c; @}
14926 @end smallexample
14928 @noindent
14929 usually calculates the addresses of all three variables, but if you
14930 compile it with @option{-fsection-anchors}, it accesses the variables
14931 from a common anchor point instead.  The effect is similar to the
14932 following pseudocode (which isn't valid C):
14934 @smallexample
14935 int foo (void)
14937   register int *xr = &x;
14938   return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
14940 @end smallexample
14942 Not all targets support this option.
14944 @opindex fzero-call-used-regs
14945 @item -fzero-call-used-regs=@var{choice}
14946 Zero call-used registers at function return to increase program
14947 security by either mitigating Return-Oriented Programming (ROP)
14948 attacks or preventing information leakage through registers.
14950 The possible values of @var{choice} are the same as for the
14951 @code{zero_call_used_regs} attribute (@pxref{Function Attributes}).
14952 The default is @samp{skip}.
14954 You can control this behavior for a specific function by using the function
14955 attribute @code{zero_call_used_regs} (@pxref{Function Attributes}).
14957 @opindex param
14958 @item --param @var{name}=@var{value}
14959 In some places, GCC uses various constants to control the amount of
14960 optimization that is done.  For example, GCC does not inline functions
14961 that contain more than a certain number of instructions.  You can
14962 control some of these constants on the command line using the
14963 @option{--param} option.
14965 The names of specific parameters, and the meaning of the values, are
14966 tied to the internals of the compiler, and are subject to change
14967 without notice in future releases.
14969 In order to get the minimal, maximal and default values of a parameter,
14970 use the @option{--help=param -Q} options.
14972 In each case, the @var{value} is an integer.  The following choices
14973 of @var{name} are recognized for all targets:
14975 @table @gcctabopt
14976 @item predictable-branch-outcome
14977 When branch is predicted to be taken with probability lower than this threshold
14978 (in percent), then it is considered well predictable.
14980 @item max-rtl-if-conversion-insns
14981 RTL if-conversion tries to remove conditional branches around a block and
14982 replace them with conditionally executed instructions.  This parameter
14983 gives the maximum number of instructions in a block which should be
14984 considered for if-conversion.  The compiler will
14985 also use other heuristics to decide whether if-conversion is likely to be
14986 profitable.
14988 @item max-rtl-if-conversion-predictable-cost
14989 RTL if-conversion will try to remove conditional branches around a block
14990 and replace them with conditionally executed instructions.  These parameters
14991 give the maximum permissible cost for the sequence that would be generated
14992 by if-conversion depending on whether the branch is statically determined
14993 to be predictable or not.  The units for this parameter are the same as
14994 those for the GCC internal seq_cost metric.  The compiler will try to
14995 provide a reasonable default for this parameter using the BRANCH_COST
14996 target macro.
14998 @item max-crossjump-edges
14999 The maximum number of incoming edges to consider for cross-jumping.
15000 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
15001 the number of edges incoming to each block.  Increasing values mean
15002 more aggressive optimization, making the compilation time increase with
15003 probably small improvement in executable size.
15005 @item min-crossjump-insns
15006 The minimum number of instructions that must be matched at the end
15007 of two blocks before cross-jumping is performed on them.  This
15008 value is ignored in the case where all instructions in the block being
15009 cross-jumped from are matched.
15011 @item max-grow-copy-bb-insns
15012 The maximum code size expansion factor when copying basic blocks
15013 instead of jumping.  The expansion is relative to a jump instruction.
15015 @item max-goto-duplication-insns
15016 The maximum number of instructions to duplicate to a block that jumps
15017 to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
15018 passes, GCC factors computed gotos early in the compilation process,
15019 and unfactors them as late as possible.  Only computed jumps at the
15020 end of a basic blocks with no more than max-goto-duplication-insns are
15021 unfactored.
15023 @item max-delay-slot-insn-search
15024 The maximum number of instructions to consider when looking for an
15025 instruction to fill a delay slot.  If more than this arbitrary number of
15026 instructions are searched, the time savings from filling the delay slot
15027 are minimal, so stop searching.  Increasing values mean more
15028 aggressive optimization, making the compilation time increase with probably
15029 small improvement in execution time.
15031 @item max-delay-slot-live-search
15032 When trying to fill delay slots, the maximum number of instructions to
15033 consider when searching for a block with valid live register
15034 information.  Increasing this arbitrarily chosen value means more
15035 aggressive optimization, increasing the compilation time.  This parameter
15036 should be removed when the delay slot code is rewritten to maintain the
15037 control-flow graph.
15039 @item max-gcse-memory
15040 The approximate maximum amount of memory in @code{kB} that can be allocated in
15041 order to perform the global common subexpression elimination
15042 optimization.  If more memory than specified is required, the
15043 optimization is not done.
15045 @item max-gcse-insertion-ratio
15046 If the ratio of expression insertions to deletions is larger than this value
15047 for any expression, then RTL PRE inserts or removes the expression and thus
15048 leaves partially redundant computations in the instruction stream.
15050 @item max-pending-list-length
15051 The maximum number of pending dependencies scheduling allows
15052 before flushing the current state and starting over.  Large functions
15053 with few branches or calls can create excessively large lists which
15054 needlessly consume memory and resources.
15056 @item max-modulo-backtrack-attempts
15057 The maximum number of backtrack attempts the scheduler should make
15058 when modulo scheduling a loop.  Larger values can exponentially increase
15059 compilation time.
15061 @item max-inline-functions-called-once-loop-depth
15062 Maximal loop depth of a call considered by inline heuristics that tries to
15063 inline all functions called once.
15065 @item max-inline-functions-called-once-insns
15066 Maximal estimated size of functions produced while inlining functions called
15067 once.
15069 @item max-inline-insns-single
15070 Several parameters control the tree inliner used in GCC@.  This number sets the
15071 maximum number of instructions (counted in GCC's internal representation) in a
15072 single function that the tree inliner considers for inlining.  This only
15073 affects functions declared inline and methods implemented in a class
15074 declaration (C++). 
15077 @item max-inline-insns-auto
15078 When you use @option{-finline-functions} (included in @option{-O3}),
15079 a lot of functions that would otherwise not be considered for inlining
15080 by the compiler are investigated.  To those functions, a different
15081 (more restrictive) limit compared to functions declared inline can
15082 be applied (@option{--param max-inline-insns-auto}).
15084 @item max-inline-insns-small
15085 This is bound applied to calls which are considered relevant with
15086 @option{-finline-small-functions}.
15088 @item max-inline-insns-size
15089 This is bound applied to calls which are optimized for size. Small growth
15090 may be desirable to anticipate optimization oppurtunities exposed by inlining.
15092 @item uninlined-function-insns
15093 Number of instructions accounted by inliner for function overhead such as
15094 function prologue and epilogue.
15096 @item uninlined-function-time
15097 Extra time accounted by inliner for function overhead such as time needed to
15098 execute function prologue and epilogue.
15100 @item inline-heuristics-hint-percent
15101 The scale (in percents) applied to @option{inline-insns-single},
15102 @option{inline-insns-single-O2}, @option{inline-insns-auto}
15103 when inline heuristics hints that inlining is
15104 very profitable (will enable later optimizations).
15106 @item uninlined-thunk-insns
15107 @item uninlined-thunk-time
15108 Same as @option{--param uninlined-function-insns} and
15109 @option{--param uninlined-function-time} but applied to function thunks.
15111 @item inline-min-speedup
15112 When estimated performance improvement of caller + callee runtime exceeds this
15113 threshold (in percent), the function can be inlined regardless of the limit on
15114 @option{--param max-inline-insns-single} and @option{--param
15115 max-inline-insns-auto}.
15117 @item large-function-insns
15118 The limit specifying really large functions.  For functions larger than this
15119 limit after inlining, inlining is constrained by
15120 @option{--param large-function-growth}.  This parameter is useful primarily
15121 to avoid extreme compilation time caused by non-linear algorithms used by the
15122 back end.
15124 @item large-function-growth
15125 Specifies maximal growth of large function caused by inlining in percents.
15126 For example, parameter value 100 limits large function growth to 2.0 times
15127 the original size.
15129 @item large-unit-insns
15130 The limit specifying large translation unit.  Growth caused by inlining of
15131 units larger than this limit is limited by @option{--param inline-unit-growth}.
15132 For small units this might be too tight.
15133 For example, consider a unit consisting of function A
15134 that is inline and B that just calls A three times.  If B is small relative to
15135 A, the growth of unit is 300\% and yet such inlining is very sane.  For very
15136 large units consisting of small inlineable functions, however, the overall unit
15137 growth limit is needed to avoid exponential explosion of code size.  Thus for
15138 smaller units, the size is increased to @option{--param large-unit-insns}
15139 before applying @option{--param inline-unit-growth}.
15141 @item lazy-modules
15142 Maximum number of concurrently open C++ module files when lazy loading.
15144 @item inline-unit-growth
15145 Specifies maximal overall growth of the compilation unit caused by inlining.
15146 For example, parameter value 20 limits unit growth to 1.2 times the original
15147 size. Cold functions (either marked cold via an attribute or by profile
15148 feedback) are not accounted into the unit size.
15150 @item ipa-cp-unit-growth
15151 Specifies maximal overall growth of the compilation unit caused by
15152 interprocedural constant propagation.  For example, parameter value 10 limits
15153 unit growth to 1.1 times the original size.
15155 @item ipa-cp-large-unit-insns
15156 The size of translation unit that IPA-CP pass considers large.
15158 @item large-stack-frame
15159 The limit specifying large stack frames.  While inlining the algorithm is trying
15160 to not grow past this limit too much.
15162 @item large-stack-frame-growth
15163 Specifies maximal growth of large stack frames caused by inlining in percents.
15164 For example, parameter value 1000 limits large stack frame growth to 11 times
15165 the original size.
15167 @item max-inline-insns-recursive
15168 @itemx max-inline-insns-recursive-auto
15169 Specifies the maximum number of instructions an out-of-line copy of a
15170 self-recursive inline
15171 function can grow into by performing recursive inlining.
15173 @option{--param max-inline-insns-recursive} applies to functions
15174 declared inline.
15175 For functions not declared inline, recursive inlining
15176 happens only when @option{-finline-functions} (included in @option{-O3}) is
15177 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
15179 @item max-inline-recursive-depth
15180 @itemx max-inline-recursive-depth-auto
15181 Specifies the maximum recursion depth used for recursive inlining.
15183 @option{--param max-inline-recursive-depth} applies to functions
15184 declared inline.  For functions not declared inline, recursive inlining
15185 happens only when @option{-finline-functions} (included in @option{-O3}) is
15186 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
15188 @item min-inline-recursive-probability
15189 Recursive inlining is profitable only for function having deep recursion
15190 in average and can hurt for function having little recursion depth by
15191 increasing the prologue size or complexity of function body to other
15192 optimizers.
15194 When profile feedback is available (see @option{-fprofile-generate}) the actual
15195 recursion depth can be guessed from the probability that function recurses
15196 via a given call expression.  This parameter limits inlining only to call
15197 expressions whose probability exceeds the given threshold (in percents).
15199 @item early-inlining-insns
15200 Specify growth that the early inliner can make.  In effect it increases
15201 the amount of inlining for code having a large abstraction penalty.
15203 @item max-early-inliner-iterations
15204 Limit of iterations of the early inliner.  This basically bounds
15205 the number of nested indirect calls the early inliner can resolve.
15206 Deeper chains are still handled by late inlining.
15208 @item comdat-sharing-probability
15209 Probability (in percent) that C++ inline function with comdat visibility
15210 are shared across multiple compilation units.
15212 @item modref-max-bases
15213 @item modref-max-refs
15214 @item modref-max-accesses
15215 Specifies the maximal number of base pointers, references and accesses stored
15216 for a single function by mod/ref analysis.
15218 @item modref-max-tests
15219 Specifies the maxmal number of tests alias oracle can perform to disambiguate
15220 memory locations using the mod/ref information.  This parameter ought to be
15221 bigger than @option{--param modref-max-bases} and @option{--param
15222 modref-max-refs}.
15224 @item modref-max-depth
15225 Specifies the maximum depth of DFS walk used by modref escape analysis.
15226 Setting to 0 disables the analysis completely.
15228 @item modref-max-escape-points
15229 Specifies the maximum number of escape points tracked by modref per SSA-name.
15231 @item modref-max-adjustments
15232 Specifies the maximum number the access range is enlarged during modref dataflow
15233 analysis.
15235 @item profile-func-internal-id
15236 A parameter to control whether to use function internal id in profile
15237 database lookup. If the value is 0, the compiler uses an id that
15238 is based on function assembler name and filename, which makes old profile
15239 data more tolerant to source changes such as function reordering etc.
15241 @item min-vect-loop-bound
15242 The minimum number of iterations under which loops are not vectorized
15243 when @option{-ftree-vectorize} is used.  The number of iterations after
15244 vectorization needs to be greater than the value specified by this option
15245 to allow vectorization.
15247 @item gcse-cost-distance-ratio
15248 Scaling factor in calculation of maximum distance an expression
15249 can be moved by GCSE optimizations.  This is currently supported only in the
15250 code hoisting pass.  The bigger the ratio, the more aggressive code hoisting
15251 is with simple expressions, i.e., the expressions that have cost
15252 less than @option{gcse-unrestricted-cost}.  Specifying 0 disables
15253 hoisting of simple expressions.
15255 @item gcse-unrestricted-cost
15256 Cost, roughly measured as the cost of a single typical machine
15257 instruction, at which GCSE optimizations do not constrain
15258 the distance an expression can travel.  This is currently
15259 supported only in the code hoisting pass.  The lesser the cost,
15260 the more aggressive code hoisting is.  Specifying 0 
15261 allows all expressions to travel unrestricted distances.
15263 @item max-hoist-depth
15264 The depth of search in the dominator tree for expressions to hoist.
15265 This is used to avoid quadratic behavior in hoisting algorithm.
15266 The value of 0 does not limit on the search, but may slow down compilation
15267 of huge functions.
15269 @item max-tail-merge-comparisons
15270 The maximum amount of similar bbs to compare a bb with.  This is used to
15271 avoid quadratic behavior in tree tail merging.
15273 @item max-tail-merge-iterations
15274 The maximum amount of iterations of the pass over the function.  This is used to
15275 limit compilation time in tree tail merging.
15277 @item store-merging-allow-unaligned
15278 Allow the store merging pass to introduce unaligned stores if it is legal to
15279 do so.
15281 @item max-stores-to-merge
15282 The maximum number of stores to attempt to merge into wider stores in the store
15283 merging pass.
15285 @item max-store-chains-to-track
15286 The maximum number of store chains to track at the same time in the attempt
15287 to merge them into wider stores in the store merging pass.
15289 @item max-stores-to-track
15290 The maximum number of stores to track at the same time in the attemt to
15291 to merge them into wider stores in the store merging pass.
15293 @item max-unrolled-insns
15294 The maximum number of instructions that a loop may have to be unrolled.
15295 If a loop is unrolled, this parameter also determines how many times
15296 the loop code is unrolled.
15298 @item max-average-unrolled-insns
15299 The maximum number of instructions biased by probabilities of their execution
15300 that a loop may have to be unrolled.  If a loop is unrolled,
15301 this parameter also determines how many times the loop code is unrolled.
15303 @item max-unroll-times
15304 The maximum number of unrollings of a single loop.
15306 @item max-peeled-insns
15307 The maximum number of instructions that a loop may have to be peeled.
15308 If a loop is peeled, this parameter also determines how many times
15309 the loop code is peeled.
15311 @item max-peel-times
15312 The maximum number of peelings of a single loop.
15314 @item max-peel-branches
15315 The maximum number of branches on the hot path through the peeled sequence.
15317 @item max-completely-peeled-insns
15318 The maximum number of insns of a completely peeled loop.
15320 @item max-completely-peel-times
15321 The maximum number of iterations of a loop to be suitable for complete peeling.
15323 @item max-completely-peel-loop-nest-depth
15324 The maximum depth of a loop nest suitable for complete peeling.
15326 @item max-unswitch-insns
15327 The maximum number of insns of an unswitched loop.
15329 @item max-unswitch-depth
15330 The maximum depth of a loop nest to be unswitched.
15332 @item lim-expensive
15333 The minimum cost of an expensive expression in the loop invariant motion.
15335 @item min-loop-cond-split-prob
15336 When FDO profile information is available, @option{min-loop-cond-split-prob}
15337 specifies minimum threshold for probability of semi-invariant condition
15338 statement to trigger loop split.
15340 @item iv-consider-all-candidates-bound
15341 Bound on number of candidates for induction variables, below which
15342 all candidates are considered for each use in induction variable
15343 optimizations.  If there are more candidates than this,
15344 only the most relevant ones are considered to avoid quadratic time complexity.
15346 @item iv-max-considered-uses
15347 The induction variable optimizations give up on loops that contain more
15348 induction variable uses.
15350 @item iv-always-prune-cand-set-bound
15351 If the number of candidates in the set is smaller than this value,
15352 always try to remove unnecessary ivs from the set
15353 when adding a new one.
15355 @item avg-loop-niter
15356 Average number of iterations of a loop.
15358 @item dse-max-object-size
15359 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
15360 Larger values may result in larger compilation times.
15362 @item dse-max-alias-queries-per-store
15363 Maximum number of queries into the alias oracle per store.
15364 Larger values result in larger compilation times and may result in more
15365 removed dead stores.
15367 @item scev-max-expr-size
15368 Bound on size of expressions used in the scalar evolutions analyzer.
15369 Large expressions slow the analyzer.
15371 @item scev-max-expr-complexity
15372 Bound on the complexity of the expressions in the scalar evolutions analyzer.
15373 Complex expressions slow the analyzer.
15375 @item max-tree-if-conversion-phi-args
15376 Maximum number of arguments in a PHI supported by TREE if conversion
15377 unless the loop is marked with simd pragma.
15379 @item vect-max-layout-candidates
15380 The maximum number of possible vector layouts (such as permutations)
15381 to consider when optimizing to-be-vectorized code.
15383 @item vect-max-version-for-alignment-checks
15384 The maximum number of run-time checks that can be performed when
15385 doing loop versioning for alignment in the vectorizer.
15387 @item vect-max-version-for-alias-checks
15388 The maximum number of run-time checks that can be performed when
15389 doing loop versioning for alias in the vectorizer.
15391 @item vect-max-peeling-for-alignment
15392 The maximum number of loop peels to enhance access alignment
15393 for vectorizer. Value -1 means no limit.
15395 @item max-iterations-to-track
15396 The maximum number of iterations of a loop the brute-force algorithm
15397 for analysis of the number of iterations of the loop tries to evaluate.
15399 @item hot-bb-count-fraction
15400 The denominator n of fraction 1/n of the maximal execution count of a
15401 basic block in the entire program that a basic block needs to at least
15402 have in order to be considered hot.  The default is 10000, which means
15403 that a basic block is considered hot if its execution count is greater
15404 than 1/10000 of the maximal execution count.  0 means that it is never
15405 considered hot.  Used in non-LTO mode.
15407 @item hot-bb-count-ws-permille
15408 The number of most executed permilles, ranging from 0 to 1000, of the
15409 profiled execution of the entire program to which the execution count
15410 of a basic block must be part of in order to be considered hot.  The
15411 default is 990, which means that a basic block is considered hot if
15412 its execution count contributes to the upper 990 permilles, or 99.0%,
15413 of the profiled execution of the entire program.  0 means that it is
15414 never considered hot.  Used in LTO mode.
15416 @item hot-bb-frequency-fraction
15417 The denominator n of fraction 1/n of the execution frequency of the
15418 entry block of a function that a basic block of this function needs
15419 to at least have in order to be considered hot.  The default is 1000,
15420 which means that a basic block is considered hot in a function if it
15421 is executed more frequently than 1/1000 of the frequency of the entry
15422 block of the function.  0 means that it is never considered hot.
15424 @item unlikely-bb-count-fraction
15425 The denominator n of fraction 1/n of the number of profiled runs of
15426 the entire program below which the execution count of a basic block
15427 must be in order for the basic block to be considered unlikely executed.
15428 The default is 20, which means that a basic block is considered unlikely
15429 executed if it is executed in fewer than 1/20, or 5%, of the runs of
15430 the program.  0 means that it is always considered unlikely executed.
15432 @item max-predicted-iterations
15433 The maximum number of loop iterations we predict statically.  This is useful
15434 in cases where a function contains a single loop with known bound and
15435 another loop with unknown bound.
15436 The known number of iterations is predicted correctly, while
15437 the unknown number of iterations average to roughly 10.  This means that the
15438 loop without bounds appears artificially cold relative to the other one.
15440 @item builtin-expect-probability
15441 Control the probability of the expression having the specified value. This
15442 parameter takes a percentage (i.e.@: 0 ... 100) as input.
15444 @item builtin-string-cmp-inline-length
15445 The maximum length of a constant string for a builtin string cmp call 
15446 eligible for inlining.
15448 @item align-threshold
15450 Select fraction of the maximal frequency of executions of a basic block in
15451 a function to align the basic block.
15453 @item align-loop-iterations
15455 A loop expected to iterate at least the selected number of iterations is
15456 aligned.
15458 @item tracer-dynamic-coverage
15459 @itemx tracer-dynamic-coverage-feedback
15461 This value is used to limit superblock formation once the given percentage of
15462 executed instructions is covered.  This limits unnecessary code size
15463 expansion.
15465 The @option{tracer-dynamic-coverage-feedback} parameter
15466 is used only when profile
15467 feedback is available.  The real profiles (as opposed to statically estimated
15468 ones) are much less balanced allowing the threshold to be larger value.
15470 @item tracer-max-code-growth
15471 Stop tail duplication once code growth has reached given percentage.  This is
15472 a rather artificial limit, as most of the duplicates are eliminated later in
15473 cross jumping, so it may be set to much higher values than is the desired code
15474 growth.
15476 @item tracer-min-branch-ratio
15478 Stop reverse growth when the reverse probability of best edge is less than this
15479 threshold (in percent).
15481 @item tracer-min-branch-probability
15482 @itemx tracer-min-branch-probability-feedback
15484 Stop forward growth if the best edge has probability lower than this
15485 threshold.
15487 Similarly to @option{tracer-dynamic-coverage} two parameters are
15488 provided.  @option{tracer-min-branch-probability-feedback} is used for
15489 compilation with profile feedback and @option{tracer-min-branch-probability}
15490 compilation without.  The value for compilation with profile feedback
15491 needs to be more conservative (higher) in order to make tracer
15492 effective.
15494 @item stack-clash-protection-guard-size
15495 Specify the size of the operating system provided stack guard as
15496 2 raised to @var{num} bytes.  Higher values may reduce the
15497 number of explicit probes, but a value larger than the operating system
15498 provided guard will leave code vulnerable to stack clash style attacks.
15500 @item stack-clash-protection-probe-interval
15501 Stack clash protection involves probing stack space as it is allocated.  This
15502 param controls the maximum distance between probes into the stack as 2 raised
15503 to @var{num} bytes.  Higher values may reduce the number of explicit probes, but a value
15504 larger than the operating system provided guard will leave code vulnerable to
15505 stack clash style attacks.
15507 @item max-cse-path-length
15509 The maximum number of basic blocks on path that CSE considers.
15511 @item max-cse-insns
15512 The maximum number of instructions CSE processes before flushing.
15514 @item ggc-min-expand
15516 GCC uses a garbage collector to manage its own memory allocation.  This
15517 parameter specifies the minimum percentage by which the garbage
15518 collector's heap should be allowed to expand between collections.
15519 Tuning this may improve compilation speed; it has no effect on code
15520 generation.
15522 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
15523 RAM >= 1GB@.  If @code{getrlimit} is available, the notion of ``RAM'' is
15524 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
15525 GCC is not able to calculate RAM on a particular platform, the lower
15526 bound of 30% is used.  Setting this parameter and
15527 @option{ggc-min-heapsize} to zero causes a full collection to occur at
15528 every opportunity.  This is extremely slow, but can be useful for
15529 debugging.
15531 @item ggc-min-heapsize
15533 Minimum size of the garbage collector's heap before it begins bothering
15534 to collect garbage.  The first collection occurs after the heap expands
15535 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
15536 tuning this may improve compilation speed, and has no effect on code
15537 generation.
15539 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
15540 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
15541 with a lower bound of 4096 (four megabytes) and an upper bound of
15542 131072 (128 megabytes).  If GCC is not able to calculate RAM on a
15543 particular platform, the lower bound is used.  Setting this parameter
15544 very large effectively disables garbage collection.  Setting this
15545 parameter and @option{ggc-min-expand} to zero causes a full collection
15546 to occur at every opportunity.
15548 @item max-reload-search-insns
15549 The maximum number of instruction reload should look backward for equivalent
15550 register.  Increasing values mean more aggressive optimization, making the
15551 compilation time increase with probably slightly better performance.
15553 @item max-cselib-memory-locations
15554 The maximum number of memory locations cselib should take into account.
15555 Increasing values mean more aggressive optimization, making the compilation time
15556 increase with probably slightly better performance.
15558 @item max-sched-ready-insns
15559 The maximum number of instructions ready to be issued the scheduler should
15560 consider at any given time during the first scheduling pass.  Increasing
15561 values mean more thorough searches, making the compilation time increase
15562 with probably little benefit.
15564 @item max-sched-region-blocks
15565 The maximum number of blocks in a region to be considered for
15566 interblock scheduling.
15568 @item max-pipeline-region-blocks
15569 The maximum number of blocks in a region to be considered for
15570 pipelining in the selective scheduler.
15572 @item max-sched-region-insns
15573 The maximum number of insns in a region to be considered for
15574 interblock scheduling.
15576 @item max-pipeline-region-insns
15577 The maximum number of insns in a region to be considered for
15578 pipelining in the selective scheduler.
15580 @item min-spec-prob
15581 The minimum probability (in percents) of reaching a source block
15582 for interblock speculative scheduling.
15584 @item max-sched-extend-regions-iters
15585 The maximum number of iterations through CFG to extend regions.
15586 A value of 0 disables region extensions.
15588 @item max-sched-insn-conflict-delay
15589 The maximum conflict delay for an insn to be considered for speculative motion.
15591 @item sched-spec-prob-cutoff
15592 The minimal probability of speculation success (in percents), so that
15593 speculative insns are scheduled.
15595 @item sched-state-edge-prob-cutoff
15596 The minimum probability an edge must have for the scheduler to save its
15597 state across it.
15599 @item sched-mem-true-dep-cost
15600 Minimal distance (in CPU cycles) between store and load targeting same
15601 memory locations.
15603 @item selsched-max-lookahead
15604 The maximum size of the lookahead window of selective scheduling.  It is a
15605 depth of search for available instructions.
15607 @item selsched-max-sched-times
15608 The maximum number of times that an instruction is scheduled during
15609 selective scheduling.  This is the limit on the number of iterations
15610 through which the instruction may be pipelined.
15612 @item selsched-insns-to-rename
15613 The maximum number of best instructions in the ready list that are considered
15614 for renaming in the selective scheduler.
15616 @item sms-min-sc
15617 The minimum value of stage count that swing modulo scheduler
15618 generates.
15620 @item max-last-value-rtl
15621 The maximum size measured as number of RTLs that can be recorded in an expression
15622 in combiner for a pseudo register as last known value of that register.
15624 @item max-combine-insns
15625 The maximum number of instructions the RTL combiner tries to combine.
15627 @item integer-share-limit
15628 Small integer constants can use a shared data structure, reducing the
15629 compiler's memory usage and increasing its speed.  This sets the maximum
15630 value of a shared integer constant.
15632 @item ssp-buffer-size
15633 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
15634 protection when @option{-fstack-protector} is used.
15636 @item min-size-for-stack-sharing
15637 The minimum size of variables taking part in stack slot sharing when not
15638 optimizing.
15640 @item max-jump-thread-duplication-stmts
15641 Maximum number of statements allowed in a block that needs to be
15642 duplicated when threading jumps.
15644 @item max-jump-thread-paths
15645 The maximum number of paths to consider when searching for jump threading
15646 opportunities.  When arriving at a block, incoming edges are only considered
15647 if the number of paths to be searched so far multiplied by the number of
15648 incoming edges does not exhaust the specified maximum number of paths to
15649 consider.
15651 @item max-fields-for-field-sensitive
15652 Maximum number of fields in a structure treated in
15653 a field sensitive manner during pointer analysis.
15655 @item prefetch-latency
15656 Estimate on average number of instructions that are executed before
15657 prefetch finishes.  The distance prefetched ahead is proportional
15658 to this constant.  Increasing this number may also lead to less
15659 streams being prefetched (see @option{simultaneous-prefetches}).
15661 @item simultaneous-prefetches
15662 Maximum number of prefetches that can run at the same time.
15664 @item l1-cache-line-size
15665 The size of cache line in L1 data cache, in bytes.
15667 @item l1-cache-size
15668 The size of L1 data cache, in kilobytes.
15670 @item l2-cache-size
15671 The size of L2 data cache, in kilobytes.
15673 @item prefetch-dynamic-strides
15674 Whether the loop array prefetch pass should issue software prefetch hints
15675 for strides that are non-constant.  In some cases this may be
15676 beneficial, though the fact the stride is non-constant may make it
15677 hard to predict when there is clear benefit to issuing these hints.
15679 Set to 1 if the prefetch hints should be issued for non-constant
15680 strides.  Set to 0 if prefetch hints should be issued only for strides that
15681 are known to be constant and below @option{prefetch-minimum-stride}.
15683 @item prefetch-minimum-stride
15684 Minimum constant stride, in bytes, to start using prefetch hints for.  If
15685 the stride is less than this threshold, prefetch hints will not be issued.
15687 This setting is useful for processors that have hardware prefetchers, in
15688 which case there may be conflicts between the hardware prefetchers and
15689 the software prefetchers.  If the hardware prefetchers have a maximum
15690 stride they can handle, it should be used here to improve the use of
15691 software prefetchers.
15693 A value of -1 means we don't have a threshold and therefore
15694 prefetch hints can be issued for any constant stride.
15696 This setting is only useful for strides that are known and constant.
15698 @item destructive-interference-size
15699 @item constructive-interference-size
15700 The values for the C++17 variables
15701 @code{std::hardware_destructive_interference_size} and
15702 @code{std::hardware_constructive_interference_size}.  The destructive
15703 interference size is the minimum recommended offset between two
15704 independent concurrently-accessed objects; the constructive
15705 interference size is the maximum recommended size of contiguous memory
15706 accessed together.  Typically both will be the size of an L1 cache
15707 line for the target, in bytes.  For a generic target covering a range of L1
15708 cache line sizes, typically the constructive interference size will be
15709 the small end of the range and the destructive size will be the large
15710 end.
15712 The destructive interference size is intended to be used for layout,
15713 and thus has ABI impact.  The default value is not expected to be
15714 stable, and on some targets varies with @option{-mtune}, so use of
15715 this variable in a context where ABI stability is important, such as
15716 the public interface of a library, is strongly discouraged; if it is
15717 used in that context, users can stabilize the value using this
15718 option.
15720 The constructive interference size is less sensitive, as it is
15721 typically only used in a @samp{static_assert} to make sure that a type
15722 fits within a cache line.
15724 See also @option{-Winterference-size}.
15726 @item loop-interchange-max-num-stmts
15727 The maximum number of stmts in a loop to be interchanged.
15729 @item loop-interchange-stride-ratio
15730 The minimum ratio between stride of two loops for interchange to be profitable.
15732 @item min-insn-to-prefetch-ratio
15733 The minimum ratio between the number of instructions and the
15734 number of prefetches to enable prefetching in a loop.
15736 @item prefetch-min-insn-to-mem-ratio
15737 The minimum ratio between the number of instructions and the
15738 number of memory references to enable prefetching in a loop.
15740 @item use-canonical-types
15741 Whether the compiler should use the ``canonical'' type system.
15742 Should always be 1, which uses a more efficient internal
15743 mechanism for comparing types in C++ and Objective-C++.  However, if
15744 bugs in the canonical type system are causing compilation failures,
15745 set this value to 0 to disable canonical types.
15747 @item switch-conversion-max-branch-ratio
15748 Switch initialization conversion refuses to create arrays that are
15749 bigger than @option{switch-conversion-max-branch-ratio} times the number of
15750 branches in the switch.
15752 @item max-partial-antic-length
15753 Maximum length of the partial antic set computed during the tree
15754 partial redundancy elimination optimization (@option{-ftree-pre}) when
15755 optimizing at @option{-O3} and above.  For some sorts of source code
15756 the enhanced partial redundancy elimination optimization can run away,
15757 consuming all of the memory available on the host machine.  This
15758 parameter sets a limit on the length of the sets that are computed,
15759 which prevents the runaway behavior.  Setting a value of 0 for
15760 this parameter allows an unlimited set length.
15762 @item rpo-vn-max-loop-depth
15763 Maximum loop depth that is value-numbered optimistically.
15764 When the limit hits the innermost
15765 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
15766 loop nest are value-numbered optimistically and the remaining ones not.
15768 @item sccvn-max-alias-queries-per-access
15769 Maximum number of alias-oracle queries we perform when looking for
15770 redundancies for loads and stores.  If this limit is hit the search
15771 is aborted and the load or store is not considered redundant.  The
15772 number of queries is algorithmically limited to the number of
15773 stores on all paths from the load to the function entry.
15775 @item ira-max-loops-num
15776 IRA uses regional register allocation by default.  If a function
15777 contains more loops than the number given by this parameter, only at most
15778 the given number of the most frequently-executed loops form regions
15779 for regional register allocation.
15781 @item ira-max-conflict-table-size 
15782 Although IRA uses a sophisticated algorithm to compress the conflict
15783 table, the table can still require excessive amounts of memory for
15784 huge functions.  If the conflict table for a function could be more
15785 than the size in MB given by this parameter, the register allocator
15786 instead uses a faster, simpler, and lower-quality
15787 algorithm that does not require building a pseudo-register conflict table.  
15789 @item ira-loop-reserved-regs
15790 IRA can be used to evaluate more accurate register pressure in loops
15791 for decisions to move loop invariants (see @option{-O3}).  The number
15792 of available registers reserved for some other purposes is given
15793 by this parameter.  Default of the parameter
15794 is the best found from numerous experiments.
15796 @item ira-consider-dup-in-all-alts
15797 Make IRA to consider matching constraint (duplicated operand number)
15798 heavily in all available alternatives for preferred register class.
15799 If it is set as zero, it means IRA only respects the matching
15800 constraint when it's in the only available alternative with an
15801 appropriate register class.  Otherwise, it means IRA will check all
15802 available alternatives for preferred register class even if it has
15803 found some choice with an appropriate register class and respect the
15804 found qualified matching constraint.
15806 @item ira-simple-lra-insn-threshold
15807 Approximate function insn number in 1K units triggering simple local RA.
15809 @item lra-inheritance-ebb-probability-cutoff
15810 LRA tries to reuse values reloaded in registers in subsequent insns.
15811 This optimization is called inheritance.  EBB is used as a region to
15812 do this optimization.  The parameter defines a minimal fall-through
15813 edge probability in percentage used to add BB to inheritance EBB in
15814 LRA.  The default value was chosen
15815 from numerous runs of SPEC2000 on x86-64.
15817 @item loop-invariant-max-bbs-in-loop
15818 Loop invariant motion can be very expensive, both in compilation time and
15819 in amount of needed compile-time memory, with very large loops.  Loops
15820 with more basic blocks than this parameter won't have loop invariant
15821 motion optimization performed on them.
15823 @item loop-max-datarefs-for-datadeps
15824 Building data dependencies is expensive for very large loops.  This
15825 parameter limits the number of data references in loops that are
15826 considered for data dependence analysis.  These large loops are no
15827 handled by the optimizations using loop data dependencies.
15829 @item max-vartrack-size
15830 Sets a maximum number of hash table slots to use during variable
15831 tracking dataflow analysis of any function.  If this limit is exceeded
15832 with variable tracking at assignments enabled, analysis for that
15833 function is retried without it, after removing all debug insns from
15834 the function.  If the limit is exceeded even without debug insns, var
15835 tracking analysis is completely disabled for the function.  Setting
15836 the parameter to zero makes it unlimited.
15838 @item max-vartrack-expr-depth
15839 Sets a maximum number of recursion levels when attempting to map
15840 variable names or debug temporaries to value expressions.  This trades
15841 compilation time for more complete debug information.  If this is set too
15842 low, value expressions that are available and could be represented in
15843 debug information may end up not being used; setting this higher may
15844 enable the compiler to find more complex debug expressions, but compile
15845 time and memory use may grow.
15847 @item max-debug-marker-count
15848 Sets a threshold on the number of debug markers (e.g.@: begin stmt
15849 markers) to avoid complexity explosion at inlining or expanding to RTL.
15850 If a function has more such gimple stmts than the set limit, such stmts
15851 will be dropped from the inlined copy of a function, and from its RTL
15852 expansion.
15854 @item min-nondebug-insn-uid
15855 Use uids starting at this parameter for nondebug insns.  The range below
15856 the parameter is reserved exclusively for debug insns created by
15857 @option{-fvar-tracking-assignments}, but debug insns may get
15858 (non-overlapping) uids above it if the reserved range is exhausted.
15860 @item ipa-sra-deref-prob-threshold
15861 IPA-SRA replaces a pointer which is known not be NULL with one or more
15862 new parameters only when the probability (in percent, relative to
15863 function entry) of it being dereferenced is higher than this parameter.
15865 @item ipa-sra-ptr-growth-factor
15866 IPA-SRA replaces a pointer to an aggregate with one or more new
15867 parameters only when their cumulative size is less or equal to
15868 @option{ipa-sra-ptr-growth-factor} times the size of the original
15869 pointer parameter.
15871 @item ipa-sra-ptrwrap-growth-factor
15872 Additional maximum allowed growth of total size of new parameters
15873 that ipa-sra replaces a pointer to an aggregate with,
15874 if it points to a local variable that the caller only writes to and
15875 passes it as an argument to other functions.
15877 @item ipa-sra-max-replacements
15878 Maximum pieces of an aggregate that IPA-SRA tracks.  As a
15879 consequence, it is also the maximum number of replacements of a formal
15880 parameter.
15882 @item sra-max-scalarization-size-Ospeed
15883 @itemx sra-max-scalarization-size-Osize
15884 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
15885 replace scalar parts of aggregates with uses of independent scalar
15886 variables.  These parameters control the maximum size, in storage units,
15887 of aggregate which is considered for replacement when compiling for
15888 speed
15889 (@option{sra-max-scalarization-size-Ospeed}) or size
15890 (@option{sra-max-scalarization-size-Osize}) respectively.
15892 @item sra-max-propagations
15893 The maximum number of artificial accesses that Scalar Replacement of
15894 Aggregates (SRA) will track, per one local variable, in order to
15895 facilitate copy propagation.
15897 @item tm-max-aggregate-size
15898 When making copies of thread-local variables in a transaction, this
15899 parameter specifies the size in bytes after which variables are
15900 saved with the logging functions as opposed to save/restore code
15901 sequence pairs.  This option only applies when using
15902 @option{-fgnu-tm}.
15904 @item graphite-max-nb-scop-params
15905 To avoid exponential effects in the Graphite loop transforms, the
15906 number of parameters in a Static Control Part (SCoP) is bounded.
15907 A value of zero can be used to lift
15908 the bound.  A variable whose value is unknown at compilation time and
15909 defined outside a SCoP is a parameter of the SCoP.
15911 @item loop-block-tile-size
15912 Loop blocking or strip mining transforms, enabled with
15913 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
15914 loop in the loop nest by a given number of iterations.  The strip
15915 length can be changed using the @option{loop-block-tile-size}
15916 parameter.
15918 @item ipa-jump-function-lookups
15919 Specifies number of statements visited during jump function offset discovery.
15921 @item ipa-cp-value-list-size
15922 IPA-CP attempts to track all possible values and types passed to a function's
15923 parameter in order to propagate them and perform devirtualization.
15924 @option{ipa-cp-value-list-size} is the maximum number of values and types it
15925 stores per one formal parameter of a function.
15927 @item ipa-cp-eval-threshold
15928 IPA-CP calculates its own score of cloning profitability heuristics
15929 and performs those cloning opportunities with scores that exceed
15930 @option{ipa-cp-eval-threshold}.
15932 @item ipa-cp-max-recursive-depth
15933 Maximum depth of recursive cloning for self-recursive function.
15935 @item ipa-cp-min-recursive-probability
15936 Recursive cloning only when the probability of call being executed exceeds
15937 the parameter.
15939 @item ipa-cp-profile-count-base
15940 When using @option{-fprofile-use} option, IPA-CP will consider the measured
15941 execution count of a call graph edge at this percentage position in their
15942 histogram as the basis for its heuristics calculation.
15944 @item ipa-cp-recursive-freq-factor
15945 The number of times interprocedural copy propagation expects recursive
15946 functions to call themselves.
15948 @item ipa-cp-recursion-penalty
15949 Percentage penalty the recursive functions will receive when they
15950 are evaluated for cloning.
15952 @item ipa-cp-single-call-penalty
15953 Percentage penalty functions containing a single call to another
15954 function will receive when they are evaluated for cloning.
15956 @item ipa-max-agg-items
15957 IPA-CP is also capable to propagate a number of scalar values passed
15958 in an aggregate. @option{ipa-max-agg-items} controls the maximum
15959 number of such values per one parameter.
15961 @item ipa-cp-loop-hint-bonus
15962 When IPA-CP determines that a cloning candidate would make the number
15963 of iterations of a loop known, it adds a bonus of
15964 @option{ipa-cp-loop-hint-bonus} to the profitability score of
15965 the candidate.
15967 @item ipa-max-loop-predicates
15968 The maximum number of different predicates IPA will use to describe when
15969 loops in a function have known properties.
15971 @item ipa-max-aa-steps
15972 During its analysis of function bodies, IPA-CP employs alias analysis
15973 in order to track values pointed to by function parameters.  In order
15974 not spend too much time analyzing huge functions, it gives up and
15975 consider all memory clobbered after examining
15976 @option{ipa-max-aa-steps} statements modifying memory.
15978 @item ipa-max-switch-predicate-bounds
15979 Maximal number of boundary endpoints of case ranges of switch statement.
15980 For switch exceeding this limit, IPA-CP will not construct cloning cost
15981 predicate, which is used to estimate cloning benefit, for default case
15982 of the switch statement.
15984 @item ipa-max-param-expr-ops
15985 IPA-CP will analyze conditional statement that references some function
15986 parameter to estimate benefit for cloning upon certain constant value.
15987 But if number of operations in a parameter expression exceeds
15988 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
15989 one, and is not handled by IPA analysis.
15991 @item lto-partitions
15992 Specify desired number of partitions produced during WHOPR compilation.
15993 The number of partitions should exceed the number of CPUs used for compilation.
15995 @item lto-min-partition
15996 Size of minimal partition for WHOPR (in estimated instructions).
15997 This prevents expenses of splitting very small programs into too many
15998 partitions.
16000 @item lto-max-partition
16001 Size of max partition for WHOPR (in estimated instructions).
16002 to provide an upper bound for individual size of partition.
16003 Meant to be used only with balanced partitioning.
16005 @item lto-max-streaming-parallelism
16006 Maximal number of parallel processes used for LTO streaming.
16008 @item cxx-max-namespaces-for-diagnostic-help
16009 The maximum number of namespaces to consult for suggestions when C++
16010 name lookup fails for an identifier.
16012 @item sink-frequency-threshold
16013 The maximum relative execution frequency (in percents) of the target block
16014 relative to a statement's original block to allow statement sinking of a
16015 statement.  Larger numbers result in more aggressive statement sinking.
16016 A small positive adjustment is applied for
16017 statements with memory operands as those are even more profitable so sink.
16019 @item max-stores-to-sink
16020 The maximum number of conditional store pairs that can be sunk.  Set to 0
16021 if either vectorization (@option{-ftree-vectorize}) or if-conversion
16022 (@option{-ftree-loop-if-convert}) is disabled.
16024 @item case-values-threshold
16025 The smallest number of different values for which it is best to use a
16026 jump-table instead of a tree of conditional branches.  If the value is
16027 0, use the default for the machine.
16029 @item jump-table-max-growth-ratio-for-size
16030 The maximum code size growth ratio when expanding
16031 into a jump table (in percent).  The parameter is used when
16032 optimizing for size.
16034 @item jump-table-max-growth-ratio-for-speed
16035 The maximum code size growth ratio when expanding
16036 into a jump table (in percent).  The parameter is used when
16037 optimizing for speed.
16039 @item tree-reassoc-width
16040 Set the maximum number of instructions executed in parallel in
16041 reassociated tree. This parameter overrides target dependent
16042 heuristics used by default if has non zero value.
16044 @item sched-pressure-algorithm
16045 Choose between the two available implementations of
16046 @option{-fsched-pressure}.  Algorithm 1 is the original implementation
16047 and is the more likely to prevent instructions from being reordered.
16048 Algorithm 2 was designed to be a compromise between the relatively
16049 conservative approach taken by algorithm 1 and the rather aggressive
16050 approach taken by the default scheduler.  It relies more heavily on
16051 having a regular register file and accurate register pressure classes.
16052 See @file{haifa-sched.cc} in the GCC sources for more details.
16054 The default choice depends on the target.
16056 @item max-slsr-cand-scan
16057 Set the maximum number of existing candidates that are considered when
16058 seeking a basis for a new straight-line strength reduction candidate.
16060 @item asan-globals
16061 Enable buffer overflow detection for global objects.  This kind
16062 of protection is enabled by default if you are using
16063 @option{-fsanitize=address} option.
16064 To disable global objects protection use @option{--param asan-globals=0}.
16066 @item asan-stack
16067 Enable buffer overflow detection for stack objects.  This kind of
16068 protection is enabled by default when using @option{-fsanitize=address}.
16069 To disable stack protection use @option{--param asan-stack=0} option.
16071 @item asan-instrument-reads
16072 Enable buffer overflow detection for memory reads.  This kind of
16073 protection is enabled by default when using @option{-fsanitize=address}.
16074 To disable memory reads protection use
16075 @option{--param asan-instrument-reads=0}.
16077 @item asan-instrument-writes
16078 Enable buffer overflow detection for memory writes.  This kind of
16079 protection is enabled by default when using @option{-fsanitize=address}.
16080 To disable memory writes protection use
16081 @option{--param asan-instrument-writes=0} option.
16083 @item asan-memintrin
16084 Enable detection for built-in functions.  This kind of protection
16085 is enabled by default when using @option{-fsanitize=address}.
16086 To disable built-in functions protection use
16087 @option{--param asan-memintrin=0}.
16089 @item asan-use-after-return
16090 Enable detection of use-after-return.  This kind of protection
16091 is enabled by default when using the @option{-fsanitize=address} option.
16092 To disable it use @option{--param asan-use-after-return=0}.
16094 Note: By default the check is disabled at run time.  To enable it,
16095 add @code{detect_stack_use_after_return=1} to the environment variable
16096 @env{ASAN_OPTIONS}.
16098 @item asan-instrumentation-with-call-threshold
16099 If number of memory accesses in function being instrumented
16100 is greater or equal to this number, use callbacks instead of inline checks.
16101 E.g. to disable inline code use
16102 @option{--param asan-instrumentation-with-call-threshold=0}.
16104 @item asan-kernel-mem-intrinsic-prefix
16105 If nonzero, prefix calls to @code{memcpy}, @code{memset} and @code{memmove}
16106 with @samp{__asan_} or @samp{__hwasan_}
16107 for @option{-fsanitize=kernel-address} or @samp{-fsanitize=kernel-hwaddress},
16108 respectively.
16110 @item hwasan-instrument-stack
16111 Enable hwasan instrumentation of statically sized stack-allocated variables.
16112 This kind of instrumentation is enabled by default when using
16113 @option{-fsanitize=hwaddress} and disabled by default when using
16114 @option{-fsanitize=kernel-hwaddress}.
16115 To disable stack instrumentation use
16116 @option{--param hwasan-instrument-stack=0}, and to enable it use
16117 @option{--param hwasan-instrument-stack=1}.
16119 @item hwasan-random-frame-tag
16120 When using stack instrumentation, decide tags for stack variables using a
16121 deterministic sequence beginning at a random tag for each frame.  With this
16122 parameter unset tags are chosen using the same sequence but beginning from 1.
16123 This is enabled by default for @option{-fsanitize=hwaddress} and unavailable
16124 for @option{-fsanitize=kernel-hwaddress}.
16125 To disable it use @option{--param hwasan-random-frame-tag=0}.
16127 @item hwasan-instrument-allocas
16128 Enable hwasan instrumentation of dynamically sized stack-allocated variables.
16129 This kind of instrumentation is enabled by default when using
16130 @option{-fsanitize=hwaddress} and disabled by default when using
16131 @option{-fsanitize=kernel-hwaddress}.
16132 To disable instrumentation of such variables use
16133 @option{--param hwasan-instrument-allocas=0}, and to enable it use
16134 @option{--param hwasan-instrument-allocas=1}.
16136 @item hwasan-instrument-reads
16137 Enable hwasan checks on memory reads.  Instrumentation of reads is enabled by
16138 default for both @option{-fsanitize=hwaddress} and
16139 @option{-fsanitize=kernel-hwaddress}.
16140 To disable checking memory reads use
16141 @option{--param hwasan-instrument-reads=0}.
16143 @item hwasan-instrument-writes
16144 Enable hwasan checks on memory writes.  Instrumentation of writes is enabled by
16145 default for both @option{-fsanitize=hwaddress} and
16146 @option{-fsanitize=kernel-hwaddress}.
16147 To disable checking memory writes use
16148 @option{--param hwasan-instrument-writes=0}.
16150 @item hwasan-instrument-mem-intrinsics
16151 Enable hwasan instrumentation of builtin functions.  Instrumentation of these
16152 builtin functions is enabled by default for both @option{-fsanitize=hwaddress}
16153 and @option{-fsanitize=kernel-hwaddress}.
16154 To disable instrumentation of builtin functions use
16155 @option{--param hwasan-instrument-mem-intrinsics=0}.
16157 @item use-after-scope-direct-emission-threshold
16158 If the size of a local variable in bytes is smaller or equal to this
16159 number, directly poison (or unpoison) shadow memory instead of using
16160 run-time callbacks.
16162 @item tsan-distinguish-volatile
16163 Emit special instrumentation for accesses to volatiles.
16165 @item tsan-instrument-func-entry-exit
16166 Emit instrumentation calls to __tsan_func_entry() and __tsan_func_exit().
16168 @item max-fsm-thread-path-insns
16169 Maximum number of instructions to copy when duplicating blocks on a
16170 finite state automaton jump thread path.
16172 @item threader-debug
16173 threader-debug=[none|all] Enables verbose dumping of the threader solver.
16175 @item parloops-chunk-size
16176 Chunk size of omp schedule for loops parallelized by parloops.
16178 @item parloops-schedule
16179 Schedule type of omp schedule for loops parallelized by parloops (static,
16180 dynamic, guided, auto, runtime).
16182 @item parloops-min-per-thread
16183 The minimum number of iterations per thread of an innermost parallelized
16184 loop for which the parallelized variant is preferred over the single threaded
16185 one.  Note that for a parallelized loop nest the
16186 minimum number of iterations of the outermost loop per thread is two.
16188 @item max-ssa-name-query-depth
16189 Maximum depth of recursion when querying properties of SSA names in things
16190 like fold routines.  One level of recursion corresponds to following a
16191 use-def chain.
16193 @item max-speculative-devirt-maydefs
16194 The maximum number of may-defs we analyze when looking for a must-def
16195 specifying the dynamic type of an object that invokes a virtual call
16196 we may be able to devirtualize speculatively.
16198 @item ranger-debug
16199 Specifies the type of debug output to be issued for ranges.
16201 @item unroll-jam-min-percent
16202 The minimum percentage of memory references that must be optimized
16203 away for the unroll-and-jam transformation to be considered profitable.
16205 @item unroll-jam-max-unroll
16206 The maximum number of times the outer loop should be unrolled by
16207 the unroll-and-jam transformation.
16209 @item max-rtl-if-conversion-unpredictable-cost
16210 Maximum permissible cost for the sequence that would be generated
16211 by the RTL if-conversion pass for a branch that is considered unpredictable.
16213 @item max-variable-expansions-in-unroller
16214 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
16215 of times that an individual variable will be expanded during loop unrolling.
16217 @item partial-inlining-entry-probability
16218 Maximum probability of the entry BB of split region
16219 (in percent relative to entry BB of the function)
16220 to make partial inlining happen.
16222 @item max-tracked-strlens
16223 Maximum number of strings for which strlen optimization pass will
16224 track string lengths.
16226 @item gcse-after-reload-partial-fraction
16227 The threshold ratio for performing partial redundancy
16228 elimination after reload.
16230 @item gcse-after-reload-critical-fraction
16231 The threshold ratio of critical edges execution count that
16232 permit performing redundancy elimination after reload.
16234 @item max-loop-header-insns
16235 The maximum number of insns in loop header duplicated
16236 by the copy loop headers pass.
16238 @item vect-epilogues-nomask
16239 Enable loop epilogue vectorization using smaller vector size.
16241 @item vect-partial-vector-usage
16242 Controls when the loop vectorizer considers using partial vector loads
16243 and stores as an alternative to falling back to scalar code.  0 stops
16244 the vectorizer from ever using partial vector loads and stores.  1 allows
16245 partial vector loads and stores if vectorization removes the need for the
16246 code to iterate.  2 allows partial vector loads and stores in all loops.
16247 The parameter only has an effect on targets that support partial
16248 vector loads and stores.
16250 @item vect-inner-loop-cost-factor
16251 The maximum factor which the loop vectorizer applies to the cost of statements
16252 in an inner loop relative to the loop being vectorized.  The factor applied
16253 is the maximum of the estimated number of iterations of the inner loop and
16254 this parameter.  The default value of this parameter is 50.
16256 @item vect-induction-float
16257 Enable loop vectorization of floating point inductions.
16259 @item vrp-sparse-threshold
16260 Maximum number of basic blocks before VRP uses a sparse bitmap cache.
16262 @item vrp-switch-limit
16263 Maximum number of outgoing edges in a switch before VRP will not process it.
16265 @item vrp-vector-threshold
16266 Maximum number of basic blocks for VRP to use a basic cache vector.
16268 @item avoid-fma-max-bits
16269 Maximum number of bits for which we avoid creating FMAs.
16271 @item sms-loop-average-count-threshold
16272 A threshold on the average loop count considered by the swing modulo scheduler.
16274 @item sms-dfa-history
16275 The number of cycles the swing modulo scheduler considers when checking
16276 conflicts using DFA.
16278 @item graphite-allow-codegen-errors
16279 Whether codegen errors should be ICEs when @option{-fchecking}.
16281 @item sms-max-ii-factor
16282 A factor for tuning the upper bound that swing modulo scheduler
16283 uses for scheduling a loop.
16285 @item lra-max-considered-reload-pseudos
16286 The max number of reload pseudos which are considered during
16287 spilling a non-reload pseudo.
16289 @item max-pow-sqrt-depth
16290 Maximum depth of sqrt chains to use when synthesizing exponentiation
16291 by a real constant.
16293 @item max-dse-active-local-stores
16294 Maximum number of active local stores in RTL dead store elimination.
16296 @item asan-instrument-allocas
16297 Enable asan allocas/VLAs protection.
16299 @item max-iterations-computation-cost
16300 Bound on the cost of an expression to compute the number of iterations.
16302 @item max-isl-operations
16303 Maximum number of isl operations, 0 means unlimited.
16305 @item graphite-max-arrays-per-scop
16306 Maximum number of arrays per scop.
16308 @item max-vartrack-reverse-op-size
16309 Max. size of loc list for which reverse ops should be added.
16311 @item fsm-scale-path-stmts
16312 Scale factor to apply to the number of statements in a threading path
16313 crossing a loop backedge when comparing to
16314 @option{--param=max-jump-thread-duplication-stmts}.
16316 @item uninit-control-dep-attempts
16317 Maximum number of nested calls to search for control dependencies
16318 during uninitialized variable analysis.
16320 @item sched-autopref-queue-depth
16321 Hardware autoprefetcher scheduler model control flag.
16322 Number of lookahead cycles the model looks into; at '
16323 ' only enable instruction sorting heuristic.
16325 @item loop-versioning-max-inner-insns
16326 The maximum number of instructions that an inner loop can have
16327 before the loop versioning pass considers it too big to copy.
16329 @item loop-versioning-max-outer-insns
16330 The maximum number of instructions that an outer loop can have
16331 before the loop versioning pass considers it too big to copy,
16332 discounting any instructions in inner loops that directly benefit
16333 from versioning.
16335 @item ssa-name-def-chain-limit
16336 The maximum number of SSA_NAME assignments to follow in determining
16337 a property of a variable such as its value.  This limits the number
16338 of iterations or recursive calls GCC performs when optimizing certain
16339 statements or when determining their validity prior to issuing
16340 diagnostics.
16342 @item store-merging-max-size
16343 Maximum size of a single store merging region in bytes.
16345 @item hash-table-verification-limit
16346 The number of elements for which hash table verification is done
16347 for each searched element.
16349 @item max-find-base-term-values
16350 Maximum number of VALUEs handled during a single find_base_term call.
16352 @item analyzer-max-enodes-per-program-point
16353 The maximum number of exploded nodes per program point within
16354 the analyzer, before terminating analysis of that point.
16356 @item analyzer-max-constraints
16357 The maximum number of constraints per state.
16359 @item analyzer-min-snodes-for-call-summary
16360 The minimum number of supernodes within a function for the
16361 analyzer to consider summarizing its effects at call sites.
16363 @item analyzer-max-enodes-for-full-dump
16364 The maximum depth of exploded nodes that should appear in a dot dump
16365 before switching to a less verbose format.
16367 @item analyzer-max-recursion-depth
16368 The maximum number of times a callsite can appear in a call stack
16369 within the analyzer, before terminating analysis of a call that would
16370 recurse deeper.
16372 @item analyzer-max-svalue-depth
16373 The maximum depth of a symbolic value, before approximating
16374 the value as unknown.
16376 @item analyzer-max-infeasible-edges
16377 The maximum number of infeasible edges to reject before declaring
16378 a diagnostic as infeasible.
16380 @item gimple-fe-computed-hot-bb-threshold
16381 The number of executions of a basic block which is considered hot.
16382 The parameter is used only in GIMPLE FE.
16384 @item analyzer-bb-explosion-factor
16385 The maximum number of 'after supernode' exploded nodes within the analyzer
16386 per supernode, before terminating analysis.
16388 @item analyzer-text-art-string-ellipsis-threshold
16389 The number of bytes at which to ellipsize string literals in analyzer text art diagrams.
16391 @item analyzer-text-art-ideal-canvas-width
16392 The ideal width in characters of text art diagrams generated by the analyzer.
16394 @item analyzer-text-art-string-ellipsis-head-len
16395 The number of literal bytes to show at the head of a string literal in text art when ellipsizing it.
16397 @item analyzer-text-art-string-ellipsis-tail-len
16398 The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it.
16400 @item ranger-logical-depth
16401 Maximum depth of logical expression evaluation ranger will look through
16402 when evaluating outgoing edge ranges.
16404 @item ranger-recompute-depth
16405 Maximum depth of instruction chains to consider for recomputation
16406 in the outgoing range calculator.
16408 @item relation-block-limit
16409 Maximum number of relations the oracle will register in a basic block.
16411 @item min-pagesize
16412 Minimum page size for warning purposes.
16414 @item openacc-kernels
16415 Specify mode of OpenACC `kernels' constructs handling.
16416 With @option{--param=openacc-kernels=decompose}, OpenACC `kernels'
16417 constructs are decomposed into parts, a sequence of compute
16418 constructs, each then handled individually.
16419 This is work in progress.
16420 With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
16421 constructs are handled by the @samp{parloops} pass, en bloc.
16422 This is the current default.
16424 @item openacc-privatization
16425 Control whether the @option{-fopt-info-omp-note} and applicable
16426 @option{-fdump-tree-*-details} options emit OpenACC privatization diagnostics.
16427 With @option{--param=openacc-privatization=quiet}, don't diagnose.
16428 This is the current default.
16429 With @option{--param=openacc-privatization=noisy}, do diagnose.
16431 @end table
16433 The following choices of @var{name} are available on AArch64 targets:
16435 @table @gcctabopt
16436 @item aarch64-sve-compare-costs
16437 When vectorizing for SVE, consider using ``unpacked'' vectors for
16438 smaller elements and use the cost model to pick the cheapest approach.
16439 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
16441 Using unpacked vectors includes storing smaller elements in larger
16442 containers and accessing elements with extending loads and truncating
16443 stores.
16445 @item aarch64-float-recp-precision
16446 The number of Newton iterations for calculating the reciprocal for float type.
16447 The precision of division is proportional to this param when division
16448 approximation is enabled.  The default value is 1.
16450 @item aarch64-double-recp-precision
16451 The number of Newton iterations for calculating the reciprocal for double type.
16452 The precision of division is propotional to this param when division
16453 approximation is enabled.  The default value is 2.
16455 @item aarch64-autovec-preference
16456 Force an ISA selection strategy for auto-vectorization.  Accepts values from
16457 0 to 4, inclusive.
16458 @table @samp
16459 @item 0
16460 Use the default heuristics.
16461 @item 1
16462 Use only Advanced SIMD for auto-vectorization.
16463 @item 2
16464 Use only SVE for auto-vectorization.
16465 @item 3
16466 Use both Advanced SIMD and SVE.  Prefer Advanced SIMD when the costs are
16467 deemed equal.
16468 @item 4
16469 Use both Advanced SIMD and SVE.  Prefer SVE when the costs are deemed equal.
16470 @end table
16471 The default value is 0.
16473 @item aarch64-loop-vect-issue-rate-niters
16474 The tuning for some AArch64 CPUs tries to take both latencies and issue
16475 rates into account when deciding whether a loop should be vectorized
16476 using SVE, vectorized using Advanced SIMD, or not vectorized at all.
16477 If this parameter is set to @var{n}, GCC will not use this heuristic
16478 for loops that are known to execute in fewer than @var{n} Advanced
16479 SIMD iterations.
16481 @item aarch64-vect-unroll-limit
16482 The vectorizer will use available tuning information to determine whether it
16483 would be beneficial to unroll the main vectorized loop and by how much.  This
16484 parameter set's the upper bound of how much the vectorizer will unroll the main
16485 loop.  The default value is four.
16487 @end table
16489 The following choices of @var{name} are available on i386 and x86_64 targets:
16491 @table @gcctabopt
16492 @item x86-stlf-window-ninsns
16493 Instructions number above which STFL stall penalty can be compensated.
16495 @item x86-stv-max-visits
16496 The maximum number of use and def visits when discovering a STV chain before
16497 the discovery is aborted.
16499 @end table
16501 @end table
16503 @node Instrumentation Options
16504 @section Program Instrumentation Options
16505 @cindex instrumentation options
16506 @cindex program instrumentation options
16507 @cindex run-time error checking options
16508 @cindex profiling options
16509 @cindex options, program instrumentation
16510 @cindex options, run-time error checking
16511 @cindex options, profiling
16513 GCC supports a number of command-line options that control adding
16514 run-time instrumentation to the code it normally generates.  
16515 For example, one purpose of instrumentation is collect profiling
16516 statistics for use in finding program hot spots, code coverage
16517 analysis, or profile-guided optimizations.
16518 Another class of program instrumentation is adding run-time checking 
16519 to detect programming errors like invalid pointer
16520 dereferences or out-of-bounds array accesses, as well as deliberately
16521 hostile attacks such as stack smashing or C++ vtable hijacking.
16522 There is also a general hook which can be used to implement other
16523 forms of tracing or function-level instrumentation for debug or
16524 program analysis purposes.
16526 @table @gcctabopt
16527 @cindex @command{prof}
16528 @cindex @command{gprof}
16529 @opindex p
16530 @opindex pg
16531 @item -p
16532 @itemx -pg
16533 Generate extra code to write profile information suitable for the
16534 analysis program @command{prof} (for @option{-p}) or @command{gprof}
16535 (for @option{-pg}).  You must use this option when compiling
16536 the source files you want data about, and you must also use it when
16537 linking.
16539 You can use the function attribute @code{no_instrument_function} to
16540 suppress profiling of individual functions when compiling with these options.
16541 @xref{Common Function Attributes}.
16543 @opindex fprofile-arcs
16544 @item -fprofile-arcs
16545 Add code so that program flow @dfn{arcs} are instrumented.  During
16546 execution the program records how many times each branch and call is
16547 executed and how many times it is taken or returns.  On targets that support
16548 constructors with priority support, profiling properly handles constructors,
16549 destructors and C++ constructors (and destructors) of classes which are used
16550 as a type of a global variable.
16552 When the compiled
16553 program exits it saves this data to a file called
16554 @file{@var{auxname}.gcda} for each source file.  The data may be used for
16555 profile-directed optimizations (@option{-fbranch-probabilities}), or for
16556 test coverage analysis (@option{-ftest-coverage}).  Each object file's
16557 @var{auxname} is generated from the name of the output file, if
16558 explicitly specified and it is not the final executable, otherwise it is
16559 the basename of the source file.  In both cases any suffix is removed
16560 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
16561 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
16563 Note that if a command line directly links source files, the corresponding
16564 @var{.gcda} files will be prefixed with the unsuffixed name of the output file.
16565 E.g. @code{gcc a.c b.c -o binary} would generate @file{binary-a.gcda} and
16566 @file{binary-b.gcda} files.
16568 @xref{Cross-profiling}.
16570 @cindex @command{gcov}
16571 @opindex coverage
16572 @item --coverage
16574 This option is used to compile and link code instrumented for coverage
16575 analysis.  The option is a synonym for @option{-fprofile-arcs}
16576 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
16577 linking).  See the documentation for those options for more details.
16579 @itemize
16581 @item
16582 Compile the source files with @option{-fprofile-arcs} plus optimization
16583 and code generation options.  For test coverage analysis, use the
16584 additional @option{-ftest-coverage} option.  You do not need to profile
16585 every source file in a program.
16587 @item
16588 Compile the source files additionally with @option{-fprofile-abs-path}
16589 to create absolute path names in the @file{.gcno} files.  This allows
16590 @command{gcov} to find the correct sources in projects where compilations
16591 occur with different working directories.
16593 @item
16594 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
16595 (the latter implies the former).
16597 @item
16598 Run the program on a representative workload to generate the arc profile
16599 information.  This may be repeated any number of times.  You can run
16600 concurrent instances of your program, and provided that the file system
16601 supports locking, the data files will be correctly updated.  Unless
16602 a strict ISO C dialect option is in effect, @code{fork} calls are
16603 detected and correctly handled without double counting.
16605 Moreover, an object file can be recompiled multiple times
16606 and the corresponding @file{.gcda} file merges as long as
16607 the source file and the compiler options are unchanged.
16609 @item
16610 For profile-directed optimizations, compile the source files again with
16611 the same optimization and code generation options plus
16612 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
16613 Control Optimization}).
16615 @item
16616 For test coverage analysis, use @command{gcov} to produce human readable
16617 information from the @file{.gcno} and @file{.gcda} files.  Refer to the
16618 @command{gcov} documentation for further information.
16620 @end itemize
16622 With @option{-fprofile-arcs}, for each function of your program GCC
16623 creates a program flow graph, then finds a spanning tree for the graph.
16624 Only arcs that are not on the spanning tree have to be instrumented: the
16625 compiler adds code to count the number of times that these arcs are
16626 executed.  When an arc is the only exit or only entrance to a block, the
16627 instrumentation code can be added to the block; otherwise, a new basic
16628 block must be created to hold the instrumentation code.
16630 @need 2000
16631 @opindex ftest-coverage
16632 @item -ftest-coverage
16633 Produce a notes file that the @command{gcov} code-coverage utility
16634 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
16635 show program coverage.  Each source file's note file is called
16636 @file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
16637 above for a description of @var{auxname} and instructions on how to
16638 generate test coverage data.  Coverage data matches the source files
16639 more closely if you do not optimize.
16641 @opindex fprofile-abs-path
16642 @item -fprofile-abs-path
16643 Automatically convert relative source file names to absolute path names
16644 in the @file{.gcno} files.  This allows @command{gcov} to find the correct
16645 sources in projects where compilations occur with different working
16646 directories.
16648 @opindex fprofile-dir
16649 @item -fprofile-dir=@var{path}
16651 Set the directory to search for the profile data files in to @var{path}.
16652 This option affects only the profile data generated by
16653 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
16654 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
16655 and its related options.  Both absolute and relative paths can be used.
16656 By default, GCC uses the current directory as @var{path}, thus the
16657 profile data file appears in the same directory as the object file.
16658 In order to prevent the file name clashing, if the object file name is
16659 not an absolute path, we mangle the absolute path of the
16660 @file{@var{sourcename}.gcda} file and use it as the file name of a
16661 @file{.gcda} file.  See details about the file naming in @option{-fprofile-arcs}.
16662 See similar option @option{-fprofile-note}.
16664 When an executable is run in a massive parallel environment, it is recommended
16665 to save profile to different folders.  That can be done with variables
16666 in @var{path} that are exported during run-time:
16668 @table @gcctabopt
16670 @item %p
16671 process ID.
16673 @item %q@{VAR@}
16674 value of environment variable @var{VAR}
16676 @end table
16678 @opindex fprofile-generate
16679 @item -fprofile-generate
16680 @itemx -fprofile-generate=@var{path}
16682 Enable options usually used for instrumenting application to produce
16683 profile useful for later recompilation with profile feedback based
16684 optimization.  You must use @option{-fprofile-generate} both when
16685 compiling and when linking your program.
16687 The following options are enabled:
16688 @option{-fprofile-arcs}, @option{-fprofile-values},
16689 @option{-finline-functions}, and @option{-fipa-bit-cp}.
16691 If @var{path} is specified, GCC looks at the @var{path} to find
16692 the profile feedback data files. See @option{-fprofile-dir}.
16694 To optimize the program based on the collected profile information, use
16695 @option{-fprofile-use}.  @xref{Optimize Options}, for more information.
16697 @opindex fprofile-info-section
16698 @item -fprofile-info-section
16699 @itemx -fprofile-info-section=@var{name}
16701 Register the profile information in the specified section instead of using a
16702 constructor/destructor.  The section name is @var{name} if it is specified,
16703 otherwise the section name defaults to @code{.gcov_info}.  A pointer to the
16704 profile information generated by @option{-fprofile-arcs} is placed in the
16705 specified section for each translation unit.  This option disables the profile
16706 information registration through a constructor and it disables the profile
16707 information processing through a destructor.  This option is not intended to be
16708 used in hosted environments such as GNU/Linux.  It targets freestanding
16709 environments (for example embedded systems) with limited resources which do not
16710 support constructors/destructors or the C library file I/O.
16712 The linker could collect the input sections in a continuous memory block and
16713 define start and end symbols.  A GNU linker script example which defines a
16714 linker output section follows:
16716 @smallexample
16717   .gcov_info      :
16718   @{
16719     PROVIDE (__gcov_info_start = .);
16720     KEEP (*(.gcov_info))
16721     PROVIDE (__gcov_info_end = .);
16722   @}
16723 @end smallexample
16725 The program could dump the profiling information registered in this linker set
16726 for example like this:
16728 @smallexample
16729 #include <gcov.h>
16730 #include <stdio.h>
16731 #include <stdlib.h>
16733 extern const struct gcov_info *const __gcov_info_start[];
16734 extern const struct gcov_info *const __gcov_info_end[];
16736 static void
16737 dump (const void *d, unsigned n, void *arg)
16739   const unsigned char *c = d;
16741   for (unsigned i = 0; i < n; ++i)
16742     printf ("%02x", c[i]);
16745 static void
16746 filename (const char *f, void *arg)
16748   __gcov_filename_to_gcfn (f, dump, arg );
16751 static void *
16752 allocate (unsigned length, void *arg)
16754   return malloc (length);
16757 static void
16758 dump_gcov_info (void)
16760   const struct gcov_info *const *info = __gcov_info_start;
16761   const struct gcov_info *const *end = __gcov_info_end;
16763   /* Obfuscate variable to prevent compiler optimizations.  */
16764   __asm__ ("" : "+r" (info));
16766   while (info != end)
16767   @{
16768     void *arg = NULL;
16769     __gcov_info_to_gcda (*info, filename, dump, allocate, arg);
16770     putchar ('\n');
16771     ++info;
16772   @}
16776 main (void)
16778   dump_gcov_info ();
16779   return 0;
16781 @end smallexample
16783 The @command{merge-stream} subcommand of @command{gcov-tool} may be used to
16784 deserialize the data stream generated by the @code{__gcov_filename_to_gcfn} and
16785 @code{__gcov_info_to_gcda} functions and merge the profile information into
16786 @file{.gcda} files on the host filesystem.
16788 @opindex fprofile-note
16789 @item -fprofile-note=@var{path}
16791 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
16792 location.  If you combine the option with multiple source files,
16793 the @file{.gcno} file will be overwritten.
16795 @opindex fprofile-prefix-path
16796 @item -fprofile-prefix-path=@var{path}
16798 This option can be used in combination with
16799 @option{profile-generate=}@var{profile_dir} and
16800 @option{profile-use=}@var{profile_dir} to inform GCC where is the base
16801 directory of built source tree.  By default @var{profile_dir} will contain
16802 files with mangled absolute paths of all object files in the built project.
16803 This is not desirable when directory used to build the instrumented binary
16804 differs from the directory used to build the binary optimized with profile
16805 feedback because the profile data will not be found during the optimized build.
16806 In such setups @option{-fprofile-prefix-path=}@var{path} with @var{path}
16807 pointing to the base directory of the build can be used to strip the irrelevant
16808 part of the path and keep all file names relative to the main build directory.
16810 @opindex fprofile-prefix-map
16811 @item -fprofile-prefix-map=@var{old}=@var{new}
16812 When compiling files residing in directory @file{@var{old}}, record
16813 profiling information (with @option{--coverage})
16814 describing them as if the files resided in
16815 directory @file{@var{new}} instead.
16816 See also @option{-ffile-prefix-map} and @option{-fcanon-prefix-map}.
16818 @opindex fprofile-update
16819 @item -fprofile-update=@var{method}
16821 Alter the update method for an application instrumented for profile
16822 feedback based optimization.  The @var{method} argument should be one of
16823 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
16824 The first one is useful for single-threaded applications,
16825 while the second one prevents profile corruption by emitting thread-safe code.
16827 @strong{Warning:} When an application does not properly join all threads
16828 (or creates an detached thread), a profile file can be still corrupted.
16830 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
16831 when supported by a target, or to @samp{single} otherwise.  The GCC driver
16832 automatically selects @samp{prefer-atomic} when @option{-pthread}
16833 is present in the command line.
16835 @opindex fprofile-filter-files
16836 @item -fprofile-filter-files=@var{regex}
16838 Instrument only functions from files whose name matches
16839 any of the regular expressions (separated by semi-colons).
16841 For example, @option{-fprofile-filter-files=main\.c;module.*\.c} will instrument
16842 only @file{main.c} and all C files starting with 'module'.
16844 @opindex fprofile-exclude-files
16845 @item -fprofile-exclude-files=@var{regex}
16847 Instrument only functions from files whose name does not match
16848 any of the regular expressions (separated by semi-colons).
16850 For example, @option{-fprofile-exclude-files=/usr/.*} will prevent instrumentation
16851 of all files that are located in the @file{/usr/} folder.
16853 @opindex fprofile-reproducible
16854 @item -fprofile-reproducible=@r{[}multithreaded@r{|}parallel-runs@r{|}serial@r{]}
16855 Control level of reproducibility of profile gathered by
16856 @code{-fprofile-generate}.  This makes it possible to rebuild program
16857 with same outcome which is useful, for example, for distribution
16858 packages.
16860 With @option{-fprofile-reproducible=serial} the profile gathered by
16861 @option{-fprofile-generate} is reproducible provided the trained program
16862 behaves the same at each invocation of the train run, it is not
16863 multi-threaded and profile data streaming is always done in the same
16864 order.  Note that profile streaming happens at the end of program run but
16865 also before @code{fork} function is invoked.
16867 Note that it is quite common that execution counts of some part of
16868 programs depends, for example, on length of temporary file names or
16869 memory space randomization (that may affect hash-table collision rate).
16870 Such non-reproducible part of programs may be annotated by
16871 @code{no_instrument_function} function attribute. @command{gcov-dump} with
16872 @option{-l} can be used to dump gathered data and verify that they are
16873 indeed reproducible.
16875 With @option{-fprofile-reproducible=parallel-runs} collected profile
16876 stays reproducible regardless the order of streaming of the data into
16877 gcda files.  This setting makes it possible to run multiple instances of
16878 instrumented program in parallel (such as with @code{make -j}). This
16879 reduces quality of gathered data, in particular of indirect call
16880 profiling.
16882 @opindex fsanitize=address
16883 @item -fsanitize=address
16884 Enable AddressSanitizer, a fast memory error detector.
16885 Memory access instructions are instrumented to detect
16886 out-of-bounds and use-after-free bugs.
16887 The option enables @option{-fsanitize-address-use-after-scope}.
16888 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
16889 more details.  The run-time behavior can be influenced using the
16890 @env{ASAN_OPTIONS} environment variable.  When set to @code{help=1},
16891 the available options are shown at startup of the instrumented program.  See
16892 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
16893 for a list of supported options.
16894 The option cannot be combined with @option{-fsanitize=thread} or
16895 @option{-fsanitize=hwaddress}.  Note that the only target
16896 @option{-fsanitize=hwaddress} is currently supported on is AArch64.
16898 To get more accurate stack traces, it is possible to use options such as
16899 @option{-O0}, @option{-O1}, or @option{-Og} (which, for instance, prevent
16900 most function inlining), @option{-fno-optimize-sibling-calls} (which prevents
16901 optimizing sibling and tail recursive calls; this option is implicit for
16902 @option{-O0}, @option{-O1}, or @option{-Og}), or @option{-fno-ipa-icf} (which
16903 disables Identical Code Folding for functions).  Since multiple runs of the
16904 program may yield backtraces with different addresses due to ASLR (Address
16905 Space Layout Randomization), it may be desirable to turn ASLR off.  On Linux,
16906 this can be achieved with @samp{setarch `uname -m` -R ./prog}.
16908 @opindex fsanitize=kernel-address
16909 @item -fsanitize=kernel-address
16910 Enable AddressSanitizer for Linux kernel.
16911 See @uref{https://github.com/google/kernel-sanitizers} for more details.
16913 @opindex fsanitize=hwaddress
16914 @item -fsanitize=hwaddress
16915 Enable Hardware-assisted AddressSanitizer, which uses a hardware ability to
16916 ignore the top byte of a pointer to allow the detection of memory errors with
16917 a low memory overhead.
16918 Memory access instructions are instrumented to detect out-of-bounds and
16919 use-after-free bugs.
16920 The option enables @option{-fsanitize-address-use-after-scope}.
16922 @uref{https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html}
16923 for more details.  The run-time behavior can be influenced using the
16924 @env{HWASAN_OPTIONS} environment variable.  When set to @code{help=1},
16925 the available options are shown at startup of the instrumented program.
16926 The option cannot be combined with @option{-fsanitize=thread} or
16927 @option{-fsanitize=address}, and is currently only available on AArch64.
16929 @opindex fsanitize=kernel-hwaddress
16930 @item -fsanitize=kernel-hwaddress
16931 Enable Hardware-assisted AddressSanitizer for compilation of the Linux kernel.
16932 Similar to @option{-fsanitize=kernel-address} but using an alternate
16933 instrumentation method, and similar to @option{-fsanitize=hwaddress} but with
16934 instrumentation differences necessary for compiling the Linux kernel.
16935 These differences are to avoid hwasan library initialization calls and to
16936 account for the stack pointer having a different value in its top byte.
16938 @emph{Note:} This option has different defaults to the @option{-fsanitize=hwaddress}.
16939 Instrumenting the stack and alloca calls are not on by default but are still
16940 possible by specifying the command-line options
16941 @option{--param hwasan-instrument-stack=1} and
16942 @option{--param hwasan-instrument-allocas=1} respectively. Using a random frame
16943 tag is not implemented for kernel instrumentation.
16945 @opindex fsanitize=pointer-compare
16946 @item -fsanitize=pointer-compare
16947 Instrument comparison operation (<, <=, >, >=) with pointer operands.
16948 The option must be combined with either @option{-fsanitize=kernel-address} or
16949 @option{-fsanitize=address}
16950 The option cannot be combined with @option{-fsanitize=thread}.
16951 Note: By default the check is disabled at run time.  To enable it,
16952 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16953 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16954 invalid operation only when both pointers are non-null.
16956 @opindex fsanitize=pointer-subtract
16957 @item -fsanitize=pointer-subtract
16958 Instrument subtraction with pointer operands.
16959 The option must be combined with either @option{-fsanitize=kernel-address} or
16960 @option{-fsanitize=address}
16961 The option cannot be combined with @option{-fsanitize=thread}.
16962 Note: By default the check is disabled at run time.  To enable it,
16963 add @code{detect_invalid_pointer_pairs=2} to the environment variable
16964 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
16965 invalid operation only when both pointers are non-null.
16967 @opindex fsanitize=shadow-call-stack
16968 @item -fsanitize=shadow-call-stack
16969 Enable ShadowCallStack, a security enhancement mechanism used to protect
16970 programs against return address overwrites (e.g. stack buffer overflows.)
16971 It works by saving a function's return address to a separately allocated
16972 shadow call stack in the function prologue and restoring the return address
16973 from the shadow call stack in the function epilogue.  Instrumentation only
16974 occurs in functions that need to save the return address to the stack.
16976 Currently it only supports the aarch64 platform.  It is specifically
16977 designed for linux kernels that enable the CONFIG_SHADOW_CALL_STACK option.
16978 For the user space programs, runtime support is not currently provided
16979 in libc and libgcc.  Users who want to use this feature in user space need
16980 to provide their own support for the runtime.  It should be noted that
16981 this may cause the ABI rules to be broken.
16983 On aarch64, the instrumentation makes use of the platform register @code{x18}.
16984 This generally means that any code that may run on the same thread as code
16985 compiled with ShadowCallStack must be compiled with the flag
16986 @option{-ffixed-x18}, otherwise functions compiled without
16987 @option{-ffixed-x18} might clobber @code{x18} and so corrupt the shadow
16988 stack pointer.
16990 Also, because there is no userspace runtime support, code compiled with
16991 ShadowCallStack cannot use exception handling.  Use @option{-fno-exceptions}
16992 to turn off exceptions.
16994 See @uref{https://clang.llvm.org/docs/ShadowCallStack.html} for more
16995 details.
16997 @opindex fsanitize=thread
16998 @item -fsanitize=thread
16999 Enable ThreadSanitizer, a fast data race detector.
17000 Memory access instructions are instrumented to detect
17001 data race bugs.  See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
17002 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
17003 environment variable; see
17004 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
17005 supported options.
17006 The option cannot be combined with @option{-fsanitize=address},
17007 @option{-fsanitize=leak}.
17009 Note that sanitized atomic builtins cannot throw exceptions when
17010 operating on invalid memory addresses with non-call exceptions
17011 (@option{-fnon-call-exceptions}).
17013 @opindex fsanitize=leak
17014 @item -fsanitize=leak
17015 Enable LeakSanitizer, a memory leak detector.
17016 This option only matters for linking of executables.
17017 The executable is linked against a library that overrides @code{malloc}
17018 and other allocator functions.  See
17019 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
17020 details.  The run-time behavior can be influenced using the
17021 @env{LSAN_OPTIONS} environment variable.
17022 The option cannot be combined with @option{-fsanitize=thread}.
17024 @opindex fsanitize=undefined
17025 @item -fsanitize=undefined
17026 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
17027 Various computations are instrumented to detect undefined behavior
17028 at runtime.  See @uref{https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html} for more details.   The run-time behavior can be influenced using the
17029 @env{UBSAN_OPTIONS} environment variable.  Current suboptions are:
17031 @table @gcctabopt
17033 @opindex fsanitize=shift
17034 @item -fsanitize=shift
17035 This option enables checking that the result of a shift operation is
17036 not undefined.  Note that what exactly is considered undefined differs
17037 slightly between C and C++, as well as between ISO C90 and C99, etc.
17038 This option has two suboptions, @option{-fsanitize=shift-base} and
17039 @option{-fsanitize=shift-exponent}.
17041 @opindex fsanitize=shift-exponent
17042 @item -fsanitize=shift-exponent
17043 This option enables checking that the second argument of a shift operation
17044 is not negative and is smaller than the precision of the promoted first
17045 argument.
17047 @opindex fsanitize=shift-base
17048 @item -fsanitize=shift-base
17049 If the second argument of a shift operation is within range, check that the
17050 result of a shift operation is not undefined.  Note that what exactly is
17051 considered undefined differs slightly between C and C++, as well as between
17052 ISO C90 and C99, etc.
17054 @opindex fsanitize=integer-divide-by-zero
17055 @item -fsanitize=integer-divide-by-zero
17056 Detect integer division by zero.
17058 @opindex fsanitize=unreachable
17059 @item -fsanitize=unreachable
17060 With this option, the compiler turns the @code{__builtin_unreachable}
17061 call into a diagnostics message call instead.  When reaching the
17062 @code{__builtin_unreachable} call, the behavior is undefined.
17064 @opindex fsanitize=vla-bound
17065 @item -fsanitize=vla-bound
17066 This option instructs the compiler to check that the size of a variable
17067 length array is positive.
17069 @opindex fsanitize=null
17070 @item -fsanitize=null
17071 This option enables pointer checking.  Particularly, the application
17072 built with this option turned on will issue an error message when it
17073 tries to dereference a NULL pointer, or if a reference (possibly an
17074 rvalue reference) is bound to a NULL pointer, or if a method is invoked
17075 on an object pointed by a NULL pointer.
17077 @opindex fsanitize=return
17078 @item -fsanitize=return
17079 This option enables return statement checking.  Programs
17080 built with this option turned on will issue an error message
17081 when the end of a non-void function is reached without actually
17082 returning a value.  This option works in C++ only.
17084 @opindex fsanitize=signed-integer-overflow
17085 @item -fsanitize=signed-integer-overflow
17086 This option enables signed integer overflow checking.  We check that
17087 the result of @code{+}, @code{*}, and both unary and binary @code{-}
17088 does not overflow in the signed arithmetics.  This also detects
17089 @code{INT_MIN / -1} signed division.  Note, integer promotion
17090 rules must be taken into account.  That is, the following is not an
17091 overflow:
17092 @smallexample
17093 signed char a = SCHAR_MAX;
17094 a++;
17095 @end smallexample
17097 @opindex fsanitize=bounds
17098 @item -fsanitize=bounds
17099 This option enables instrumentation of array bounds.  Various out of bounds
17100 accesses are detected.  Flexible array members, flexible array member-like
17101 arrays, and initializers of variables with static storage are not
17102 instrumented, with the exception of flexible array member-like arrays
17103 for which @code{-fstrict-flex-arrays} or @code{-fstrict-flex-arrays=}
17104 options or @code{strict_flex_array} attributes say they shouldn't be treated
17105 like flexible array member-like arrays.
17107 @opindex fsanitize=bounds-strict
17108 @item -fsanitize=bounds-strict
17109 This option enables strict instrumentation of array bounds.  Most out of bounds
17110 accesses are detected, including flexible array member-like arrays.
17111 Initializers of variables with static storage are not instrumented.
17113 @opindex fsanitize=alignment
17114 @item -fsanitize=alignment
17116 This option enables checking of alignment of pointers when they are
17117 dereferenced, or when a reference is bound to insufficiently aligned target,
17118 or when a method or constructor is invoked on insufficiently aligned object.
17120 @opindex fsanitize=object-size
17121 @item -fsanitize=object-size
17122 This option enables instrumentation of memory references using the
17123 @code{__builtin_dynamic_object_size} function.  Various out of bounds
17124 pointer accesses are detected.
17126 @opindex fsanitize=float-divide-by-zero
17127 @item -fsanitize=float-divide-by-zero
17128 Detect floating-point division by zero.  Unlike other similar options,
17129 @option{-fsanitize=float-divide-by-zero} is not enabled by
17130 @option{-fsanitize=undefined}, since floating-point division by zero can
17131 be a legitimate way of obtaining infinities and NaNs.
17133 @opindex fsanitize=float-cast-overflow
17134 @item -fsanitize=float-cast-overflow
17135 This option enables floating-point type to integer conversion checking.
17136 We check that the result of the conversion does not overflow.
17137 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
17138 not enabled by @option{-fsanitize=undefined}.
17139 This option does not work well with @code{FE_INVALID} exceptions enabled.
17141 @opindex fsanitize=nonnull-attribute
17142 @item -fsanitize=nonnull-attribute
17144 This option enables instrumentation of calls, checking whether null values
17145 are not passed to arguments marked as requiring a non-null value by the
17146 @code{nonnull} function attribute.
17148 @opindex fsanitize=returns-nonnull-attribute
17149 @item -fsanitize=returns-nonnull-attribute
17151 This option enables instrumentation of return statements in functions
17152 marked with @code{returns_nonnull} function attribute, to detect returning
17153 of null values from such functions.
17155 @opindex fsanitize=bool
17156 @item -fsanitize=bool
17158 This option enables instrumentation of loads from bool.  If a value other
17159 than 0/1 is loaded, a run-time error is issued.
17161 @opindex fsanitize=enum
17162 @item -fsanitize=enum
17164 This option enables instrumentation of loads from an enum type.  If
17165 a value outside the range of values for the enum type is loaded,
17166 a run-time error is issued.
17168 @opindex fsanitize=vptr
17169 @item -fsanitize=vptr
17171 This option enables instrumentation of C++ member function calls, member
17172 accesses and some conversions between pointers to base and derived classes,
17173 to verify the referenced object has the correct dynamic type.
17175 @opindex fsanitize=pointer-overflow
17176 @item -fsanitize=pointer-overflow
17178 This option enables instrumentation of pointer arithmetics.  If the pointer
17179 arithmetics overflows, a run-time error is issued.
17181 @opindex fsanitize=builtin
17182 @item -fsanitize=builtin
17184 This option enables instrumentation of arguments to selected builtin
17185 functions.  If an invalid value is passed to such arguments, a run-time
17186 error is issued.  E.g.@ passing 0 as the argument to @code{__builtin_ctz}
17187 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
17188 by this option.
17190 @end table
17192 Note that sanitizers tend to increase the rate of false positive
17193 warnings, most notably those around @option{-Wmaybe-uninitialized}.
17194 We recommend against combining @option{-Werror} and [the use of]
17195 sanitizers.
17197 While @option{-ftrapv} causes traps for signed overflows to be emitted,
17198 @option{-fsanitize=undefined} gives a diagnostic message.
17199 This currently works only for the C family of languages.
17201 @opindex fno-sanitize=all
17202 @item -fno-sanitize=all
17204 This option disables all previously enabled sanitizers.
17205 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
17206 together.
17208 @opindex fasan-shadow-offset
17209 @item -fasan-shadow-offset=@var{number}
17210 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
17211 It is useful for experimenting with different shadow memory layouts in
17212 Kernel AddressSanitizer.
17214 @opindex fsanitize-sections
17215 @item -fsanitize-sections=@var{s1},@var{s2},...
17216 Sanitize global variables in selected user-defined sections.  @var{si} may
17217 contain wildcards.
17219 @opindex fsanitize-recover
17220 @opindex fno-sanitize-recover
17221 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
17222 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
17223 mentioned in comma-separated list of @var{opts}.  Enabling this option
17224 for a sanitizer component causes it to attempt to continue
17225 running the program as if no error happened.  This means multiple
17226 runtime errors can be reported in a single program run, and the exit
17227 code of the program may indicate success even when errors
17228 have been reported.  The @option{-fno-sanitize-recover=} option
17229 can be used to alter
17230 this behavior: only the first detected error is reported
17231 and program then exits with a non-zero exit code.
17233 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
17234 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
17235 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
17236 @option{-fsanitize=bounds-strict},
17237 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
17238 For these sanitizers error recovery is turned on by default,
17239 except @option{-fsanitize=address}, for which this feature is experimental.
17240 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
17241 accepted, the former enables recovery for all sanitizers that support it,
17242 the latter disables recovery for all sanitizers that support it.
17244 Even if a recovery mode is turned on the compiler side, it needs to be also
17245 enabled on the runtime library side, otherwise the failures are still fatal.
17246 The runtime library defaults to @code{halt_on_error=0} for
17247 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
17248 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
17249 setting the @code{halt_on_error} flag in the corresponding environment variable.
17251 Syntax without an explicit @var{opts} parameter is deprecated.  It is
17252 equivalent to specifying an @var{opts} list of:
17254 @smallexample
17255 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
17256 @end smallexample
17258 @opindex fsanitize-address-use-after-scope
17259 @item -fsanitize-address-use-after-scope
17260 Enable sanitization of local variables to detect use-after-scope bugs.
17261 The option sets @option{-fstack-reuse} to @samp{none}.
17263 @opindex fsanitize-trap
17264 @opindex fno-sanitize-trap
17265 @item -fsanitize-trap@r{[}=@var{opts}@r{]}
17266 The @option{-fsanitize-trap=} option instructs the compiler to
17267 report for sanitizers mentioned in comma-separated list of @var{opts}
17268 undefined behavior using @code{__builtin_trap} rather than a @code{libubsan}
17269 library routine.  If this option is enabled for certain sanitizer,
17270 it takes precedence over the @option{-fsanitizer-recover=} for that
17271 sanitizer, @code{__builtin_trap} will be emitted and be fatal regardless
17272 of whether recovery is enabled or disabled using @option{-fsanitize-recover=}.
17274 The advantage of this is that the @code{libubsan} library is not needed
17275 and is not linked in, so this is usable even in freestanding environments.
17277 Currently this feature works with @option{-fsanitize=undefined} (and its suboptions
17278 except for @option{-fsanitize=vptr}), @option{-fsanitize=float-cast-overflow},
17279 @option{-fsanitize=float-divide-by-zero} and
17280 @option{-fsanitize=bounds-strict}.  @code{-fsanitize-trap=all} can be also
17281 specified, which enables it for @code{undefined} suboptions,
17282 @option{-fsanitize=float-cast-overflow},
17283 @option{-fsanitize=float-divide-by-zero} and
17284 @option{-fsanitize=bounds-strict}.
17285 If @code{-fsanitize-trap=undefined} or @code{-fsanitize-trap=all} is used
17286 and @code{-fsanitize=vptr} is enabled on the command line, the
17287 instrumentation is silently ignored as the instrumentation always needs
17288 @code{libubsan} support, @option{-fsanitize-trap=vptr} is not allowed.
17290 @opindex fsanitize-undefined-trap-on-error
17291 @item -fsanitize-undefined-trap-on-error
17292 The @option{-fsanitize-undefined-trap-on-error} option is deprecated
17293 equivalent of @option{-fsanitize-trap=all}.
17295 @opindex fsanitize-coverage=trace-pc
17296 @item -fsanitize-coverage=trace-pc
17297 Enable coverage-guided fuzzing code instrumentation.
17298 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
17300 @opindex fsanitize-coverage=trace-cmp
17301 @item -fsanitize-coverage=trace-cmp
17302 Enable dataflow guided fuzzing code instrumentation.
17303 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
17304 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
17305 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
17306 variable or @code{__sanitizer_cov_trace_const_cmp1},
17307 @code{__sanitizer_cov_trace_const_cmp2},
17308 @code{__sanitizer_cov_trace_const_cmp4} or
17309 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
17310 operand constant, @code{__sanitizer_cov_trace_cmpf} or
17311 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
17312 @code{__sanitizer_cov_trace_switch} for switch statements.
17314 @opindex fcf-protection
17315 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{|}check@r{]}
17316 Enable code instrumentation of control-flow transfers to increase
17317 program security by checking that target addresses of control-flow
17318 transfer instructions (such as indirect function call, function return,
17319 indirect jump) are valid.  This prevents diverting the flow of control
17320 to an unexpected target.  This is intended to protect against such
17321 threats as Return-oriented Programming (ROP), and similarly
17322 call/jmp-oriented programming (COP/JOP).
17324 The value @code{branch} tells the compiler to implement checking of
17325 validity of control-flow transfer at the point of indirect branch
17326 instructions, i.e.@: call/jmp instructions.  The value @code{return}
17327 implements checking of validity at the point of returning from a
17328 function.  The value @code{full} is an alias for specifying both
17329 @code{branch} and @code{return}. The value @code{none} turns off
17330 instrumentation.
17332 The value @code{check} is used for the final link with link-time
17333 optimization (LTO).  An error is issued if LTO object files are
17334 compiled with different @option{-fcf-protection} values.  The
17335 value @code{check} is ignored at the compile time.
17337 The macro @code{__CET__} is defined when @option{-fcf-protection} is
17338 used.  The first bit of @code{__CET__} is set to 1 for the value
17339 @code{branch} and the second bit of @code{__CET__} is set to 1 for
17340 the @code{return}.
17342 You can also use the @code{nocf_check} attribute to identify
17343 which functions and calls should be skipped from instrumentation
17344 (@pxref{Function Attributes}).
17346 Currently the x86 GNU/Linux target provides an implementation based
17347 on Intel Control-flow Enforcement Technology (CET) which works for
17348 i686 processor or newer.
17350 @opindex fharden-compares
17351 @item -fharden-compares
17352 For every logical test that survives gimple optimizations and is
17353 @emph{not} the condition in a conditional branch (for example,
17354 conditions tested for conditional moves, or to store in boolean
17355 variables), emit extra code to compute and verify the reversed
17356 condition, and to call @code{__builtin_trap} if the results do not
17357 match.  Use with @samp{-fharden-conditional-branches} to cover all
17358 conditionals.
17360 @opindex fharden-conditional-branches
17361 @item -fharden-conditional-branches
17362 For every non-vectorized conditional branch that survives gimple
17363 optimizations, emit extra code to compute and verify the reversed
17364 condition, and to call @code{__builtin_trap} if the result is
17365 unexpected.  Use with @samp{-fharden-compares} to cover all
17366 conditionals.
17368 @opindex fstack-protector
17369 @item -fstack-protector
17370 Emit extra code to check for buffer overflows, such as stack smashing
17371 attacks.  This is done by adding a guard variable to functions with
17372 vulnerable objects.  This includes functions that call @code{alloca}, and
17373 functions with buffers larger than or equal to 8 bytes.  The guards are
17374 initialized when a function is entered and then checked when the function
17375 exits.  If a guard check fails, an error message is printed and the program
17376 exits.  Only variables that are actually allocated on the stack are
17377 considered, optimized away variables or variables allocated in registers
17378 don't count.
17380 @opindex fstack-protector-all
17381 @item -fstack-protector-all
17382 Like @option{-fstack-protector} except that all functions are protected.
17384 @opindex fstack-protector-strong
17385 @item -fstack-protector-strong
17386 Like @option{-fstack-protector} but includes additional functions to
17387 be protected --- those that have local array definitions, or have
17388 references to local frame addresses.  Only variables that are actually
17389 allocated on the stack are considered, optimized away variables or variables
17390 allocated in registers don't count.
17392 @opindex fstack-protector-explicit
17393 @item -fstack-protector-explicit
17394 Like @option{-fstack-protector} but only protects those functions which
17395 have the @code{stack_protect} attribute.
17397 @opindex fstack-check
17398 @item -fstack-check
17399 Generate code to verify that you do not go beyond the boundary of the
17400 stack.  You should specify this flag if you are running in an
17401 environment with multiple threads, but you only rarely need to specify it in
17402 a single-threaded environment since stack overflow is automatically
17403 detected on nearly all systems if there is only one stack.
17405 Note that this switch does not actually cause checking to be done; the
17406 operating system or the language runtime must do that.  The switch causes
17407 generation of code to ensure that they see the stack being extended.
17409 You can additionally specify a string parameter: @samp{no} means no
17410 checking, @samp{generic} means force the use of old-style checking,
17411 @samp{specific} means use the best checking method and is equivalent
17412 to bare @option{-fstack-check}.
17414 Old-style checking is a generic mechanism that requires no specific
17415 target support in the compiler but comes with the following drawbacks:
17417 @enumerate
17418 @item
17419 Modified allocation strategy for large objects: they are always
17420 allocated dynamically if their size exceeds a fixed threshold.  Note this
17421 may change the semantics of some code.
17423 @item
17424 Fixed limit on the size of the static frame of functions: when it is
17425 topped by a particular function, stack checking is not reliable and
17426 a warning is issued by the compiler.
17428 @item
17429 Inefficiency: because of both the modified allocation strategy and the
17430 generic implementation, code performance is hampered.
17431 @end enumerate
17433 Note that old-style stack checking is also the fallback method for
17434 @samp{specific} if no target support has been added in the compiler.
17436 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
17437 and stack overflows.  @samp{specific} is an excellent choice when compiling
17438 Ada code.  It is not generally sufficient to protect against stack-clash
17439 attacks.  To protect against those you want @samp{-fstack-clash-protection}.
17441 @opindex fstack-clash-protection
17442 @item -fstack-clash-protection
17443 Generate code to prevent stack clash style attacks.  When this option is
17444 enabled, the compiler will only allocate one page of stack space at a time
17445 and each page is accessed immediately after allocation.  Thus, it prevents
17446 allocations from jumping over any stack guard page provided by the
17447 operating system.
17449 Most targets do not fully support stack clash protection.  However, on
17450 those targets @option{-fstack-clash-protection} will protect dynamic stack
17451 allocations.  @option{-fstack-clash-protection} may also provide limited
17452 protection for static stack allocations if the target supports
17453 @option{-fstack-check=specific}.
17455 @opindex fstack-limit-register
17456 @opindex fstack-limit-symbol
17457 @opindex fno-stack-limit
17458 @item -fstack-limit-register=@var{reg}
17459 @itemx -fstack-limit-symbol=@var{sym}
17460 @itemx -fno-stack-limit
17461 Generate code to ensure that the stack does not grow beyond a certain value,
17462 either the value of a register or the address of a symbol.  If a larger
17463 stack is required, a signal is raised at run time.  For most targets,
17464 the signal is raised before the stack overruns the boundary, so
17465 it is possible to catch the signal without taking special precautions.
17467 For instance, if the stack starts at absolute address @samp{0x80000000}
17468 and grows downwards, you can use the flags
17469 @option{-fstack-limit-symbol=__stack_limit} and
17470 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17471 of 128KB@.  Note that this may only work with the GNU linker.
17473 You can locally override stack limit checking by using the
17474 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
17476 @opindex fsplit-stack
17477 @item -fsplit-stack
17478 Generate code to automatically split the stack before it overflows.
17479 The resulting program has a discontiguous stack which can only
17480 overflow if the program is unable to allocate any more memory.  This
17481 is most useful when running threaded programs, as it is no longer
17482 necessary to calculate a good stack size to use for each thread.  This
17483 is currently only implemented for the x86 targets running
17484 GNU/Linux.
17486 When code compiled with @option{-fsplit-stack} calls code compiled
17487 without @option{-fsplit-stack}, there may not be much stack space
17488 available for the latter code to run.  If compiling all code,
17489 including library code, with @option{-fsplit-stack} is not an option,
17490 then the linker can fix up these calls so that the code compiled
17491 without @option{-fsplit-stack} always has a large stack.  Support for
17492 this is implemented in the gold linker in GNU binutils release 2.21
17493 and later.
17495 @opindex fvtable-verify
17496 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
17497 This option is only available when compiling C++ code.
17498 It turns on (or off, if using @option{-fvtable-verify=none}) the security
17499 feature that verifies at run time, for every virtual call, that
17500 the vtable pointer through which the call is made is valid for the type of
17501 the object, and has not been corrupted or overwritten.  If an invalid vtable
17502 pointer is detected at run time, an error is reported and execution of the
17503 program is immediately halted.
17505 This option causes run-time data structures to be built at program startup,
17506 which are used for verifying the vtable pointers.  
17507 The options @samp{std} and @samp{preinit}
17508 control the timing of when these data structures are built.  In both cases the
17509 data structures are built before execution reaches @code{main}.  Using
17510 @option{-fvtable-verify=std} causes the data structures to be built after
17511 shared libraries have been loaded and initialized.
17512 @option{-fvtable-verify=preinit} causes them to be built before shared
17513 libraries have been loaded and initialized.
17515 If this option appears multiple times in the command line with different
17516 values specified, @samp{none} takes highest priority over both @samp{std} and
17517 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
17519 @opindex fvtv-debug
17520 @item -fvtv-debug
17521 When used in conjunction with @option{-fvtable-verify=std} or 
17522 @option{-fvtable-verify=preinit}, causes debug versions of the 
17523 runtime functions for the vtable verification feature to be called.  
17524 This flag also causes the compiler to log information about which 
17525 vtable pointers it finds for each class.
17526 This information is written to a file named @file{vtv_set_ptr_data.log} 
17527 in the directory named by the environment variable @env{VTV_LOGS_DIR} 
17528 if that is defined or the current working directory otherwise.
17530 Note:  This feature @emph{appends} data to the log file. If you want a fresh log
17531 file, be sure to delete any existing one.
17533 @opindex fvtv-counts
17534 @item -fvtv-counts
17535 This is a debugging flag.  When used in conjunction with
17536 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
17537 causes the compiler to keep track of the total number of virtual calls
17538 it encounters and the number of verifications it inserts.  It also
17539 counts the number of calls to certain run-time library functions
17540 that it inserts and logs this information for each compilation unit.
17541 The compiler writes this information to a file named
17542 @file{vtv_count_data.log} in the directory named by the environment
17543 variable @env{VTV_LOGS_DIR} if that is defined or the current working
17544 directory otherwise.  It also counts the size of the vtable pointer sets
17545 for each class, and writes this information to @file{vtv_class_set_sizes.log}
17546 in the same directory.
17548 Note:  This feature @emph{appends} data to the log files.  To get fresh log
17549 files, be sure to delete any existing ones.
17551 @opindex finstrument-functions
17552 @item -finstrument-functions
17553 Generate instrumentation calls for entry and exit to functions.  Just
17554 after function entry and just before function exit, the following
17555 profiling functions are called with the address of the current
17556 function and its call site.  (On some platforms,
17557 @code{__builtin_return_address} does not work beyond the current
17558 function, so the call site information may not be available to the
17559 profiling functions otherwise.)
17561 @smallexample
17562 void __cyg_profile_func_enter (void *this_fn,
17563                                void *call_site);
17564 void __cyg_profile_func_exit  (void *this_fn,
17565                                void *call_site);
17566 @end smallexample
17568 The first argument is the address of the start of the current function,
17569 which may be looked up exactly in the symbol table.
17571 This instrumentation is also done for functions expanded inline in other
17572 functions.  The profiling calls indicate where, conceptually, the
17573 inline function is entered and exited.  This means that addressable
17574 versions of such functions must be available.  If all your uses of a
17575 function are expanded inline, this may mean an additional expansion of
17576 code size.  If you use @code{extern inline} in your C code, an
17577 addressable version of such functions must be provided.  (This is
17578 normally the case anyway, but if you get lucky and the optimizer always
17579 expands the functions inline, you might have gotten away without
17580 providing static copies.)
17582 A function may be given the attribute @code{no_instrument_function}, in
17583 which case this instrumentation is not done.  This can be used, for
17584 example, for the profiling functions listed above, high-priority
17585 interrupt routines, and any functions from which the profiling functions
17586 cannot safely be called (perhaps signal handlers, if the profiling
17587 routines generate output or allocate memory).
17588 @xref{Common Function Attributes}.
17590 @opindex finstrument-functions-once
17591 @item -finstrument-functions-once
17592 This is similar to @option{-finstrument-functions}, but the profiling
17593 functions are called only once per instrumented function, i.e. the first
17594 profiling function is called after the first entry into the instrumented
17595 function and the second profiling function is called before the exit
17596 corresponding to this first entry.
17598 The definition of @code{once} for the purpose of this option is a little
17599 vague because the implementation is not protected against data races.
17600 As a result, the implementation only guarantees that the profiling
17601 functions are called at @emph{least} once per process and at @emph{most}
17602 once per thread, but the calls are always paired, that is to say, if a
17603 thread calls the first function, then it will call the second function,
17604 unless it never reaches the exit of the instrumented function.
17606 @opindex finstrument-functions-exclude-file-list
17607 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17609 Set the list of functions that are excluded from instrumentation (see
17610 the description of @option{-finstrument-functions}).  If the file that
17611 contains a function definition matches with one of @var{file}, then
17612 that function is not instrumented.  The match is done on substrings:
17613 if the @var{file} parameter is a substring of the file name, it is
17614 considered to be a match.
17616 For example:
17618 @smallexample
17619 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
17620 @end smallexample
17622 @noindent
17623 excludes any inline function defined in files whose pathnames
17624 contain @file{/bits/stl} or @file{include/sys}.
17626 If, for some reason, you want to include letter @samp{,} in one of
17627 @var{sym}, write @samp{\,}. For example,
17628 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
17629 (note the single quote surrounding the option).
17631 @opindex finstrument-functions-exclude-function-list
17632 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17634 This is similar to @option{-finstrument-functions-exclude-file-list},
17635 but this option sets the list of function names to be excluded from
17636 instrumentation.  The function name to be matched is its user-visible
17637 name, such as @code{vector<int> blah(const vector<int> &)}, not the
17638 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17639 match is done on substrings: if the @var{sym} parameter is a substring
17640 of the function name, it is considered to be a match.  For C99 and C++
17641 extended identifiers, the function name must be given in UTF-8, not
17642 using universal character names.
17644 @opindex fpatchable-function-entry
17645 @item -fpatchable-function-entry=@var{N}[,@var{M}]
17646 Generate @var{N} NOPs right at the beginning
17647 of each function, with the function entry point before the @var{M}th NOP.
17648 If @var{M} is omitted, it defaults to @code{0} so the
17649 function entry points to the address just at the first NOP.
17650 The NOP instructions reserve extra space which can be used to patch in
17651 any desired instrumentation at run time, provided that the code segment
17652 is writable.  The amount of space is controllable indirectly via
17653 the number of NOPs; the NOP instruction used corresponds to the instruction
17654 emitted by the internal GCC back-end interface @code{gen_nop}.  This behavior
17655 is target-specific and may also depend on the architecture variant and/or
17656 other compilation options.
17658 For run-time identification, the starting addresses of these areas,
17659 which correspond to their respective function entries minus @var{M},
17660 are additionally collected in the @code{__patchable_function_entries}
17661 section of the resulting binary.
17663 Note that the value of @code{__attribute__ ((patchable_function_entry
17664 (N,M)))} takes precedence over command-line option
17665 @option{-fpatchable-function-entry=N,M}.  This can be used to increase
17666 the area size or to remove it completely on a single function.
17667 If @code{N=0}, no pad location is recorded.
17669 The NOP instructions are inserted at---and maybe before, depending on
17670 @var{M}---the function entry address, even before the prologue.  On
17671 PowerPC with the ELFv2 ABI, for a function with dual entry points,
17672 the local entry point is this function entry address.
17674 The maximum value of @var{N} and @var{M} is 65535.  On PowerPC with the
17675 ELFv2 ABI, for a function with dual entry points, the supported values
17676 for @var{M} are 0, 2, 6 and 14.
17677 @end table
17680 @node Preprocessor Options
17681 @section Options Controlling the Preprocessor
17682 @cindex preprocessor options
17683 @cindex options, preprocessor
17685 These options control the C preprocessor, which is run on each C source
17686 file before actual compilation.
17688 If you use the @option{-E} option, nothing is done except preprocessing.
17689 Some of these options make sense only together with @option{-E} because
17690 they cause the preprocessor output to be unsuitable for actual
17691 compilation.
17693 In addition to the options listed here, there are a number of options 
17694 to control search paths for include files documented in 
17695 @ref{Directory Options}.  
17696 Options to control preprocessor diagnostics are listed in 
17697 @ref{Warning Options}.
17699 @table @gcctabopt
17700 @include cppopts.texi
17702 @opindex Wp
17703 @item -Wp,@var{option}
17704 You can use @option{-Wp,@var{option}} to bypass the compiler driver
17705 and pass @var{option} directly through to the preprocessor.  If
17706 @var{option} contains commas, it is split into multiple options at the
17707 commas.  However, many options are modified, translated or interpreted
17708 by the compiler driver before being passed to the preprocessor, and
17709 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
17710 interface is undocumented and subject to change, so whenever possible
17711 you should avoid using @option{-Wp} and let the driver handle the
17712 options instead.
17714 @opindex Xpreprocessor
17715 @item -Xpreprocessor @var{option}
17716 Pass @var{option} as an option to the preprocessor.  You can use this to
17717 supply system-specific preprocessor options that GCC does not 
17718 recognize.
17720 If you want to pass an option that takes an argument, you must use
17721 @option{-Xpreprocessor} twice, once for the option and once for the argument.
17723 @opindex no-integrated-cpp
17724 @item -no-integrated-cpp
17725 Perform preprocessing as a separate pass before compilation.
17726 By default, GCC performs preprocessing as an integrated part of
17727 input tokenization and parsing.
17728 If this option is provided, the appropriate language front end
17729 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
17730 and Objective-C, respectively) is instead invoked twice,
17731 once for preprocessing only and once for actual compilation
17732 of the preprocessed input.
17733 This option may be useful in conjunction with the @option{-B} or
17734 @option{-wrapper} options to specify an alternate preprocessor or
17735 perform additional processing of the program source between
17736 normal preprocessing and compilation.
17738 @opindex flarge-source-files
17739 @item -flarge-source-files
17740 Adjust GCC to expect large source files, at the expense of slower
17741 compilation and higher memory usage.
17743 Specifically, GCC normally tracks both column numbers and line numbers
17744 within source files and it normally prints both of these numbers in
17745 diagnostics.  However, once it has processed a certain number of source
17746 lines, it stops tracking column numbers and only tracks line numbers.
17747 This means that diagnostics for later lines do not include column numbers.
17748 It also means that options like @option{-Wmisleading-indentation} cease to work
17749 at that point, although the compiler prints a note if this happens.
17750 Passing @option{-flarge-source-files} significantly increases the number
17751 of source lines that GCC can process before it stops tracking columns.
17753 @end table
17755 @node Assembler Options
17756 @section Passing Options to the Assembler
17758 @c prevent bad page break with this line
17759 You can pass options to the assembler.
17761 @table @gcctabopt
17762 @opindex Wa
17763 @item -Wa,@var{option}
17764 Pass @var{option} as an option to the assembler.  If @var{option}
17765 contains commas, it is split into multiple options at the commas.
17767 @opindex Xassembler
17768 @item -Xassembler @var{option}
17769 Pass @var{option} as an option to the assembler.  You can use this to
17770 supply system-specific assembler options that GCC does not
17771 recognize.
17773 If you want to pass an option that takes an argument, you must use
17774 @option{-Xassembler} twice, once for the option and once for the argument.
17776 @end table
17778 @node Link Options
17779 @section Options for Linking
17780 @cindex link options
17781 @cindex options, linking
17783 These options come into play when the compiler links object files into
17784 an executable output file.  They are meaningless if the compiler is
17785 not doing a link step.
17787 @table @gcctabopt
17788 @cindex file names
17789 @item @var{object-file-name}
17790 A file name that does not end in a special recognized suffix is
17791 considered to name an object file or library.  (Object files are
17792 distinguished from libraries by the linker according to the file
17793 contents.)  If linking is done, these object files are used as input
17794 to the linker.
17796 @opindex c
17797 @opindex S
17798 @opindex E
17799 @item -c
17800 @itemx -S
17801 @itemx -E
17802 If any of these options is used, then the linker is not run, and
17803 object file names should not be used as arguments.  @xref{Overall
17804 Options}.
17806 @opindex flinker-output
17807 @item -flinker-output=@var{type}
17808 This option controls code generation of the link-time optimizer.  By
17809 default the linker output is automatically determined by the linker
17810 plugin.  For debugging the compiler and if incremental linking with a 
17811 non-LTO object file is desired, it may be useful to control the type
17812 manually.
17814 If @var{type} is @samp{exec}, code generation produces a static
17815 binary. In this case @option{-fpic} and @option{-fpie} are both
17816 disabled.
17818 If @var{type} is @samp{dyn}, code generation produces a shared
17819 library.  In this case @option{-fpic} or @option{-fPIC} is preserved,
17820 but not enabled automatically.  This allows to build shared libraries
17821 without position-independent code on architectures where this is
17822 possible, i.e.@: on x86.
17824 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
17825 executable. This results in similar optimizations as @samp{exec}
17826 except that @option{-fpie} is not disabled if specified at compilation
17827 time.
17829 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
17830 done.  The sections containing intermediate code for link-time optimization are
17831 merged, pre-optimized, and output to the resulting object file. In addition, if
17832 @option{-ffat-lto-objects} is specified, binary code is produced for future
17833 non-LTO linking. The object file produced by incremental linking is smaller
17834 than a static library produced from the same object files.  At link time the
17835 result of incremental linking also loads faster than a static
17836 library assuming that the majority of objects in the library are used.
17838 Finally @samp{nolto-rel} configures the compiler for incremental linking where
17839 code generation is forced, a final binary is produced, and the intermediate
17840 code for later link-time optimization is stripped. When multiple object files
17841 are linked together the resulting code is better optimized than with
17842 link-time optimizations disabled (for example, cross-module inlining 
17843 happens), but most of benefits of whole program optimizations are lost. 
17845 During the incremental link (by @option{-r}) the linker plugin defaults to
17846 @option{rel}. With current interfaces to GNU Binutils it is however not
17847 possible to incrementally link LTO objects and non-LTO objects into a single
17848 mixed object file.  If any of object files in incremental link cannot
17849 be used for link-time optimization, the linker plugin issues a warning and
17850 uses @samp{nolto-rel}. To maintain whole program optimization, it is
17851 recommended to link such objects into static library instead. Alternatively it
17852 is possible to use H.J. Lu's binutils with support for mixed objects.
17854 @opindex fuse-ld=bfd
17855 @item -fuse-ld=bfd
17856 Use the @command{bfd} linker instead of the default linker.
17858 @opindex fuse-ld=gold
17859 @item -fuse-ld=gold
17860 Use the @command{gold} linker instead of the default linker.
17862 @opindex fuse-ld=lld
17863 @item -fuse-ld=lld
17864 Use the LLVM @command{lld} linker instead of the default linker.
17866 @opindex fuse-ld=mold
17867 @item -fuse-ld=mold
17868 Use the Modern Linker (@command{mold}) instead of the default linker.
17870 @cindex Libraries
17871 @opindex l
17872 @item -l@var{library}
17873 @itemx -l @var{library}
17874 Search the library named @var{library} when linking.  (The second
17875 alternative with the library as a separate argument is only for
17876 POSIX compliance and is not recommended.)
17878 The @option{-l} option is passed directly to the linker by GCC.  Refer
17879 to your linker documentation for exact details.  The general
17880 description below applies to the GNU linker.  
17882 The linker searches a standard list of directories for the library.
17883 The directories searched include several standard system directories
17884 plus any that you specify with @option{-L}.
17886 Static libraries are archives of object files, and have file names
17887 like @file{lib@var{library}.a}.  Some targets also support shared
17888 libraries, which typically have names like @file{lib@var{library}.so}.
17889 If both static and shared libraries are found, the linker gives
17890 preference to linking with the shared library unless the
17891 @option{-static} option is used.
17893 It makes a difference where in the command you write this option; the
17894 linker searches and processes libraries and object files in the order they
17895 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
17896 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
17897 to functions in @samp{z}, those functions may not be loaded.
17899 @opindex lobjc
17900 @item -lobjc
17901 You need this special case of the @option{-l} option in order to
17902 link an Objective-C or Objective-C++ program.
17904 @opindex nostartfiles
17905 @item -nostartfiles
17906 Do not use the standard system startup files when linking.
17907 The standard system libraries are used normally, unless @option{-nostdlib},
17908 @option{-nolibc}, or @option{-nodefaultlibs} is used.
17910 @opindex nodefaultlibs
17911 @item -nodefaultlibs
17912 Do not use the standard system libraries when linking.
17913 Only the libraries you specify are passed to the linker, and options
17914 specifying linkage of the system libraries, such as @option{-static-libgcc}
17915 or @option{-shared-libgcc}, are ignored.  
17916 The standard startup files are used normally, unless @option{-nostartfiles}
17917 is used.  
17919 The compiler may generate calls to @code{memcmp},
17920 @code{memset}, @code{memcpy} and @code{memmove}.
17921 These entries are usually resolved by entries in
17922 libc.  These entry points should be supplied through some other
17923 mechanism when this option is specified.
17925 @opindex nolibc
17926 @item -nolibc
17927 Do not use the C library or system libraries tightly coupled with it when
17928 linking.  Still link with the startup files, @file{libgcc} or toolchain
17929 provided language support libraries such as @file{libgnat}, @file{libgfortran}
17930 or @file{libstdc++} unless options preventing their inclusion are used as
17931 well.  This typically removes @option{-lc} from the link command line, as well
17932 as system libraries that normally go with it and become meaningless when
17933 absence of a C library is assumed, for example @option{-lpthread} or
17934 @option{-lm} in some configurations.  This is intended for bare-board
17935 targets when there is indeed no C library available.
17937 @opindex nostdlib
17938 @item -nostdlib
17939 Do not use the standard system startup files or libraries when linking.
17940 No startup files and only the libraries you specify are passed to
17941 the linker, and options specifying linkage of the system libraries, such as
17942 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
17944 The compiler may generate calls to @code{memcmp}, @code{memset},
17945 @code{memcpy} and @code{memmove}.
17946 These entries are usually resolved by entries in
17947 libc.  These entry points should be supplied through some other
17948 mechanism when this option is specified.
17950 @cindex @option{-lgcc}, use with @option{-nostdlib}
17951 @cindex @option{-nostdlib} and unresolved references
17952 @cindex unresolved references and @option{-nostdlib}
17953 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
17954 @cindex @option{-nodefaultlibs} and unresolved references
17955 @cindex unresolved references and @option{-nodefaultlibs}
17956 One of the standard libraries bypassed by @option{-nostdlib} and
17957 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
17958 which GCC uses to overcome shortcomings of particular machines, or special
17959 needs for some languages.
17960 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
17961 Collection (GCC) Internals},
17962 for more discussion of @file{libgcc.a}.)
17963 In most cases, you need @file{libgcc.a} even when you want to avoid
17964 other standard libraries.  In other words, when you specify @option{-nostdlib}
17965 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
17966 This ensures that you have no unresolved references to internal GCC
17967 library subroutines.
17968 (An example of such an internal subroutine is @code{__main}, used to ensure C++
17969 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
17970 GNU Compiler Collection (GCC) Internals}.)
17972 @opindex nostdlib++
17973 @item -nostdlib++
17974 Do not implicitly link with standard C++ libraries.
17976 @opindex e
17977 @opindex entry
17978 @item -e @var{entry}
17979 @itemx --entry=@var{entry}
17981 Specify that the program entry point is @var{entry}.  The argument is
17982 interpreted by the linker; the GNU linker accepts either a symbol name
17983 or an address.
17985 @opindex pie
17986 @item -pie
17987 Produce a dynamically linked position independent executable on targets
17988 that support it.  For predictable results, you must also specify the same
17989 set of options used for compilation (@option{-fpie}, @option{-fPIE},
17990 or model suboptions) when you specify this linker option.
17992 @opindex no-pie
17993 @item -no-pie
17994 Don't produce a dynamically linked position independent executable.
17996 @opindex static-pie
17997 @item -static-pie
17998 Produce a static position independent executable on targets that support
17999 it.  A static position independent executable is similar to a static
18000 executable, but can be loaded at any address without a dynamic linker.
18001 For predictable results, you must also specify the same set of options
18002 used for compilation (@option{-fpie}, @option{-fPIE}, or model
18003 suboptions) when you specify this linker option.
18005 @opindex pthread
18006 @item -pthread
18007 Link with the POSIX threads library.  This option is supported on 
18008 GNU/Linux targets, most other Unix derivatives, and also on 
18009 x86 Cygwin and MinGW targets.  On some targets this option also sets 
18010 flags for the preprocessor, so it should be used consistently for both
18011 compilation and linking.
18013 @opindex r
18014 @item -r
18015 Produce a relocatable object as output.  This is also known as partial
18016 linking.
18018 @opindex rdynamic
18019 @item -rdynamic
18020 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
18021 that support it. This instructs the linker to add all symbols, not
18022 only used ones, to the dynamic symbol table. This option is needed
18023 for some uses of @code{dlopen} or to allow obtaining backtraces
18024 from within a program.
18026 @opindex s
18027 @item -s
18028 Remove all symbol table and relocation information from the executable.
18030 @opindex static
18031 @item -static
18032 On systems that support dynamic linking, this overrides @option{-pie}
18033 and prevents linking with the shared libraries.  On other systems, this
18034 option has no effect.
18036 @opindex shared
18037 @item -shared
18038 Produce a shared object which can then be linked with other objects to
18039 form an executable.  Not all systems support this option.  For predictable
18040 results, you must also specify the same set of options used for compilation
18041 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
18042 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
18043 needs to build supplementary stub code for constructors to work.  On
18044 multi-libbed systems, @samp{gcc -shared} must select the correct support
18045 libraries to link against.  Failing to supply the correct flags may lead
18046 to subtle defects.  Supplying them in cases where they are not necessary
18047 is innocuous.  @option{-shared} suppresses the addition of startup code
18048 to alter the floating-point environment as done with @option{-ffast-math},
18049 @option{-Ofast} or @option{-funsafe-math-optimizations} on some targets.}
18051 @opindex shared-libgcc
18052 @opindex static-libgcc
18053 @item -shared-libgcc
18054 @itemx -static-libgcc
18055 On systems that provide @file{libgcc} as a shared library, these options
18056 force the use of either the shared or static version, respectively.
18057 If no shared version of @file{libgcc} was built when the compiler was
18058 configured, these options have no effect.
18060 There are several situations in which an application should use the
18061 shared @file{libgcc} instead of the static version.  The most common
18062 of these is when the application wishes to throw and catch exceptions
18063 across different shared libraries.  In that case, each of the libraries
18064 as well as the application itself should use the shared @file{libgcc}.
18066 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
18067 whenever you build a shared library or a main executable, because C++
18068 programs typically use exceptions, so this is the right thing to do.
18070 If, instead, you use the GCC driver to create shared libraries, you may
18071 find that they are not always linked with the shared @file{libgcc}.
18072 If GCC finds, at its configuration time, that you have a non-GNU linker
18073 or a GNU linker that does not support option @option{--eh-frame-hdr},
18074 it links the shared version of @file{libgcc} into shared libraries
18075 by default.  Otherwise, it takes advantage of the linker and optimizes
18076 away the linking with the shared version of @file{libgcc}, linking with
18077 the static version of libgcc by default.  This allows exceptions to
18078 propagate through such shared libraries, without incurring relocation
18079 costs at library load time.
18081 However, if a library or main executable is supposed to throw or catch
18082 exceptions, you must link it using the G++ driver, or using the option
18083 @option{-shared-libgcc}, such that it is linked with the shared
18084 @file{libgcc}.
18086 @opindex static-libasan
18087 @item -static-libasan
18088 When the @option{-fsanitize=address} option is used to link a program,
18089 the GCC driver automatically links against @option{libasan}.  If
18090 @file{libasan} is available as a shared library, and the @option{-static}
18091 option is not used, then this links against the shared version of
18092 @file{libasan}.  The @option{-static-libasan} option directs the GCC
18093 driver to link @file{libasan} statically, without necessarily linking
18094 other libraries statically.
18096 @opindex static-libtsan
18097 @item -static-libtsan
18098 When the @option{-fsanitize=thread} option is used to link a program,
18099 the GCC driver automatically links against @option{libtsan}.  If
18100 @file{libtsan} is available as a shared library, and the @option{-static}
18101 option is not used, then this links against the shared version of
18102 @file{libtsan}.  The @option{-static-libtsan} option directs the GCC
18103 driver to link @file{libtsan} statically, without necessarily linking
18104 other libraries statically.
18106 @opindex static-liblsan
18107 @item -static-liblsan
18108 When the @option{-fsanitize=leak} option is used to link a program,
18109 the GCC driver automatically links against @option{liblsan}.  If
18110 @file{liblsan} is available as a shared library, and the @option{-static}
18111 option is not used, then this links against the shared version of
18112 @file{liblsan}.  The @option{-static-liblsan} option directs the GCC
18113 driver to link @file{liblsan} statically, without necessarily linking
18114 other libraries statically.
18116 @opindex static-libubsan
18117 @item -static-libubsan
18118 When the @option{-fsanitize=undefined} option is used to link a program,
18119 the GCC driver automatically links against @option{libubsan}.  If
18120 @file{libubsan} is available as a shared library, and the @option{-static}
18121 option is not used, then this links against the shared version of
18122 @file{libubsan}.  The @option{-static-libubsan} option directs the GCC
18123 driver to link @file{libubsan} statically, without necessarily linking
18124 other libraries statically.
18126 @opindex static-libstdc++
18127 @item -static-libstdc++
18128 When the @command{g++} program is used to link a C++ program, it
18129 normally automatically links against @option{libstdc++}.  If
18130 @file{libstdc++} is available as a shared library, and the
18131 @option{-static} option is not used, then this links against the
18132 shared version of @file{libstdc++}.  That is normally fine.  However, it
18133 is sometimes useful to freeze the version of @file{libstdc++} used by
18134 the program without going all the way to a fully static link.  The
18135 @option{-static-libstdc++} option directs the @command{g++} driver to
18136 link @file{libstdc++} statically, without necessarily linking other
18137 libraries statically.
18139 @opindex symbolic
18140 @item -symbolic
18141 Bind references to global symbols when building a shared object.  Warn
18142 about any unresolved references (unless overridden by the link editor
18143 option @option{-Xlinker -z -Xlinker defs}).  Only a few systems support
18144 this option.
18146 @opindex T
18147 @cindex linker script
18148 @item -T @var{script}
18149 Use @var{script} as the linker script.  This option is supported by most
18150 systems using the GNU linker.  On some targets, such as bare-board
18151 targets without an operating system, the @option{-T} option may be required
18152 when linking to avoid references to undefined symbols.
18154 @opindex Xlinker
18155 @item -Xlinker @var{option}
18156 Pass @var{option} as an option to the linker.  You can use this to
18157 supply system-specific linker options that GCC does not recognize.
18159 If you want to pass an option that takes a separate argument, you must use
18160 @option{-Xlinker} twice, once for the option and once for the argument.
18161 For example, to pass @option{-assert definitions}, you must write
18162 @option{-Xlinker -assert -Xlinker definitions}.  It does not work to write
18163 @option{-Xlinker "-assert definitions"}, because this passes the entire
18164 string as a single argument, which is not what the linker expects.
18166 When using the GNU linker, it is usually more convenient to pass
18167 arguments to linker options using the @option{@var{option}=@var{value}}
18168 syntax than as separate arguments.  For example, you can specify
18169 @option{-Xlinker -Map=output.map} rather than
18170 @option{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
18171 this syntax for command-line options.
18173 @opindex Wl
18174 @item -Wl,@var{option}
18175 Pass @var{option} as an option to the linker.  If @var{option} contains
18176 commas, it is split into multiple options at the commas.  You can use this
18177 syntax to pass an argument to the option.
18178 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
18179 linker.  When using the GNU linker, you can also get the same effect with
18180 @option{-Wl,-Map=output.map}.
18182 @opindex u
18183 @item -u @var{symbol}
18184 Pretend the symbol @var{symbol} is undefined, to force linking of
18185 library modules to define it.  You can use @option{-u} multiple times with
18186 different symbols to force loading of additional library modules.
18188 @opindex z
18189 @item -z @var{keyword}
18190 @option{-z} is passed directly on to the linker along with the keyword
18191 @var{keyword}. See the section in the documentation of your linker for
18192 permitted values and their meanings.
18193 @end table
18195 @node Directory Options
18196 @section Options for Directory Search
18197 @cindex directory options
18198 @cindex options, directory search
18199 @cindex search path
18201 These options specify directories to search for header files, for
18202 libraries and for parts of the compiler:
18204 @table @gcctabopt
18205 @include cppdiropts.texi
18207 @opindex iplugindir=
18208 @item -iplugindir=@var{dir}
18209 Set the directory to search for plugins that are passed
18210 by @option{-fplugin=@var{name}} instead of
18211 @option{-fplugin=@var{path}/@var{name}.so}.  This option is not meant
18212 to be used by the user, but only passed by the driver.
18214 @opindex L
18215 @item -L@var{dir}
18216 Add directory @var{dir} to the list of directories to be searched
18217 for @option{-l}.
18219 @opindex B
18220 @item -B@var{prefix}
18221 This option specifies where to find the executables, libraries,
18222 include files, and data files of the compiler itself.
18224 The compiler driver program runs one or more of the subprograms
18225 @command{cpp}, @command{cc1}, @command{as} and @command{ld}.  It tries
18226 @var{prefix} as a prefix for each program it tries to run, both with and
18227 without @samp{@var{machine}/@var{version}/} for the corresponding target
18228 machine and compiler version.
18230 For each subprogram to be run, the compiler driver first tries the
18231 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
18232 is not specified, the driver tries two standard prefixes, 
18233 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
18234 those results in a file name that is found, the unmodified program
18235 name is searched for using the directories specified in your
18236 @env{PATH} environment variable.
18238 The compiler checks to see if the path provided by @option{-B}
18239 refers to a directory, and if necessary it adds a directory
18240 separator character at the end of the path.
18242 @option{-B} prefixes that effectively specify directory names also apply
18243 to libraries in the linker, because the compiler translates these
18244 options into @option{-L} options for the linker.  They also apply to
18245 include files in the preprocessor, because the compiler translates these
18246 options into @option{-isystem} options for the preprocessor.  In this case,
18247 the compiler appends @samp{include} to the prefix.
18249 The runtime support file @file{libgcc.a} can also be searched for using
18250 the @option{-B} prefix, if needed.  If it is not found there, the two
18251 standard prefixes above are tried, and that is all.  The file is left
18252 out of the link if it is not found by those means.
18254 Another way to specify a prefix much like the @option{-B} prefix is to use
18255 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
18256 Variables}.
18258 As a special kludge, if the path provided by @option{-B} is
18259 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
18260 9, then it is replaced by @file{[dir/]include}.  This is to help
18261 with boot-strapping the compiler.
18263 @opindex no-canonical-prefixes
18264 @item -no-canonical-prefixes
18265 Do not expand any symbolic links, resolve references to @samp{/../}
18266 or @samp{/./}, or make the path absolute when generating a relative
18267 prefix.
18269 @opindex sysroot
18270 @item --sysroot=@var{dir}
18271 Use @var{dir} as the logical root directory for headers and libraries.
18272 For example, if the compiler normally searches for headers in
18273 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
18274 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
18276 If you use both this option and the @option{-isysroot} option, then
18277 the @option{--sysroot} option applies to libraries, but the
18278 @option{-isysroot} option applies to header files.
18280 The GNU linker (beginning with version 2.16) has the necessary support
18281 for this option.  If your linker does not support this option, the
18282 header file aspect of @option{--sysroot} still works, but the
18283 library aspect does not.
18285 @opindex no-sysroot-suffix
18286 @item --no-sysroot-suffix
18287 For some targets, a suffix is added to the root directory specified
18288 with @option{--sysroot}, depending on the other options used, so that
18289 headers may for example be found in
18290 @file{@var{dir}/@var{suffix}/usr/include} instead of
18291 @file{@var{dir}/usr/include}.  This option disables the addition of
18292 such a suffix.
18294 @end table
18296 @node Code Gen Options
18297 @section Options for Code Generation Conventions
18298 @cindex code generation conventions
18299 @cindex options, code generation
18300 @cindex run-time options
18302 These machine-independent options control the interface conventions
18303 used in code generation.
18305 Most of them have both positive and negative forms; the negative form
18306 of @option{-ffoo} is @option{-fno-foo}.  In the table below, only
18307 one of the forms is listed---the one that is not the default.  You
18308 can figure out the other form by either removing @samp{no-} or adding
18311 @table @gcctabopt
18312 @opindex fstack_reuse
18313 @item -fstack-reuse=@var{reuse-level}
18314 This option controls stack space reuse for user declared local/auto variables
18315 and compiler generated temporaries.  @var{reuse_level} can be @samp{all},
18316 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
18317 local variables and temporaries, @samp{named_vars} enables the reuse only for
18318 user defined local variables with names, and @samp{none} disables stack reuse
18319 completely. The default value is @samp{all}. The option is needed when the
18320 program extends the lifetime of a scoped local variable or a compiler generated
18321 temporary beyond the end point defined by the language.  When a lifetime of
18322 a variable ends, and if the variable lives in memory, the optimizing compiler
18323 has the freedom to reuse its stack space with other temporaries or scoped
18324 local variables whose live range does not overlap with it. Legacy code extending
18325 local lifetime is likely to break with the stack reuse optimization.
18327 For example,
18329 @smallexample
18330    int *p;
18331    @{
18332      int local1;
18334      p = &local1;
18335      local1 = 10;
18336      ....
18337    @}
18338    @{
18339       int local2;
18340       local2 = 20;
18341       ...
18342    @}
18344    if (*p == 10)  // out of scope use of local1
18345      @{
18347      @}
18348 @end smallexample
18350 Another example:
18351 @smallexample
18353    struct A
18354    @{
18355        A(int k) : i(k), j(k) @{ @}
18356        int i;
18357        int j;
18358    @};
18360    A *ap;
18362    void foo(const A& ar)
18363    @{
18364       ap = &ar;
18365    @}
18367    void bar()
18368    @{
18369       foo(A(10)); // temp object's lifetime ends when foo returns
18371       @{
18372         A a(20);
18373         ....
18374       @}
18375       ap->i+= 10;  // ap references out of scope temp whose space
18376                    // is reused with a. What is the value of ap->i?
18377    @}
18379 @end smallexample
18381 The lifetime of a compiler generated temporary is well defined by the C++
18382 standard. When a lifetime of a temporary ends, and if the temporary lives
18383 in memory, the optimizing compiler has the freedom to reuse its stack
18384 space with other temporaries or scoped local variables whose live range
18385 does not overlap with it. However some of the legacy code relies on
18386 the behavior of older compilers in which temporaries' stack space is
18387 not reused, the aggressive stack reuse can lead to runtime errors. This
18388 option is used to control the temporary stack reuse optimization.
18390 @opindex ftrapv
18391 @item -ftrapv
18392 This option generates traps for signed overflow on addition, subtraction,
18393 multiplication operations.
18394 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18395 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18396 @option{-fwrapv} being effective.  Note that only active options override, so
18397 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18398 results in @option{-ftrapv} being effective.
18400 @opindex fwrapv
18401 @item -fwrapv
18402 This option instructs the compiler to assume that signed arithmetic
18403 overflow of addition, subtraction and multiplication wraps around
18404 using twos-complement representation.  This flag enables some optimizations
18405 and disables others.
18406 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
18407 @option{-ftrapv} @option{-fwrapv} on the command-line results in
18408 @option{-fwrapv} being effective.  Note that only active options override, so
18409 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
18410 results in @option{-ftrapv} being effective.
18412 @opindex fwrapv-pointer
18413 @item -fwrapv-pointer
18414 This option instructs the compiler to assume that pointer arithmetic
18415 overflow on addition and subtraction wraps around using twos-complement
18416 representation.  This flag disables some optimizations which assume
18417 pointer overflow is invalid.
18419 @opindex fstrict-overflow
18420 @item -fstrict-overflow
18421 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
18422 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
18424 @opindex fexceptions
18425 @item -fexceptions
18426 Enable exception handling.  Generates extra code needed to propagate
18427 exceptions.  For some targets, this implies GCC generates frame
18428 unwind information for all functions, which can produce significant data
18429 size overhead, although it does not affect execution.  If you do not
18430 specify this option, GCC enables it by default for languages like
18431 C++ that normally require exception handling, and disables it for
18432 languages like C that do not normally require it.  However, you may need
18433 to enable this option when compiling C code that needs to interoperate
18434 properly with exception handlers written in C++.  You may also wish to
18435 disable this option if you are compiling older C++ programs that don't
18436 use exception handling.
18438 @opindex fnon-call-exceptions
18439 @item -fnon-call-exceptions
18440 Generate code that allows trapping instructions to throw exceptions.
18441 Note that this requires platform-specific runtime support that does
18442 not exist everywhere.  Moreover, it only allows @emph{trapping}
18443 instructions to throw exceptions, i.e.@: memory references or floating-point
18444 instructions.  It does not allow exceptions to be thrown from
18445 arbitrary signal handlers such as @code{SIGALRM}.  This enables
18446 @option{-fexceptions}.
18448 @opindex fdelete-dead-exceptions
18449 @item -fdelete-dead-exceptions
18450 Consider that instructions that may throw exceptions but don't otherwise
18451 contribute to the execution of the program can be optimized away.
18452 This does not affect calls to functions except those with the
18453 @code{pure} or @code{const} attributes.
18454 This option is enabled by default for the Ada and C++ compilers, as permitted by
18455 the language specifications.
18456 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
18458 @opindex funwind-tables
18459 @item -funwind-tables
18460 Similar to @option{-fexceptions}, except that it just generates any needed
18461 static data, but does not affect the generated code in any other way.
18462 You normally do not need to enable this option; instead, a language processor
18463 that needs this handling enables it on your behalf.
18465 @opindex fasynchronous-unwind-tables
18466 @item -fasynchronous-unwind-tables
18467 Generate unwind table in DWARF format, if supported by target machine.  The
18468 table is exact at each instruction boundary, so it can be used for stack
18469 unwinding from asynchronous events (such as debugger or garbage collector).
18471 @opindex fno-gnu-unique
18472 @opindex fgnu-unique
18473 @item -fno-gnu-unique
18474 On systems with recent GNU assembler and C library, the C++ compiler
18475 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
18476 of template static data members and static local variables in inline
18477 functions are unique even in the presence of @code{RTLD_LOCAL}; this
18478 is necessary to avoid problems with a library used by two different
18479 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
18480 therefore disagreeing with the other one about the binding of the
18481 symbol.  But this causes @code{dlclose} to be ignored for affected
18482 DSOs; if your program relies on reinitialization of a DSO via
18483 @code{dlclose} and @code{dlopen}, you can use
18484 @option{-fno-gnu-unique}.
18486 @opindex fpcc-struct-return
18487 @item -fpcc-struct-return
18488 Return ``short'' @code{struct} and @code{union} values in memory like
18489 longer ones, rather than in registers.  This convention is less
18490 efficient, but it has the advantage of allowing intercallability between
18491 GCC-compiled files and files compiled with other compilers, particularly
18492 the Portable C Compiler (pcc).
18494 The precise convention for returning structures in memory depends
18495 on the target configuration macros.
18497 Short structures and unions are those whose size and alignment match
18498 that of some integer type.
18500 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18501 switch is not binary compatible with code compiled with the
18502 @option{-freg-struct-return} switch.
18503 Use it to conform to a non-default application binary interface.
18505 @opindex freg-struct-return
18506 @item -freg-struct-return
18507 Return @code{struct} and @code{union} values in registers when possible.
18508 This is more efficient for small structures than
18509 @option{-fpcc-struct-return}.
18511 If you specify neither @option{-fpcc-struct-return} nor
18512 @option{-freg-struct-return}, GCC defaults to whichever convention is
18513 standard for the target.  If there is no standard convention, GCC
18514 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18515 the principal compiler.  In those cases, we can choose the standard, and
18516 we chose the more efficient register return alternative.
18518 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18519 switch is not binary compatible with code compiled with the
18520 @option{-fpcc-struct-return} switch.
18521 Use it to conform to a non-default application binary interface.
18523 @opindex fshort-enums
18524 @item -fshort-enums
18525 Allocate to an @code{enum} type only as many bytes as it needs for the
18526 declared range of possible values.  Specifically, the @code{enum} type
18527 is equivalent to the smallest integer type that has enough room.
18528 This option has no effect for an enumeration type with a fixed underlying
18529 type.
18531 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18532 code that is not binary compatible with code generated without that switch.
18533 Use it to conform to a non-default application binary interface.
18535 @opindex fshort-wchar
18536 @item -fshort-wchar
18537 Override the underlying type for @code{wchar_t} to be @code{short
18538 unsigned int} instead of the default for the target.  This option is
18539 useful for building programs to run under WINE@.
18541 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18542 code that is not binary compatible with code generated without that switch.
18543 Use it to conform to a non-default application binary interface.
18545 @opindex fcommon
18546 @opindex fno-common
18547 @cindex tentative definitions
18548 @item -fcommon
18549 In C code, this option controls the placement of global variables
18550 defined without an initializer, known as @dfn{tentative definitions}
18551 in the C standard.  Tentative definitions are distinct from declarations
18552 of a variable with the @code{extern} keyword, which do not allocate storage.
18554 The default is @option{-fno-common}, which specifies that the compiler places
18555 uninitialized global variables in the BSS section of the object file.
18556 This inhibits the merging of tentative definitions by the linker so you get a
18557 multiple-definition error if the same variable is accidentally defined in more
18558 than one compilation unit.
18560 The @option{-fcommon} places uninitialized global variables in a common block.
18561 This allows the linker to resolve all tentative definitions of the same variable
18562 in different compilation units to the same object, or to a non-tentative
18563 definition.  This behavior is inconsistent with C++, and on many targets implies
18564 a speed and code size penalty on global variable references.  It is mainly
18565 useful to enable legacy code to link without errors.
18567 @opindex fno-ident
18568 @opindex fident
18569 @item -fno-ident
18570 Ignore the @code{#ident} directive.
18572 @opindex finhibit-size-directive
18573 @item -finhibit-size-directive
18574 Don't output a @code{.size} assembler directive, or anything else that
18575 would cause trouble if the function is split in the middle, and the
18576 two halves are placed at locations far apart in memory.  This option is
18577 used when compiling @file{crtstuff.c}; you should not need to use it
18578 for anything else.
18580 @opindex fverbose-asm
18581 @item -fverbose-asm
18582 Put extra commentary information in the generated assembly code to
18583 make it more readable.  This option is generally only of use to those
18584 who actually need to read the generated assembly code (perhaps while
18585 debugging the compiler itself).
18587 @option{-fno-verbose-asm}, the default, causes the
18588 extra information to be omitted and is useful when comparing two assembler
18589 files.
18591 The added comments include:
18593 @itemize @bullet
18595 @item
18596 information on the compiler version and command-line options,
18598 @item
18599 the source code lines associated with the assembly instructions,
18600 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
18602 @item
18603 hints on which high-level expressions correspond to
18604 the various assembly instruction operands.
18606 @end itemize
18608 For example, given this C source file:
18610 @smallexample
18611 int test (int n)
18613   int i;
18614   int total = 0;
18616   for (i = 0; i < n; i++)
18617     total += i * i;
18619   return total;
18621 @end smallexample
18623 compiling to (x86_64) assembly via @option{-S} and emitting the result
18624 direct to stdout via @option{-o} @option{-}
18626 @smallexample
18627 gcc -S test.c -fverbose-asm -Os -o -
18628 @end smallexample
18630 gives output similar to this:
18632 @smallexample
18633         .file   "test.c"
18634 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
18635   [...snip...]
18636 # options passed:
18637   [...snip...]
18639         .text
18640         .globl  test
18641         .type   test, @@function
18642 test:
18643 .LFB0:
18644         .cfi_startproc
18645 # test.c:4:   int total = 0;
18646         xorl    %eax, %eax      # <retval>
18647 # test.c:6:   for (i = 0; i < n; i++)
18648         xorl    %edx, %edx      # i
18649 .L2:
18650 # test.c:6:   for (i = 0; i < n; i++)
18651         cmpl    %edi, %edx      # n, i
18652         jge     .L5     #,
18653 # test.c:7:     total += i * i;
18654         movl    %edx, %ecx      # i, tmp92
18655         imull   %edx, %ecx      # i, tmp92
18656 # test.c:6:   for (i = 0; i < n; i++)
18657         incl    %edx    # i
18658 # test.c:7:     total += i * i;
18659         addl    %ecx, %eax      # tmp92, <retval>
18660         jmp     .L2     #
18661 .L5:
18662 # test.c:10: @}
18663         ret
18664         .cfi_endproc
18665 .LFE0:
18666         .size   test, .-test
18667         .ident  "GCC: (GNU) 7.0.0 20160809 (experimental)"
18668         .section        .note.GNU-stack,"",@@progbits
18669 @end smallexample
18671 The comments are intended for humans rather than machines and hence the
18672 precise format of the comments is subject to change.
18674 @opindex frecord-gcc-switches
18675 @item -frecord-gcc-switches
18676 This switch causes the command line used to invoke the
18677 compiler to be recorded into the object file that is being created.
18678 This switch is only implemented on some targets and the exact format
18679 of the recording is target and binary file format dependent, but it
18680 usually takes the form of a section containing ASCII text.  This
18681 switch is related to the @option{-fverbose-asm} switch, but that
18682 switch only records information in the assembler output file as
18683 comments, so it never reaches the object file.
18684 See also @option{-grecord-gcc-switches} for another
18685 way of storing compiler options into the object file.
18687 @opindex fpic
18688 @cindex global offset table
18689 @cindex PIC
18690 @item -fpic
18691 Generate position-independent code (PIC) suitable for use in a shared
18692 library, if supported for the target machine.  Such code accesses all
18693 constant addresses through a global offset table (GOT)@.  The dynamic
18694 loader resolves the GOT entries when the program starts (the dynamic
18695 loader is not part of GCC; it is part of the operating system).  If
18696 the GOT size for the linked executable exceeds a machine-specific
18697 maximum size, you get an error message from the linker indicating that
18698 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18699 instead.  (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
18700 on the m68k and RS/6000.  The x86 has no such limit.)
18702 Position-independent code requires special support, and therefore works
18703 only on certain machines.  For the x86, GCC supports PIC for System V
18704 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
18705 position-independent.
18707 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18708 are defined to 1.
18710 @opindex fPIC
18711 @item -fPIC
18712 If supported for the target machine, emit position-independent code,
18713 suitable for dynamic linking and avoiding any limit on the size of the
18714 global offset table.  This option makes a difference on AArch64, m68k,
18715 PowerPC and SPARC@.
18717 Position-independent code requires special support, and therefore works
18718 only on certain machines.
18720 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18721 are defined to 2.
18723 @opindex fpie
18724 @opindex fPIE
18725 @item -fpie
18726 @itemx -fPIE
18727 These options are similar to @option{-fpic} and @option{-fPIC}, but the
18728 generated position-independent code can be only linked into executables.
18729 Usually these options are used to compile code that will be linked using
18730 the @option{-pie} GCC option.
18732 @option{-fpie} and @option{-fPIE} both define the macros
18733 @code{__pie__} and @code{__PIE__}.  The macros have the value 1
18734 for @option{-fpie} and 2 for @option{-fPIE}.
18736 @opindex fno-plt
18737 @opindex fplt
18738 @item -fno-plt
18739 Do not use the PLT for external function calls in position-independent code.
18740 Instead, load the callee address at call sites from the GOT and branch to it.
18741 This leads to more efficient code by eliminating PLT stubs and exposing
18742 GOT loads to optimizations.  On architectures such as 32-bit x86 where
18743 PLT stubs expect the GOT pointer in a specific register, this gives more
18744 register allocation freedom to the compiler.
18745 Lazy binding requires use of the PLT; 
18746 with @option{-fno-plt} all external symbols are resolved at load time.
18748 Alternatively, the function attribute @code{noplt} can be used to avoid calls
18749 through the PLT for specific external functions.
18751 In position-dependent code, a few targets also convert calls to
18752 functions that are marked to not use the PLT to use the GOT instead.
18754 @opindex fno-jump-tables
18755 @opindex fjump-tables
18756 @item -fno-jump-tables
18757 Do not use jump tables for switch statements even where it would be
18758 more efficient than other code generation strategies.  This option is
18759 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18760 building code that forms part of a dynamic linker and cannot
18761 reference the address of a jump table.  On some targets, jump tables
18762 do not require a GOT and this option is not needed.
18764 @opindex fno-bit-tests
18765 @opindex fbit-tests
18766 @item -fno-bit-tests
18767 Do not use bit tests for switch statements even where it would be
18768 more efficient than other code generation strategies.
18770 @opindex ffixed
18771 @item -ffixed-@var{reg}
18772 Treat the register named @var{reg} as a fixed register; generated code
18773 should never refer to it (except perhaps as a stack pointer, frame
18774 pointer or in some other fixed role).
18776 @var{reg} must be the name of a register.  The register names accepted
18777 are machine-specific and are defined in the @code{REGISTER_NAMES}
18778 macro in the machine description macro file.
18780 This flag does not have a negative form, because it specifies a
18781 three-way choice.
18783 @opindex fcall-used
18784 @item -fcall-used-@var{reg}
18785 Treat the register named @var{reg} as an allocable register that is
18786 clobbered by function calls.  It may be allocated for temporaries or
18787 variables that do not live across a call.  Functions compiled this way
18788 do not save and restore the register @var{reg}.
18790 It is an error to use this flag with the frame pointer or stack pointer.
18791 Use of this flag for other registers that have fixed pervasive roles in
18792 the machine's execution model produces disastrous results.
18794 This flag does not have a negative form, because it specifies a
18795 three-way choice.
18797 @opindex fcall-saved
18798 @item -fcall-saved-@var{reg}
18799 Treat the register named @var{reg} as an allocable register saved by
18800 functions.  It may be allocated even for temporaries or variables that
18801 live across a call.  Functions compiled this way save and restore
18802 the register @var{reg} if they use it.
18804 It is an error to use this flag with the frame pointer or stack pointer.
18805 Use of this flag for other registers that have fixed pervasive roles in
18806 the machine's execution model produces disastrous results.
18808 A different sort of disaster results from the use of this flag for
18809 a register in which function values may be returned.
18811 This flag does not have a negative form, because it specifies a
18812 three-way choice.
18814 @opindex fpack-struct
18815 @item -fpack-struct[=@var{n}]
18816 Without a value specified, pack all structure members together without
18817 holes.  When a value is specified (which must be a small power of two), pack
18818 structure members according to this value, representing the maximum
18819 alignment (that is, objects with default alignment requirements larger than
18820 this are output potentially unaligned at the next fitting location.
18822 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18823 code that is not binary compatible with code generated without that switch.
18824 Additionally, it makes the code suboptimal.
18825 Use it to conform to a non-default application binary interface.
18827 @opindex fleading-underscore
18828 @item -fleading-underscore
18829 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18830 change the way C symbols are represented in the object file.  One use
18831 is to help link with legacy assembly code.
18833 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18834 generate code that is not binary compatible with code generated without that
18835 switch.  Use it to conform to a non-default application binary interface.
18836 Not all targets provide complete support for this switch.
18838 @opindex ftls-model
18839 @item -ftls-model=@var{model}
18840 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18841 The @var{model} argument should be one of @samp{global-dynamic},
18842 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
18843 Note that the choice is subject to optimization: the compiler may use
18844 a more efficient model for symbols not visible outside of the translation
18845 unit, or if @option{-fpic} is not given on the command line.
18847 The default without @option{-fpic} is @samp{initial-exec}; with
18848 @option{-fpic} the default is @samp{global-dynamic}.
18850 @opindex ftrampolines
18851 @item -ftrampolines
18852 For targets that normally need trampolines for nested functions, always
18853 generate them instead of using descriptors.  Otherwise, for targets that
18854 do not need them, like for example HP-PA or IA-64, do nothing.
18856 A trampoline is a small piece of code that is created at run time on the
18857 stack when the address of a nested function is taken, and is used to call
18858 the nested function indirectly.  Therefore, it requires the stack to be
18859 made executable in order for the program to work properly.
18861 @option{-fno-trampolines} is enabled by default on a language by language
18862 basis to let the compiler avoid generating them, if it computes that this
18863 is safe, and replace them with descriptors.  Descriptors are made up of data
18864 only, but the generated code must be prepared to deal with them.  As of this
18865 writing, @option{-fno-trampolines} is enabled by default only for Ada.
18867 Moreover, code compiled with @option{-ftrampolines} and code compiled with
18868 @option{-fno-trampolines} are not binary compatible if nested functions are
18869 present.  This option must therefore be used on a program-wide basis and be
18870 manipulated with extreme care.
18872 For languages other than Ada, the @code{-ftrampolines} and
18873 @code{-fno-trampolines} options currently have no effect, and
18874 trampolines are always generated on platforms that need them
18875 for nested functions.
18877 @opindex fvisibility
18878 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
18879 Set the default ELF image symbol visibility to the specified option---all
18880 symbols are marked with this unless overridden within the code.
18881 Using this feature can very substantially improve linking and
18882 load times of shared object libraries, produce more optimized
18883 code, provide near-perfect API export and prevent symbol clashes.
18884 It is @strong{strongly} recommended that you use this in any shared objects
18885 you distribute.
18887 Despite the nomenclature, @samp{default} always means public; i.e.,
18888 available to be linked against from outside the shared object.
18889 @samp{protected} and @samp{internal} are pretty useless in real-world
18890 usage so the only other commonly used option is @samp{hidden}.
18891 The default if @option{-fvisibility} isn't specified is
18892 @samp{default}, i.e., make every symbol public.
18894 A good explanation of the benefits offered by ensuring ELF
18895 symbols have the correct visibility is given by ``How To Write
18896 Shared Libraries'' by Ulrich Drepper (which can be found at
18897 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
18898 solution made possible by this option to marking things hidden when
18899 the default is public is to make the default hidden and mark things
18900 public.  This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
18901 and @code{__attribute__ ((visibility("default")))} instead of
18902 @code{__declspec(dllexport)} you get almost identical semantics with
18903 identical syntax.  This is a great boon to those working with
18904 cross-platform projects.
18906 For those adding visibility support to existing code, you may find
18907 @code{#pragma GCC visibility} of use.  This works by you enclosing
18908 the declarations you wish to set visibility for with (for example)
18909 @code{#pragma GCC visibility push(hidden)} and
18910 @code{#pragma GCC visibility pop}.
18911 Bear in mind that symbol visibility should be viewed @strong{as
18912 part of the API interface contract} and thus all new code should
18913 always specify visibility when it is not the default; i.e., declarations
18914 only for use within the local DSO should @strong{always} be marked explicitly
18915 as hidden as so to avoid PLT indirection overheads---making this
18916 abundantly clear also aids readability and self-documentation of the code.
18917 Note that due to ISO C++ specification requirements, @code{operator new} and
18918 @code{operator delete} must always be of default visibility.
18920 Be aware that headers from outside your project, in particular system
18921 headers and headers from any other library you use, may not be
18922 expecting to be compiled with visibility other than the default.  You
18923 may need to explicitly say @code{#pragma GCC visibility push(default)}
18924 before including any such headers.
18926 @code{extern} declarations are not affected by @option{-fvisibility}, so
18927 a lot of code can be recompiled with @option{-fvisibility=hidden} with
18928 no modifications.  However, this means that calls to @code{extern}
18929 functions with no explicit visibility use the PLT, so it is more
18930 effective to use @code{__attribute ((visibility))} and/or
18931 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
18932 declarations should be treated as hidden.
18934 Note that @option{-fvisibility} does affect C++ vague linkage
18935 entities. This means that, for instance, an exception class that is
18936 be thrown between DSOs must be explicitly marked with default
18937 visibility so that the @samp{type_info} nodes are unified between
18938 the DSOs.
18940 An overview of these techniques, their benefits and how to use them
18941 is at @uref{https://gcc.gnu.org/@/wiki/@/Visibility}.
18943 @opindex fstrict-volatile-bitfields
18944 @item -fstrict-volatile-bitfields
18945 This option should be used if accesses to volatile bit-fields (or other
18946 structure fields, although the compiler usually honors those types
18947 anyway) should use a single access of the width of the
18948 field's type, aligned to a natural alignment if possible.  For
18949 example, targets with memory-mapped peripheral registers might require
18950 all such accesses to be 16 bits wide; with this flag you can
18951 declare all peripheral bit-fields as @code{unsigned short} (assuming short
18952 is 16 bits on these targets) to force GCC to use 16-bit accesses
18953 instead of, perhaps, a more efficient 32-bit access.
18955 If this option is disabled, the compiler uses the most efficient
18956 instruction.  In the previous example, that might be a 32-bit load
18957 instruction, even though that accesses bytes that do not contain
18958 any portion of the bit-field, or memory-mapped registers unrelated to
18959 the one being updated.
18961 In some cases, such as when the @code{packed} attribute is applied to a 
18962 structure field, it may not be possible to access the field with a single
18963 read or write that is correctly aligned for the target machine.  In this
18964 case GCC falls back to generating multiple accesses rather than code that 
18965 will fault or truncate the result at run time.
18967 Note:  Due to restrictions of the C/C++11 memory model, write accesses are
18968 not allowed to touch non bit-field members.  It is therefore recommended
18969 to define all bits of the field's type as bit-field members.
18971 The default value of this option is determined by the application binary
18972 interface for the target processor.
18974 @opindex fsync-libcalls
18975 @item -fsync-libcalls
18976 This option controls whether any out-of-line instance of the @code{__sync}
18977 family of functions may be used to implement the C++11 @code{__atomic}
18978 family of functions.
18980 The default value of this option is enabled, thus the only useful form
18981 of the option is @option{-fno-sync-libcalls}.  This option is used in
18982 the implementation of the @file{libatomic} runtime library.
18984 @end table
18986 @node Developer Options
18987 @section GCC Developer Options
18988 @cindex developer options
18989 @cindex debugging GCC
18990 @cindex debug dump options
18991 @cindex dump options
18992 @cindex compilation statistics
18994 This section describes command-line options that are primarily of
18995 interest to GCC developers, including options to support compiler
18996 testing and investigation of compiler bugs and compile-time
18997 performance problems.  This includes options that produce debug dumps
18998 at various points in the compilation; that print statistics such as
18999 memory use and execution time; and that print information about GCC's
19000 configuration, such as where it searches for libraries.  You should
19001 rarely need to use any of these options for ordinary compilation and
19002 linking tasks.
19004 Many developer options that cause GCC to dump output to a file take an
19005 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
19006 or @samp{-} to dump to standard output, and @samp{stderr} for standard
19007 error.
19009 If @samp{=@var{filename}} is omitted, a default dump file name is
19010 constructed by concatenating the base dump file name, a pass number,
19011 phase letter, and pass name.  The base dump file name is the name of
19012 output file produced by the compiler if explicitly specified and not
19013 an executable; otherwise it is the source file name.
19014 The pass number is determined by the order passes are registered with
19015 the compiler's pass manager. 
19016 This is generally the same as the order of execution, but passes
19017 registered by plugins, target-specific passes, or passes that are
19018 otherwise registered late are numbered higher than the pass named
19019 @samp{final}, even if they are executed earlier.  The phase letter is
19020 one of @samp{i} (inter-procedural analysis), @samp{l}
19021 (language-specific), @samp{r} (RTL), or @samp{t} (tree). 
19022 The files are created in the directory of the output file. 
19024 @table @gcctabopt
19026 @opindex fcallgraph-info
19027 @item -fcallgraph-info
19028 @itemx -fcallgraph-info=@var{MARKERS}
19029 Makes the compiler output callgraph information for the program, on a
19030 per-object-file basis.  The information is generated in the common VCG
19031 format.  It can be decorated with additional, per-node and/or per-edge
19032 information, if a list of comma-separated markers is additionally
19033 specified.  When the @code{su} marker is specified, the callgraph is
19034 decorated with stack usage information; it is equivalent to
19035 @option{-fstack-usage}.  When the @code{da} marker is specified, the
19036 callgraph is decorated with information about dynamically allocated
19037 objects.
19039 When compiling with @option{-flto}, no callgraph information is output
19040 along with the object file.  At LTO link time, @option{-fcallgraph-info}
19041 may generate multiple callgraph information files next to intermediate
19042 LTO output files.
19044 @opindex d
19045 @opindex fdump-rtl-@var{pass}
19046 @item -d@var{letters}
19047 @itemx -fdump-rtl-@var{pass}
19048 @itemx -fdump-rtl-@var{pass}=@var{filename}
19049 Says to make debugging dumps during compilation at times specified by
19050 @var{letters}.  This is used for debugging the RTL-based passes of the
19051 compiler.
19053 Some @option{-d@var{letters}} switches have different meaning when
19054 @option{-E} is used for preprocessing.  @xref{Preprocessor Options},
19055 for information about preprocessor-specific dump options.
19057 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
19058 @option{-d} option @var{letters}.  Here are the possible
19059 letters for use in @var{pass} and @var{letters}, and their meanings:
19061 @table @gcctabopt
19063 @opindex fdump-rtl-alignments
19064 @item -fdump-rtl-alignments
19065 Dump after branch alignments have been computed.
19067 @opindex fdump-rtl-asmcons
19068 @item -fdump-rtl-asmcons
19069 Dump after fixing rtl statements that have unsatisfied in/out constraints.
19071 @opindex fdump-rtl-auto_inc_dec
19072 @item -fdump-rtl-auto_inc_dec
19073 Dump after auto-inc-dec discovery.  This pass is only run on
19074 architectures that have auto inc or auto dec instructions.
19076 @opindex fdump-rtl-barriers
19077 @item -fdump-rtl-barriers
19078 Dump after cleaning up the barrier instructions.
19080 @opindex fdump-rtl-bbpart
19081 @item -fdump-rtl-bbpart
19082 Dump after partitioning hot and cold basic blocks.
19084 @opindex fdump-rtl-bbro
19085 @item -fdump-rtl-bbro
19086 Dump after block reordering.
19088 @opindex fdump-rtl-btl2
19089 @opindex fdump-rtl-btl2
19090 @item -fdump-rtl-btl1
19091 @itemx -fdump-rtl-btl2
19092 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
19093 after the two branch
19094 target load optimization passes.
19096 @opindex fdump-rtl-bypass
19097 @item -fdump-rtl-bypass
19098 Dump after jump bypassing and control flow optimizations.
19100 @opindex fdump-rtl-combine
19101 @item -fdump-rtl-combine
19102 Dump after the RTL instruction combination pass.
19104 @opindex fdump-rtl-compgotos
19105 @item -fdump-rtl-compgotos
19106 Dump after duplicating the computed gotos.
19108 @opindex fdump-rtl-ce1
19109 @opindex fdump-rtl-ce2
19110 @opindex fdump-rtl-ce3
19111 @item -fdump-rtl-ce1
19112 @itemx -fdump-rtl-ce2
19113 @itemx -fdump-rtl-ce3
19114 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
19115 @option{-fdump-rtl-ce3} enable dumping after the three
19116 if conversion passes.
19118 @opindex fdump-rtl-cprop_hardreg
19119 @item -fdump-rtl-cprop_hardreg
19120 Dump after hard register copy propagation.
19122 @opindex fdump-rtl-csa
19123 @item -fdump-rtl-csa
19124 Dump after combining stack adjustments.
19126 @opindex fdump-rtl-cse1
19127 @opindex fdump-rtl-cse2
19128 @item -fdump-rtl-cse1
19129 @itemx -fdump-rtl-cse2
19130 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
19131 the two common subexpression elimination passes.
19133 @opindex fdump-rtl-dce
19134 @item -fdump-rtl-dce
19135 Dump after the standalone dead code elimination passes.
19137 @opindex fdump-rtl-dbr
19138 @item -fdump-rtl-dbr
19139 Dump after delayed branch scheduling.
19141 @opindex fdump-rtl-dce1
19142 @opindex fdump-rtl-dce2
19143 @item -fdump-rtl-dce1
19144 @itemx -fdump-rtl-dce2
19145 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
19146 the two dead store elimination passes.
19148 @opindex fdump-rtl-eh
19149 @item -fdump-rtl-eh
19150 Dump after finalization of EH handling code.
19152 @opindex fdump-rtl-eh_ranges
19153 @item -fdump-rtl-eh_ranges
19154 Dump after conversion of EH handling range regions.
19156 @opindex fdump-rtl-expand
19157 @item -fdump-rtl-expand
19158 Dump after RTL generation.
19160 @opindex fdump-rtl-fwprop1
19161 @opindex fdump-rtl-fwprop2
19162 @item -fdump-rtl-fwprop1
19163 @itemx -fdump-rtl-fwprop2
19164 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
19165 dumping after the two forward propagation passes.
19167 @opindex fdump-rtl-gcse1
19168 @opindex fdump-rtl-gcse2
19169 @item -fdump-rtl-gcse1
19170 @itemx -fdump-rtl-gcse2
19171 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
19172 after global common subexpression elimination.
19174 @opindex fdump-rtl-init-regs
19175 @item -fdump-rtl-init-regs
19176 Dump after the initialization of the registers.
19178 @opindex fdump-rtl-initvals
19179 @item -fdump-rtl-initvals
19180 Dump after the computation of the initial value sets.
19182 @opindex fdump-rtl-into_cfglayout
19183 @item -fdump-rtl-into_cfglayout
19184 Dump after converting to cfglayout mode.
19186 @opindex fdump-rtl-ira
19187 @item -fdump-rtl-ira
19188 Dump after iterated register allocation.
19190 @opindex fdump-rtl-jump
19191 @item -fdump-rtl-jump
19192 Dump after the second jump optimization.
19194 @opindex fdump-rtl-loop2
19195 @item -fdump-rtl-loop2
19196 @option{-fdump-rtl-loop2} enables dumping after the rtl
19197 loop optimization passes.
19199 @opindex fdump-rtl-mach
19200 @item -fdump-rtl-mach
19201 Dump after performing the machine dependent reorganization pass, if that
19202 pass exists.
19204 @opindex fdump-rtl-mode_sw
19205 @item -fdump-rtl-mode_sw
19206 Dump after removing redundant mode switches.
19208 @opindex fdump-rtl-rnreg
19209 @item -fdump-rtl-rnreg
19210 Dump after register renumbering.
19212 @opindex fdump-rtl-outof_cfglayout
19213 @item -fdump-rtl-outof_cfglayout
19214 Dump after converting from cfglayout mode.
19216 @opindex fdump-rtl-peephole2
19217 @item -fdump-rtl-peephole2
19218 Dump after the peephole pass.
19220 @opindex fdump-rtl-postreload
19221 @item -fdump-rtl-postreload
19222 Dump after post-reload optimizations.
19224 @opindex fdump-rtl-pro_and_epilogue
19225 @item -fdump-rtl-pro_and_epilogue
19226 Dump after generating the function prologues and epilogues.
19228 @opindex fdump-rtl-sched1
19229 @opindex fdump-rtl-sched2
19230 @item -fdump-rtl-sched1
19231 @itemx -fdump-rtl-sched2
19232 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
19233 after the basic block scheduling passes.
19235 @opindex fdump-rtl-ree
19236 @item -fdump-rtl-ree
19237 Dump after sign/zero extension elimination.
19239 @opindex fdump-rtl-seqabstr
19240 @item -fdump-rtl-seqabstr
19241 Dump after common sequence discovery.
19243 @opindex fdump-rtl-shorten
19244 @item -fdump-rtl-shorten
19245 Dump after shortening branches.
19247 @opindex fdump-rtl-sibling
19248 @item -fdump-rtl-sibling
19249 Dump after sibling call optimizations.
19251 @opindex fdump-rtl-split1
19252 @opindex fdump-rtl-split2
19253 @opindex fdump-rtl-split3
19254 @opindex fdump-rtl-split4
19255 @opindex fdump-rtl-split5
19256 @item -fdump-rtl-split1
19257 @itemx -fdump-rtl-split2
19258 @itemx -fdump-rtl-split3
19259 @itemx -fdump-rtl-split4
19260 @itemx -fdump-rtl-split5
19261 These options enable dumping after five rounds of
19262 instruction splitting.
19264 @opindex fdump-rtl-sms
19265 @item -fdump-rtl-sms
19266 Dump after modulo scheduling.  This pass is only run on some
19267 architectures.
19269 @opindex fdump-rtl-stack
19270 @item -fdump-rtl-stack
19271 Dump after conversion from GCC's ``flat register file'' registers to the
19272 x87's stack-like registers.  This pass is only run on x86 variants.
19274 @opindex fdump-rtl-subreg1
19275 @opindex fdump-rtl-subreg2
19276 @item -fdump-rtl-subreg1
19277 @itemx -fdump-rtl-subreg2
19278 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
19279 the two subreg expansion passes.
19281 @opindex fdump-rtl-unshare
19282 @item -fdump-rtl-unshare
19283 Dump after all rtl has been unshared.
19285 @opindex fdump-rtl-vartrack
19286 @item -fdump-rtl-vartrack
19287 Dump after variable tracking.
19289 @opindex fdump-rtl-vregs
19290 @item -fdump-rtl-vregs
19291 Dump after converting virtual registers to hard registers.
19293 @opindex fdump-rtl-web
19294 @item -fdump-rtl-web
19295 Dump after live range splitting.
19297 @opindex fdump-rtl-regclass
19298 @opindex fdump-rtl-subregs_of_mode_init
19299 @opindex fdump-rtl-subregs_of_mode_finish
19300 @opindex fdump-rtl-dfinit
19301 @opindex fdump-rtl-dfinish
19302 @item -fdump-rtl-regclass
19303 @itemx -fdump-rtl-subregs_of_mode_init
19304 @itemx -fdump-rtl-subregs_of_mode_finish
19305 @itemx -fdump-rtl-dfinit
19306 @itemx -fdump-rtl-dfinish
19307 These dumps are defined but always produce empty files.
19309 @opindex da
19310 @opindex fdump-rtl-all
19311 @item -da
19312 @itemx -fdump-rtl-all
19313 Produce all the dumps listed above.
19315 @opindex dA
19316 @item -dA
19317 Annotate the assembler output with miscellaneous debugging information.
19319 @opindex dD
19320 @item -dD
19321 Dump all macro definitions, at the end of preprocessing, in addition to
19322 normal output.
19324 @opindex dH
19325 @item -dH
19326 Produce a core dump whenever an error occurs.
19328 @opindex dp
19329 @item -dp
19330 Annotate the assembler output with a comment indicating which
19331 pattern and alternative is used.  The length and cost of each instruction are
19332 also printed.
19334 @opindex dP
19335 @item -dP
19336 Dump the RTL in the assembler output as a comment before each instruction.
19337 Also turns on @option{-dp} annotation.
19339 @opindex dx
19340 @item -dx
19341 Just generate RTL for a function instead of compiling it.  Usually used
19342 with @option{-fdump-rtl-expand}.
19343 @end table
19345 @opindex fdump-debug
19346 @item -fdump-debug
19347 Dump debugging information generated during the debug
19348 generation phase.
19350 @opindex fdump-earlydebug
19351 @item -fdump-earlydebug
19352 Dump debugging information generated during the early debug
19353 generation phase.
19355 @opindex fdump-noaddr
19356 @item -fdump-noaddr
19357 When doing debugging dumps, suppress address output.  This makes it more
19358 feasible to use diff on debugging dumps for compiler invocations with
19359 different compiler binaries and/or different
19360 text / bss / data / heap / stack / dso start locations.
19362 @opindex freport-bug
19363 @item -freport-bug
19364 Collect and dump debug information into a temporary file if an
19365 internal compiler error (ICE) occurs.
19367 @opindex fdump-unnumbered
19368 @item -fdump-unnumbered
19369 When doing debugging dumps, suppress instruction numbers and address output.
19370 This makes it more feasible to use diff on debugging dumps for compiler
19371 invocations with different options, in particular with and without
19372 @option{-g}.
19374 @opindex fdump-unnumbered-links
19375 @item -fdump-unnumbered-links
19376 When doing debugging dumps (see @option{-d} option above), suppress
19377 instruction numbers for the links to the previous and next instructions
19378 in a sequence.
19380 @opindex fdump-ipa
19381 @item -fdump-ipa-@var{switch}
19382 @itemx -fdump-ipa-@var{switch}-@var{options}
19383 Control the dumping at various stages of inter-procedural analysis
19384 language tree to a file.  The file name is generated by appending a
19385 switch specific suffix to the source file name, and the file is created
19386 in the same directory as the output file.  The following dumps are
19387 possible:
19389 @table @samp
19390 @item all
19391 Enables all inter-procedural analysis dumps.
19393 @item cgraph
19394 Dumps information about call-graph optimization, unused function removal,
19395 and inlining decisions.
19397 @item inline
19398 Dump after function inlining.
19400 @end table
19402 Additionally, the options @option{-optimized}, @option{-missed},
19403 @option{-note}, and @option{-all} can be provided, with the same meaning
19404 as for @option{-fopt-info}, defaulting to @option{-optimized}.
19406 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
19407 information on callsites that were inlined, along with callsites
19408 that were not inlined.
19410 By default, the dump will contain messages about successful
19411 optimizations (equivalent to @option{-optimized}) together with
19412 low-level details about the analysis.
19414 @opindex fdump-lang
19415 @item -fdump-lang
19416 Dump language-specific information.  The file name is made by appending
19417 @file{.lang} to the source file name.
19419 @opindex fdump-lang-all
19420 @opindex fdump-lang
19421 @item -fdump-lang-all
19422 @itemx -fdump-lang-@var{switch}
19423 @itemx -fdump-lang-@var{switch}-@var{options}
19424 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
19425 Control the dumping of language-specific information.  The @var{options}
19426 and @var{filename} portions behave as described in the
19427 @option{-fdump-tree} option.  The following @var{switch} values are
19428 accepted:
19430 @table @samp
19431 @item all
19433 Enable all language-specific dumps.
19435 @item class
19436 Dump class hierarchy information.  Virtual table information is emitted
19437 unless '@option{slim}' is specified.  This option is applicable to C++ only.
19439 @item module
19440 Dump module information.  Options @option{lineno} (locations),
19441 @option{graph} (reachability), @option{blocks} (clusters),
19442 @option{uid} (serialization), @option{alias} (mergeable),
19443 @option{asmname} (Elrond), @option{eh} (mapper) & @option{vops}
19444 (macros) may provide additional information.  This option is
19445 applicable to C++ only.
19447 @item raw
19448 Dump the raw internal tree data.  This option is applicable to C++ only.
19450 @end table
19452 @opindex fdump-passes
19453 @item -fdump-passes
19454 Print on @file{stderr} the list of optimization passes that are turned
19455 on and off by the current command-line options.
19457 @opindex fdump-statistics
19458 @item -fdump-statistics-@var{option}
19459 Enable and control dumping of pass statistics in a separate file.  The
19460 file name is generated by appending a suffix ending in
19461 @samp{.statistics} to the source file name, and the file is created in
19462 the same directory as the output file.  If the @samp{-@var{option}}
19463 form is used, @samp{-stats} causes counters to be summed over the
19464 whole compilation unit while @samp{-details} dumps every event as
19465 the passes generate them.  The default with no option is to sum
19466 counters for each function compiled.
19468 @opindex fdump-tree-all
19469 @opindex fdump-tree
19470 @item -fdump-tree-all
19471 @itemx -fdump-tree-@var{switch}
19472 @itemx -fdump-tree-@var{switch}-@var{options}
19473 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
19474 Control the dumping at various stages of processing the intermediate
19475 language tree to a file.  If the @samp{-@var{options}}
19476 form is used, @var{options} is a list of @samp{-} separated options
19477 which control the details of the dump.  Not all options are applicable
19478 to all dumps; those that are not meaningful are ignored.  The
19479 following options are available
19481 @table @samp
19482 @item address
19483 Print the address of each node.  Usually this is not meaningful as it
19484 changes according to the environment and source file.  Its primary use
19485 is for tying up a dump file with a debug environment.
19486 @item asmname
19487 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
19488 in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
19489 use working backward from mangled names in the assembly file.
19490 @item slim
19491 When dumping front-end intermediate representations, inhibit dumping
19492 of members of a scope or body of a function merely because that scope
19493 has been reached.  Only dump such items when they are directly reachable
19494 by some other path.
19496 When dumping pretty-printed trees, this option inhibits dumping the
19497 bodies of control structures.
19499 When dumping RTL, print the RTL in slim (condensed) form instead of
19500 the default LISP-like representation.
19501 @item raw
19502 Print a raw representation of the tree.  By default, trees are
19503 pretty-printed into a C-like representation.
19504 @item details
19505 Enable more detailed dumps (not honored by every dump option). Also
19506 include information from the optimization passes.
19507 @item stats
19508 Enable dumping various statistics about the pass (not honored by every dump
19509 option).
19510 @item blocks
19511 Enable showing basic block boundaries (disabled in raw dumps).
19512 @item graph
19513 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
19514 dump a representation of the control flow graph suitable for viewing with
19515 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}.  Each function in
19516 the file is pretty-printed as a subgraph, so that GraphViz can render them
19517 all in a single plot.
19519 This option currently only works for RTL dumps, and the RTL is always
19520 dumped in slim form.
19521 @item vops
19522 Enable showing virtual operands for every statement.
19523 @item lineno
19524 Enable showing line numbers for statements.
19525 @item uid
19526 Enable showing the unique ID (@code{DECL_UID}) for each variable.
19527 @item verbose
19528 Enable showing the tree dump for each statement.
19529 @item eh
19530 Enable showing the EH region number holding each statement.
19531 @item scev
19532 Enable showing scalar evolution analysis details.
19533 @item optimized
19534 Enable showing optimization information (only available in certain
19535 passes).
19536 @item missed
19537 Enable showing missed optimization information (only available in certain
19538 passes).
19539 @item note
19540 Enable other detailed optimization information (only available in
19541 certain passes).
19542 @item all
19543 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
19544 and @option{lineno}.
19545 @item optall
19546 Turn on all optimization options, i.e., @option{optimized},
19547 @option{missed}, and @option{note}.
19548 @end table
19550 To determine what tree dumps are available or find the dump for a pass
19551 of interest follow the steps below.
19553 @enumerate
19554 @item
19555 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
19556 look for a code that corresponds to the pass you are interested in.
19557 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
19558 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
19559 The number at the end distinguishes distinct invocations of the same pass.
19560 @item
19561 To enable the creation of the dump file, append the pass code to
19562 the @option{-fdump-} option prefix and invoke GCC with it.  For example,
19563 to enable the dump from the Early Value Range Propagation pass, invoke
19564 GCC with the @option{-fdump-tree-evrp} option.  Optionally, you may
19565 specify the name of the dump file.  If you don't specify one, GCC
19566 creates as described below.
19567 @item
19568 Find the pass dump in a file whose name is composed of three components
19569 separated by a period: the name of the source file GCC was invoked to
19570 compile, a numeric suffix indicating the pass number followed by the
19571 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
19572 and finally the pass code.  For example, the Early VRP pass dump might
19573 be in a file named @file{myfile.c.038t.evrp} in the current working
19574 directory.  Note that the numeric codes are not stable and may change
19575 from one version of GCC to another.
19576 @end enumerate
19578 @opindex fopt-info
19579 @item -fopt-info
19580 @itemx -fopt-info-@var{options}
19581 @itemx -fopt-info-@var{options}=@var{filename}
19582 Controls optimization dumps from various optimization passes. If the
19583 @samp{-@var{options}} form is used, @var{options} is a list of
19584 @samp{-} separated option keywords to select the dump details and
19585 optimizations.  
19587 The @var{options} can be divided into three groups:
19588 @enumerate
19589 @item
19590 options describing what kinds of messages should be emitted,
19591 @item
19592 options describing the verbosity of the dump, and
19593 @item
19594 options describing which optimizations should be included.
19595 @end enumerate
19596 The options from each group can be freely mixed as they are
19597 non-overlapping. However, in case of any conflicts,
19598 the later options override the earlier options on the command
19599 line. 
19601 The following options control which kinds of messages should be emitted:
19603 @table @samp
19604 @item optimized
19605 Print information when an optimization is successfully applied. It is
19606 up to a pass to decide which information is relevant. For example, the
19607 vectorizer passes print the source location of loops which are
19608 successfully vectorized.
19609 @item missed
19610 Print information about missed optimizations. Individual passes
19611 control which information to include in the output. 
19612 @item note
19613 Print verbose information about optimizations, such as certain
19614 transformations, more detailed messages about decisions etc.
19615 @item all
19616 Print detailed optimization information. This includes
19617 @samp{optimized}, @samp{missed}, and @samp{note}.
19618 @end table
19620 The following option controls the dump verbosity:
19622 @table @samp
19623 @item internals
19624 By default, only ``high-level'' messages are emitted. This option enables
19625 additional, more detailed, messages, which are likely to only be of interest
19626 to GCC developers.
19627 @end table
19629 One or more of the following option keywords can be used to describe a
19630 group of optimizations:
19632 @table @samp
19633 @item ipa
19634 Enable dumps from all interprocedural optimizations.
19635 @item loop
19636 Enable dumps from all loop optimizations.
19637 @item inline
19638 Enable dumps from all inlining optimizations.
19639 @item omp
19640 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
19641 @item vec
19642 Enable dumps from all vectorization optimizations.
19643 @item optall
19644 Enable dumps from all optimizations. This is a superset of
19645 the optimization groups listed above.
19646 @end table
19648 If @var{options} is
19649 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
19650 about successful optimizations from all the passes, omitting messages
19651 that are treated as ``internals''.
19653 If the @var{filename} is provided, then the dumps from all the
19654 applicable optimizations are concatenated into the @var{filename}.
19655 Otherwise the dump is output onto @file{stderr}. Though multiple
19656 @option{-fopt-info} options are accepted, only one of them can include
19657 a @var{filename}. If other filenames are provided then all but the
19658 first such option are ignored.
19660 Note that the output @var{filename} is overwritten
19661 in case of multiple translation units. If a combined output from
19662 multiple translation units is desired, @file{stderr} should be used
19663 instead.
19665 In the following example, the optimization info is output to
19666 @file{stderr}:
19668 @smallexample
19669 gcc -O3 -fopt-info
19670 @end smallexample
19672 This example:
19673 @smallexample
19674 gcc -O3 -fopt-info-missed=missed.all
19675 @end smallexample
19677 @noindent
19678 outputs missed optimization report from all the passes into
19679 @file{missed.all}, and this one:
19681 @smallexample
19682 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
19683 @end smallexample
19685 @noindent
19686 prints information about missed optimization opportunities from
19687 vectorization passes on @file{stderr}.  
19688 Note that @option{-fopt-info-vec-missed} is equivalent to 
19689 @option{-fopt-info-missed-vec}.  The order of the optimization group
19690 names and message types listed after @option{-fopt-info} does not matter.
19692 As another example,
19693 @smallexample
19694 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
19695 @end smallexample
19697 @noindent
19698 outputs information about missed optimizations as well as
19699 optimized locations from all the inlining passes into
19700 @file{inline.txt}.
19702 Finally, consider:
19704 @smallexample
19705 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
19706 @end smallexample
19708 @noindent
19709 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
19710 in conflict since only one output file is allowed. In this case, only
19711 the first option takes effect and the subsequent options are
19712 ignored. Thus only @file{vec.miss} is produced which contains
19713 dumps from the vectorizer about missed opportunities.
19715 @opindex fsave-optimization-record
19716 @item -fsave-optimization-record
19717 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
19718 were performed, for those optimizations that support @option{-fopt-info}.
19720 This option is experimental and the format of the data within the
19721 compressed JSON file is subject to change.
19723 It is roughly equivalent to a machine-readable version of
19724 @option{-fopt-info-all}, as a collection of messages with source file,
19725 line number and column number, with the following additional data for
19726 each message:
19728 @itemize @bullet
19730 @item
19731 the execution count of the code being optimized, along with metadata about
19732 whether this was from actual profile data, or just an estimate, allowing
19733 consumers to prioritize messages by code hotness,
19735 @item
19736 the function name of the code being optimized, where applicable,
19738 @item
19739 the ``inlining chain'' for the code being optimized, so that when
19740 a function is inlined into several different places (which might
19741 themselves be inlined), the reader can distinguish between the copies,
19743 @item
19744 objects identifying those parts of the message that refer to expressions,
19745 statements or symbol-table nodes, which of these categories they are, and,
19746 when available, their source code location,
19748 @item
19749 the GCC pass that emitted the message, and
19751 @item
19752 the location in GCC's own code from which the message was emitted
19754 @end itemize
19756 Additionally, some messages are logically nested within other
19757 messages, reflecting implementation details of the optimization
19758 passes.
19760 @opindex fsched-verbose
19761 @item -fsched-verbose=@var{n}
19762 On targets that use instruction scheduling, this option controls the
19763 amount of debugging output the scheduler prints to the dump files.
19765 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
19766 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
19767 For @var{n} greater than one, it also output basic block probabilities,
19768 detailed ready list information and unit/insn info.  For @var{n} greater
19769 than two, it includes RTL at abort point, control-flow and regions info.
19770 And for @var{n} over four, @option{-fsched-verbose} also includes
19771 dependence info.
19775 @opindex fdisable-
19776 @opindex fenable-
19777 @item -fenable-@var{kind}-@var{pass}
19778 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
19780 This is a set of options that are used to explicitly disable/enable
19781 optimization passes.  These options are intended for use for debugging GCC.
19782 Compiler users should use regular options for enabling/disabling
19783 passes instead.
19785 @table @gcctabopt
19787 @item -fdisable-ipa-@var{pass}
19788 Disable IPA pass @var{pass}. @var{pass} is the pass name.  If the same pass is
19789 statically invoked in the compiler multiple times, the pass name should be
19790 appended with a sequential number starting from 1.
19792 @item -fdisable-rtl-@var{pass}
19793 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
19794 Disable RTL pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19795 statically invoked in the compiler multiple times, the pass name should be
19796 appended with a sequential number starting from 1.  @var{range-list} is a 
19797 comma-separated list of function ranges or assembler names.  Each range is a number
19798 pair separated by a colon.  The range is inclusive in both ends.  If the range
19799 is trivial, the number pair can be simplified as a single number.  If the
19800 function's call graph node's @var{uid} falls within one of the specified ranges,
19801 the @var{pass} is disabled for that function.  The @var{uid} is shown in the
19802 function header of a dump file, and the pass names can be dumped by using
19803 option @option{-fdump-passes}.
19805 @item -fdisable-tree-@var{pass}
19806 @itemx -fdisable-tree-@var{pass}=@var{range-list}
19807 Disable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description of
19808 option arguments.
19810 @item -fenable-ipa-@var{pass}
19811 Enable IPA pass @var{pass}.  @var{pass} is the pass name.  If the same pass is
19812 statically invoked in the compiler multiple times, the pass name should be
19813 appended with a sequential number starting from 1.
19815 @item -fenable-rtl-@var{pass}
19816 @itemx -fenable-rtl-@var{pass}=@var{range-list}
19817 Enable RTL pass @var{pass}.  See @option{-fdisable-rtl} for option argument
19818 description and examples.
19820 @item -fenable-tree-@var{pass}
19821 @itemx -fenable-tree-@var{pass}=@var{range-list}
19822 Enable tree pass @var{pass}.  See @option{-fdisable-rtl} for the description
19823 of option arguments.
19825 @end table
19827 Here are some examples showing uses of these options.
19829 @smallexample
19831 # disable ccp1 for all functions
19832    -fdisable-tree-ccp1
19833 # disable complete unroll for function whose cgraph node uid is 1
19834    -fenable-tree-cunroll=1
19835 # disable gcse2 for functions at the following ranges [1,1],
19836 # [300,400], and [400,1000]
19837 # disable gcse2 for functions foo and foo2
19838    -fdisable-rtl-gcse2=foo,foo2
19839 # disable early inlining
19840    -fdisable-tree-einline
19841 # disable ipa inlining
19842    -fdisable-ipa-inline
19843 # enable tree full unroll
19844    -fenable-tree-unroll
19846 @end smallexample
19848 @opindex fchecking
19849 @opindex fno-checking
19850 @item -fchecking
19851 @itemx -fchecking=@var{n}
19852 Enable internal consistency checking.  The default depends on
19853 the compiler configuration.  @option{-fchecking=2} enables further
19854 internal consistency checking that might affect code generation.
19856 @opindex frandom-seed
19857 @item -frandom-seed=@var{string}
19858 This option provides a seed that GCC uses in place of
19859 random numbers in generating certain symbol names
19860 that have to be different in every compiled file.  It is also used to
19861 place unique stamps in coverage data files and the object files that
19862 produce them.  You can use the @option{-frandom-seed} option to produce
19863 reproducibly identical object files.
19865 The @var{string} can either be a number (decimal, octal or hex) or an
19866 arbitrary string (in which case it's converted to a number by
19867 computing CRC32).
19869 The @var{string} should be different for every file you compile.
19871 @opindex save-temps
19872 @item -save-temps
19873 Store the usual ``temporary'' intermediate files permanently; name them
19874 as auxiliary output files, as specified described under
19875 @option{-dumpbase} and @option{-dumpdir}.
19877 When used in combination with the @option{-x} command-line option,
19878 @option{-save-temps} is sensible enough to avoid overwriting an
19879 input source file with the same extension as an intermediate file.
19880 The corresponding intermediate file may be obtained by renaming the
19881 source file before using @option{-save-temps}.
19883 @opindex save-temps=cwd
19884 @item -save-temps=cwd
19885 Equivalent to @option{-save-temps -dumpdir ./}.
19887 @opindex save-temps=obj
19888 @item -save-temps=obj
19889 Equivalent to @option{-save-temps -dumpdir @file{outdir/}}, where
19890 @file{outdir/} is the directory of the output file specified after the
19891 @option{-o} option, including any directory separators.  If the
19892 @option{-o} option is not used, the @option{-save-temps=obj} switch
19893 behaves like @option{-save-temps=cwd}.
19895 @opindex time
19896 @item -time@r{[}=@var{file}@r{]}
19897 Report the CPU time taken by each subprocess in the compilation
19898 sequence.  For C source files, this is the compiler proper and assembler
19899 (plus the linker if linking is done).
19901 Without the specification of an output file, the output looks like this:
19903 @smallexample
19904 # cc1 0.12 0.01
19905 # as 0.00 0.01
19906 @end smallexample
19908 The first number on each line is the ``user time'', that is time spent
19909 executing the program itself.  The second number is ``system time'',
19910 time spent executing operating system routines on behalf of the program.
19911 Both numbers are in seconds.
19913 With the specification of an output file, the output is appended to the
19914 named file, and it looks like this:
19916 @smallexample
19917 0.12 0.01 cc1 @var{options}
19918 0.00 0.01 as @var{options}
19919 @end smallexample
19921 The ``user time'' and the ``system time'' are moved before the program
19922 name, and the options passed to the program are displayed, so that one
19923 can later tell what file was being compiled, and with which options.
19925 @opindex fdump-final-insns
19926 @item -fdump-final-insns@r{[}=@var{file}@r{]}
19927 Dump the final internal representation (RTL) to @var{file}.  If the
19928 optional argument is omitted (or if @var{file} is @code{.}), the name
19929 of the dump file is determined by appending @code{.gkd} to the
19930 dump base name, see @option{-dumpbase}.
19932 @opindex fcompare-debug
19933 @opindex fno-compare-debug
19934 @item -fcompare-debug@r{[}=@var{opts}@r{]}
19935 If no error occurs during compilation, run the compiler a second time,
19936 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
19937 passed to the second compilation.  Dump the final internal
19938 representation in both compilations, and print an error if they differ.
19940 If the equal sign is omitted, the default @option{-gtoggle} is used.
19942 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
19943 and nonzero, implicitly enables @option{-fcompare-debug}.  If
19944 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
19945 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
19946 is used.
19948 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
19949 is equivalent to @option{-fno-compare-debug}, which disables the dumping
19950 of the final representation and the second compilation, preventing even
19951 @env{GCC_COMPARE_DEBUG} from taking effect.
19953 To verify full coverage during @option{-fcompare-debug} testing, set
19954 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
19955 which GCC rejects as an invalid option in any actual compilation
19956 (rather than preprocessing, assembly or linking).  To get just a
19957 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
19958 not overridden} will do.
19960 @opindex fcompare-debug-second
19961 @item -fcompare-debug-second
19962 This option is implicitly passed to the compiler for the second
19963 compilation requested by @option{-fcompare-debug}, along with options to
19964 silence warnings, and omitting other options that would cause the compiler
19965 to produce output to files or to standard output as a side effect.  Dump
19966 files and preserved temporary files are renamed so as to contain the
19967 @code{.gk} additional extension during the second compilation, to avoid
19968 overwriting those generated by the first.
19970 When this option is passed to the compiler driver, it causes the
19971 @emph{first} compilation to be skipped, which makes it useful for little
19972 other than debugging the compiler proper.
19974 @opindex gtoggle
19975 @item -gtoggle
19976 Turn off generation of debug info, if leaving out this option
19977 generates it, or turn it on at level 2 otherwise.  The position of this
19978 argument in the command line does not matter; it takes effect after all
19979 other options are processed, and it does so only once, no matter how
19980 many times it is given.  This is mainly intended to be used with
19981 @option{-fcompare-debug}.
19983 @opindex fvar-tracking-assignments-toggle
19984 @opindex fno-var-tracking-assignments-toggle
19985 @item -fvar-tracking-assignments-toggle
19986 Toggle @option{-fvar-tracking-assignments}, in the same way that
19987 @option{-gtoggle} toggles @option{-g}.
19989 @opindex Q
19990 @item -Q
19991 Makes the compiler print out each function name as it is compiled, and
19992 print some statistics about each pass when it finishes.
19994 @opindex ftime-report
19995 @item -ftime-report
19996 Makes the compiler print some statistics to stderr about the time consumed
19997 by each pass when it finishes.
19999 If SARIF output of diagnostics was requested via
20000 @option{-fdiagnostics-format=sarif-file} or
20001 @option{-fdiagnostics-format=sarif-stderr} then the @option{-ftime-report}
20002 information is instead emitted in JSON form as part of SARIF output.  The
20003 precise format of this JSON data is subject to change, and the values may
20004 not exactly match those emitted to stderr due to being written out at a
20005 slightly different place within the compiler.
20007 @opindex ftime-report-details
20008 @item -ftime-report-details
20009 Record the time consumed by infrastructure parts separately for each pass.
20011 @opindex fira-verbose
20012 @item -fira-verbose=@var{n}
20013 Control the verbosity of the dump file for the integrated register allocator.
20014 The default value is 5.  If the value @var{n} is greater or equal to 10,
20015 the dump output is sent to stderr using the same format as @var{n} minus 10.
20017 @opindex flto-report
20018 @item -flto-report
20019 Prints a report with internal details on the workings of the link-time
20020 optimizer.  The contents of this report vary from version to version.
20021 It is meant to be useful to GCC developers when processing object
20022 files in LTO mode (via @option{-flto}).
20024 Disabled by default.
20026 @opindex flto-report-wpa
20027 @item -flto-report-wpa
20028 Like @option{-flto-report}, but only print for the WPA phase of link-time
20029 optimization.
20031 @opindex fmem-report
20032 @item -fmem-report
20033 Makes the compiler print some statistics about permanent memory
20034 allocation when it finishes.
20036 @opindex fmem-report-wpa
20037 @item -fmem-report-wpa
20038 Makes the compiler print some statistics about permanent memory
20039 allocation for the WPA phase only.
20041 @opindex fpre-ipa-mem-report
20042 @opindex fpost-ipa-mem-report
20043 @item -fpre-ipa-mem-report
20044 @item -fpost-ipa-mem-report
20045 Makes the compiler print some statistics about permanent memory
20046 allocation before or after interprocedural optimization.
20048 @opindex fmultiflags
20049 @item -fmultiflags
20050 This option enables multilib-aware @code{TFLAGS} to be used to build
20051 target libraries with options different from those the compiler is
20052 configured to use by default, through the use of specs (@xref{Spec
20053 Files}) set up by compiler internals, by the target, or by builders at
20054 configure time.
20056 Like @code{TFLAGS}, this allows the target libraries to be built for
20057 portable baseline environments, while the compiler defaults to more
20058 demanding ones.  That's useful because users can easily override the
20059 defaults the compiler is configured to use to build their own programs,
20060 if the defaults are not ideal for their target environment, whereas
20061 rebuilding the runtime libraries is usually not as easy or desirable.
20063 Unlike @code{TFLAGS}, the use of specs enables different flags to be
20064 selected for different multilibs.  The way to accomplish that is to
20065 build with @samp{make TFLAGS=-fmultiflags}, after configuring
20066 @samp{--with-specs=%@{fmultiflags:...@}}.
20068 This option is discarded by the driver once it's done processing driver
20069 self spec.
20071 It is also useful to check that @code{TFLAGS} are being used to build
20072 all target libraries, by configuring a non-bootstrap compiler
20073 @samp{--with-specs='%@{!fmultiflags:%emissing TFLAGS@}'} and building
20074 the compiler and target libraries.
20076 @opindex fprofile-report
20077 @item -fprofile-report
20078 Makes the compiler print some statistics about consistency of the
20079 (estimated) profile and effect of individual passes.
20081 @opindex fstack-usage
20082 @item -fstack-usage
20083 Makes the compiler output stack usage information for the program, on a
20084 per-function basis.  The filename for the dump is made by appending
20085 @file{.su} to the @var{auxname}.  @var{auxname} is generated from the name of
20086 the output file, if explicitly specified and it is not an executable,
20087 otherwise it is the basename of the source file.  An entry is made up
20088 of three fields:
20090 @itemize
20091 @item
20092 The name of the function.
20093 @item
20094 A number of bytes.
20095 @item
20096 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
20097 @end itemize
20099 The qualifier @code{static} means that the function manipulates the stack
20100 statically: a fixed number of bytes are allocated for the frame on function
20101 entry and released on function exit; no stack adjustments are otherwise made
20102 in the function.  The second field is this fixed number of bytes.
20104 The qualifier @code{dynamic} means that the function manipulates the stack
20105 dynamically: in addition to the static allocation described above, stack
20106 adjustments are made in the body of the function, for example to push/pop
20107 arguments around function calls.  If the qualifier @code{bounded} is also
20108 present, the amount of these adjustments is bounded at compile time and
20109 the second field is an upper bound of the total amount of stack used by
20110 the function.  If it is not present, the amount of these adjustments is
20111 not bounded at compile time and the second field only represents the
20112 bounded part.
20114 @opindex fstats
20115 @item -fstats
20116 Emit statistics about front-end processing at the end of the compilation.
20117 This option is supported only by the C++ front end, and
20118 the information is generally only useful to the G++ development team.
20120 @opindex fdbg-cnt-list
20121 @item -fdbg-cnt-list
20122 Print the name and the counter upper bound for all debug counters.
20125 @opindex fdbg-cnt
20126 @item -fdbg-cnt=@var{counter-value-list}
20127 Set the internal debug counter lower and upper bound.  @var{counter-value-list}
20128 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
20129 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
20130 the name of the counter and list of closed intervals.
20131 The @var{lower_bound} is optional and is zero
20132 initialized if not set.
20133 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
20134 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
20135 eleventh invocation.
20136 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
20138 @opindex print-file-name
20139 @item -print-file-name=@var{library}
20140 Print the full absolute name of the library file @var{library} that
20141 would be used when linking---and don't do anything else.  With this
20142 option, GCC does not compile or link anything; it just prints the
20143 file name.
20145 @opindex print-multi-directory
20146 @item -print-multi-directory
20147 Print the directory name corresponding to the multilib selected by any
20148 other switches present in the command line.  This directory is supposed
20149 to exist in @env{GCC_EXEC_PREFIX}.
20151 @opindex print-multi-lib
20152 @item -print-multi-lib
20153 Print the mapping from multilib directory names to compiler switches
20154 that enable them.  The directory name is separated from the switches by
20155 @samp{;}, and each switch starts with an @samp{@@} instead of the
20156 @samp{-}, without spaces between multiple switches.  This is supposed to
20157 ease shell processing.
20159 @opindex print-multi-os-directory
20160 @item -print-multi-os-directory
20161 Print the path to OS libraries for the selected
20162 multilib, relative to some @file{lib} subdirectory.  If OS libraries are
20163 present in the @file{lib} subdirectory and no multilibs are used, this is
20164 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
20165 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
20166 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
20167 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
20169 @opindex print-multiarch
20170 @item -print-multiarch
20171 Print the path to OS libraries for the selected multiarch,
20172 relative to some @file{lib} subdirectory.
20174 @opindex print-prog-name
20175 @item -print-prog-name=@var{program}
20176 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
20178 @opindex print-libgcc-file-name
20179 @item -print-libgcc-file-name
20180 Same as @option{-print-file-name=libgcc.a}.
20182 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
20183 but you do want to link with @file{libgcc.a}.  You can do:
20185 @smallexample
20186 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
20187 @end smallexample
20189 @opindex print-search-dirs
20190 @item -print-search-dirs
20191 Print the name of the configured installation directory and a list of
20192 program and library directories @command{gcc} searches---and don't do anything else.
20194 This is useful when @command{gcc} prints the error message
20195 @samp{installation problem, cannot exec cpp0: No such file or directory}.
20196 To resolve this you either need to put @file{cpp0} and the other compiler
20197 components where @command{gcc} expects to find them, or you can set the environment
20198 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
20199 Don't forget the trailing @samp{/}.
20200 @xref{Environment Variables}.
20202 @opindex print-sysroot
20203 @item -print-sysroot
20204 Print the target sysroot directory that is used during
20205 compilation.  This is the target sysroot specified either at configure
20206 time or using the @option{--sysroot} option, possibly with an extra
20207 suffix that depends on compilation options.  If no target sysroot is
20208 specified, the option prints nothing.
20210 @opindex print-sysroot-headers-suffix
20211 @item -print-sysroot-headers-suffix
20212 Print the suffix added to the target sysroot when searching for
20213 headers, or give an error if the compiler is not configured with such
20214 a suffix---and don't do anything else.
20216 @opindex dumpmachine
20217 @item -dumpmachine
20218 Print the compiler's target machine (for example,
20219 @samp{i686-pc-linux-gnu})---and don't do anything else.
20221 @opindex dumpversion
20222 @item -dumpversion
20223 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
20224 anything else.  This is the compiler version used in filesystem paths and
20225 specs. Depending on how the compiler has been configured it can be just
20226 a single number (major version), two numbers separated by a dot (major and
20227 minor version) or three numbers separated by dots (major, minor and patchlevel
20228 version).
20230 @opindex dumpfullversion
20231 @item -dumpfullversion
20232 Print the full compiler version---and don't do anything else. The output is
20233 always three numbers separated by dots, major, minor and patchlevel version.
20235 @opindex dumpspecs
20236 @item -dumpspecs
20237 Print the compiler's built-in specs---and don't do anything else.  (This
20238 is used when GCC itself is being built.)  @xref{Spec Files}.
20239 @end table
20241 @node Submodel Options
20242 @section Machine-Dependent Options
20243 @cindex submodel options
20244 @cindex specifying hardware config
20245 @cindex hardware models and configurations, specifying
20246 @cindex target-dependent options
20247 @cindex machine-dependent options
20249 Each target machine supported by GCC can have its own options---for
20250 example, to allow you to compile for a particular processor variant or
20251 ABI, or to control optimizations specific to that machine.  By
20252 convention, the names of machine-specific options start with
20253 @samp{-m}.
20255 Some configurations of the compiler also support additional target-specific
20256 options, usually for compatibility with other compilers on the same
20257 platform.
20259 @c This list is ordered alphanumerically by subsection name.
20260 @c It should be the same order and spelling as these options are listed
20261 @c in Machine Dependent Options
20263 @menu
20264 * AArch64 Options::
20265 * Adapteva Epiphany Options::
20266 * AMD GCN Options::
20267 * ARC Options::
20268 * ARM Options::
20269 * AVR Options::
20270 * Blackfin Options::
20271 * C6X Options::
20272 * CRIS Options::
20273 * C-SKY Options::
20274 * Darwin Options::
20275 * DEC Alpha Options::
20276 * eBPF Options::
20277 * FR30 Options::
20278 * FT32 Options::
20279 * FRV Options::
20280 * GNU/Linux Options::
20281 * H8/300 Options::
20282 * HPPA Options::
20283 * IA-64 Options::
20284 * LM32 Options::
20285 * LoongArch Options::
20286 * M32C Options::
20287 * M32R/D Options::
20288 * M680x0 Options::
20289 * MCore Options::
20290 * MicroBlaze Options::
20291 * MIPS Options::
20292 * MMIX Options::
20293 * MN10300 Options::
20294 * Moxie Options::
20295 * MSP430 Options::
20296 * NDS32 Options::
20297 * Nios II Options::
20298 * Nvidia PTX Options::
20299 * OpenRISC Options::
20300 * PDP-11 Options::
20301 * PowerPC Options::
20302 * PRU Options::
20303 * RISC-V Options::
20304 * RL78 Options::
20305 * RS/6000 and PowerPC Options::
20306 * RX Options::
20307 * S/390 and zSeries Options::
20308 * SH Options::
20309 * Solaris 2 Options::
20310 * SPARC Options::
20311 * System V Options::
20312 * V850 Options::
20313 * VAX Options::
20314 * Visium Options::
20315 * VMS Options::
20316 * VxWorks Options::
20317 * x86 Options::
20318 * x86 Windows Options::
20319 * Xstormy16 Options::
20320 * Xtensa Options::
20321 * zSeries Options::
20322 @end menu
20324 @node AArch64 Options
20325 @subsection AArch64 Options
20326 @cindex AArch64 Options
20328 These options are defined for AArch64 implementations:
20330 @table @gcctabopt
20332 @opindex mabi
20333 @item -mabi=@var{name}
20334 Generate code for the specified data model.  Permissible values
20335 are @samp{ilp32} for SysV-like data model where int, long int and pointers
20336 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
20337 but long int and pointers are 64 bits.
20339 The default depends on the specific target configuration.  Note that
20340 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
20341 entire program with the same ABI, and link with a compatible set of libraries.
20343 @opindex mbig-endian
20344 @item -mbig-endian
20345 Generate big-endian code.  This is the default when GCC is configured for an
20346 @samp{aarch64_be-*-*} target.
20348 @opindex mgeneral-regs-only
20349 @item -mgeneral-regs-only
20350 Generate code which uses only the general-purpose registers.  This will prevent
20351 the compiler from using floating-point and Advanced SIMD registers but will not
20352 impose any restrictions on the assembler.
20354 @opindex mlittle-endian
20355 @item -mlittle-endian
20356 Generate little-endian code.  This is the default when GCC is configured for an
20357 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
20359 @opindex mcmodel=tiny
20360 @item -mcmodel=tiny
20361 Generate code for the tiny code model.  The program and its statically defined
20362 symbols must be within 1MB of each other.  Programs can be statically or
20363 dynamically linked.
20365 @opindex mcmodel=small
20366 @item -mcmodel=small
20367 Generate code for the small code model.  The program and its statically defined
20368 symbols must be within 4GB of each other.  Programs can be statically or
20369 dynamically linked.  This is the default code model.
20371 @opindex mcmodel=large
20372 @item -mcmodel=large
20373 Generate code for the large code model.  This makes no assumptions about
20374 addresses and sizes of sections.  Programs can be statically linked only.  The
20375 @option{-mcmodel=large} option is incompatible with @option{-mabi=ilp32},
20376 @option{-fpic} and @option{-fPIC}.
20378 @item -mtp=@var{name}
20379 @opindex mtp
20380 Specify the system register to use as a thread pointer.  The valid values
20381 are @samp{tpidr_el0}, @samp{tpidrro_el0}, @samp{tpidr_el1}, @samp{tpidr_el2},
20382 @samp{tpidr_el3}.  For backwards compatibility the aliases @samp{el0},
20383 @samp{el1}, @samp{el2}, @samp{el3} are also accepted.
20384 The default setting is @samp{tpidr_el0}.  It is recommended to compile all
20385 code intended to interoperate with the same value of this option to avoid
20386 accessing a different thread pointer from the wrong exception level.
20388 @opindex mstrict-align
20389 @opindex mno-strict-align
20390 @item -mstrict-align
20391 @itemx -mno-strict-align
20392 Avoid or allow generating memory accesses that may not be aligned on a natural
20393 object boundary as described in the architecture specification.
20395 @opindex momit-leaf-frame-pointer
20396 @opindex mno-omit-leaf-frame-pointer
20397 @item -momit-leaf-frame-pointer
20398 @itemx -mno-omit-leaf-frame-pointer
20399 Omit or keep the frame pointer in leaf functions.  The former behavior is the
20400 default.
20402 @opindex mstack-protector-guard
20403 @opindex mstack-protector-guard-reg
20404 @opindex mstack-protector-guard-offset
20405 @item -mstack-protector-guard=@var{guard}
20406 @itemx -mstack-protector-guard-reg=@var{reg}
20407 @itemx -mstack-protector-guard-offset=@var{offset}
20408 Generate stack protection code using canary at @var{guard}.  Supported
20409 locations are @samp{global} for a global canary or @samp{sysreg} for a
20410 canary in an appropriate system register.
20412 With the latter choice the options
20413 @option{-mstack-protector-guard-reg=@var{reg}} and
20414 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
20415 which system register to use as base register for reading the canary,
20416 and from what offset from that base register. There is no default
20417 register or offset as this is entirely for use within the Linux
20418 kernel.
20420 @opindex mtls-dialect=desc
20421 @item -mtls-dialect=desc
20422 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
20423 of TLS variables.  This is the default.
20425 @opindex mtls-dialect=traditional
20426 @item -mtls-dialect=traditional
20427 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
20428 of TLS variables.
20430 @opindex mtls-size
20431 @item -mtls-size=@var{size}
20432 Specify bit size of immediate TLS offsets.  Valid values are 12, 24, 32, 48.
20433 This option requires binutils 2.26 or newer.
20435 @opindex mfix-cortex-a53-835769
20436 @opindex mno-fix-cortex-a53-835769
20437 @item -mfix-cortex-a53-835769
20438 @itemx -mno-fix-cortex-a53-835769
20439 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
20440 This involves inserting a NOP instruction between memory instructions and
20441 64-bit integer multiply-accumulate instructions.
20443 @opindex mfix-cortex-a53-843419
20444 @opindex mno-fix-cortex-a53-843419
20445 @item -mfix-cortex-a53-843419
20446 @itemx -mno-fix-cortex-a53-843419
20447 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
20448 This erratum workaround is made at link time and this will only pass the
20449 corresponding flag to the linker.
20451 @opindex mlow-precision-recip-sqrt
20452 @opindex mno-low-precision-recip-sqrt
20453 @item -mlow-precision-recip-sqrt
20454 @itemx -mno-low-precision-recip-sqrt
20455 Enable or disable the reciprocal square root approximation.
20456 This option only has an effect if @option{-ffast-math} or
20457 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20458 precision of reciprocal square root results to about 16 bits for
20459 single precision and to 32 bits for double precision.
20461 @opindex mlow-precision-sqrt
20462 @opindex mno-low-precision-sqrt
20463 @item -mlow-precision-sqrt
20464 @itemx -mno-low-precision-sqrt
20465 Enable or disable the square root approximation.
20466 This option only has an effect if @option{-ffast-math} or
20467 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20468 precision of square root results to about 16 bits for
20469 single precision and to 32 bits for double precision.
20470 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
20472 @opindex mlow-precision-div
20473 @opindex mno-low-precision-div
20474 @item -mlow-precision-div
20475 @itemx -mno-low-precision-div
20476 Enable or disable the division approximation.
20477 This option only has an effect if @option{-ffast-math} or
20478 @option{-funsafe-math-optimizations} is used as well.  Enabling this reduces
20479 precision of division results to about 16 bits for
20480 single precision and to 32 bits for double precision.
20482 @item -mtrack-speculation
20483 @itemx -mno-track-speculation
20484 Enable or disable generation of additional code to track speculative
20485 execution through conditional branches.  The tracking state can then
20486 be used by the compiler when expanding calls to
20487 @code{__builtin_speculation_safe_copy} to permit a more efficient code
20488 sequence to be generated.
20490 @item -moutline-atomics
20491 @itemx -mno-outline-atomics
20492 Enable or disable calls to out-of-line helpers to implement atomic operations.
20493 These helpers will, at runtime, determine if the LSE instructions from
20494 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
20495 instructions that are present in the base ARMv8.0 ISA.
20497 This option is only applicable when compiling for the base ARMv8.0
20498 instruction set.  If using a later revision, e.g. @option{-march=armv8.1-a}
20499 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
20500 used directly.  The same applies when using @option{-mcpu=} when the
20501 selected cpu supports the @samp{lse} feature.
20502 This option is on by default.
20504 @opindex march
20505 @item -march=@var{name}
20506 Specify the name of the target architecture and, optionally, one or
20507 more feature modifiers.  This option has the form
20508 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
20510 The table below summarizes the permissible values for @var{arch}
20511 and the features that they enable by default:
20513 @multitable @columnfractions 0.20 0.20 0.60
20514 @headitem @var{arch} value @tab Architecture @tab Includes by default
20515 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
20516 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
20517 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
20518 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}, @samp{+pauth}
20519 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+flagm}, @samp{+fp16fml}, @samp{+dotprod}
20520 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
20521 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
20522 @item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
20523 @item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
20524 @item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
20525 @item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
20526 @item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
20527 @item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
20528 @item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
20529 @end multitable
20531 The value @samp{native} is available on native AArch64 GNU/Linux and
20532 causes the compiler to pick the architecture of the host system.  This
20533 option has no effect if the compiler is unable to recognize the
20534 architecture of the host system,
20536 The permissible values for @var{feature} are listed in the sub-section
20537 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20538 Feature Modifiers}.  Where conflicting feature modifiers are
20539 specified, the right-most feature is used.
20541 GCC uses @var{name} to determine what kind of instructions it can emit
20542 when generating assembly code.  If @option{-march} is specified
20543 without either of @option{-mtune} or @option{-mcpu} also being
20544 specified, the code is tuned to perform well across a range of target
20545 processors implementing the target architecture.
20547 @opindex mtune
20548 @item -mtune=@var{name}
20549 Specify the name of the target processor for which GCC should tune the
20550 performance of the code.  Permissible values for this option are:
20551 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
20552 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
20553 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
20554 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
20555 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c},
20556 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
20557 @samp{neoverse-512tvb}, @samp{neoverse-e1}, @samp{neoverse-n1},
20558 @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{neoverse-v2}, @samp{qdf24xx},
20559 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
20560 @samp{octeontx}, @samp{octeontx81},  @samp{octeontx83},
20561 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
20562 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
20563 @samp{octeontx2f95mm},
20564 @samp{a64fx},
20565 @samp{thunderx}, @samp{thunderxt88},
20566 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
20567 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{thunderx3t110}, @samp{zeus},
20568 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20569 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20570 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55},
20571 @samp{cortex-r82}, @samp{cortex-x1}, @samp{cortex-x1c}, @samp{cortex-x2},
20572 @samp{cortex-x3}, @samp{cortex-a510}, @samp{cortex-a520}, @samp{cortex-a710},
20573 @samp{cortex-a715}, @samp{cortex-a720}, @samp{ampere1}, @samp{ampere1a},
20574 and @samp{native}.
20576 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
20577 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
20578 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
20579 should tune for a big.LITTLE system.
20581 The value @samp{neoverse-512tvb} specifies that GCC should tune
20582 for Neoverse cores that (a) implement SVE and (b) have a total vector
20583 bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
20584 tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
20585 instructions a cycle and that can execute an equivalent number of SVE
20586 arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
20587 This is more general than tuning for a specific core like Neoverse V1
20588 but is more specific than the default tuning described below.
20590 Additionally on native AArch64 GNU/Linux systems the value
20591 @samp{native} tunes performance to the host system.  This option has no effect
20592 if the compiler is unable to recognize the processor of the host system.
20594 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
20595 are specified, the code is tuned to perform well across a range
20596 of target processors.
20598 This option cannot be suffixed by feature modifiers.
20600 @opindex mcpu
20601 @item -mcpu=@var{name}
20602 Specify the name of the target processor, optionally suffixed by one
20603 or more feature modifiers.  This option has the form
20604 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
20605 the permissible values for @var{cpu} are the same as those available
20606 for @option{-mtune}.  The permissible values for @var{feature} are
20607 documented in the sub-section on
20608 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
20609 Feature Modifiers}.  Where conflicting feature modifiers are
20610 specified, the right-most feature is used.
20612 GCC uses @var{name} to determine what kind of instructions it can emit when
20613 generating assembly code (as if by @option{-march}) and to determine
20614 the target processor for which to tune for performance (as if
20615 by @option{-mtune}).  Where this option is used in conjunction
20616 with @option{-march} or @option{-mtune}, those options take precedence
20617 over the appropriate part of this option.
20619 @option{-mcpu=neoverse-512tvb} is special in that it does not refer
20620 to a specific core, but instead refers to all Neoverse cores that
20621 (a) implement SVE and (b) have a total vector bandwidth of 512 bits
20622 a cycle.  Unless overridden by @option{-march},
20623 @option{-mcpu=neoverse-512tvb} generates code that can run on a
20624 Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
20625 these properties.  Unless overridden by @option{-mtune},
20626 @option{-mcpu=neoverse-512tvb} tunes code in the same way as for
20627 @option{-mtune=neoverse-512tvb}.
20629 @opindex moverride
20630 @item -moverride=@var{string}
20631 Override tuning decisions made by the back-end in response to a
20632 @option{-mtune=} switch.  The syntax, semantics, and accepted values
20633 for @var{string} in this option are not guaranteed to be consistent
20634 across releases.
20636 This option is only intended to be useful when developing GCC.
20638 @opindex mverbose-cost-dump
20639 @item -mverbose-cost-dump
20640 Enable verbose cost model dumping in the debug dump files.  This option is
20641 provided for use in debugging the compiler.
20643 @opindex mpc-relative-literal-loads
20644 @opindex mno-pc-relative-literal-loads
20645 @item -mpc-relative-literal-loads
20646 @itemx -mno-pc-relative-literal-loads
20647 Enable or disable PC-relative literal loads.  With this option literal pools are
20648 accessed using a single instruction and emitted after each function.  This
20649 limits the maximum size of functions to 1MB.  This is enabled by default for
20650 @option{-mcmodel=tiny}.
20652 @opindex msign-return-address
20653 @item -msign-return-address=@var{scope}
20654 Select the function scope on which return address signing will be applied.
20655 Permissible values are @samp{none}, which disables return address signing,
20656 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
20657 functions, and @samp{all}, which enables pointer signing for all functions.  The
20658 default value is @samp{none}. This option has been deprecated by
20659 -mbranch-protection.
20661 @opindex mbranch-protection
20662 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
20663 Select the branch protection features to use.
20664 @samp{none} is the default and turns off all types of branch protection.
20665 @samp{standard} turns on all types of branch protection features.  If a feature
20666 has additional tuning options, then @samp{standard} sets it to its standard
20667 level.
20668 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
20669 level: signing functions that save the return address to memory (non-leaf
20670 functions will practically always do this) using the a-key.  The optional
20671 argument @samp{leaf} can be used to extend the signing to include leaf
20672 functions.  The optional argument @samp{b-key} can be used to sign the functions
20673 with the B-key instead of the A-key.
20674 @samp{bti} turns on branch target identification mechanism.
20676 @opindex mharden-sls
20677 @item -mharden-sls=@var{opts}
20678 Enable compiler hardening against straight line speculation (SLS).
20679 @var{opts} is a comma-separated list of the following options:
20680 @table @samp
20681 @item retbr
20682 @item blr
20683 @end table
20684 In addition, @samp{-mharden-sls=all} enables all SLS hardening while
20685 @samp{-mharden-sls=none} disables all SLS hardening.
20687 @opindex msve-vector-bits
20688 @item -msve-vector-bits=@var{bits}
20689 Specify the number of bits in an SVE vector register.  This option only has
20690 an effect when SVE is enabled.
20692 GCC supports two forms of SVE code generation: ``vector-length
20693 agnostic'' output that works with any size of vector register and
20694 ``vector-length specific'' output that allows GCC to make assumptions
20695 about the vector length when it is useful for optimization reasons.
20696 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
20697 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
20698 Specifying @samp{scalable} selects vector-length agnostic
20699 output.  At present @samp{-msve-vector-bits=128} also generates vector-length
20700 agnostic output for big-endian targets.  All other values generate
20701 vector-length specific code.  The behavior of these values may change
20702 in future releases and no value except @samp{scalable} should be
20703 relied on for producing code that is portable across different
20704 hardware SVE vector lengths.
20706 The default is @samp{-msve-vector-bits=scalable}, which produces
20707 vector-length agnostic code.
20708 @end table
20710 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
20711 @anchor{aarch64-feature-modifiers}
20712 @cindex @option{-march} feature modifiers
20713 @cindex @option{-mcpu} feature modifiers
20714 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
20715 the following and their inverses @option{no@var{feature}}:
20717 @table @samp
20718 @item crc
20719 Enable CRC extension.  This is on by default for
20720 @option{-march=armv8.1-a}.
20721 @item crypto
20722 Enable Crypto extension.  This also enables Advanced SIMD and floating-point
20723 instructions.
20724 @item fp
20725 Enable floating-point instructions.  This is on by default for all possible
20726 values for options @option{-march} and @option{-mcpu}.
20727 @item simd
20728 Enable Advanced SIMD instructions.  This also enables floating-point
20729 instructions.  This is on by default for all possible values for options
20730 @option{-march} and @option{-mcpu}.
20731 @item sve
20732 Enable Scalable Vector Extension instructions.  This also enables Advanced
20733 SIMD and floating-point instructions.
20734 @item lse
20735 Enable Large System Extension instructions.  This is on by default for
20736 @option{-march=armv8.1-a}.
20737 @item rdma
20738 Enable Round Double Multiply Accumulate instructions.  This is on by default
20739 for @option{-march=armv8.1-a}.
20740 @item fp16
20741 Enable FP16 extension.  This also enables floating-point instructions.
20742 @item fp16fml
20743 Enable FP16 fmla extension.  This also enables FP16 extensions and
20744 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.
20746 @item rcpc
20747 Enable the RCpc extension.  This enables the use of the LDAPR instructions for
20748 load-acquire atomic semantics, and passes it on to the assembler, enabling
20749 inline asm statements to use instructions from the RCpc extension.
20750 @item dotprod
20751 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
20752 @item aes
20753 Enable the Armv8-a aes and pmull crypto extension.  This also enables Advanced
20754 SIMD instructions.
20755 @item sha2
20756 Enable the Armv8-a sha2 crypto extension.  This also enables Advanced SIMD instructions.
20757 @item sha3
20758 Enable the sha512 and sha3 crypto extension.  This also enables Advanced SIMD
20759 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
20760 @item sm4
20761 Enable the sm3 and sm4 crypto extension.  This also enables Advanced SIMD instructions.
20762 Use of this option with architectures prior to Armv8.2-A is not supported.
20763 @item profile
20764 Enable the Statistical Profiling extension.  This option is only to enable the
20765 extension at the assembler level and does not affect code generation.
20766 @item rng
20767 Enable the Armv8.5-a Random Number instructions.  This option is only to
20768 enable the extension at the assembler level and does not affect code
20769 generation.
20770 @item memtag
20771 Enable the Armv8.5-a Memory Tagging Extensions.
20772 Use of this option with architectures prior to Armv8.5-A is not supported.
20773 @item sb
20774 Enable the Armv8-a Speculation Barrier instruction.  This option is only to
20775 enable the extension at the assembler level and does not affect code
20776 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20777 @item ssbs
20778 Enable the Armv8-a Speculative Store Bypass Safe instruction.  This option
20779 is only to enable the extension at the assembler level and does not affect code
20780 generation.  This option is enabled by default for @option{-march=armv8.5-a}.
20781 @item predres
20782 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
20783 This option is only to enable the extension at the assembler level and does
20784 not affect code generation.  This option is enabled by default for
20785 @option{-march=armv8.5-a}.
20786 @item sve2
20787 Enable the Armv8-a Scalable Vector Extension 2.  This also enables SVE
20788 instructions.
20789 @item sve2-bitperm
20790 Enable SVE2 bitperm instructions.  This also enables SVE2 instructions.
20791 @item sve2-sm4
20792 Enable SVE2 sm4 instructions.  This also enables SVE2 instructions.
20793 @item sve2-aes
20794 Enable SVE2 aes instructions.  This also enables SVE2 instructions.
20795 @item sve2-sha3
20796 Enable SVE2 sha3 instructions.  This also enables SVE2 instructions.
20797 @item tme
20798 Enable the Transactional Memory Extension.
20799 @item i8mm
20800 Enable 8-bit Integer Matrix Multiply instructions.  This also enables
20801 Advanced SIMD and floating-point instructions.  This option is enabled by
20802 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20803 prior to Armv8.2-A is not supported.
20804 @item f32mm
20805 Enable 32-bit Floating point Matrix Multiply instructions.  This also enables
20806 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20807 not supported.
20808 @item f64mm
20809 Enable 64-bit Floating point Matrix Multiply instructions.  This also enables
20810 SVE instructions.  Use of this option with architectures prior to Armv8.2-A is
20811 not supported.
20812 @item bf16
20813 Enable brain half-precision floating-point instructions.  This also enables
20814 Advanced SIMD and floating-point instructions.  This option is enabled by
20815 default for @option{-march=armv8.6-a}.  Use of this option with architectures
20816 prior to Armv8.2-A is not supported.
20817 @item ls64
20818 Enable the 64-byte atomic load and store instructions for accelerators.
20819 This option is enabled by default for @option{-march=armv8.7-a}.
20820 @item mops
20821 Enable the instructions to accelerate memory operations like @code{memcpy},
20822 @code{memmove}, @code{memset}.  This option is enabled by default for
20823 @option{-march=armv8.8-a}
20824 @item flagm
20825 Enable the Flag Manipulation instructions Extension.
20826 @item pauth
20827 Enable the Pointer Authentication Extension.
20828 @item cssc
20829 Enable the Common Short Sequence Compression instructions.
20831 @end table
20833 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
20834 which implies @option{fp}.
20835 Conversely, @option{nofp} implies @option{nosimd}, which implies
20836 @option{nocrypto}, @option{noaes} and @option{nosha2}.
20838 @node Adapteva Epiphany Options
20839 @subsection Adapteva Epiphany Options
20841 These @samp{-m} options are defined for Adapteva Epiphany:
20843 @table @gcctabopt
20844 @opindex mhalf-reg-file
20845 @item -mhalf-reg-file
20846 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
20847 That allows code to run on hardware variants that lack these registers.
20849 @opindex mprefer-short-insn-regs
20850 @item -mprefer-short-insn-regs
20851 Preferentially allocate registers that allow short instruction generation.
20852 This can result in increased instruction count, so this may either reduce or
20853 increase overall code size.
20855 @opindex mbranch-cost
20856 @item -mbranch-cost=@var{num}
20857 Set the cost of branches to roughly @var{num} ``simple'' instructions.
20858 This cost is only a heuristic and is not guaranteed to produce
20859 consistent results across releases.
20861 @opindex mcmove
20862 @item -mcmove
20863 Enable the generation of conditional moves.
20865 @opindex mnops
20866 @item -mnops=@var{num}
20867 Emit @var{num} NOPs before every other generated instruction.
20869 @opindex mno-soft-cmpsf
20870 @opindex msoft-cmpsf
20871 @item -mno-soft-cmpsf
20872 For single-precision floating-point comparisons, emit an @code{fsub} instruction
20873 and test the flags.  This is faster than a software comparison, but can
20874 get incorrect results in the presence of NaNs, or when two different small
20875 numbers are compared such that their difference is calculated as zero.
20876 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
20877 software comparisons.
20879 @opindex mstack-offset
20880 @item -mstack-offset=@var{num}
20881 Set the offset between the top of the stack and the stack pointer.
20882 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
20883 can be used by leaf functions without stack allocation.
20884 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
20885 Note also that this option changes the ABI; compiling a program with a
20886 different stack offset than the libraries have been compiled with
20887 generally does not work.
20888 This option can be useful if you want to evaluate if a different stack
20889 offset would give you better code, but to actually use a different stack
20890 offset to build working programs, it is recommended to configure the
20891 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
20893 @opindex mno-round-nearest
20894 @opindex mround-nearest
20895 @item -mno-round-nearest
20896 Make the scheduler assume that the rounding mode has been set to
20897 truncating.  The default is @option{-mround-nearest}.
20899 @opindex mlong-calls
20900 @item -mlong-calls
20901 If not otherwise specified by an attribute, assume all calls might be beyond
20902 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
20903 function address into a register before performing a (otherwise direct) call.
20904 This is the default.
20906 @opindex short-calls
20907 @item -mshort-calls
20908 If not otherwise specified by an attribute, assume all direct calls are
20909 in the range of the @code{b} / @code{bl} instructions, so use these instructions
20910 for direct calls.  The default is @option{-mlong-calls}.
20912 @opindex msmall16
20913 @item -msmall16
20914 Assume addresses can be loaded as 16-bit unsigned values.  This does not
20915 apply to function addresses for which @option{-mlong-calls} semantics
20916 are in effect.
20918 @opindex mfp-mode
20919 @item -mfp-mode=@var{mode}
20920 Set the prevailing mode of the floating-point unit.
20921 This determines the floating-point mode that is provided and expected
20922 at function call and return time.  Making this mode match the mode you
20923 predominantly need at function start can make your programs smaller and
20924 faster by avoiding unnecessary mode switches.
20926 @var{mode} can be set to one the following values:
20928 @table @samp
20929 @item caller
20930 Any mode at function entry is valid, and retained or restored when
20931 the function returns, and when it calls other functions.
20932 This mode is useful for compiling libraries or other compilation units
20933 you might want to incorporate into different programs with different
20934 prevailing FPU modes, and the convenience of being able to use a single
20935 object file outweighs the size and speed overhead for any extra
20936 mode switching that might be needed, compared with what would be needed
20937 with a more specific choice of prevailing FPU mode.
20939 @item truncate
20940 This is the mode used for floating-point calculations with
20941 truncating (i.e.@: round towards zero) rounding mode.  That includes
20942 conversion from floating point to integer.
20944 @item round-nearest
20945 This is the mode used for floating-point calculations with
20946 round-to-nearest-or-even rounding mode.
20948 @item int
20949 This is the mode used to perform integer calculations in the FPU, e.g.@:
20950 integer multiply, or integer multiply-and-accumulate.
20951 @end table
20953 The default is @option{-mfp-mode=caller}
20955 @opindex mno-split-lohi
20956 @opindex msplit-lohi
20957 @opindex mno-postinc
20958 @opindex mpostinc
20959 @opindex mno-postmodify
20960 @opindex mpostmodify
20961 @item -mno-split-lohi
20962 @itemx -mno-postinc
20963 @itemx -mno-postmodify
20964 Code generation tweaks that disable, respectively, splitting of 32-bit
20965 loads, generation of post-increment addresses, and generation of
20966 post-modify addresses.  The defaults are @option{msplit-lohi},
20967 @option{-mpost-inc}, and @option{-mpost-modify}.
20969 @opindex mno-vect-double
20970 @opindex mvect-double
20971 @item -mnovect-double
20972 Change the preferred SIMD mode to SImode.  The default is
20973 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
20975 @opindex max-vect-align
20976 @item -max-vect-align=@var{num}
20977 The maximum alignment for SIMD vector mode types.
20978 @var{num} may be 4 or 8.  The default is 8.
20979 Note that this is an ABI change, even though many library function
20980 interfaces are unaffected if they don't use SIMD vector modes
20981 in places that affect size and/or alignment of relevant types.
20983 @opindex msplit-vecmove-early
20984 @item -msplit-vecmove-early
20985 Split vector moves into single word moves before reload.  In theory this
20986 can give better register allocation, but so far the reverse seems to be
20987 generally the case.
20989 @opindex m1reg-
20990 @item -m1reg-@var{reg}
20991 Specify a register to hold the constant @minus{}1, which makes loading small negative
20992 constants and certain bitmasks faster.
20993 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
20994 which specify use of that register as a fixed register,
20995 and @samp{none}, which means that no register is used for this
20996 purpose.  The default is @option{-m1reg-none}.
20998 @end table
21000 @node AMD GCN Options
21001 @subsection AMD GCN Options
21002 @cindex AMD GCN Options
21004 These options are defined specifically for the AMD GCN port.
21006 @table @gcctabopt
21008 @opindex march
21009 @opindex mtune
21010 @item -march=@var{gpu}
21011 @itemx -mtune=@var{gpu}
21012 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
21015 @table @samp
21016 @item fiji
21017 Compile for GCN3 Fiji devices (gfx803).
21019 @item gfx900
21020 Compile for GCN5 Vega 10 devices (gfx900).
21022 @item gfx906
21023 Compile for GCN5 Vega 20 devices (gfx906).
21025 @item gfx908
21026 Compile for CDNA1 Instinct MI100 series devices (gfx908).
21028 @item gfx90a
21029 Compile for CDNA2 Instinct MI200 series devices (gfx90a).
21031 @end table
21033 @opindex msram-ecc
21034 @item -msram-ecc=on
21035 @itemx -msram-ecc=off
21036 @itemx -msram-ecc=any
21037 Compile binaries suitable for devices with the SRAM-ECC feature enabled,
21038 disabled, or either mode.  This feature can be enabled per-process on some
21039 devices.  The compiled code must match the device mode. The default is
21040 @samp{any}, for devices that support it.
21042 @opindex mstack-size
21043 @item -mstack-size=@var{bytes}
21044 Specify how many @var{bytes} of stack space will be requested for each GPU
21045 thread (wave-front).  Beware that there may be many threads and limited memory
21046 available.  The size of the stack allocation may also have an impact on
21047 run-time performance.  The default is 32KB when using OpenACC or OpenMP, and
21048 1MB otherwise.
21050 @opindex mxnack
21051 @item -mxnack=on
21052 @itemx -mxnack=off
21053 @itemx -mxnack=any
21054 Compile binaries suitable for devices with the XNACK feature enabled, disabled,
21055 or either mode.  Some devices always require XNACK and some allow the user to
21056 configure XNACK.  The compiled code must match the device mode.
21057 @c The default is @samp{-mxnack=any}.
21058 At present this option is a placeholder for support that is not yet implemented.
21060 @end table
21062 @node ARC Options
21063 @subsection ARC Options
21064 @cindex ARC options
21066 The following options control the architecture variant for which code
21067 is being compiled:
21069 @c architecture variants
21070 @table @gcctabopt
21072 @opindex mbarrel-shifter
21073 @item -mbarrel-shifter
21074 Generate instructions supported by barrel shifter.  This is the default
21075 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
21077 @opindex mjli-always
21078 @item -mjli-always
21079 Force to call a function using jli_s instruction.  This option is
21080 valid only for ARCv2 architecture.
21082 @opindex mcpu
21083 @item -mcpu=@var{cpu}
21084 Set architecture type, register usage, and instruction scheduling
21085 parameters for @var{cpu}.  There are also shortcut alias options
21086 available for backward compatibility and convenience.  Supported
21087 values for @var{cpu} are
21089 @table @samp
21090 @opindex mA6
21091 @opindex mARC600
21092 @item arc600
21093 Compile for ARC600.  Aliases: @option{-mA6}, @option{-mARC600}.
21095 @opindex mARC601
21096 @item arc601
21097 Compile for ARC601.  Alias: @option{-mARC601}.
21099 @opindex mA7
21100 @opindex mARC700
21101 @item arc700
21102 Compile for ARC700.  Aliases: @option{-mA7}, @option{-mARC700}.
21103 This is the default when configured with @option{--with-cpu=arc700}@.
21105 @item arcem
21106 Compile for ARC EM.
21108 @item archs
21109 Compile for ARC HS.
21111 @item em
21112 Compile for ARC EM CPU with no hardware extensions.
21114 @item em4
21115 Compile for ARC EM4 CPU.
21117 @item em4_dmips
21118 Compile for ARC EM4 DMIPS CPU.
21120 @item em4_fpus
21121 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
21122 extension.
21124 @item em4_fpuda
21125 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
21126 double assist instructions.
21128 @item hs
21129 Compile for ARC HS CPU with no hardware extensions except the atomic
21130 instructions.
21132 @item hs34
21133 Compile for ARC HS34 CPU.
21135 @item hs38
21136 Compile for ARC HS38 CPU.
21138 @item hs38_linux
21139 Compile for ARC HS38 CPU with all hardware extensions on.
21141 @item hs4x
21142 Compile for ARC HS4x CPU.
21144 @item hs4xd
21145 Compile for ARC HS4xD CPU.
21147 @item hs4x_rel31
21148 Compile for ARC HS4x CPU release 3.10a.
21150 @item arc600_norm
21151 Compile for ARC 600 CPU with @code{norm} instructions enabled.
21153 @item arc600_mul32x16
21154 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply 
21155 instructions enabled.
21157 @item arc600_mul64
21158 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family 
21159 instructions enabled.
21161 @item arc601_norm
21162 Compile for ARC 601 CPU with @code{norm} instructions enabled.
21164 @item arc601_mul32x16
21165 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
21166 instructions enabled.
21168 @item arc601_mul64
21169 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
21170 instructions enabled.
21172 @item nps400
21173 Compile for ARC 700 on NPS400 chip.
21175 @item em_mini
21176 Compile for ARC EM minimalist configuration featuring reduced register
21177 set.
21179 @end table
21181 @opindex mdpfp
21182 @opindex mdpfp-compact
21183 @item -mdpfp
21184 @itemx -mdpfp-compact
21185 Generate double-precision FPX instructions, tuned for the compact
21186 implementation.
21188 @opindex mdpfp-fast
21189 @item -mdpfp-fast
21190 Generate double-precision FPX instructions, tuned for the fast
21191 implementation.
21193 @opindex mno-dpfp-lrsr
21194 @item -mno-dpfp-lrsr
21195 Disable @code{lr} and @code{sr} instructions from using FPX extension
21196 aux registers.
21198 @opindex mea
21199 @item -mea
21200 Generate extended arithmetic instructions.  Currently only
21201 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
21202 supported.  Only valid for @option{-mcpu=ARC700}.
21204 @opindex mno-mpy
21205 @opindex mmpy
21206 @item -mno-mpy
21207 Do not generate @code{mpy}-family instructions for ARC700.  This option is
21208 deprecated.
21210 @opindex mmul32x16
21211 @item -mmul32x16
21212 Generate 32x16-bit multiply and multiply-accumulate instructions.
21214 @opindex mmul64
21215 @item -mmul64
21216 Generate @code{mul64} and @code{mulu64} instructions.  
21217 Only valid for @option{-mcpu=ARC600}.
21219 @opindex mnorm
21220 @item -mnorm
21221 Generate @code{norm} instructions.  This is the default if @option{-mcpu=ARC700}
21222 is in effect.
21224 @opindex mspfp
21225 @opindex mspfp-compact
21226 @item -mspfp
21227 @itemx -mspfp-compact
21228 Generate single-precision FPX instructions, tuned for the compact
21229 implementation.
21231 @opindex mspfp-fast
21232 @item -mspfp-fast
21233 Generate single-precision FPX instructions, tuned for the fast
21234 implementation.
21236 @opindex msimd
21237 @item -msimd
21238 Enable generation of ARC SIMD instructions via target-specific
21239 builtins.  Only valid for @option{-mcpu=ARC700}.
21241 @opindex msoft-float
21242 @item -msoft-float
21243 This option ignored; it is provided for compatibility purposes only.
21244 Software floating-point code is emitted by default, and this default
21245 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
21246 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
21247 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
21249 @opindex mswap
21250 @item -mswap
21251 Generate @code{swap} instructions.
21253 @opindex matomic
21254 @item -matomic
21255 This enables use of the locked load/store conditional extension to implement
21256 atomic memory built-in functions.  Not available for ARC 6xx or ARC
21257 EM cores.
21259 @opindex mdiv-rem
21260 @item -mdiv-rem
21261 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
21263 @opindex mcode-density
21264 @item -mcode-density
21265 Enable code density instructions for ARC EM.  
21266 This option is on by default for ARC HS.
21268 @opindex mll64
21269 @item -mll64
21270 Enable double load/store operations for ARC HS cores.
21272 @opindex mtp-regno
21273 @item -mtp-regno=@var{regno}
21274 Specify thread pointer register number.
21276 @opindex mmpy-option
21277 @item -mmpy-option=@var{multo}
21278 Compile ARCv2 code with a multiplier design option.  You can specify 
21279 the option using either a string or numeric value for @var{multo}.  
21280 @samp{wlh1} is the default value.  The recognized values are:
21282 @table @samp
21283 @item 0
21284 @itemx none
21285 No multiplier available.
21287 @item 1
21288 @itemx w
21289 16x16 multiplier, fully pipelined.
21290 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
21292 @item 2
21293 @itemx wlh1
21294 32x32 multiplier, fully
21295 pipelined (1 stage).  The following instructions are additionally
21296 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21298 @item 3
21299 @itemx wlh2
21300 32x32 multiplier, fully pipelined
21301 (2 stages).  The following instructions are additionally enabled: @code{mpy},
21302 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21304 @item 4
21305 @itemx wlh3
21306 Two 16x16 multipliers, blocking,
21307 sequential.  The following instructions are additionally enabled: @code{mpy},
21308 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21310 @item 5
21311 @itemx wlh4
21312 One 16x16 multiplier, blocking,
21313 sequential.  The following instructions are additionally enabled: @code{mpy},
21314 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21316 @item 6
21317 @itemx wlh5
21318 One 32x4 multiplier, blocking,
21319 sequential.  The following instructions are additionally enabled: @code{mpy},
21320 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
21322 @item 7
21323 @itemx plus_dmpy
21324 ARC HS SIMD support.
21326 @item 8
21327 @itemx plus_macd
21328 ARC HS SIMD support.
21330 @item 9
21331 @itemx plus_qmacw
21332 ARC HS SIMD support.
21334 @end table
21336 This option is only available for ARCv2 cores@.
21338 @opindex mfpu
21339 @item -mfpu=@var{fpu}
21340 Enables support for specific floating-point hardware extensions for ARCv2
21341 cores.  Supported values for @var{fpu} are:
21343 @table @samp
21345 @item fpus
21346 Enables support for single-precision floating-point hardware
21347 extensions@.
21349 @item fpud
21350 Enables support for double-precision floating-point hardware
21351 extensions.  The single-precision floating-point extension is also
21352 enabled.  Not available for ARC EM@.
21354 @item fpuda
21355 Enables support for double-precision floating-point hardware
21356 extensions using double-precision assist instructions.  The single-precision
21357 floating-point extension is also enabled.  This option is
21358 only available for ARC EM@.
21360 @item fpuda_div
21361 Enables support for double-precision floating-point hardware
21362 extensions using double-precision assist instructions.
21363 The single-precision floating-point, square-root, and divide 
21364 extensions are also enabled.  This option is
21365 only available for ARC EM@.
21367 @item fpuda_fma
21368 Enables support for double-precision floating-point hardware
21369 extensions using double-precision assist instructions.
21370 The single-precision floating-point and fused multiply and add 
21371 hardware extensions are also enabled.  This option is
21372 only available for ARC EM@.
21374 @item fpuda_all
21375 Enables support for double-precision floating-point hardware
21376 extensions using double-precision assist instructions.
21377 All single-precision floating-point hardware extensions are also
21378 enabled.  This option is only available for ARC EM@.
21380 @item fpus_div
21381 Enables support for single-precision floating-point, square-root and divide 
21382 hardware extensions@.
21384 @item fpud_div
21385 Enables support for double-precision floating-point, square-root and divide 
21386 hardware extensions.  This option
21387 includes option @samp{fpus_div}. Not available for ARC EM@.
21389 @item fpus_fma
21390 Enables support for single-precision floating-point and 
21391 fused multiply and add hardware extensions@.
21393 @item fpud_fma
21394 Enables support for double-precision floating-point and 
21395 fused multiply and add hardware extensions.  This option
21396 includes option @samp{fpus_fma}.  Not available for ARC EM@.
21398 @item fpus_all
21399 Enables support for all single-precision floating-point hardware
21400 extensions@.
21402 @item fpud_all
21403 Enables support for all single- and double-precision floating-point
21404 hardware extensions.  Not available for ARC EM@.
21406 @end table
21408 @opindex mirq-ctrl-saved
21409 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
21410 Specifies general-purposes registers that the processor automatically
21411 saves/restores on interrupt entry and exit.  @var{register-range} is
21412 specified as two registers separated by a dash.  The register range
21413 always starts with @code{r0}, the upper limit is @code{fp} register.
21414 @var{blink} and @var{lp_count} are optional.  This option is only
21415 valid for ARC EM and ARC HS cores.
21417 @opindex mrgf-banked-regs
21418 @item -mrgf-banked-regs=@var{number}
21419 Specifies the number of registers replicated in second register bank
21420 on entry to fast interrupt.  Fast interrupts are interrupts with the
21421 highest priority level P0.  These interrupts save only PC and STATUS32
21422 registers to avoid memory transactions during interrupt entry and exit
21423 sequences.  Use this option when you are using fast interrupts in an
21424 ARC V2 family processor.  Permitted values are 4, 8, 16, and 32.
21426 @opindex mlpc-width
21427 @item -mlpc-width=@var{width}
21428 Specify the width of the @code{lp_count} register.  Valid values for
21429 @var{width} are 8, 16, 20, 24, 28 and 32 bits.  The default width is
21430 fixed to 32 bits.  If the width is less than 32, the compiler does not
21431 attempt to transform loops in your program to use the zero-delay loop
21432 mechanism unless it is known that the @code{lp_count} register can
21433 hold the required loop-counter value.  Depending on the width
21434 specified, the compiler and run-time library might continue to use the
21435 loop mechanism for various needs.  This option defines macro
21436 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
21438 @opindex mrf16
21439 @item -mrf16
21440 This option instructs the compiler to generate code for a 16-entry
21441 register file.  This option defines the @code{__ARC_RF16__}
21442 preprocessor macro.
21444 @opindex mbranch-index
21445 @item -mbranch-index
21446 Enable use of @code{bi} or @code{bih} instructions to implement jump
21447 tables.
21449 @end table
21451 The following options are passed through to the assembler, and also
21452 define preprocessor macro symbols.
21454 @c Flags used by the assembler, but for which we define preprocessor
21455 @c macro symbols as well.
21456 @table @gcctabopt
21457 @opindex mdsp-packa
21458 @item -mdsp-packa
21459 Passed down to the assembler to enable the DSP Pack A extensions.
21460 Also sets the preprocessor symbol @code{__Xdsp_packa}.  This option is
21461 deprecated.
21463 @opindex mdvbf
21464 @item -mdvbf
21465 Passed down to the assembler to enable the dual Viterbi butterfly
21466 extension.  Also sets the preprocessor symbol @code{__Xdvbf}.  This
21467 option is deprecated.
21469 @c ARC700 4.10 extension instruction
21470 @opindex mlock
21471 @item -mlock
21472 Passed down to the assembler to enable the locked load/store
21473 conditional extension.  Also sets the preprocessor symbol
21474 @code{__Xlock}.
21476 @opindex mmac-d16
21477 @item -mmac-d16
21478 Passed down to the assembler.  Also sets the preprocessor symbol
21479 @code{__Xxmac_d16}.  This option is deprecated.
21481 @opindex mmac-24
21482 @item -mmac-24
21483 Passed down to the assembler.  Also sets the preprocessor symbol
21484 @code{__Xxmac_24}.  This option is deprecated.
21486 @c ARC700 4.10 extension instruction
21487 @opindex mrtsc
21488 @item -mrtsc
21489 Passed down to the assembler to enable the 64-bit time-stamp counter
21490 extension instruction.  Also sets the preprocessor symbol
21491 @code{__Xrtsc}.  This option is deprecated.
21493 @c ARC700 4.10 extension instruction
21494 @opindex mswape
21495 @item -mswape
21496 Passed down to the assembler to enable the swap byte ordering
21497 extension instruction.  Also sets the preprocessor symbol
21498 @code{__Xswape}.
21500 @opindex mtelephony
21501 @item -mtelephony
21502 Passed down to the assembler to enable dual- and single-operand
21503 instructions for telephony.  Also sets the preprocessor symbol
21504 @code{__Xtelephony}.  This option is deprecated.
21506 @opindex mxy
21507 @item -mxy
21508 Passed down to the assembler to enable the XY memory extension.  Also
21509 sets the preprocessor symbol @code{__Xxy}.
21511 @end table
21513 The following options control how the assembly code is annotated:
21515 @c Assembly annotation options
21516 @table @gcctabopt
21517 @opindex misize
21518 @item -misize
21519 Annotate assembler instructions with estimated addresses.
21521 @opindex mannotate-align
21522 @item -mannotate-align
21523 Explain what alignment considerations lead to the decision to make an
21524 instruction short or long.
21526 @end table
21528 The following options are passed through to the linker:
21530 @c options passed through to the linker
21531 @table @gcctabopt
21532 @opindex marclinux
21533 @item -marclinux
21534 Passed through to the linker, to specify use of the @code{arclinux} emulation.
21535 This option is enabled by default in tool chains built for
21536 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
21537 when profiling is not requested.
21539 @opindex marclinux_prof
21540 @item -marclinux_prof
21541 Passed through to the linker, to specify use of the
21542 @code{arclinux_prof} emulation.  This option is enabled by default in
21543 tool chains built for @w{@code{arc-linux-uclibc}} and
21544 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
21546 @end table
21548 The following options control the semantics of generated code:
21550 @c semantically relevant code generation options
21551 @table @gcctabopt
21552 @opindex mlong-calls
21553 @item -mlong-calls
21554 Generate calls as register indirect calls, thus providing access
21555 to the full 32-bit address range.
21557 @opindex mmedium-calls
21558 @item -mmedium-calls
21559 Don't use less than 25-bit addressing range for calls, which is the
21560 offset available for an unconditional branch-and-link
21561 instruction.  Conditional execution of function calls is suppressed, to
21562 allow use of the 25-bit range, rather than the 21-bit range with
21563 conditional branch-and-link.  This is the default for tool chains built
21564 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
21566 @opindex G
21567 @item -G @var{num}
21568 Put definitions of externally-visible data in a small data section if
21569 that data is no bigger than @var{num} bytes.  The default value of
21570 @var{num} is 4 for any ARC configuration, or 8 when we have double
21571 load/store operations.
21573 @opindex mno-sdata
21574 @opindex msdata
21575 @item -mno-sdata
21576 Do not generate sdata references.  This is the default for tool chains
21577 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
21578 targets.
21580 @opindex mvolatile-cache
21581 @item -mvolatile-cache
21582 Use ordinarily cached memory accesses for volatile references.  This is the
21583 default.
21585 @opindex mno-volatile-cache
21586 @opindex mvolatile-cache
21587 @item -mno-volatile-cache
21588 Enable cache bypass for volatile references.
21590 @end table
21592 The following options fine tune code generation:
21593 @c code generation tuning options
21594 @table @gcctabopt
21595 @opindex malign-call
21596 @item -malign-call
21597 Does nothing.  Preserved for backward compatibility.
21599 @opindex mauto-modify-reg
21600 @item -mauto-modify-reg
21601 Enable the use of pre/post modify with register displacement.
21603 @opindex mbbit-peephole
21604 @item -mbbit-peephole
21605 Enable bbit peephole2.
21607 @opindex mno-brcc
21608 @item -mno-brcc
21609 This option disables a target-specific pass in @file{arc_reorg} to
21610 generate compare-and-branch (@code{br@var{cc}}) instructions.  
21611 It has no effect on
21612 generation of these instructions driven by the combiner pass.
21614 @opindex mcase-vector-pcrel
21615 @item -mcase-vector-pcrel
21616 Use PC-relative switch case tables to enable case table shortening.
21617 This is the default for @option{-Os}.
21619 @opindex mcompact-casesi
21620 @item -mcompact-casesi
21621 Enable compact @code{casesi} pattern.  This is the default for @option{-Os},
21622 and only available for ARCv1 cores.  This option is deprecated.
21624 @opindex mno-cond-exec
21625 @item -mno-cond-exec
21626 Disable the ARCompact-specific pass to generate conditional 
21627 execution instructions.
21629 Due to delay slot scheduling and interactions between operand numbers,
21630 literal sizes, instruction lengths, and the support for conditional execution,
21631 the target-independent pass to generate conditional execution is often lacking,
21632 so the ARC port has kept a special pass around that tries to find more
21633 conditional execution generation opportunities after register allocation,
21634 branch shortening, and delay slot scheduling have been done.  This pass
21635 generally, but not always, improves performance and code size, at the cost of
21636 extra compilation time, which is why there is an option to switch it off.
21637 If you have a problem with call instructions exceeding their allowable
21638 offset range because they are conditionalized, you should consider using
21639 @option{-mmedium-calls} instead.
21641 @opindex mearly-cbranchsi
21642 @item -mearly-cbranchsi
21643 Enable pre-reload use of the @code{cbranchsi} pattern.
21645 @opindex mexpand-adddi
21646 @item -mexpand-adddi
21647 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
21648 @code{add.f}, @code{adc} etc.  This option is deprecated.
21650 @opindex mindexed-loads
21651 @item -mindexed-loads
21652 Enable the use of indexed loads.  This can be problematic because some
21653 optimizers then assume that indexed stores exist, which is not
21654 the case.
21656 @opindex mlra
21657 @item -mlra
21658 Enable Local Register Allocation.  This is still experimental for ARC,
21659 so by default the compiler uses standard reload
21660 (i.e.@: @option{-mno-lra}).
21662 @opindex mlra-priority-none
21663 @item -mlra-priority-none
21664 Don't indicate any priority for target registers.
21666 @opindex mlra-priority-compact
21667 @item -mlra-priority-compact
21668 Indicate target register priority for r0..r3 / r12..r15.
21670 @opindex mlra-priority-noncompact
21671 @item -mlra-priority-noncompact
21672 Reduce target register priority for r0..r3 / r12..r15.
21674 @opindex mmillicode
21675 @item -mmillicode
21676 When optimizing for size (using @option{-Os}), prologues and epilogues
21677 that have to save or restore a large number of registers are often
21678 shortened by using call to a special function in libgcc; this is
21679 referred to as a @emph{millicode} call.  As these calls can pose
21680 performance issues, and/or cause linking issues when linking in a
21681 nonstandard way, this option is provided to turn on or off millicode
21682 call generation.
21684 @opindex mcode-density-frame
21685 @item -mcode-density-frame
21686 This option enable the compiler to emit @code{enter} and @code{leave}
21687 instructions.  These instructions are only valid for CPUs with
21688 code-density feature.
21690 @opindex mmixed-code
21691 @item -mmixed-code
21692 Does nothing.  Preserved for backward compatibility.
21694 @opindex mq-class
21695 @item -mq-class
21696 Ths option is deprecated.  Enable @samp{q} instruction alternatives.
21697 This is the default for @option{-Os}.
21699 @opindex mRcq
21700 @item -mRcq
21701 Does nothing.  Preserved for backward compatibility.
21703 @opindex mRcw
21704 @item -mRcw
21705 Does nothing.  Preserved for backward compatibility.
21707 @opindex msize-level
21708 @item -msize-level=@var{level}
21709 Fine-tune size optimization with regards to instruction lengths and alignment.
21710 The recognized values for @var{level} are:
21711 @table @samp
21712 @item 0
21713 No size optimization.  This level is deprecated and treated like @samp{1}.
21715 @item 1
21716 Short instructions are used opportunistically.
21718 @item 2
21719 In addition, alignment of loops and of code after barriers are dropped.
21721 @item 3
21722 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
21724 @end table
21726 This defaults to @samp{3} when @option{-Os} is in effect.  Otherwise,
21727 the behavior when this is not set is equivalent to level @samp{1}.
21729 @opindex mtune
21730 @item -mtune=@var{cpu}
21731 Set instruction scheduling parameters for @var{cpu}, overriding any implied
21732 by @option{-mcpu=}.
21734 Supported values for @var{cpu} are
21736 @table @samp
21737 @item ARC600
21738 Tune for ARC600 CPU.
21740 @item ARC601
21741 Tune for ARC601 CPU.
21743 @item ARC700
21744 Tune for ARC700 CPU with standard multiplier block.
21746 @item ARC700-xmac
21747 Tune for ARC700 CPU with XMAC block.
21749 @item ARC725D
21750 Tune for ARC725D CPU.
21752 @item ARC750D
21753 Tune for ARC750D CPU.
21755 @item core3
21756 Tune for ARCv2 core3 type CPU.  This option enable usage of
21757 @code{dbnz} instruction.
21759 @item release31a
21760 Tune for ARC4x release 3.10a.
21762 @end table
21764 @opindex mmultcost
21765 @item -mmultcost=@var{num}
21766 Cost to assume for a multiply instruction, with @samp{4} being equal to a
21767 normal instruction.
21769 @opindex munalign-prob-threshold
21770 @item -munalign-prob-threshold=@var{probability}
21771 Does nothing.  Preserved for backward compatibility.
21773 @end table
21775 The following options are maintained for backward compatibility, but
21776 are now deprecated and will be removed in a future release:
21778 @c Deprecated options
21779 @table @gcctabopt
21781 @opindex margonaut
21782 @item -margonaut
21783 Obsolete FPX.
21785 @opindex mbig-endian
21786 @opindex EB
21787 @item -mbig-endian
21788 @itemx -EB
21789 Compile code for big-endian targets.  Use of these options is now
21790 deprecated.  Big-endian code is supported by configuring GCC to build
21791 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
21792 for which big endian is the default.
21794 @opindex mlittle-endian
21795 @opindex EL
21796 @item -mlittle-endian
21797 @itemx -EL
21798 Compile code for little-endian targets.  Use of these options is now
21799 deprecated.  Little-endian code is supported by configuring GCC to build 
21800 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
21801 for which little endian is the default.
21803 @opindex mbarrel_shifter
21804 @item -mbarrel_shifter
21805 Replaced by @option{-mbarrel-shifter}.
21807 @opindex mdpfp_compact
21808 @item -mdpfp_compact
21809 Replaced by @option{-mdpfp-compact}.
21811 @opindex mdpfp_fast
21812 @item -mdpfp_fast
21813 Replaced by @option{-mdpfp-fast}.
21815 @opindex mdsp_packa
21816 @item -mdsp_packa
21817 Replaced by @option{-mdsp-packa}.
21819 @opindex mEA
21820 @item -mEA
21821 Replaced by @option{-mea}.
21823 @opindex mmac_24
21824 @item -mmac_24
21825 Replaced by @option{-mmac-24}.
21827 @opindex mmac_d16
21828 @item -mmac_d16
21829 Replaced by @option{-mmac-d16}.
21831 @opindex mspfp_compact
21832 @item -mspfp_compact
21833 Replaced by @option{-mspfp-compact}.
21835 @opindex mspfp_fast
21836 @item -mspfp_fast
21837 Replaced by @option{-mspfp-fast}.
21839 @opindex mtune
21840 @item -mtune=@var{cpu}
21841 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
21842 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
21843 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
21845 @opindex multcost
21846 @item -multcost=@var{num}
21847 Replaced by @option{-mmultcost}.
21849 @end table
21851 @node ARM Options
21852 @subsection ARM Options
21853 @cindex ARM options
21855 These @samp{-m} options are defined for the ARM port:
21857 @table @gcctabopt
21858 @opindex mabi
21859 @item -mabi=@var{name}
21860 Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
21861 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
21863 @opindex mapcs-frame
21864 @item -mapcs-frame
21865 Generate a stack frame that is compliant with the ARM Procedure Call
21866 Standard for all functions, even if this is not strictly necessary for
21867 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
21868 with this option causes the stack frames not to be generated for
21869 leaf functions.  The default is @option{-mno-apcs-frame}.
21870 This option is deprecated.
21872 @opindex mapcs
21873 @item -mapcs
21874 This is a synonym for @option{-mapcs-frame} and is deprecated.
21876 @ignore
21877 @c not currently implemented
21878 @opindex mapcs-stack-check
21879 @item -mapcs-stack-check
21880 Generate code to check the amount of stack space available upon entry to
21881 every function (that actually uses some stack space).  If there is
21882 insufficient space available then either the function
21883 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
21884 called, depending upon the amount of stack space required.  The runtime
21885 system is required to provide these functions.  The default is
21886 @option{-mno-apcs-stack-check}, since this produces smaller code.
21888 @c not currently implemented
21889 @opindex mapcs-reentrant
21890 @item -mapcs-reentrant
21891 Generate reentrant, position-independent code.  The default is
21892 @option{-mno-apcs-reentrant}.
21893 @end ignore
21895 @opindex mthumb-interwork
21896 @item -mthumb-interwork
21897 Generate code that supports calling between the ARM and Thumb
21898 instruction sets.  Without this option, on pre-v5 architectures, the
21899 two instruction sets cannot be reliably used inside one program.  The
21900 default is @option{-mno-thumb-interwork}, since slightly larger code
21901 is generated when @option{-mthumb-interwork} is specified.  In AAPCS
21902 configurations this option is meaningless.
21904 @opindex mno-sched-prolog
21905 @opindex msched-prolog
21906 @item -mno-sched-prolog
21907 Prevent the reordering of instructions in the function prologue, or the
21908 merging of those instruction with the instructions in the function's
21909 body.  This means that all functions start with a recognizable set
21910 of instructions (or in fact one of a choice from a small set of
21911 different function prologues), and this information can be used to
21912 locate the start of functions inside an executable piece of code.  The
21913 default is @option{-msched-prolog}.
21915 @opindex mfloat-abi
21916 @item -mfloat-abi=@var{name}
21917 Specifies which floating-point ABI to use.  Permissible values
21918 are: @samp{soft}, @samp{softfp} and @samp{hard}.
21920 Specifying @samp{soft} causes GCC to generate output containing
21921 library calls for floating-point operations.
21922 @samp{softfp} allows the generation of code using hardware floating-point
21923 instructions, but still uses the soft-float calling conventions.
21924 @samp{hard} allows generation of floating-point instructions
21925 and uses FPU-specific calling conventions.
21927 The default depends on the specific target configuration.  Note that
21928 the hard-float and soft-float ABIs are not link-compatible; you must
21929 compile your entire program with the same ABI, and link with a
21930 compatible set of libraries.
21932 @opindex mgeneral-regs-only
21933 @item -mgeneral-regs-only
21934 Generate code which uses only the general-purpose registers.  This will prevent
21935 the compiler from using floating-point and Advanced SIMD registers but will not
21936 impose any restrictions on the assembler.
21938 @opindex mlittle-endian
21939 @item -mlittle-endian
21940 Generate code for a processor running in little-endian mode.  This is
21941 the default for all standard configurations.
21943 @opindex mbig-endian
21944 @item -mbig-endian
21945 Generate code for a processor running in big-endian mode; the default is
21946 to compile code for a little-endian processor.
21948 @opindex mbe8
21949 @item -mbe8
21950 @itemx -mbe32
21951 When linking a big-endian image select between BE8 and BE32 formats.
21952 The option has no effect for little-endian images and is ignored.  The
21953 default is dependent on the selected target architecture.  For ARMv6
21954 and later architectures the default is BE8, for older architectures
21955 the default is BE32.  BE32 format has been deprecated by ARM.
21957 @opindex march
21958 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
21959 This specifies the name of the target ARM architecture.  GCC uses this
21960 name to determine what kind of instructions it can emit when generating
21961 assembly code.  This option can be used in conjunction with or instead
21962 of the @option{-mcpu=} option.
21964 Permissible names are:
21965 @samp{armv4t},
21966 @samp{armv5t}, @samp{armv5te},
21967 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
21968 @samp{armv6z}, @samp{armv6zk},
21969 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve}, 
21970 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
21971 @samp{armv8.4-a},
21972 @samp{armv8.5-a},
21973 @samp{armv8.6-a},
21974 @samp{armv9-a},
21975 @samp{armv7-r},
21976 @samp{armv8-r},
21977 @samp{armv6-m}, @samp{armv6s-m},
21978 @samp{armv7-m}, @samp{armv7e-m},
21979 @samp{armv8-m.base}, @samp{armv8-m.main},
21980 @samp{armv8.1-m.main},
21981 @samp{armv9-a},
21982 @samp{iwmmxt} and @samp{iwmmxt2}.
21984 Additionally, the following architectures, which lack support for the
21985 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
21987 Many of the architectures support extensions.  These can be added by
21988 appending @samp{+@var{extension}} to the architecture name.  Extension
21989 options are processed in order and capabilities accumulate.  An extension
21990 will also enable any necessary base extensions
21991 upon which it depends.  For example, the @samp{+crypto} extension
21992 will always enable the @samp{+simd} extension.  The exception to the
21993 additive construction is for extensions that are prefixed with
21994 @samp{+no@dots{}}: these extensions disable the specified option and
21995 any other extensions that may depend on the presence of that
21996 extension.
21998 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
21999 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
22000 entirely disabled by the @samp{+nofp} option that follows it.
22002 Most extension names are generically named, but have an effect that is
22003 dependent upon the architecture to which it is applied.  For example,
22004 the @samp{+simd} option can be applied to both @samp{armv7-a} and
22005 @samp{armv8-a} architectures, but will enable the original ARMv7-A
22006 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
22007 variant for @samp{armv8-a}.
22009 The table below lists the supported extensions for each architecture.
22010 Architectures not mentioned do not support any extensions.
22012 @table @samp
22013 @item armv5te
22014 @itemx armv6
22015 @itemx armv6j
22016 @itemx armv6k
22017 @itemx armv6kz
22018 @itemx armv6t2
22019 @itemx armv6z
22020 @itemx armv6zk
22021 @table @samp
22022 @item +fp
22023 The VFPv2 floating-point instructions.  The extension @samp{+vfpv2} can be
22024 used as an alias for this extension.
22026 @item +nofp
22027 Disable the floating-point instructions.
22028 @end table
22030 @item armv7
22031 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
22032 @table @samp
22033 @item +fp
22034 The VFPv3 floating-point instructions, with 16 double-precision
22035 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22036 for this extension.  Note that floating-point is not supported by the
22037 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
22038 ARMv7-R architectures.
22040 @item +nofp
22041 Disable the floating-point instructions.
22042 @end table
22044 @item armv7-a
22045 @table @samp
22046 @item +mp
22047 The multiprocessing extension.
22049 @item +sec
22050 The security extension.
22052 @item +fp
22053 The VFPv3 floating-point instructions, with 16 double-precision
22054 registers.  The extension @samp{+vfpv3-d16} can be used as an alias
22055 for this extension.
22057 @item +simd
22058 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22059 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
22060 for this extension.
22062 @item +vfpv3
22063 The VFPv3 floating-point instructions, with 32 double-precision
22064 registers.
22066 @item +vfpv3-d16-fp16
22067 The VFPv3 floating-point instructions, with 16 double-precision
22068 registers and the half-precision floating-point conversion operations.
22070 @item +vfpv3-fp16
22071 The VFPv3 floating-point instructions, with 32 double-precision
22072 registers and the half-precision floating-point conversion operations.
22074 @item +vfpv4-d16
22075 The VFPv4 floating-point instructions, with 16 double-precision
22076 registers.
22078 @item +vfpv4
22079 The VFPv4 floating-point instructions, with 32 double-precision
22080 registers.
22082 @item +neon-fp16
22083 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22084 the half-precision floating-point conversion operations.
22086 @item +neon-vfpv4
22087 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
22089 @item +nosimd
22090 Disable the Advanced SIMD instructions (does not disable floating point).
22092 @item +nofp
22093 Disable the floating-point and Advanced SIMD instructions.
22094 @end table
22096 @item armv7ve
22097 The extended version of the ARMv7-A architecture with support for
22098 virtualization.
22099 @table @samp
22100 @item +fp
22101 The VFPv4 floating-point instructions, with 16 double-precision registers.
22102 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
22104 @item +simd
22105 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.  The
22106 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
22108 @item +vfpv3-d16
22109 The VFPv3 floating-point instructions, with 16 double-precision
22110 registers.
22112 @item +vfpv3
22113 The VFPv3 floating-point instructions, with 32 double-precision
22114 registers.
22116 @item +vfpv3-d16-fp16
22117 The VFPv3 floating-point instructions, with 16 double-precision
22118 registers and the half-precision floating-point conversion operations.
22120 @item +vfpv3-fp16
22121 The VFPv3 floating-point instructions, with 32 double-precision
22122 registers and the half-precision floating-point conversion operations.
22124 @item +vfpv4-d16
22125 The VFPv4 floating-point instructions, with 16 double-precision
22126 registers.
22128 @item +vfpv4
22129 The VFPv4 floating-point instructions, with 32 double-precision
22130 registers.
22132 @item +neon
22133 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
22134 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
22136 @item +neon-fp16
22137 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
22138 the half-precision floating-point conversion operations.
22140 @item +nosimd
22141 Disable the Advanced SIMD instructions (does not disable floating point).
22143 @item +nofp
22144 Disable the floating-point and Advanced SIMD instructions.
22145 @end table
22147 @item armv8-a
22148 @table @samp
22149 @item +crc
22150 The Cyclic Redundancy Check (CRC) instructions.
22151 @item +simd
22152 The ARMv8-A Advanced SIMD and floating-point instructions.
22153 @item +crypto
22154 The cryptographic instructions.
22155 @item +nocrypto
22156 Disable the cryptographic instructions.
22157 @item +nofp
22158 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22159 @item +sb
22160 Speculation Barrier Instruction.
22161 @item +predres
22162 Execution and Data Prediction Restriction Instructions.
22163 @end table
22165 @item armv8.1-a
22166 @table @samp
22167 @item +simd
22168 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22170 @item +crypto
22171 The cryptographic instructions.  This also enables the Advanced SIMD and
22172 floating-point instructions.
22174 @item +nocrypto
22175 Disable the cryptographic instructions.
22177 @item +nofp
22178 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22180 @item +sb
22181 Speculation Barrier Instruction.
22183 @item +predres
22184 Execution and Data Prediction Restriction Instructions.
22185 @end table
22187 @item armv8.2-a
22188 @itemx armv8.3-a
22189 @table @samp
22190 @item +fp16
22191 The half-precision floating-point data processing instructions.
22192 This also enables the Advanced SIMD and floating-point instructions.
22194 @item +fp16fml
22195 The half-precision floating-point fmla extension.  This also enables
22196 the half-precision floating-point extension and Advanced SIMD and
22197 floating-point instructions.
22199 @item +simd
22200 The ARMv8.1-A Advanced SIMD and floating-point instructions.
22202 @item +crypto
22203 The cryptographic instructions.  This also enables the Advanced SIMD and
22204 floating-point instructions.
22206 @item +dotprod
22207 Enable the Dot Product extension.  This also enables Advanced SIMD instructions.
22209 @item +nocrypto
22210 Disable the cryptographic extension.
22212 @item +nofp
22213 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22215 @item +sb
22216 Speculation Barrier Instruction.
22218 @item +predres
22219 Execution and Data Prediction Restriction Instructions.
22221 @item +i8mm
22222 8-bit Integer Matrix Multiply instructions.
22223 This also enables Advanced SIMD and floating-point instructions.
22225 @item +bf16
22226 Brain half-precision floating-point instructions.
22227 This also enables Advanced SIMD and floating-point instructions.
22228 @end table
22230 @item armv8.4-a
22231 @table @samp
22232 @item +fp16
22233 The half-precision floating-point data processing instructions.
22234 This also enables the Advanced SIMD and floating-point instructions as well
22235 as the Dot Product extension and the half-precision floating-point fmla
22236 extension.
22238 @item +simd
22239 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22240 Dot Product extension.
22242 @item +crypto
22243 The cryptographic instructions.  This also enables the Advanced SIMD and
22244 floating-point instructions as well as the Dot Product extension.
22246 @item +nocrypto
22247 Disable the cryptographic extension.
22249 @item +nofp
22250 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22252 @item +sb
22253 Speculation Barrier Instruction.
22255 @item +predres
22256 Execution and Data Prediction Restriction Instructions.
22258 @item +i8mm
22259 8-bit Integer Matrix Multiply instructions.
22260 This also enables Advanced SIMD and floating-point instructions.
22262 @item +bf16
22263 Brain half-precision floating-point instructions.
22264 This also enables Advanced SIMD and floating-point instructions.
22265 @end table
22267 @item armv8.5-a
22268 @table @samp
22269 @item +fp16
22270 The half-precision floating-point data processing instructions.
22271 This also enables the Advanced SIMD and floating-point instructions as well
22272 as the Dot Product extension and the half-precision floating-point fmla
22273 extension.
22275 @item +simd
22276 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22277 Dot Product extension.
22279 @item +crypto
22280 The cryptographic instructions.  This also enables the Advanced SIMD and
22281 floating-point instructions as well as the Dot Product extension.
22283 @item +nocrypto
22284 Disable the cryptographic extension.
22286 @item +nofp
22287 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22289 @item +i8mm
22290 8-bit Integer Matrix Multiply instructions.
22291 This also enables Advanced SIMD and floating-point instructions.
22293 @item +bf16
22294 Brain half-precision floating-point instructions.
22295 This also enables Advanced SIMD and floating-point instructions.
22296 @end table
22298 @item armv8.6-a
22299 @table @samp
22300 @item +fp16
22301 The half-precision floating-point data processing instructions.
22302 This also enables the Advanced SIMD and floating-point instructions as well
22303 as the Dot Product extension and the half-precision floating-point fmla
22304 extension.
22306 @item +simd
22307 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
22308 Dot Product extension.
22310 @item +crypto
22311 The cryptographic instructions.  This also enables the Advanced SIMD and
22312 floating-point instructions as well as the Dot Product extension.
22314 @item +nocrypto
22315 Disable the cryptographic extension.
22317 @item +nofp
22318 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22320 @item +i8mm
22321 8-bit Integer Matrix Multiply instructions.
22322 This also enables Advanced SIMD and floating-point instructions.
22324 @item +bf16
22325 Brain half-precision floating-point instructions.
22326 This also enables Advanced SIMD and floating-point instructions.
22327 @end table
22329 @item armv7-r
22330 @table @samp
22331 @item +fp.sp
22332 The single-precision VFPv3 floating-point instructions.  The extension
22333 @samp{+vfpv3xd} can be used as an alias for this extension.
22335 @item +fp
22336 The VFPv3 floating-point instructions with 16 double-precision registers.
22337 The extension +vfpv3-d16 can be used as an alias for this extension.
22339 @item +vfpv3xd-d16-fp16
22340 The single-precision VFPv3 floating-point instructions with 16 double-precision
22341 registers and the half-precision floating-point conversion operations.
22343 @item +vfpv3-d16-fp16
22344 The VFPv3 floating-point instructions with 16 double-precision
22345 registers and the half-precision floating-point conversion operations.
22347 @item +nofp
22348 Disable the floating-point extension.
22350 @item +idiv
22351 The ARM-state integer division instructions.
22353 @item +noidiv
22354 Disable the ARM-state integer division extension.
22355 @end table
22357 @item armv7e-m
22358 @table @samp
22359 @item +fp
22360 The single-precision VFPv4 floating-point instructions.
22362 @item +fpv5
22363 The single-precision FPv5 floating-point instructions.
22365 @item +fp.dp
22366 The single- and double-precision FPv5 floating-point instructions.
22368 @item +nofp
22369 Disable the floating-point extensions.
22370 @end table
22372 @item  armv8.1-m.main
22373 @table @samp
22375 @item +dsp
22376 The DSP instructions.
22378 @item +mve
22379 The M-Profile Vector Extension (MVE) integer instructions.
22381 @item +mve.fp
22382 The M-Profile Vector Extension (MVE) integer and single precision
22383 floating-point instructions.
22385 @item +fp
22386 The single-precision floating-point instructions.
22388 @item +fp.dp
22389 The single- and double-precision floating-point instructions.
22391 @item +nofp
22392 Disable the floating-point extension.
22394 @item +cdecp0, +cdecp1, ... , +cdecp7
22395 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22396 to the numbers given in the options in the range 0 to 7.
22398 @item +pacbti
22399 Enable the Pointer Authentication and Branch Target Identification Extension.
22400 @end table
22402 @item  armv8-m.main
22403 @table @samp
22404 @item +dsp
22405 The DSP instructions.
22407 @item +nodsp
22408 Disable the DSP extension.
22410 @item +fp
22411 The single-precision floating-point instructions.
22413 @item +fp.dp
22414 The single- and double-precision floating-point instructions.
22416 @item +nofp
22417 Disable the floating-point extension.
22419 @item +cdecp0, +cdecp1, ... , +cdecp7
22420 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22421 to the numbers given in the options in the range 0 to 7.
22422 @end table
22424 @item armv8-r
22425 @table @samp
22426 @item +crc
22427 The Cyclic Redundancy Check (CRC) instructions.
22428 @item +fp.sp
22429 The single-precision FPv5 floating-point instructions.
22430 @item +simd
22431 The ARMv8-A Advanced SIMD and floating-point instructions.
22432 @item +crypto
22433 The cryptographic instructions.
22434 @item +nocrypto
22435 Disable the cryptographic instructions.
22436 @item +nofp
22437 Disable the floating-point, Advanced SIMD and cryptographic instructions.
22438 @end table
22440 @end table
22442 @option{-march=native} causes the compiler to auto-detect the architecture
22443 of the build computer.  At present, this feature is only supported on
22444 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22445 is unsuccessful the option has no effect.
22447 @opindex mtune
22448 @item -mtune=@var{name}
22449 This option specifies the name of the target ARM processor for
22450 which GCC should tune the performance of the code.
22451 For some ARM implementations better performance can be obtained by using
22452 this option.
22453 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
22454 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
22455 @samp{strongarm1100}, @samp{strongarm1110}, @samp{arm8}, @samp{arm810},
22456 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
22457 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
22458 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
22459 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
22460 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
22461 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
22462 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
22463 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
22464 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
22465 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
22466 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
22467 @samp{cortex-a78}, @samp{cortex-a78ae}, @samp{cortex-a78c}, @samp{cortex-a710},
22468 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
22469 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52}, @samp{cortex-r52plus},
22470 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
22471 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
22472 @samp{cortex-m35p}, @samp{cortex-m55}, @samp{cortex-m85}, @samp{cortex-x1},
22473 @samp{cortex-x1c}, @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
22474 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
22475 @samp{neoverse-n1}, @samp{neoverse-n2}, @samp{neoverse-v1}, @samp{xscale},
22476 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}, @samp{fa526}, @samp{fa626},
22477 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}, @samp{star-mc1},
22478 @samp{xgene1}.
22480 Additionally, this option can specify that GCC should tune the performance
22481 of the code for a big.LITTLE system.  Permissible names are:
22482 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
22483 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22484 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
22485 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
22487 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
22488 performance for a blend of processors within architecture @var{arch}.
22489 The aim is to generate code that run well on the current most popular
22490 processors, balancing between optimizations that benefit some CPUs in the
22491 range, and avoiding performance pitfalls of other CPUs.  The effects of
22492 this option may change in future GCC versions as CPU models come and go.
22494 @option{-mtune} permits the same extension options as @option{-mcpu}, but
22495 the extension options do not affect the tuning of the generated code.
22497 @option{-mtune=native} causes the compiler to auto-detect the CPU
22498 of the build computer.  At present, this feature is only supported on
22499 GNU/Linux, and not all architectures are recognized.  If the auto-detect is
22500 unsuccessful the option has no effect.
22502 @opindex mcpu
22503 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
22504 This specifies the name of the target ARM processor.  GCC uses this name
22505 to derive the name of the target ARM architecture (as if specified
22506 by @option{-march}) and the ARM processor type for which to tune for
22507 performance (as if specified by @option{-mtune}).  Where this option
22508 is used in conjunction with @option{-march} or @option{-mtune},
22509 those options take precedence over the appropriate part of this option.
22511 Many of the supported CPUs implement optional architectural
22512 extensions.  Where this is so the architectural extensions are
22513 normally enabled by default.  If implementations that lack the
22514 extension exist, then the extension syntax can be used to disable
22515 those extensions that have been omitted.  For floating-point and
22516 Advanced SIMD (Neon) instructions, the settings of the options
22517 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
22518 floating-point and Advanced SIMD instructions will only be used if
22519 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
22520 @option{-mfpu} other than @samp{auto} will override the available
22521 floating-point and SIMD extension instructions.
22523 For example, @samp{cortex-a9} can be found in three major
22524 configurations: integer only, with just a floating-point unit or with
22525 floating-point and Advanced SIMD.  The default is to enable all the
22526 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
22527 be used to disable just the SIMD or both the SIMD and floating-point
22528 instructions respectively.
22530 Permissible names for this option are the same as those for
22531 @option{-mtune}.
22533 The following extension options are common to the listed CPUs:
22535 @table @samp
22536 @item +nodsp
22537 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p},
22538 @samp{cortex-m55} and @samp{cortex-m85}. Also disable the M-Profile Vector
22539 Extension (MVE) integer and single precision floating-point instructions on
22540 @samp{cortex-m55} and @samp{cortex-m85}.
22542 @item +nopacbti
22543 Disable the Pointer Authentication and Branch Target Identification Extension
22544 on @samp{cortex-m85}.
22546 @item +nomve
22547 Disable the M-Profile Vector Extension (MVE) integer and single precision
22548 floating-point instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22550 @item +nomve.fp
22551 Disable the M-Profile Vector Extension (MVE) single precision floating-point
22552 instructions on @samp{cortex-m55} and @samp{cortex-m85}.
22554 @item +cdecp0, +cdecp1, ... , +cdecp7
22555 Enable the Custom Datapath Extension (CDE) on selected coprocessors according
22556 to the numbers given in the options in the range 0 to 7 on @samp{cortex-m55}.
22558 @item  +nofp
22559 Disables the floating-point instructions on @samp{arm9e},
22560 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
22561 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
22562 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
22563 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p}
22564 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33}, @samp{cortex-m35p},
22565 @samp{cortex-m55} and @samp{cortex-m85}.
22566 Disables the floating-point and SIMD instructions on
22567 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
22568 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
22569 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
22570 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
22571 @samp{cortex-a53} and @samp{cortex-a55}.
22573 @item +nofp.dp
22574 Disables the double-precision component of the floating-point instructions
22575 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
22576 @samp{cortex-r52plus} and @samp{cortex-m7}.
22578 @item +nosimd
22579 Disables the SIMD (but not floating-point) instructions on
22580 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
22581 and @samp{cortex-a9}.
22583 @item +crypto
22584 Enables the cryptographic instructions on @samp{cortex-a32},
22585 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
22586 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
22587 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
22588 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
22589 @samp{cortex-a75.cortex-a55}.
22590 @end table
22592 Additionally the @samp{generic-armv7-a} pseudo target defaults to
22593 VFPv3 with 16 double-precision registers.  It supports the following
22594 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
22595 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
22596 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
22597 @samp{neon-fp16}, @samp{neon-vfpv4}.  The meanings are the same as for
22598 the extensions to @option{-march=armv7-a}.
22600 @option{-mcpu=generic-@var{arch}} is also permissible, and is
22601 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
22602 See @option{-mtune} for more information.
22604 @option{-mcpu=native} causes the compiler to auto-detect the CPU
22605 of the build computer.  At present, this feature is only supported on
22606 GNU/Linux, and not all architectures are recognized.  If the auto-detect
22607 is unsuccessful the option has no effect.
22609 @opindex mfpu
22610 @item -mfpu=@var{name}
22611 This specifies what floating-point hardware (or hardware emulation) is
22612 available on the target.  Permissible names are: @samp{auto}, @samp{vfpv2},
22613 @samp{vfpv3},
22614 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
22615 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
22616 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
22617 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
22618 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
22619 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
22620 is an alias for @samp{vfpv2}.
22622 The setting @samp{auto} is the default and is special.  It causes the
22623 compiler to select the floating-point and Advanced SIMD instructions
22624 based on the settings of @option{-mcpu} and @option{-march}.
22626 If the selected floating-point hardware includes the NEON extension
22627 (e.g.@: @option{-mfpu=neon}), note that floating-point
22628 operations are not generated by GCC's auto-vectorization pass unless
22629 @option{-funsafe-math-optimizations} is also specified.  This is
22630 because NEON hardware does not fully implement the IEEE 754 standard for
22631 floating-point arithmetic (in particular denormal values are treated as
22632 zero), so the use of NEON instructions may lead to a loss of precision.
22634 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}).
22636 @opindex mfp16-format
22637 @item -mfp16-format=@var{name}
22638 Specify the format of the @code{__fp16} half-precision floating-point type.
22639 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
22640 the default is @samp{none}, in which case the @code{__fp16} type is not
22641 defined.  @xref{Half-Precision}, for more information.
22643 @opindex mstructure-size-boundary
22644 @item -mstructure-size-boundary=@var{n}
22645 The sizes of all structures and unions are rounded up to a multiple
22646 of the number of bits set by this option.  Permissible values are 8, 32
22647 and 64.  The default value varies for different toolchains.  For the COFF
22648 targeted toolchain the default value is 8.  A value of 64 is only allowed
22649 if the underlying ABI supports it.
22651 Specifying a larger number can produce faster, more efficient code, but
22652 can also increase the size of the program.  Different values are potentially
22653 incompatible.  Code compiled with one value cannot necessarily expect to
22654 work with code or libraries compiled with another value, if they exchange
22655 information using structures or unions.
22657 This option is deprecated.
22659 @opindex mabort-on-noreturn
22660 @item -mabort-on-noreturn
22661 Generate a call to the function @code{abort} at the end of a
22662 @code{noreturn} function.  It is executed if the function tries to
22663 return.
22665 @opindex mlong-calls
22666 @opindex mno-long-calls
22667 @item -mlong-calls
22668 @itemx -mno-long-calls
22669 Tells the compiler to perform function calls by first loading the
22670 address of the function into a register and then performing a subroutine
22671 call on this register.  This switch is needed if the target function
22672 lies outside of the 64-megabyte addressing range of the offset-based
22673 version of subroutine call instruction.
22675 Even if this switch is enabled, not all function calls are turned
22676 into long calls.  The heuristic is that static functions, functions
22677 that have the @code{short_call} attribute, functions that are inside
22678 the scope of a @code{#pragma no_long_calls} directive, and functions whose
22679 definitions have already been compiled within the current compilation
22680 unit are not turned into long calls.  The exceptions to this rule are
22681 that weak function definitions, functions with the @code{long_call}
22682 attribute or the @code{section} attribute, and functions that are within
22683 the scope of a @code{#pragma long_calls} directive are always
22684 turned into long calls.
22686 This feature is not enabled by default.  Specifying
22687 @option{-mno-long-calls} restores the default behavior, as does
22688 placing the function calls within the scope of a @code{#pragma
22689 long_calls_off} directive.  Note these switches have no effect on how
22690 the compiler generates code to handle function calls via function
22691 pointers.
22693 @opindex msingle-pic-base
22694 @item -msingle-pic-base
22695 Treat the register used for PIC addressing as read-only, rather than
22696 loading it in the prologue for each function.  The runtime system is
22697 responsible for initializing this register with an appropriate value
22698 before execution begins.
22700 @opindex mpic-register
22701 @item -mpic-register=@var{reg}
22702 Specify the register to be used for PIC addressing.
22703 For standard PIC base case, the default is any suitable register
22704 determined by compiler.  For single PIC base case, the default is
22705 @samp{R9} if target is EABI based or stack-checking is enabled,
22706 otherwise the default is @samp{R10}.
22708 @opindex mpic-data-is-text-relative
22709 @item -mpic-data-is-text-relative
22710 Assume that the displacement between the text and data segments is fixed
22711 at static link time.  This permits using PC-relative addressing
22712 operations to access data known to be in the data segment.  For
22713 non-VxWorks RTP targets, this option is enabled by default.  When
22714 disabled on such targets, it will enable @option{-msingle-pic-base} by
22715 default.
22717 @opindex mpoke-function-name
22718 @item -mpoke-function-name
22719 Write the name of each function into the text section, directly
22720 preceding the function prologue.  The generated code is similar to this:
22722 @smallexample
22723      t0
22724          .ascii "arm_poke_function_name", 0
22725          .align
22726      t1
22727          .word 0xff000000 + (t1 - t0)
22728      arm_poke_function_name
22729          mov     ip, sp
22730          stmfd   sp!, @{fp, ip, lr, pc@}
22731          sub     fp, ip, #4
22732 @end smallexample
22734 When performing a stack backtrace, code can inspect the value of
22735 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
22736 location @code{pc - 12} and the top 8 bits are set, then we know that
22737 there is a function name embedded immediately preceding this location
22738 and has length @code{((pc[-3]) & 0xff000000)}.
22740 @opindex marm
22741 @opindex mthumb
22742 @item -mthumb
22743 @itemx -marm
22745 Select between generating code that executes in ARM and Thumb
22746 states.  The default for most configurations is to generate code
22747 that executes in ARM state, but the default can be changed by
22748 configuring GCC with the @option{--with-mode=}@var{state}
22749 configure option.
22751 You can also override the ARM and Thumb mode for each function
22752 by using the @code{target("thumb")} and @code{target("arm")} function attributes
22753 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
22755 @opindex mflip-thumb
22756 @item -mflip-thumb 
22757 Switch ARM/Thumb modes on alternating functions.
22758 This option is provided for regression testing of mixed Thumb/ARM code
22759 generation, and is not intended for ordinary use in compiling code.
22761 @opindex mtpcs-frame
22762 @item -mtpcs-frame
22763 Generate a stack frame that is compliant with the Thumb Procedure Call
22764 Standard for all non-leaf functions.  (A leaf function is one that does
22765 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
22767 @opindex mtpcs-leaf-frame
22768 @item -mtpcs-leaf-frame
22769 Generate a stack frame that is compliant with the Thumb Procedure Call
22770 Standard for all leaf functions.  (A leaf function is one that does
22771 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
22773 @opindex mcallee-super-interworking
22774 @item -mcallee-super-interworking
22775 Gives all externally visible functions in the file being compiled an ARM
22776 instruction set header which switches to Thumb mode before executing the
22777 rest of the function.  This allows these functions to be called from
22778 non-interworking code.  This option is not valid in AAPCS configurations
22779 because interworking is enabled by default.
22781 @opindex mcaller-super-interworking
22782 @item -mcaller-super-interworking
22783 Allows calls via function pointers (including virtual functions) to
22784 execute correctly regardless of whether the target code has been
22785 compiled for interworking or not.  There is a small overhead in the cost
22786 of executing a function pointer if this option is enabled.  This option
22787 is not valid in AAPCS configurations because interworking is enabled
22788 by default.
22790 @opindex mtp
22791 @item -mtp=@var{name}
22792 Specify the access model for the thread local storage pointer.  The model
22793 @samp{soft} generates calls to @code{__aeabi_read_tp}.  Other accepted
22794 models are @samp{tpidrurw}, @samp{tpidruro} and @samp{tpidrprw} which fetch
22795 the thread pointer from the corresponding system register directly
22796 (supported from the arm6k architecture and later).  These system registers
22797 are accessed through the CP15 co-processor interface and the argument
22798 @samp{cp15} is also accepted as a convenience alias of @samp{tpidruro}.
22799 The argument @samp{auto} uses the best available method for the selected
22800 processor.  The default setting is @samp{auto}.
22802 @opindex mtls-dialect
22803 @item -mtls-dialect=@var{dialect}
22804 Specify the dialect to use for accessing thread local storage.  Two
22805 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}.  The
22806 @samp{gnu} dialect selects the original GNU scheme for supporting
22807 local and global dynamic TLS models.  The @samp{gnu2} dialect
22808 selects the GNU descriptor scheme, which provides better performance
22809 for shared libraries.  The GNU descriptor scheme is compatible with
22810 the original scheme, but does require new assembler, linker and
22811 library support.  Initial and local exec TLS models are unaffected by
22812 this option and always use the original scheme.
22814 @opindex mword-relocations
22815 @item -mword-relocations
22816 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
22817 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
22818 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
22819 is specified. This option conflicts with @option{-mslow-flash-data}.
22821 @opindex mfix-cortex-m3-ldrd
22822 @item -mfix-cortex-m3-ldrd
22823 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
22824 with overlapping destination and base registers are used.  This option avoids
22825 generating these instructions.  This option is enabled by default when
22826 @option{-mcpu=cortex-m3} is specified.
22828 @item -mfix-cortex-a57-aes-1742098
22829 @itemx -mno-fix-cortex-a57-aes-1742098
22830 @itemx -mfix-cortex-a72-aes-1655431
22831 @itemx -mno-fix-cortex-a72-aes-1655431
22832 Enable (disable) mitigation for an erratum on Cortex-A57 and
22833 Cortex-A72 that affects the AES cryptographic instructions.  This
22834 option is enabled by default when either @option{-mcpu=cortex-a57} or
22835 @option{-mcpu=cortex-a72} is specified.
22837 @opindex munaligned-access
22838 @opindex mno-unaligned-access
22839 @item -munaligned-access
22840 @itemx -mno-unaligned-access
22841 Enables (or disables) reading and writing of 16- and 32- bit values
22842 from addresses that are not 16- or 32- bit aligned.  By default
22843 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
22844 ARMv8-M Baseline architectures, and enabled for all other
22845 architectures.  If unaligned access is not enabled then words in packed
22846 data structures are accessed a byte at a time.
22848 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
22849 generated object file to either true or false, depending upon the
22850 setting of this option.  If unaligned access is enabled then the
22851 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
22852 defined.
22854 @opindex mneon-for-64bits
22855 @item -mneon-for-64bits
22856 This option is deprecated and has no effect.
22858 @opindex mslow-flash-data
22859 @item -mslow-flash-data
22860 Assume loading data from flash is slower than fetching instruction.
22861 Therefore literal load is minimized for better performance.
22862 This option is only supported when compiling for ARMv7 M-profile and
22863 off by default. It conflicts with @option{-mword-relocations}.
22865 @opindex masm-syntax-unified
22866 @item -masm-syntax-unified
22867 Assume inline assembler is using unified asm syntax.  The default is
22868 currently off which implies divided syntax.  This option has no impact
22869 on Thumb2. However, this may change in future releases of GCC.
22870 Divided syntax should be considered deprecated.
22872 @opindex mrestrict-it
22873 @item -mrestrict-it
22874 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
22875 IT blocks can only contain a single 16-bit instruction from a select
22876 set of instructions. This option is on by default for ARMv8-A Thumb mode.
22878 @opindex mprint-tune-info
22879 @item -mprint-tune-info
22880 Print CPU tuning information as comment in assembler file.  This is
22881 an option used only for regression testing of the compiler and not
22882 intended for ordinary use in compiling code.  This option is disabled
22883 by default.
22885 @opindex mverbose-cost-dump
22886 @item -mverbose-cost-dump
22887 Enable verbose cost model dumping in the debug dump files.  This option is
22888 provided for use in debugging the compiler.
22890 @opindex mpure-code
22891 @item -mpure-code
22892 Do not allow constant data to be placed in code sections.
22893 Additionally, when compiling for ELF object format give all text sections the
22894 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}.  This option
22895 is only available when generating non-pic code for M-profile targets.
22897 @opindex mcmse
22898 @item -mcmse
22899 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
22900 Development Tools Engineering Specification", which can be found on
22901 @url{https://developer.arm.com/documentation/ecm0359818/latest/}.
22903 @opindex mfix-cmse-cve-2021-35465
22904 @item -mfix-cmse-cve-2021-35465
22905 Mitigate against a potential security issue with the @code{VLLDM} instruction
22906 in some M-profile devices when using CMSE (CVE-2021-365465).  This option is
22907 enabled by default when the option @option{-mcpu=} is used with
22908 @code{cortex-m33}, @code{cortex-m35p}, @code{cortex-m55}, @code{cortex-m85}
22909 or @code{star-mc1}. The option @option{-mno-fix-cmse-cve-2021-35465} can be used
22910 to disable the mitigation.
22912 @opindex mstack-protector-guard
22913 @opindex mstack-protector-guard-offset
22914 @item -mstack-protector-guard=@var{guard}
22915 @itemx -mstack-protector-guard-offset=@var{offset}
22916 Generate stack protection code using canary at @var{guard}.  Supported
22917 locations are @samp{global} for a global canary or @samp{tls} for a
22918 canary accessible via the TLS register. The option
22919 @option{-mstack-protector-guard-offset=} is for use with
22920 @option{-fstack-protector-guard=tls} and not for use in user-land code.
22922 @opindex mfdpic
22923 @opindex mno-fdpic
22924 @item -mfdpic
22925 @itemx -mno-fdpic
22926 Select the FDPIC ABI, which uses 64-bit function descriptors to
22927 represent pointers to functions.  When the compiler is configured for
22928 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
22929 and implies @option{-fPIE} if none of the PIC/PIE-related options is
22930 provided.  On other targets, it only enables the FDPIC-specific code
22931 generation features, and the user should explicitly provide the
22932 PIC/PIE-related options as needed.
22934 Note that static linking is not supported because it would still
22935 involve the dynamic linker when the program self-relocates.  If such
22936 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
22938 The opposite @option{-mno-fdpic} option is useful (and required) to
22939 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
22940 toolchain as the one used to build the userland programs.
22942 @opindex mbranch-protection
22943 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}][+@var{bti}]|@var{bti}[+@var{pac-ret}[+@var{leaf}]]
22944 Enable branch protection features (armv8.1-m.main only).
22945 @samp{none} generate code without branch protection or return address
22946 signing.
22947 @samp{standard[+@var{leaf}]} generate code with all branch protection
22948 features enabled at their standard level.
22949 @samp{pac-ret[+@var{leaf}]} generate code with return address signing
22950 set to its standard level, which is to sign all functions that save
22951 the return address to memory.
22952 @samp{leaf} When return address signing is enabled, also sign leaf
22953 functions even if they do not write the return address to memory.
22954 +@samp{bti} Add landing-pad instructions at the permitted targets of
22955 indirect branch instructions.
22957 If the @samp{+pacbti} architecture extension is not enabled, then all
22958 branch protection and return address signing operations are
22959 constrained to use only the instructions defined in the
22960 architectural-NOP space. The generated code will remain
22961 backwards-compatible with earlier versions of the architecture, but
22962 the additional security can be enabled at run time on processors that
22963 support the @samp{PACBTI} extension.
22965 Branch target enforcement using BTI can only be enabled at runtime if
22966 all code in the application has been compiled with at least
22967 @samp{-mbranch-protection=bti}.
22969 Any setting other than @samp{none} is supported only on armv8-m.main
22970 or later.
22972 The default is to generate code without branch protection or return
22973 address signing.
22975 @end table
22977 @node AVR Options
22978 @subsection AVR Options
22979 @cindex AVR Options
22981 These options are defined for AVR implementations:
22983 @table @gcctabopt
22984 @opindex mmcu
22985 @item -mmcu=@var{mcu}
22986 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
22988 The default for this option is@tie{}@samp{avr2}.
22990 GCC supports the following AVR devices and ISAs:
22992 @include avr-mmcu.texi
22994 @opindex mabsdata
22995 @item -mabsdata
22997 Assume that all data in static storage can be accessed by LDS / STS
22998 instructions.  This option has only an effect on reduced Tiny devices like
22999 ATtiny40.  See also the @code{absdata}
23000 @ref{AVR Variable Attributes,variable attribute}.
23002 @opindex maccumulate-args
23003 @item -maccumulate-args
23004 Accumulate outgoing function arguments and acquire/release the needed
23005 stack space for outgoing function arguments once in function
23006 prologue/epilogue.  Without this option, outgoing arguments are pushed
23007 before calling a function and popped afterwards.
23009 Popping the arguments after the function call can be expensive on
23010 AVR so that accumulating the stack space might lead to smaller
23011 executables because arguments need not be removed from the
23012 stack after such a function call.
23014 This option can lead to reduced code size for functions that perform
23015 several calls to functions that get their arguments on the stack like
23016 calls to printf-like functions.
23018 @opindex mbranch-cost
23019 @item -mbranch-cost=@var{cost}
23020 Set the branch costs for conditional branch instructions to
23021 @var{cost}.  Reasonable values for @var{cost} are small, non-negative
23022 integers. The default branch cost is 0.
23024 @opindex mcall-prologues
23025 @item -mcall-prologues
23026 Functions prologues/epilogues are expanded as calls to appropriate
23027 subroutines.  Code size is smaller.
23029 @opindex mdouble
23030 @opindex mlong-double
23031 @item -mdouble=@var{bits}
23032 @itemx -mlong-double=@var{bits}
23033 Set the size (in bits) of the @code{double} or @code{long double} type,
23034 respectively.  Possible values for @var{bits} are 32 and 64.
23035 Whether or not a specific value for @var{bits} is allowed depends on
23036 the @code{--with-double=} and @code{--with-long-double=}
23037 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
23038 and the same applies for the default values of the options.
23040 @opindex mgas-isr-prologues
23041 @item -mgas-isr-prologues
23042 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
23043 instruction supported by GNU Binutils.
23044 If this option is on, the feature can still be disabled for individual
23045 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
23046 function attribute.  This feature is activated per default
23047 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
23048 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
23050 @opindex mint8
23051 @item -mint8
23052 Assume @code{int} to be 8-bit integer.  This affects the sizes of all types: a
23053 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
23054 and @code{long long} is 4 bytes.  Please note that this option does not
23055 conform to the C standards, but it results in smaller code
23056 size.
23058 @opindex mmain-is-OS_task
23059 @item -mmain-is-OS_task
23060 Do not save registers in @code{main}.  The effect is the same like
23061 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
23062 to @code{main}. It is activated per default if optimization is on.
23064 @opindex mn-flash
23065 @item -mn-flash=@var{num}
23066 Assume that the flash memory has a size of 
23067 @var{num} times 64@tie{}KiB.
23069 @opindex mno-interrupts
23070 @item -mno-interrupts
23071 Generated code is not compatible with hardware interrupts.
23072 Code size is smaller.
23074 @opindex mrelax
23075 @item -mrelax
23076 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
23077 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
23078 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
23079 the assembler's command line and the @option{--relax} option to the
23080 linker's command line.
23082 Jump relaxing is performed by the linker because jump offsets are not
23083 known before code is located. Therefore, the assembler code generated by the
23084 compiler is the same, but the instructions in the executable may
23085 differ from instructions in the assembler code.
23087 Relaxing must be turned on if linker stubs are needed, see the
23088 section on @code{EIND} and linker stubs below.
23090 @opindex mrmw
23091 @item -mrmw
23092 Assume that the device supports the Read-Modify-Write
23093 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
23095 @opindex mshort-calls
23096 @item -mshort-calls
23098 Assume that @code{RJMP} and @code{RCALL} can target the whole
23099 program memory.
23101 This option is used internally for multilib selection.  It is
23102 not an optimization option, and you don't need to set it by hand.
23104 @opindex msp8
23105 @item -msp8
23106 Treat the stack pointer register as an 8-bit register,
23107 i.e.@: assume the high byte of the stack pointer is zero.
23108 In general, you don't need to set this option by hand.
23110 This option is used internally by the compiler to select and
23111 build multilibs for architectures @code{avr2} and @code{avr25}.
23112 These architectures mix devices with and without @code{SPH}.
23113 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
23114 the compiler driver adds or removes this option from the compiler
23115 proper's command line, because the compiler then knows if the device
23116 or architecture has an 8-bit stack pointer and thus no @code{SPH}
23117 register or not.
23119 @opindex mstrict-X
23120 @item -mstrict-X
23121 Use address register @code{X} in a way proposed by the hardware.  This means
23122 that @code{X} is only used in indirect, post-increment or
23123 pre-decrement addressing.
23125 Without this option, the @code{X} register may be used in the same way
23126 as @code{Y} or @code{Z} which then is emulated by additional
23127 instructions.  
23128 For example, loading a value with @code{X+const} addressing with a
23129 small non-negative @code{const < 64} to a register @var{Rn} is
23130 performed as
23132 @example
23133 adiw r26, const   ; X += const
23134 ld   @var{Rn}, X        ; @var{Rn} = *X
23135 sbiw r26, const   ; X -= const
23136 @end example
23138 @opindex mtiny-stack
23139 @item -mtiny-stack
23140 Only change the lower 8@tie{}bits of the stack pointer.
23142 @opindex mfract-convert-truncate
23143 @item -mfract-convert-truncate
23144 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
23146 @opindex nodevicelib
23147 @item -nodevicelib
23148 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
23150 @opindex nodevicespecs
23151 @item -nodevicespecs
23152 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
23153 command line.  The user takes responsibility for supplying the sub-processes
23154 like compiler proper, assembler and linker with appropriate command line
23155 options.  This means that the user has to supply her private device specs
23156 file by means of @option{-specs=@var{path-to-specs-file}}.  There is no
23157 more need for option @option{-mmcu=@var{mcu}}.
23159 This option can also serve as a replacement for the older way of
23160 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
23161 which contains a folder named @code{device-specs} which contains a specs file named
23162 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
23164 @opindex Waddr-space-convert
23165 @opindex Wno-addr-space-convert
23166 @item -Waddr-space-convert
23167 Warn about conversions between address spaces in the case where the
23168 resulting address space is not contained in the incoming address space.
23170 @opindex Wmisspelled-isr
23171 @opindex Wno-misspelled-isr
23172 @item -Wmisspelled-isr
23173 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
23174 Enabled by default.
23175 @end table
23177 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
23178 @cindex @code{EIND}
23179 Pointers in the implementation are 16@tie{}bits wide.
23180 The address of a function or label is represented as word address so
23181 that indirect jumps and calls can target any code address in the
23182 range of 64@tie{}Ki words.
23184 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
23185 bytes of program memory space, there is a special function register called
23186 @code{EIND} that serves as most significant part of the target address
23187 when @code{EICALL} or @code{EIJMP} instructions are used.
23189 Indirect jumps and calls on these devices are handled as follows by
23190 the compiler and are subject to some limitations:
23192 @itemize @bullet
23194 @item
23195 The compiler never sets @code{EIND}.
23197 @item
23198 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
23199 instructions or might read @code{EIND} directly in order to emulate an
23200 indirect call/jump by means of a @code{RET} instruction.
23202 @item
23203 The compiler assumes that @code{EIND} never changes during the startup
23204 code or during the application. In particular, @code{EIND} is not
23205 saved/restored in function or interrupt service routine
23206 prologue/epilogue.
23208 @item
23209 For indirect calls to functions and computed goto, the linker
23210 generates @emph{stubs}. Stubs are jump pads sometimes also called
23211 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
23212 The stub contains a direct jump to the desired address.
23214 @item
23215 Linker relaxation must be turned on so that the linker generates
23216 the stubs correctly in all situations. See the compiler option
23217 @option{-mrelax} and the linker option @option{--relax}.
23218 There are corner cases where the linker is supposed to generate stubs
23219 but aborts without relaxation and without a helpful error message.
23221 @item
23222 The default linker script is arranged for code with @code{EIND = 0}.
23223 If code is supposed to work for a setup with @code{EIND != 0}, a custom
23224 linker script has to be used in order to place the sections whose
23225 name start with @code{.trampolines} into the segment where @code{EIND}
23226 points to.
23228 @item
23229 The startup code from libgcc never sets @code{EIND}.
23230 Notice that startup code is a blend of code from libgcc and AVR-LibC.
23231 For the impact of AVR-LibC on @code{EIND}, see the
23232 @w{@uref{https://www.nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
23234 @item
23235 It is legitimate for user-specific startup code to set up @code{EIND}
23236 early, for example by means of initialization code located in
23237 section @code{.init3}. Such code runs prior to general startup code
23238 that initializes RAM and calls constructors, but after the bit
23239 of startup code from AVR-LibC that sets @code{EIND} to the segment
23240 where the vector table is located.
23241 @example
23242 #include <avr/io.h>
23244 static void
23245 __attribute__((section(".init3"),naked,used,no_instrument_function))
23246 init3_set_eind (void)
23248   __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
23249                   "out %i0,r24" :: "n" (&EIND) : "r24","memory");
23251 @end example
23253 @noindent
23254 The @code{__trampolines_start} symbol is defined in the linker script.
23256 @item
23257 Stubs are generated automatically by the linker if
23258 the following two conditions are met:
23259 @itemize @minus
23261 @item The address of a label is taken by means of the @code{gs} modifier
23262 (short for @emph{generate stubs}) like so:
23263 @example
23264 LDI r24, lo8(gs(@var{func}))
23265 LDI r25, hi8(gs(@var{func}))
23266 @end example
23267 @item The final location of that label is in a code segment
23268 @emph{outside} the segment where the stubs are located.
23269 @end itemize
23271 @item
23272 The compiler emits such @code{gs} modifiers for code labels in the
23273 following situations:
23274 @itemize @minus
23275 @item Taking address of a function or code label.
23276 @item Computed goto.
23277 @item If prologue-save function is used, see @option{-mcall-prologues}
23278 command-line option.
23279 @item Switch/case dispatch tables. If you do not want such dispatch
23280 tables you can specify the @option{-fno-jump-tables} command-line option.
23281 @item C and C++ constructors/destructors called during startup/shutdown.
23282 @item If the tools hit a @code{gs()} modifier explained above.
23283 @end itemize
23285 @item
23286 Jumping to non-symbolic addresses like so is @emph{not} supported:
23288 @example
23289 int main (void)
23291     /* Call function at word address 0x2 */
23292     return ((int(*)(void)) 0x2)();
23294 @end example
23296 Instead, a stub has to be set up, i.e.@: the function has to be called
23297 through a symbol (@code{func_4} in the example):
23299 @example
23300 int main (void)
23302     extern int func_4 (void);
23304     /* Call function at byte address 0x4 */
23305     return func_4();
23307 @end example
23309 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
23310 Alternatively, @code{func_4} can be defined in the linker script.
23311 @end itemize
23313 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
23314 @cindex @code{RAMPD}
23315 @cindex @code{RAMPX}
23316 @cindex @code{RAMPY}
23317 @cindex @code{RAMPZ}
23318 Some AVR devices support memories larger than the 64@tie{}KiB range
23319 that can be accessed with 16-bit pointers.  To access memory locations
23320 outside this 64@tie{}KiB range, the content of a @code{RAMP}
23321 register is used as high part of the address:
23322 The @code{X}, @code{Y}, @code{Z} address register is concatenated
23323 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
23324 register, respectively, to get a wide address. Similarly,
23325 @code{RAMPD} is used together with direct addressing.
23327 @itemize
23328 @item
23329 The startup code initializes the @code{RAMP} special function
23330 registers with zero.
23332 @item
23333 If a @ref{AVR Named Address Spaces,named address space} other than
23334 generic or @code{__flash} is used, then @code{RAMPZ} is set
23335 as needed before the operation.
23337 @item
23338 If the device supports RAM larger than 64@tie{}KiB and the compiler
23339 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
23340 is reset to zero after the operation.
23342 @item
23343 If the device comes with a specific @code{RAMP} register, the ISR
23344 prologue/epilogue saves/restores that SFR and initializes it with
23345 zero in case the ISR code might (implicitly) use it.
23347 @item
23348 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
23349 If you use inline assembler to read from locations outside the
23350 16-bit address range and change one of the @code{RAMP} registers,
23351 you must reset it to zero after the access.
23353 @end itemize
23355 @subsubsection AVR Built-in Macros
23357 GCC defines several built-in macros so that the user code can test
23358 for the presence or absence of features.  Almost any of the following
23359 built-in macros are deduced from device capabilities and thus
23360 triggered by the @option{-mmcu=} command-line option.
23362 For even more AVR-specific built-in macros see
23363 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
23365 @table @code
23367 @item __AVR_ARCH__
23368 Build-in macro that resolves to a decimal number that identifies the
23369 architecture and depends on the @option{-mmcu=@var{mcu}} option.
23370 Possible values are:
23372 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
23373 @code{4}, @code{5}, @code{51}, @code{6}
23375 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
23376 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
23378 respectively and
23380 @code{100},
23381 @code{102}, @code{103}, @code{104},
23382 @code{105}, @code{106}, @code{107}
23384 for @var{mcu}=@code{avrtiny},
23385 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
23386 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
23387 If @var{mcu} specifies a device, this built-in macro is set
23388 accordingly. For example, with @option{-mmcu=atmega8} the macro is
23389 defined to @code{4}.
23391 @item __AVR_@var{Device}__
23392 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
23393 the device's name. For example, @option{-mmcu=atmega8} defines the
23394 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
23395 @code{__AVR_ATtiny261A__}, etc.
23397 The built-in macros' names follow
23398 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
23399 the device name as from the AVR user manual. The difference between
23400 @var{Device} in the built-in macro and @var{device} in
23401 @option{-mmcu=@var{device}} is that the latter is always lowercase.
23403 If @var{device} is not a device but only a core architecture like
23404 @samp{avr51}, this macro is not defined.
23406 @item __AVR_DEVICE_NAME__
23407 Setting @option{-mmcu=@var{device}} defines this built-in macro to
23408 the device's name. For example, with @option{-mmcu=atmega8} the macro
23409 is defined to @code{atmega8}.
23411 If @var{device} is not a device but only a core architecture like
23412 @samp{avr51}, this macro is not defined.
23414 @item __AVR_XMEGA__
23415 The device / architecture belongs to the XMEGA family of devices.
23417 @item __AVR_HAVE_ELPM__
23418 The device has the @code{ELPM} instruction.
23420 @item __AVR_HAVE_ELPMX__
23421 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
23422 R@var{n},Z+} instructions.
23424 @item __AVR_HAVE_MOVW__
23425 The device has the @code{MOVW} instruction to perform 16-bit
23426 register-register moves.
23428 @item __AVR_HAVE_LPMX__
23429 The device has the @code{LPM R@var{n},Z} and
23430 @code{LPM R@var{n},Z+} instructions.
23432 @item __AVR_HAVE_MUL__
23433 The device has a hardware multiplier. 
23435 @item __AVR_HAVE_JMP_CALL__
23436 The device has the @code{JMP} and @code{CALL} instructions.
23437 This is the case for devices with more than 8@tie{}KiB of program
23438 memory.
23440 @item __AVR_HAVE_EIJMP_EICALL__
23441 @itemx __AVR_3_BYTE_PC__
23442 The device has the @code{EIJMP} and @code{EICALL} instructions.
23443 This is the case for devices with more than 128@tie{}KiB of program memory.
23444 This also means that the program counter
23445 (PC) is 3@tie{}bytes wide.
23447 @item __AVR_2_BYTE_PC__
23448 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
23449 with up to 128@tie{}KiB of program memory.
23451 @item __AVR_HAVE_8BIT_SP__
23452 @itemx __AVR_HAVE_16BIT_SP__
23453 The stack pointer (SP) register is treated as 8-bit respectively
23454 16-bit register by the compiler.
23455 The definition of these macros is affected by @option{-mtiny-stack}.
23457 @item __AVR_HAVE_SPH__
23458 @itemx __AVR_SP8__
23459 The device has the SPH (high part of stack pointer) special function
23460 register or has an 8-bit stack pointer, respectively.
23461 The definition of these macros is affected by @option{-mmcu=} and
23462 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
23463 by @option{-msp8}.
23465 @item __AVR_HAVE_RAMPD__
23466 @itemx __AVR_HAVE_RAMPX__
23467 @itemx __AVR_HAVE_RAMPY__
23468 @itemx __AVR_HAVE_RAMPZ__
23469 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
23470 @code{RAMPZ} special function register, respectively.
23472 @item __NO_INTERRUPTS__
23473 This macro reflects the @option{-mno-interrupts} command-line option.
23475 @item __AVR_ERRATA_SKIP__
23476 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
23477 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
23478 instructions because of a hardware erratum.  Skip instructions are
23479 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
23480 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
23481 set.
23483 @item __AVR_ISA_RMW__
23484 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
23486 @item __AVR_SFR_OFFSET__=@var{offset}
23487 Instructions that can address I/O special function registers directly
23488 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
23489 address as if addressed by an instruction to access RAM like @code{LD}
23490 or @code{STS}. This offset depends on the device architecture and has
23491 to be subtracted from the RAM address in order to get the
23492 respective I/O@tie{}address.
23494 @item __AVR_SHORT_CALLS__
23495 The @option{-mshort-calls} command line option is set.
23497 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
23498 Some devices support reading from flash memory by means of @code{LD*}
23499 instructions.  The flash memory is seen in the data address space
23500 at an offset of @code{__AVR_PM_BASE_ADDRESS__}.  If this macro
23501 is not defined, this feature is not available.  If defined,
23502 the address space is linear and there is no need to put
23503 @code{.rodata} into RAM.  This is handled by the default linker
23504 description file, and is currently available for
23505 @code{avrtiny} and @code{avrxmega3}.  Even more convenient,
23506 there is no need to use address spaces like @code{__flash} or
23507 features like attribute @code{progmem} and @code{pgm_read_*}.
23509 @item __WITH_AVRLIBC__
23510 The compiler is configured to be used together with AVR-Libc.
23511 See the @option{--with-avrlibc} configure option.
23513 @item __HAVE_DOUBLE_MULTILIB__
23514 Defined if @option{-mdouble=} acts as a multilib option.
23516 @item __HAVE_DOUBLE32__
23517 @itemx __HAVE_DOUBLE64__
23518 Defined if the compiler supports 32-bit double resp. 64-bit double.
23519 The actual layout is specified by option @option{-mdouble=}.
23521 @item __DEFAULT_DOUBLE__
23522 The size in bits of @code{double} if @option{-mdouble=} is not set.
23523 To test the layout of @code{double} in a program, use the built-in
23524 macro @code{__SIZEOF_DOUBLE__}.
23526 @item __HAVE_LONG_DOUBLE32__
23527 @itemx __HAVE_LONG_DOUBLE64__
23528 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
23529 @itemx __DEFAULT_LONG_DOUBLE__
23530 Same as above, but for @code{long double} instead of @code{double}.
23532 @item __WITH_DOUBLE_COMPARISON__
23533 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
23534 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
23535 and is defined to @code{2} or @code{3}.
23537 @item __WITH_LIBF7_LIBGCC__
23538 @itemx __WITH_LIBF7_MATH__
23539 @itemx __WITH_LIBF7_MATH_SYMBOLS__
23540 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
23541 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
23543 @end table
23545 @node Blackfin Options
23546 @subsection Blackfin Options
23547 @cindex Blackfin Options
23549 @table @gcctabopt
23550 @opindex mcpu=
23551 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
23552 Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
23553 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
23554 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
23555 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
23556 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
23557 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
23558 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
23559 @samp{bf561}, @samp{bf592}.
23561 The optional @var{sirevision} specifies the silicon revision of the target
23562 Blackfin processor.  Any workarounds available for the targeted silicon revision
23563 are enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
23564 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
23565 are enabled.  The @code{__SILICON_REVISION__} macro is defined to two
23566 hexadecimal digits representing the major and minor numbers in the silicon
23567 revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
23568 is not defined.  If @var{sirevision} is @samp{any}, the
23569 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
23570 If this optional @var{sirevision} is not used, GCC assumes the latest known
23571 silicon revision of the targeted Blackfin processor.
23573 GCC defines a preprocessor macro for the specified @var{cpu}.
23574 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
23575 provided by libgloss to be linked in if @option{-msim} is not given.
23577 Without this option, @samp{bf532} is used as the processor by default.
23579 Note that support for @samp{bf561} is incomplete.  For @samp{bf561},
23580 only the preprocessor macro is defined.
23582 @opindex msim
23583 @item -msim
23584 Specifies that the program will be run on the simulator.  This causes
23585 the simulator BSP provided by libgloss to be linked in.  This option
23586 has effect only for @samp{bfin-elf} toolchain.
23587 Certain other options, such as @option{-mid-shared-library} and
23588 @option{-mfdpic}, imply @option{-msim}.
23590 @opindex momit-leaf-frame-pointer
23591 @item -momit-leaf-frame-pointer
23592 Don't keep the frame pointer in a register for leaf functions.  This
23593 avoids the instructions to save, set up and restore frame pointers and
23594 makes an extra register available in leaf functions.
23596 @opindex mspecld-anomaly
23597 @item -mspecld-anomaly
23598 When enabled, the compiler ensures that the generated code does not
23599 contain speculative loads after jump instructions. If this option is used,
23600 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
23602 @opindex mno-specld-anomaly
23603 @opindex mspecld-anomaly
23604 @item -mno-specld-anomaly
23605 Don't generate extra code to prevent speculative loads from occurring.
23607 @opindex mcsync-anomaly
23608 @item -mcsync-anomaly
23609 When enabled, the compiler ensures that the generated code does not
23610 contain CSYNC or SSYNC instructions too soon after conditional branches.
23611 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
23613 @opindex mno-csync-anomaly
23614 @opindex mcsync-anomaly
23615 @item -mno-csync-anomaly
23616 Don't generate extra code to prevent CSYNC or SSYNC instructions from
23617 occurring too soon after a conditional branch.
23619 @opindex mlow64k
23620 @item -mlow64k
23621 When enabled, the compiler is free to take advantage of the knowledge that
23622 the entire program fits into the low 64k of memory.
23624 @opindex mno-low64k
23625 @item -mno-low64k
23626 Assume that the program is arbitrarily large.  This is the default.
23628 @opindex mstack-check-l1
23629 @item -mstack-check-l1
23630 Do stack checking using information placed into L1 scratchpad memory by the
23631 uClinux kernel.
23633 @opindex mid-shared-library
23634 @item -mid-shared-library
23635 Generate code that supports shared libraries via the library ID method.
23636 This allows for execute in place and shared libraries in an environment
23637 without virtual memory management.  This option implies @option{-fPIC}.
23638 With a @samp{bfin-elf} target, this option implies @option{-msim}.
23640 @opindex mno-id-shared-library
23641 @opindex mid-shared-library
23642 @item -mno-id-shared-library
23643 Generate code that doesn't assume ID-based shared libraries are being used.
23644 This is the default.
23646 @opindex mleaf-id-shared-library
23647 @item -mleaf-id-shared-library
23648 Generate code that supports shared libraries via the library ID method,
23649 but assumes that this library or executable won't link against any other
23650 ID shared libraries.  That allows the compiler to use faster code for jumps
23651 and calls.
23653 @opindex mno-leaf-id-shared-library
23654 @opindex mleaf-id-shared-library
23655 @item -mno-leaf-id-shared-library
23656 Do not assume that the code being compiled won't link against any ID shared
23657 libraries.  Slower code is generated for jump and call insns.
23659 @opindex mshared-library-id
23660 @item -mshared-library-id=n
23661 Specifies the identification number of the ID-based shared library being
23662 compiled.  Specifying a value of 0 generates more compact code; specifying
23663 other values forces the allocation of that number to the current
23664 library but is no more space- or time-efficient than omitting this option.
23666 @opindex msep-data
23667 @item -msep-data
23668 Generate code that allows the data segment to be located in a different
23669 area of memory from the text segment.  This allows for execute in place in
23670 an environment without virtual memory management by eliminating relocations
23671 against the text section.
23673 @opindex mno-sep-data
23674 @opindex msep-data
23675 @item -mno-sep-data
23676 Generate code that assumes that the data segment follows the text segment.
23677 This is the default.
23679 @opindex mlong-calls
23680 @opindex mno-long-calls
23681 @item -mlong-calls
23682 @itemx -mno-long-calls
23683 Tells the compiler to perform function calls by first loading the
23684 address of the function into a register and then performing a subroutine
23685 call on this register.  This switch is needed if the target function
23686 lies outside of the 24-bit addressing range of the offset-based
23687 version of subroutine call instruction.
23689 This feature is not enabled by default.  Specifying
23690 @option{-mno-long-calls} restores the default behavior.  Note these
23691 switches have no effect on how the compiler generates code to handle
23692 function calls via function pointers.
23694 @opindex mfast-fp
23695 @item -mfast-fp
23696 Link with the fast floating-point library. This library relaxes some of
23697 the IEEE floating-point standard's rules for checking inputs against
23698 Not-a-Number (NAN), in the interest of performance.
23700 @opindex minline-plt
23701 @item -minline-plt
23702 Enable inlining of PLT entries in function calls to functions that are
23703 not known to bind locally.  It has no effect without @option{-mfdpic}.
23705 @opindex mmulticore
23706 @item -mmulticore
23707 Build a standalone application for multicore Blackfin processors. 
23708 This option causes proper start files and link scripts supporting 
23709 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}. 
23710 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. 
23712 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
23713 selects the one-application-per-core programming model.  Without
23714 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
23715 programming model is used. In this model, the main function of Core B
23716 should be named as @code{coreb_main}.
23718 If this option is not used, the single-core application programming
23719 model is used.
23721 @opindex mcorea
23722 @item -mcorea
23723 Build a standalone application for Core A of BF561 when using
23724 the one-application-per-core programming model. Proper start files
23725 and link scripts are used to support Core A, and the macro
23726 @code{__BFIN_COREA} is defined.
23727 This option can only be used in conjunction with @option{-mmulticore}.
23729 @opindex mcoreb
23730 @item -mcoreb
23731 Build a standalone application for Core B of BF561 when using
23732 the one-application-per-core programming model. Proper start files
23733 and link scripts are used to support Core B, and the macro
23734 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
23735 should be used instead of @code{main}. 
23736 This option can only be used in conjunction with @option{-mmulticore}.
23738 @opindex msdram
23739 @item -msdram
23740 Build a standalone application for SDRAM. Proper start files and
23741 link scripts are used to put the application into SDRAM, and the macro
23742 @code{__BFIN_SDRAM} is defined.
23743 The loader should initialize SDRAM before loading the application.
23745 @opindex micplb
23746 @item -micplb
23747 Assume that ICPLBs are enabled at run time.  This has an effect on certain
23748 anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
23749 are enabled; for standalone applications the default is off.
23750 @end table
23752 @node C6X Options
23753 @subsection C6X Options
23754 @cindex C6X Options
23756 @table @gcctabopt
23757 @opindex march
23758 @item -march=@var{name}
23759 This specifies the name of the target architecture.  GCC uses this
23760 name to determine what kind of instructions it can emit when generating
23761 assembly code.  Permissible names are: @samp{c62x},
23762 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
23764 @opindex mbig-endian
23765 @item -mbig-endian
23766 Generate code for a big-endian target.
23768 @opindex mlittle-endian
23769 @item -mlittle-endian
23770 Generate code for a little-endian target.  This is the default.
23772 @opindex msim
23773 @item -msim
23774 Choose startup files and linker script suitable for the simulator.
23776 @opindex msdata=default
23777 @item -msdata=default
23778 Put small global and static data in the @code{.neardata} section,
23779 which is pointed to by register @code{B14}.  Put small uninitialized
23780 global and static data in the @code{.bss} section, which is adjacent
23781 to the @code{.neardata} section.  Put small read-only data into the
23782 @code{.rodata} section.  The corresponding sections used for large
23783 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
23785 @opindex msdata=all
23786 @item -msdata=all
23787 Put all data, not just small objects, into the sections reserved for
23788 small data, and use addressing relative to the @code{B14} register to
23789 access them.
23791 @opindex msdata=none
23792 @item -msdata=none
23793 Make no use of the sections reserved for small data, and use absolute
23794 addresses to access all data.  Put all initialized global and static
23795 data in the @code{.fardata} section, and all uninitialized data in the
23796 @code{.far} section.  Put all constant data into the @code{.const}
23797 section.
23798 @end table
23800 @node CRIS Options
23801 @subsection CRIS Options
23802 @cindex CRIS Options
23804 These options are defined specifically for the CRIS ports.
23806 @table @gcctabopt
23807 @opindex march
23808 @opindex mcpu
23809 @item -march=@var{architecture-type}
23810 @itemx -mcpu=@var{architecture-type}
23811 Generate code for the specified architecture.  The choices for
23812 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
23813 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
23814 Default is @samp{v0}.
23816 @opindex mtune
23817 @item -mtune=@var{architecture-type}
23818 Tune to @var{architecture-type} everything applicable about the generated
23819 code, except for the ABI and the set of available instructions.  The
23820 choices for @var{architecture-type} are the same as for
23821 @option{-march=@var{architecture-type}}.
23823 @opindex mmax-stack-frame
23824 @item -mmax-stack-frame=@var{n}
23825 Warn when the stack frame of a function exceeds @var{n} bytes.
23827 @opindex metrax4
23828 @opindex metrax100
23829 @item -metrax4
23830 @itemx -metrax100
23831 The options @option{-metrax4} and @option{-metrax100} are synonyms for
23832 @option{-march=v3} and @option{-march=v8} respectively.
23834 @opindex mmul-bug-workaround
23835 @opindex mno-mul-bug-workaround
23836 @item -mmul-bug-workaround
23837 @itemx -mno-mul-bug-workaround
23838 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
23839 models where it applies.  This option is disabled by default.
23841 @opindex mpdebug
23842 @item -mpdebug
23843 Enable CRIS-specific verbose debug-related information in the assembly
23844 code.  This option also has the effect of turning off the @samp{#NO_APP}
23845 formatted-code indicator to the assembler at the beginning of the
23846 assembly file.
23848 @opindex mcc-init
23849 @item -mcc-init
23850 Do not use condition-code results from previous instruction; always emit
23851 compare and test instructions before use of condition codes.
23853 @opindex mno-side-effects
23854 @opindex mside-effects
23855 @item -mno-side-effects
23856 Do not emit instructions with side effects in addressing modes other than
23857 post-increment.
23859 @opindex mstack-align
23860 @opindex mno-stack-align
23861 @opindex mdata-align
23862 @opindex mno-data-align
23863 @opindex mconst-align
23864 @opindex mno-const-align
23865 @item -mstack-align
23866 @itemx -mno-stack-align
23867 @itemx -mdata-align
23868 @itemx -mno-data-align
23869 @itemx -mconst-align
23870 @itemx -mno-const-align
23871 These options (@samp{no-} options) arrange (eliminate arrangements) for the
23872 stack frame, individual data and constants to be aligned for the maximum
23873 single data access size for the chosen CPU model.  The default is to
23874 arrange for 32-bit alignment.  ABI details such as structure layout are
23875 not affected by these options.
23877 @opindex m32-bit
23878 @opindex m16-bit
23879 @opindex m8-bit
23880 @item -m32-bit
23881 @itemx -m16-bit
23882 @itemx -m8-bit
23883 Similar to the stack- data- and const-align options above, these options
23884 arrange for stack frame, writable data and constants to all be 32-bit,
23885 16-bit or 8-bit aligned.  The default is 32-bit alignment.
23887 @opindex mno-prologue-epilogue
23888 @opindex mprologue-epilogue
23889 @item -mno-prologue-epilogue
23890 @itemx -mprologue-epilogue
23891 With @option{-mno-prologue-epilogue}, the normal function prologue and
23892 epilogue which set up the stack frame are omitted and no return
23893 instructions or return sequences are generated in the code.  Use this
23894 option only together with visual inspection of the compiled code: no
23895 warnings or errors are generated when call-saved registers must be saved,
23896 or storage for local variables needs to be allocated.
23898 @opindex melf
23899 @item -melf
23900 Legacy no-op option.
23902 @opindex sim
23903 @item -sim
23904 This option arranges
23905 to link with input-output functions from a simulator library.  Code,
23906 initialized data and zero-initialized data are allocated consecutively.
23908 @opindex sim2
23909 @item -sim2
23910 Like @option{-sim}, but pass linker options to locate initialized data at
23911 0x40000000 and zero-initialized data at 0x80000000.
23912 @end table
23914 @node C-SKY Options
23915 @subsection C-SKY Options
23916 @cindex C-SKY Options
23918 GCC supports these options when compiling for C-SKY V2 processors.
23920 @table @gcctabopt
23922 @opindex march=
23923 @item -march=@var{arch}
23924 Specify the C-SKY target architecture.  Valid values for @var{arch} are:
23925 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
23926 The default is @samp{ck810}.
23928 @opindex mcpu=
23929 @item -mcpu=@var{cpu}
23930 Specify the C-SKY target processor.  Valid values for @var{cpu} are:
23931 @samp{ck801}, @samp{ck801t},
23932 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
23933 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
23934 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
23935 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
23936 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
23937 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
23938 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
23939 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
23940 @samp{ck803eftr1}, @samp{ck803efhtr1},
23941 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
23942 @samp{ck803sef}, @samp{ck803seft},
23943 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
23944 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
23945 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
23946 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
23948 @opindex mbig-endian
23949 @opindex EB
23950 @opindex mlittle-endian
23951 @opindex EL
23952 @item -mbig-endian
23953 @itemx -EB
23954 @itemx -mlittle-endian
23955 @itemx -EL
23957 Select big- or little-endian code.  The default is little-endian.
23959 @opindex mfloat-abi
23960 @item -mfloat-abi=@var{name}
23961 Specifies which floating-point ABI to use.  Permissible values
23962 are: @samp{soft}, @samp{softfp} and @samp{hard}.
23964 Specifying @samp{soft} causes GCC to generate output containing
23965 library calls for floating-point operations.
23966 @samp{softfp} allows the generation of code using hardware floating-point
23967 instructions, but still uses the soft-float calling conventions.
23968 @samp{hard} allows generation of floating-point instructions
23969 and uses FPU-specific calling conventions.
23971 The default depends on the specific target configuration.  Note that
23972 the hard-float and soft-float ABIs are not link-compatible; you must
23973 compile your entire program with the same ABI, and link with a
23974 compatible set of libraries.
23976 @opindex mhard-float
23977 @opindex msoft-float
23978 @item -mhard-float
23979 @itemx -msoft-float
23981 Select hardware or software floating-point implementations.
23982 The default is soft float.
23984 @opindex mdouble-float
23985 @item -mdouble-float
23986 @itemx -mno-double-float
23987 When @option{-mhard-float} is in effect, enable generation of
23988 double-precision float instructions.  This is the default except
23989 when compiling for CK803.
23991 @opindex mfdivdu
23992 @item -mfdivdu
23993 @itemx -mno-fdivdu
23994 When @option{-mhard-float} is in effect, enable generation of
23995 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
23996 This is the default except when compiling for CK803.
23998 @opindex mfpu=
23999 @item -mfpu=@var{fpu}
24000 Select the floating-point processor.  This option can only be used with
24001 @option{-mhard-float}.
24002 Values for @var{fpu} are
24003 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
24004 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
24005 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
24007 @opindex melrw
24008 @item -melrw
24009 @itemx -mno-elrw
24010 Enable the extended @code{lrw} instruction.  This option defaults to on
24011 for CK801 and off otherwise.
24013 @opindex mistack
24014 @item -mistack
24015 @itemx -mno-istack
24016 Enable interrupt stack instructions; the default is off.
24018 The @option{-mistack} option is required to handle the
24019 @code{interrupt} and @code{isr} function attributes
24020 (@pxref{C-SKY Function Attributes}).
24022 @opindex mmp
24023 @item -mmp
24024 Enable multiprocessor instructions; the default is off.
24026 @opindex mcp
24027 @item -mcp
24028 Enable coprocessor instructions; the default is off.
24030 @opindex mcache
24031 @item -mcache
24032 Enable coprocessor instructions; the default is off.
24034 @opindex msecurity
24035 @item -msecurity
24036 Enable C-SKY security instructions; the default is off.
24038 @opindex mtrust
24039 @item -mtrust
24040 Enable C-SKY trust instructions; the default is off.
24042 @opindex mdsp
24043 @opindex medsp
24044 @opindex mvdsp
24045 @item -mdsp
24046 @itemx -medsp
24047 @itemx -mvdsp
24048 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
24049 All of these options default to off.
24051 @opindex mdiv
24052 @item -mdiv
24053 @itemx -mno-div
24054 Generate divide instructions.  Default is off.
24056 @opindex msmart
24057 @item -msmart
24058 @itemx -mno-smart
24059 Generate code for Smart Mode, using only registers numbered 0-7 to allow
24060 use of 16-bit instructions.  This option is ignored for CK801 where this
24061 is the required behavior, and it defaults to on for CK802.
24062 For other targets, the default is off.
24064 @opindex mhigh-registers
24065 @item -mhigh-registers
24066 @itemx -mno-high-registers
24067 Generate code using the high registers numbered 16-31.  This option
24068 is not supported on CK801, CK802, or CK803, and is enabled by default
24069 for other processors.
24071 @opindex manchor
24072 @item -manchor
24073 @itemx -mno-anchor
24074 Generate code using global anchor symbol addresses.
24076 @opindex mpushpop
24077 @item -mpushpop
24078 @itemx -mno-pushpop
24079 Generate code using @code{push} and @code{pop} instructions.  This option
24080 defaults to on.
24082 @opindex mmultiple-stld
24083 @item -mmultiple-stld
24084 @itemx -mstm
24085 @itemx -mno-multiple-stld
24086 @itemx -mno-stm
24087 Generate code using @code{stm} and @code{ldm} instructions.  This option
24088 isn't supported on CK801 but is enabled by default on other processors.
24090 @opindex mconstpool
24091 @item -mconstpool
24092 @itemx -mno-constpool
24093 Create constant pools in the compiler instead of deferring it to the
24094 assembler.  This option is the default and required for correct code
24095 generation on CK801 and CK802, and is optional on other processors.
24097 @opindex mstack-size
24098 @item -mstack-size
24099 @item -mno-stack-size
24100 Emit @code{.stack_size} directives for each function in the assembly
24101 output.  This option defaults to off.
24103 @opindex mccrt
24104 @item -mccrt
24105 @itemx -mno-ccrt
24106 Generate code for the C-SKY compiler runtime instead of libgcc.  This
24107 option defaults to off.
24109 @opindex mbranch-cost=
24110 @item -mbranch-cost=@var{n}
24111 Set the branch costs to roughly @code{n} instructions.  The default is 1.
24113 @opindex msched-prolog
24114 @item -msched-prolog
24115 @itemx -mno-sched-prolog
24116 Permit scheduling of function prologue and epilogue sequences.  Using
24117 this option can result in code that is not compliant with the C-SKY V2 ABI
24118 prologue requirements and that cannot be debugged or backtraced.
24119 It is disabled by default.
24121 @opindex msim
24122 @item -msim
24123 Links the library libsemi.a which is in compatible with simulator. Applicable
24124 to ELF compiler only.
24126 @end table
24128 @node Darwin Options
24129 @subsection Darwin Options
24130 @cindex Darwin options
24132 These options are defined for all architectures running the Darwin operating
24133 system.
24135 FSF GCC on Darwin does not create ``fat'' object files; it creates
24136 an object file for the single architecture that GCC was built to
24137 target.  Apple's GCC on Darwin does create ``fat'' files if multiple
24138 @option{-arch} options are used; it does so by running the compiler or
24139 linker multiple times and joining the results together with
24140 @file{lipo}.
24142 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
24143 @samp{i686}) is determined by the flags that specify the ISA
24144 that GCC is targeting, like @option{-mcpu} or @option{-march}.  The
24145 @option{-force_cpusubtype_ALL} option can be used to override this.
24147 The Darwin tools vary in their behavior when presented with an ISA
24148 mismatch.  The assembler, @file{as}, only permits instructions to
24149 be used that are valid for the subtype of the file it is generating,
24150 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
24151 The linker for shared libraries, @file{/usr/bin/libtool}, fails
24152 and prints an error if asked to create a shared library with a less
24153 restrictive subtype than its input files (for instance, trying to put
24154 a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
24155 for executables, @command{ld}, quietly gives the executable the most
24156 restrictive subtype of any of its input files.
24158 @table @gcctabopt
24159 @opindex F
24160 @item -F@var{dir}
24161 Add the framework directory @var{dir} to the head of the list of
24162 directories to be searched for header files.  These directories are
24163 interleaved with those specified by @option{-I} options and are
24164 scanned in a left-to-right order.
24166 A framework directory is a directory with frameworks in it.  A
24167 framework is a directory with a @file{Headers} and/or
24168 @file{PrivateHeaders} directory contained directly in it that ends
24169 in @file{.framework}.  The name of a framework is the name of this
24170 directory excluding the @file{.framework}.  Headers associated with
24171 the framework are found in one of those two directories, with
24172 @file{Headers} being searched first.  A subframework is a framework
24173 directory that is in a framework's @file{Frameworks} directory.
24174 Includes of subframework headers can only appear in a header of a
24175 framework that contains the subframework, or in a sibling subframework
24176 header.  Two subframeworks are siblings if they occur in the same
24177 framework.  A subframework should not have the same name as a
24178 framework; a warning is issued if this is violated.  Currently a
24179 subframework cannot have subframeworks; in the future, the mechanism
24180 may be extended to support this.  The standard frameworks can be found
24181 in @file{/System/Library/Frameworks} and
24182 @file{/Library/Frameworks}.  An example include looks like
24183 @code{#include <Framework/header.h>}, where @file{Framework} denotes
24184 the name of the framework and @file{header.h} is found in the
24185 @file{PrivateHeaders} or @file{Headers} directory.
24187 @opindex iframework
24188 @item -iframework@var{dir}
24189 Like @option{-F} except the directory is a treated as a system
24190 directory.  The main difference between this @option{-iframework} and
24191 @option{-F} is that with @option{-iframework} the compiler does not
24192 warn about constructs contained within header files found via
24193 @var{dir}.  This option is valid only for the C family of languages.
24195 @opindex gused
24196 @item -gused
24197 Emit debugging information for symbols that are used.  For stabs
24198 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
24199 This is by default ON@.
24201 @opindex gfull
24202 @item -gfull
24203 Emit debugging information for all symbols and types.
24205 @opindex fconstant-cfstrings
24206 @item -fconstant-cfstrings
24207 The @option{-fconstant-cfstrings} is an alias for @option{-mconstant-cfstrings}.
24209 @opindex mconstant-cfstrings
24210 @item -mconstant-cfstrings
24211 When the NeXT runtime is being used (the default on these systems), override
24212 any @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"}
24213 literals to be laid out as constant CoreFoundation strings.
24215 @opindex mmacosx-version-min
24216 @item -mmacosx-version-min=@var{version}
24217 The earliest version of MacOS X that this executable will run on is
24218 @var{version}.  Typical values supported for @var{version} include @code{12},
24219 @code{10.12}, and @code{10.5.8}.
24221 If the compiler was built to use the system's headers by default,
24222 then the default for this option is the system version on which the
24223 compiler is running, otherwise the default is to make choices that
24224 are compatible with as many systems and code bases as possible.
24226 @opindex mkernel
24227 @item -mkernel
24228 Enable kernel development mode.  The @option{-mkernel} option sets
24229 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
24230 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
24231 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
24232 applicable.  This mode also sets @option{-mno-altivec},
24233 @option{-msoft-float}, @option{-fno-builtin} and
24234 @option{-mlong-branch} for PowerPC targets.
24236 @opindex mone-byte-bool
24237 @item -mone-byte-bool
24238 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
24239 By default @code{sizeof(bool)} is @code{4} when compiling for
24240 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
24241 option has no effect on x86.
24243 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
24244 to generate code that is not binary compatible with code generated
24245 without that switch.  Using this switch may require recompiling all
24246 other modules in a program, including system libraries.  Use this
24247 switch to conform to a non-default data model.
24249 @opindex mfix-and-continue
24250 @opindex ffix-and-continue
24251 @opindex findirect-data
24252 @item -mfix-and-continue
24253 @itemx -ffix-and-continue
24254 @itemx -findirect-data
24255 Generate code suitable for fast turnaround development, such as to
24256 allow GDB to dynamically load @file{.o} files into already-running
24257 programs.  @option{-findirect-data} and @option{-ffix-and-continue}
24258 are provided for backwards compatibility.
24260 @opindex all_load
24261 @item -all_load
24262 Loads all members of static archive libraries.
24263 See man ld(1) for more information.
24265 @opindex arch_errors_fatal
24266 @item -arch_errors_fatal
24267 Cause the errors having to do with files that have the wrong architecture
24268 to be fatal.
24270 @opindex bind_at_load
24271 @item -bind_at_load
24272 Causes the output file to be marked such that the dynamic linker will
24273 bind all undefined references when the file is loaded or launched.
24275 @opindex bundle
24276 @item -bundle
24277 Produce a Mach-o bundle format file.
24278 See man ld(1) for more information.
24280 @opindex bundle_loader
24281 @item -bundle_loader @var{executable}
24282 This option specifies the @var{executable} that will load the build
24283 output file being linked.  See man ld(1) for more information.
24285 @opindex dynamiclib
24286 @item -dynamiclib
24287 When passed this option, GCC produces a dynamic library instead of
24288 an executable when linking, using the Darwin @file{libtool} command.
24290 @opindex force_cpusubtype_ALL
24291 @item -force_cpusubtype_ALL
24292 This causes GCC's output file to have the @samp{ALL} subtype, instead of
24293 one controlled by the @option{-mcpu} or @option{-march} option.
24295 @item -allowable_client  @var{client_name}
24296 @itemx -client_name
24297 @itemx -compatibility_version
24298 @itemx -current_version
24299 @itemx -dead_strip
24300 @itemx -dependency-file
24301 @itemx -dylib_file
24302 @itemx -dylinker_install_name
24303 @itemx -dynamic
24304 @itemx -exported_symbols_list
24305 @itemx -filelist
24306 @need 800
24307 @itemx -flat_namespace
24308 @itemx -force_flat_namespace
24309 @itemx -headerpad_max_install_names
24310 @itemx -image_base
24311 @itemx -init
24312 @itemx -install_name
24313 @itemx -keep_private_externs
24314 @itemx -multi_module
24315 @itemx -multiply_defined
24316 @itemx -multiply_defined_unused
24317 @need 800
24318 @itemx -noall_load
24319 @itemx -no_dead_strip_inits_and_terms
24320 @itemx -nofixprebinding
24321 @itemx -nomultidefs
24322 @itemx -noprebind
24323 @itemx -noseglinkedit
24324 @itemx -pagezero_size
24325 @itemx -prebind
24326 @itemx -prebind_all_twolevel_modules
24327 @itemx -private_bundle
24328 @need 800
24329 @itemx -read_only_relocs
24330 @itemx -sectalign
24331 @itemx -sectobjectsymbols
24332 @itemx -whyload
24333 @itemx -seg1addr
24334 @itemx -sectcreate
24335 @itemx -sectobjectsymbols
24336 @itemx -sectorder
24337 @itemx -segaddr
24338 @itemx -segs_read_only_addr
24339 @need 800
24340 @itemx -segs_read_write_addr
24341 @itemx -seg_addr_table
24342 @itemx -seg_addr_table_filename
24343 @itemx -seglinkedit
24344 @itemx -segprot
24345 @itemx -segs_read_only_addr
24346 @itemx -segs_read_write_addr
24347 @itemx -single_module
24348 @itemx -static
24349 @itemx -sub_library
24350 @need 800
24351 @opindex allowable_client
24352 @opindex client_name
24353 @opindex compatibility_version
24354 @opindex current_version
24355 @opindex dead_strip
24356 @opindex dependency-file
24357 @opindex dylib_file
24358 @opindex dylinker_install_name
24359 @opindex dynamic
24360 @opindex exported_symbols_list
24361 @opindex filelist
24362 @opindex flat_namespace
24363 @opindex force_flat_namespace
24364 @opindex headerpad_max_install_names
24365 @opindex image_base
24366 @opindex init
24367 @opindex install_name
24368 @opindex keep_private_externs
24369 @opindex multi_module
24370 @opindex multiply_defined
24371 @opindex multiply_defined_unused
24372 @opindex noall_load
24373 @opindex no_dead_strip_inits_and_terms
24374 @opindex nofixprebinding
24375 @opindex nomultidefs
24376 @opindex noprebind
24377 @opindex noseglinkedit
24378 @opindex pagezero_size
24379 @opindex prebind
24380 @opindex prebind_all_twolevel_modules
24381 @opindex private_bundle
24382 @opindex read_only_relocs
24383 @opindex sectalign
24384 @opindex sectobjectsymbols
24385 @opindex whyload
24386 @opindex seg1addr
24387 @opindex sectcreate
24388 @opindex sectobjectsymbols
24389 @opindex sectorder
24390 @opindex segaddr
24391 @opindex segs_read_only_addr
24392 @opindex segs_read_write_addr
24393 @opindex seg_addr_table
24394 @opindex seg_addr_table_filename
24395 @opindex seglinkedit
24396 @opindex segprot
24397 @opindex segs_read_only_addr
24398 @opindex segs_read_write_addr
24399 @opindex single_module
24400 @opindex static
24401 @opindex sub_library
24402 @opindex sub_umbrella
24403 @opindex twolevel_namespace
24404 @opindex umbrella
24405 @opindex undefined
24406 @opindex unexported_symbols_list
24407 @opindex weak_reference_mismatches
24408 @opindex whatsloaded
24409 @itemx -sub_umbrella
24410 @itemx -twolevel_namespace
24411 @itemx -umbrella
24412 @itemx -undefined
24413 @itemx -unexported_symbols_list
24414 @itemx -weak_reference_mismatches
24415 @itemx -whatsloaded
24416 These options are passed to the Darwin linker.  The Darwin linker man page
24417 describes them in detail.
24418 @end table
24420 @node DEC Alpha Options
24421 @subsection DEC Alpha Options
24423 These @samp{-m} options are defined for the DEC Alpha implementations:
24425 @table @gcctabopt
24426 @opindex mno-soft-float
24427 @opindex msoft-float
24428 @item -mno-soft-float
24429 @itemx -msoft-float
24430 Use (do not use) the hardware floating-point instructions for
24431 floating-point operations.  When @option{-msoft-float} is specified,
24432 functions in @file{libgcc.a} are used to perform floating-point
24433 operations.  Unless they are replaced by routines that emulate the
24434 floating-point operations, or compiled in such a way as to call such
24435 emulations routines, these routines issue floating-point
24436 operations.   If you are compiling for an Alpha without floating-point
24437 operations, you must ensure that the library is built so as not to call
24438 them.
24440 Note that Alpha implementations without floating-point operations are
24441 required to have floating-point registers.
24443 @opindex mfp-reg
24444 @opindex mno-fp-regs
24445 @item -mfp-reg
24446 @itemx -mno-fp-regs
24447 Generate code that uses (does not use) the floating-point register set.
24448 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
24449 register set is not used, floating-point operands are passed in integer
24450 registers as if they were integers and floating-point results are passed
24451 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
24452 so any function with a floating-point argument or return value called by code
24453 compiled with @option{-mno-fp-regs} must also be compiled with that
24454 option.
24456 A typical use of this option is building a kernel that does not use,
24457 and hence need not save and restore, any floating-point registers.
24459 @opindex mieee
24460 @item -mieee
24461 The Alpha architecture implements floating-point hardware optimized for
24462 maximum performance.  It is mostly compliant with the IEEE floating-point
24463 standard.  However, for full compliance, software assistance is
24464 required.  This option generates code fully IEEE-compliant code
24465 @emph{except} that the @var{inexact-flag} is not maintained (see below).
24466 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
24467 defined during compilation.  The resulting code is less efficient but is
24468 able to correctly support denormalized numbers and exceptional IEEE
24469 values such as not-a-number and plus/minus infinity.  Other Alpha
24470 compilers call this option @option{-ieee_with_no_inexact}.
24472 @opindex mieee-with-inexact
24473 @item -mieee-with-inexact
24474 This is like @option{-mieee} except the generated code also maintains
24475 the IEEE @var{inexact-flag}.  Turning on this option causes the
24476 generated code to implement fully-compliant IEEE math.  In addition to
24477 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
24478 macro.  On some Alpha implementations the resulting code may execute
24479 significantly slower than the code generated by default.  Since there is
24480 very little code that depends on the @var{inexact-flag}, you should
24481 normally not specify this option.  Other Alpha compilers call this
24482 option @option{-ieee_with_inexact}.
24484 @opindex mfp-trap-mode
24485 @item -mfp-trap-mode=@var{trap-mode}
24486 This option controls what floating-point related traps are enabled.
24487 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
24488 The trap mode can be set to one of four values:
24490 @table @samp
24491 @item n
24492 This is the default (normal) setting.  The only traps that are enabled
24493 are the ones that cannot be disabled in software (e.g., division by zero
24494 trap).
24496 @item u
24497 In addition to the traps enabled by @samp{n}, underflow traps are enabled
24498 as well.
24500 @item su
24501 Like @samp{u}, but the instructions are marked to be safe for software
24502 completion (see Alpha architecture manual for details).
24504 @item sui
24505 Like @samp{su}, but inexact traps are enabled as well.
24506 @end table
24508 @opindex mfp-rounding-mode
24509 @item -mfp-rounding-mode=@var{rounding-mode}
24510 Selects the IEEE rounding mode.  Other Alpha compilers call this option
24511 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
24514 @table @samp
24515 @item n
24516 Normal IEEE rounding mode.  Floating-point numbers are rounded towards
24517 the nearest machine number or towards the even machine number in case
24518 of a tie.
24520 @item m
24521 Round towards minus infinity.
24523 @item c
24524 Chopped rounding mode.  Floating-point numbers are rounded towards zero.
24526 @item d
24527 Dynamic rounding mode.  A field in the floating-point control register
24528 (@var{fpcr}, see Alpha architecture reference manual) controls the
24529 rounding mode in effect.  The C library initializes this register for
24530 rounding towards plus infinity.  Thus, unless your program modifies the
24531 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
24532 @end table
24534 @opindex mtrap-precision
24535 @item -mtrap-precision=@var{trap-precision}
24536 In the Alpha architecture, floating-point traps are imprecise.  This
24537 means without software assistance it is impossible to recover from a
24538 floating trap and program execution normally needs to be terminated.
24539 GCC can generate code that can assist operating system trap handlers
24540 in determining the exact location that caused a floating-point trap.
24541 Depending on the requirements of an application, different levels of
24542 precisions can be selected:
24544 @table @samp
24545 @item p
24546 Program precision.  This option is the default and means a trap handler
24547 can only identify which program caused a floating-point exception.
24549 @item f
24550 Function precision.  The trap handler can determine the function that
24551 caused a floating-point exception.
24553 @item i
24554 Instruction precision.  The trap handler can determine the exact
24555 instruction that caused a floating-point exception.
24556 @end table
24558 Other Alpha compilers provide the equivalent options called
24559 @option{-scope_safe} and @option{-resumption_safe}.
24561 @opindex mieee-conformant
24562 @item -mieee-conformant
24563 This option marks the generated code as IEEE conformant.  You must not
24564 use this option unless you also specify @option{-mtrap-precision=i} and either
24565 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
24566 is to emit the line @samp{.eflag 48} in the function prologue of the
24567 generated assembly file.
24569 @opindex mbuild-constants
24570 @item -mbuild-constants
24571 Normally GCC examines a 32- or 64-bit integer constant to
24572 see if it can construct it from smaller constants in two or three
24573 instructions.  If it cannot, it outputs the constant as a literal and
24574 generates code to load it from the data segment at run time.
24576 Use this option to require GCC to construct @emph{all} integer constants
24577 using code, even if it takes more instructions (the maximum is six).
24579 You typically use this option to build a shared library dynamic
24580 loader.  Itself a shared library, it must relocate itself in memory
24581 before it can find the variables and constants in its own data segment.
24583 @opindex mbwx
24584 @opindex mno-bwx
24585 @opindex mcix
24586 @opindex mno-cix
24587 @opindex mfix
24588 @opindex mno-fix
24589 @opindex mmax
24590 @opindex mno-max
24591 @item -mbwx
24592 @itemx -mno-bwx
24593 @itemx -mcix
24594 @itemx -mno-cix
24595 @itemx -mfix
24596 @itemx -mno-fix
24597 @itemx -mmax
24598 @itemx -mno-max
24599 Indicate whether GCC should generate code to use the optional BWX,
24600 CIX, FIX and MAX instruction sets.  The default is to use the instruction
24601 sets supported by the CPU type specified via @option{-mcpu=} option or that
24602 of the CPU on which GCC was built if none is specified.
24604 @opindex mfloat-vax
24605 @opindex mfloat-ieee
24606 @item -mfloat-vax
24607 @itemx -mfloat-ieee
24608 Generate code that uses (does not use) VAX F and G floating-point
24609 arithmetic instead of IEEE single and double precision.
24611 @opindex mexplicit-relocs
24612 @opindex mno-explicit-relocs
24613 @item -mexplicit-relocs
24614 @itemx -mno-explicit-relocs
24615 Older Alpha assemblers provided no way to generate symbol relocations
24616 except via assembler macros.  Use of these macros does not allow
24617 optimal instruction scheduling.  GNU binutils as of version 2.12
24618 supports a new syntax that allows the compiler to explicitly mark
24619 which relocations should apply to which instructions.  This option
24620 is mostly useful for debugging, as GCC detects the capabilities of
24621 the assembler when it is built and sets the default accordingly.
24623 @opindex msmall-data
24624 @opindex mlarge-data
24625 @item -msmall-data
24626 @itemx -mlarge-data
24627 When @option{-mexplicit-relocs} is in effect, static data is
24628 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
24629 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
24630 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
24631 16-bit relocations off of the @code{$gp} register.  This limits the
24632 size of the small data area to 64KB, but allows the variables to be
24633 directly accessed via a single instruction.
24635 The default is @option{-mlarge-data}.  With this option the data area
24636 is limited to just below 2GB@.  Programs that require more than 2GB of
24637 data must use @code{malloc} or @code{mmap} to allocate the data in the
24638 heap instead of in the program's data segment.
24640 When generating code for shared libraries, @option{-fpic} implies
24641 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
24643 @opindex msmall-text
24644 @opindex mlarge-text
24645 @item -msmall-text
24646 @itemx -mlarge-text
24647 When @option{-msmall-text} is used, the compiler assumes that the
24648 code of the entire program (or shared library) fits in 4MB, and is
24649 thus reachable with a branch instruction.  When @option{-msmall-data}
24650 is used, the compiler can assume that all local symbols share the
24651 same @code{$gp} value, and thus reduce the number of instructions
24652 required for a function call from 4 to 1.
24654 The default is @option{-mlarge-text}.
24656 @opindex mcpu
24657 @item -mcpu=@var{cpu_type}
24658 Set the instruction set and instruction scheduling parameters for
24659 machine type @var{cpu_type}.  You can specify either the @samp{EV}
24660 style name or the corresponding chip number.  GCC supports scheduling
24661 parameters for the EV4, EV5 and EV6 family of processors and
24662 chooses the default values for the instruction set from the processor
24663 you specify.  If you do not specify a processor type, GCC defaults
24664 to the processor on which the compiler was built.
24666 Supported values for @var{cpu_type} are
24668 @table @samp
24669 @item ev4
24670 @itemx ev45
24671 @itemx 21064
24672 Schedules as an EV4 and has no instruction set extensions.
24674 @item ev5
24675 @itemx 21164
24676 Schedules as an EV5 and has no instruction set extensions.
24678 @item ev56
24679 @itemx 21164a
24680 Schedules as an EV5 and supports the BWX extension.
24682 @item pca56
24683 @itemx 21164pc
24684 @itemx 21164PC
24685 Schedules as an EV5 and supports the BWX and MAX extensions.
24687 @item ev6
24688 @itemx 21264
24689 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
24691 @item ev67
24692 @itemx 21264a
24693 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
24694 @end table
24696 Native toolchains also support the value @samp{native},
24697 which selects the best architecture option for the host processor.
24698 @option{-mcpu=native} has no effect if GCC does not recognize
24699 the processor.
24701 @opindex mtune
24702 @item -mtune=@var{cpu_type}
24703 Set only the instruction scheduling parameters for machine type
24704 @var{cpu_type}.  The instruction set is not changed.
24706 Native toolchains also support the value @samp{native},
24707 which selects the best architecture option for the host processor.
24708 @option{-mtune=native} has no effect if GCC does not recognize
24709 the processor.
24711 @opindex mmemory-latency
24712 @item -mmemory-latency=@var{time}
24713 Sets the latency the scheduler should assume for typical memory
24714 references as seen by the application.  This number is highly
24715 dependent on the memory access patterns used by the application
24716 and the size of the external cache on the machine.
24718 Valid options for @var{time} are
24720 @table @samp
24721 @item @var{number}
24722 A decimal number representing clock cycles.
24724 @item L1
24725 @itemx L2
24726 @itemx L3
24727 @itemx main
24728 The compiler contains estimates of the number of clock cycles for
24729 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
24730 (also called Dcache, Scache, and Bcache), as well as to main memory.
24731 Note that L3 is only valid for EV5.
24733 @end table
24734 @end table
24736 @node eBPF Options
24737 @subsection eBPF Options
24738 @cindex eBPF Options
24740 @table @gcctabopt
24741 @item -mframe-limit=@var{bytes}
24742 This specifies the hard limit for frame sizes, in bytes.  Currently,
24743 the value that can be specified should be less than or equal to
24744 @samp{32767}.  Defaults to whatever limit is imposed by the version of
24745 the Linux kernel targeted.
24747 @opindex mbig-endian
24748 @item -mbig-endian
24749 Generate code for a big-endian target.
24751 @opindex mlittle-endian
24752 @item -mlittle-endian
24753 Generate code for a little-endian target.  This is the default.
24755 @opindex mjmpext
24756 @item -mjmpext
24757 @itemx -mno-jmpext
24758 Enable or disable generation of extra conditional-branch instructions.
24759 Enabled for CPU v2 and above.
24761 @opindex mjmp32
24762 @item -mjmp32
24763 @itemx -mno-jmp32
24764 Enable or disable generation of 32-bit jump instructions.
24765 Enabled for CPU v3 and above.
24767 @opindex malu32
24768 @item -malu32
24769 @itemx -mno-alu32
24770 Enable or disable generation of 32-bit ALU instructions.
24771 Enabled for CPU v3 and above.
24773 @opindex mv3-atomics
24774 @item -mv3-atomics
24775 @itemx -mno-v3-atomics
24776 Enable or disable instructions for general atomic operations introduced
24777 in CPU v3.  Enabled for CPU v3 and above.
24779 @opindex mbswap
24780 @item -mbswap
24781 @itemx -mno-bswap
24782 Enable or disable byte swap instructions.  Enabled for CPU v4 and above.
24784 @opindex msdiv
24785 @item -msdiv
24786 @itemx -mno-sdiv
24787 Enable or disable signed division and modulus instructions.  Enabled for
24788 CPU v4 and above.
24790 @opindex msmov
24791 @item -msmov
24792 @itemx -mno-smov
24793 Enable or disable sign-extending move and memory load instructions.
24794 Enabled for CPU v4 and above.
24796 @opindex mcpu
24797 @item -mcpu=@var{version}
24798 This specifies which version of the eBPF ISA to target. Newer versions
24799 may not be supported by all kernels. The default is @samp{v4}.
24801 Supported values for @var{version} are:
24803 @table @samp
24804 @item v1
24805 The first stable eBPF ISA with no special features or extensions.
24807 @item v2
24808 Supports the jump extensions, as in @option{-mjmpext}.
24810 @item v3
24811 All features of v2, plus:
24812 @itemize @minus
24813 @item 32-bit jump operations, as in @option{-mjmp32}
24814 @item 32-bit ALU operations, as in @option{-malu32}
24815 @item general atomic operations, as in @option{-mv3-atomics}
24816 @end itemize
24818 @item v4
24819 All features of v3, plus:
24820 @itemize @minus
24821 @item Byte swap instructions, as in @option{-mbswap}
24822 @item Signed division and modulus instructions, as in @option{-msdiv}
24823 @item Sign-extending move and memory load instructions, as in @option{-msmov}
24824 @end itemize
24825 @end table
24827 @opindex mco-re
24828 @item -mco-re
24829 Enable BPF Compile Once - Run Everywhere (CO-RE) support. Requires and
24830 is implied by @option{-gbtf}.
24832 @opindex mno-co-re
24833 @item -mno-co-re
24834 Disable BPF Compile Once - Run Everywhere (CO-RE) support. BPF CO-RE
24835 support is enabled by default when generating BTF debug information for
24836 the BPF target.
24838 @item -mxbpf
24839 Generate code for an expanded version of BPF, which relaxes some of
24840 the restrictions imposed by the BPF architecture:
24841 @itemize @minus
24842 @item Save and restore callee-saved registers at function entry and
24843 exit, respectively.
24844 @end itemize
24846 @opindex masm=@var{dialect}
24847 @item -masm=@var{dialect}
24848 Outputs assembly instructions using eBPF selected @var{dialect}.  The default
24849 is @samp{normal}.
24851 Supported values for @var{dialect} are:
24853 @table @samp
24854 @item normal
24855 Outputs normal assembly dialect.
24857 @item pseudoc
24858 Outputs pseudo-c assembly dialect.
24860 @end table
24862 @end table
24864 @node FR30 Options
24865 @subsection FR30 Options
24866 @cindex FR30 Options
24868 These options are defined specifically for the FR30 port.
24870 @table @gcctabopt
24872 @opindex msmall-model
24873 @item -msmall-model
24874 Use the small address space model.  This can produce smaller code, but
24875 it does assume that all symbolic values and addresses fit into a
24876 20-bit range.
24878 @opindex mno-lsim
24879 @item -mno-lsim
24880 Assume that runtime support has been provided and so there is no need
24881 to include the simulator library (@file{libsim.a}) on the linker
24882 command line.
24884 @end table
24886 @node FT32 Options
24887 @subsection FT32 Options
24888 @cindex FT32 Options
24890 These options are defined specifically for the FT32 port.
24892 @table @gcctabopt
24894 @opindex msim
24895 @item -msim
24896 Specifies that the program will be run on the simulator.  This causes
24897 an alternate runtime startup and library to be linked.
24898 You must not use this option when generating programs that will run on
24899 real hardware; you must provide your own runtime library for whatever
24900 I/O functions are needed.
24902 @opindex mlra
24903 @item -mlra
24904 Enable Local Register Allocation.  This is still experimental for FT32,
24905 so by default the compiler uses standard reload.
24907 @opindex mnodiv
24908 @item -mnodiv
24909 Do not use div and mod instructions.
24911 @opindex mft32b
24912 @item -mft32b
24913 Enable use of the extended instructions of the FT32B processor.
24915 @opindex mcompress
24916 @item -mcompress
24917 Compress all code using the Ft32B code compression scheme.
24919 @opindex  mnopm
24920 @item -mnopm
24921 Do not generate code that reads program memory.
24923 @end table
24925 @node FRV Options
24926 @subsection FRV Options
24927 @cindex FRV Options
24929 @table @gcctabopt
24930 @opindex mgpr-32
24931 @item -mgpr-32
24933 Only use the first 32 general-purpose registers.
24935 @opindex mgpr-64
24936 @item -mgpr-64
24938 Use all 64 general-purpose registers.
24940 @opindex mfpr-32
24941 @item -mfpr-32
24943 Use only the first 32 floating-point registers.
24945 @opindex mfpr-64
24946 @item -mfpr-64
24948 Use all 64 floating-point registers.
24950 @opindex mhard-float
24951 @item -mhard-float
24953 Use hardware instructions for floating-point operations.
24955 @opindex msoft-float
24956 @item -msoft-float
24958 Use library routines for floating-point operations.
24960 @opindex malloc-cc
24961 @item -malloc-cc
24963 Dynamically allocate condition code registers.
24965 @opindex mfixed-cc
24966 @item -mfixed-cc
24968 Do not try to dynamically allocate condition code registers, only
24969 use @code{icc0} and @code{fcc0}.
24971 @opindex mdword
24972 @item -mdword
24974 Change ABI to use double word insns.
24976 @opindex mno-dword
24977 @opindex mdword
24978 @item -mno-dword
24980 Do not use double word instructions.
24982 @opindex mdouble
24983 @item -mdouble
24985 Use floating-point double instructions.
24987 @opindex mno-double
24988 @item -mno-double
24990 Do not use floating-point double instructions.
24992 @opindex mmedia
24993 @item -mmedia
24995 Use media instructions.
24997 @opindex mno-media
24998 @item -mno-media
25000 Do not use media instructions.
25002 @opindex mmuladd
25003 @item -mmuladd
25005 Use multiply and add/subtract instructions.
25007 @opindex mno-muladd
25008 @item -mno-muladd
25010 Do not use multiply and add/subtract instructions.
25012 @opindex mfdpic
25013 @item -mfdpic
25015 Select the FDPIC ABI, which uses function descriptors to represent
25016 pointers to functions.  Without any PIC/PIE-related options, it
25017 implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
25018 assumes GOT entries and small data are within a 12-bit range from the
25019 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
25020 are computed with 32 bits.
25021 With a @samp{bfin-elf} target, this option implies @option{-msim}.
25023 @opindex minline-plt
25024 @item -minline-plt
25026 Enable inlining of PLT entries in function calls to functions that are
25027 not known to bind locally.  It has no effect without @option{-mfdpic}.
25028 It's enabled by default if optimizing for speed and compiling for
25029 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
25030 optimization option such as @option{-O3} or above is present in the
25031 command line.
25033 @opindex mTLS
25034 @item -mTLS
25036 Assume a large TLS segment when generating thread-local code.
25038 @opindex mtls
25039 @item -mtls
25041 Do not assume a large TLS segment when generating thread-local code.
25043 @opindex mgprel-ro
25044 @item -mgprel-ro
25046 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
25047 that is known to be in read-only sections.  It's enabled by default,
25048 except for @option{-fpic} or @option{-fpie}: even though it may help
25049 make the global offset table smaller, it trades 1 instruction for 4.
25050 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
25051 one of which may be shared by multiple symbols, and it avoids the need
25052 for a GOT entry for the referenced symbol, so it's more likely to be a
25053 win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
25055 @opindex multilib-library-pic
25056 @item -multilib-library-pic
25058 Link with the (library, not FD) pic libraries.  It's implied by
25059 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
25060 @option{-fpic} without @option{-mfdpic}.  You should never have to use
25061 it explicitly.
25063 @opindex mlinked-fp
25064 @item -mlinked-fp
25066 Follow the EABI requirement of always creating a frame pointer whenever
25067 a stack frame is allocated.  This option is enabled by default and can
25068 be disabled with @option{-mno-linked-fp}.
25070 @opindex mlong-calls
25071 @item -mlong-calls
25073 Use indirect addressing to call functions outside the current
25074 compilation unit.  This allows the functions to be placed anywhere
25075 within the 32-bit address space.
25077 @opindex malign-labels
25078 @item -malign-labels
25080 Try to align labels to an 8-byte boundary by inserting NOPs into the
25081 previous packet.  This option only has an effect when VLIW packing
25082 is enabled.  It doesn't create new packets; it merely adds NOPs to
25083 existing ones.
25085 @opindex mlibrary-pic
25086 @item -mlibrary-pic
25088 Generate position-independent EABI code.
25090 @opindex macc-4
25091 @item -macc-4
25093 Use only the first four media accumulator registers.
25095 @opindex macc-8
25096 @item -macc-8
25098 Use all eight media accumulator registers.
25100 @opindex mpack
25101 @item -mpack
25103 Pack VLIW instructions.
25105 @opindex mno-pack
25106 @item -mno-pack
25108 Do not pack VLIW instructions.
25110 @opindex mno-eflags
25111 @item -mno-eflags
25113 Do not mark ABI switches in e_flags.
25115 @opindex mcond-move
25116 @item -mcond-move
25118 Enable the use of conditional-move instructions (default).
25120 This switch is mainly for debugging the compiler and will likely be removed
25121 in a future version.
25123 @opindex mno-cond-move
25124 @item -mno-cond-move
25126 Disable the use of conditional-move instructions.
25128 This switch is mainly for debugging the compiler and will likely be removed
25129 in a future version.
25131 @opindex mscc
25132 @item -mscc
25134 Enable the use of conditional set instructions (default).
25136 This switch is mainly for debugging the compiler and will likely be removed
25137 in a future version.
25139 @opindex mno-scc
25140 @item -mno-scc
25142 Disable the use of conditional set instructions.
25144 This switch is mainly for debugging the compiler and will likely be removed
25145 in a future version.
25147 @opindex mcond-exec
25148 @item -mcond-exec
25150 Enable the use of conditional execution (default).
25152 This switch is mainly for debugging the compiler and will likely be removed
25153 in a future version.
25155 @opindex mno-cond-exec
25156 @item -mno-cond-exec
25158 Disable the use of conditional execution.
25160 This switch is mainly for debugging the compiler and will likely be removed
25161 in a future version.
25163 @opindex mvliw-branch
25164 @item -mvliw-branch
25166 Run a pass to pack branches into VLIW instructions (default).
25168 This switch is mainly for debugging the compiler and will likely be removed
25169 in a future version.
25171 @opindex mno-vliw-branch
25172 @item -mno-vliw-branch
25174 Do not run a pass to pack branches into VLIW instructions.
25176 This switch is mainly for debugging the compiler and will likely be removed
25177 in a future version.
25179 @opindex mmulti-cond-exec
25180 @item -mmulti-cond-exec
25182 Enable optimization of @code{&&} and @code{||} in conditional execution
25183 (default).
25185 This switch is mainly for debugging the compiler and will likely be removed
25186 in a future version.
25188 @opindex mno-multi-cond-exec
25189 @item -mno-multi-cond-exec
25191 Disable optimization of @code{&&} and @code{||} in conditional execution.
25193 This switch is mainly for debugging the compiler and will likely be removed
25194 in a future version.
25196 @opindex mnested-cond-exec
25197 @item -mnested-cond-exec
25199 Enable nested conditional execution optimizations (default).
25201 This switch is mainly for debugging the compiler and will likely be removed
25202 in a future version.
25204 @opindex mno-nested-cond-exec
25205 @item -mno-nested-cond-exec
25207 Disable nested conditional execution optimizations.
25209 This switch is mainly for debugging the compiler and will likely be removed
25210 in a future version.
25212 @opindex moptimize-membar
25213 @item -moptimize-membar
25215 This switch removes redundant @code{membar} instructions from the
25216 compiler-generated code.  It is enabled by default.
25218 @opindex mno-optimize-membar
25219 @opindex moptimize-membar
25220 @item -mno-optimize-membar
25222 This switch disables the automatic removal of redundant @code{membar}
25223 instructions from the generated code.
25225 @opindex mtomcat-stats
25226 @item -mtomcat-stats
25228 Cause gas to print out tomcat statistics.
25230 @opindex mcpu
25231 @item -mcpu=@var{cpu}
25233 Select the processor type for which to generate code.  Possible values are
25234 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
25235 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
25237 @end table
25239 @node GNU/Linux Options
25240 @subsection GNU/Linux Options
25242 These @samp{-m} options are defined for GNU/Linux targets:
25244 @table @gcctabopt
25245 @opindex mglibc
25246 @item -mglibc
25247 Use the GNU C library.  This is the default except
25248 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
25249 @samp{*-*-linux-*android*} targets.
25251 @opindex muclibc
25252 @item -muclibc
25253 Use uClibc C library.  This is the default on
25254 @samp{*-*-linux-*uclibc*} targets.
25256 @opindex mmusl
25257 @item -mmusl
25258 Use the musl C library.  This is the default on
25259 @samp{*-*-linux-*musl*} targets.
25261 @opindex mbionic
25262 @item -mbionic
25263 Use Bionic C library.  This is the default on
25264 @samp{*-*-linux-*android*} targets.
25266 @opindex mandroid
25267 @item -mandroid
25268 Compile code compatible with Android platform.  This is the default on
25269 @samp{*-*-linux-*android*} targets.
25271 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
25272 @option{-fno-exceptions} and @option{-fno-rtti} by default.  When linking,
25273 this option makes the GCC driver pass Android-specific options to the linker.
25274 Finally, this option causes the preprocessor macro @code{__ANDROID__}
25275 to be defined.
25277 @opindex tno-android-cc
25278 @item -tno-android-cc
25279 Disable compilation effects of @option{-mandroid}, i.e., do not enable
25280 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
25281 @option{-fno-rtti} by default.
25283 @opindex tno-android-ld
25284 @item -tno-android-ld
25285 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
25286 linking options to the linker.
25288 @end table
25290 @node H8/300 Options
25291 @subsection H8/300 Options
25293 These @samp{-m} options are defined for the H8/300 implementations:
25295 @table @gcctabopt
25296 @opindex mrelax
25297 @item -mrelax
25298 Shorten some address references at link time, when possible; uses the
25299 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
25300 ld, Using ld}, for a fuller description.
25302 @opindex mh
25303 @item -mh
25304 Generate code for the H8/300H@.
25306 @opindex ms
25307 @item -ms
25308 Generate code for the H8S@.
25310 @opindex mn
25311 @item -mn
25312 Generate code for the H8S and H8/300H in the normal mode.  This switch
25313 must be used either with @option{-mh} or @option{-ms}.
25315 @opindex ms2600
25316 @item -ms2600
25317 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
25319 @opindex mexr
25320 @item -mexr
25321 Extended registers are stored on stack before execution of function
25322 with monitor attribute. Default option is @option{-mexr}.
25323 This option is valid only for H8S targets.
25325 @opindex mno-exr
25326 @opindex mexr
25327 @item -mno-exr
25328 Extended registers are not stored on stack before execution of function 
25329 with monitor attribute. Default option is @option{-mno-exr}. 
25330 This option is valid only for H8S targets.
25332 @opindex mint32
25333 @item -mint32
25334 Make @code{int} data 32 bits by default.
25336 @opindex malign-300
25337 @item -malign-300
25338 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
25339 The default for the H8/300H and H8S is to align longs and floats on
25340 4-byte boundaries.
25341 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
25342 This option has no effect on the H8/300.
25343 @end table
25345 @node HPPA Options
25346 @subsection HPPA Options
25347 @cindex HPPA Options
25349 These @samp{-m} options are defined for the HPPA family of computers:
25351 @table @gcctabopt
25352 @opindex march
25353 @item -march=@var{architecture-type}
25354 Generate code for the specified architecture.  The choices for
25355 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
25356 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
25357 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
25358 architecture option for your machine.  Code compiled for lower numbered
25359 architectures runs on higher numbered architectures, but not the
25360 other way around.
25362 @opindex mpa-risc-1-0
25363 @opindex mpa-risc-1-1
25364 @opindex mpa-risc-2-0
25365 @item -mpa-risc-1-0
25366 @itemx -mpa-risc-1-1
25367 @itemx -mpa-risc-2-0
25368 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
25370 @opindex matomic-libcalls
25371 @opindex mno-atomic-libcalls
25372 @item -matomic-libcalls
25373 Generate libcalls for atomic loads and stores when sync libcalls are disabled.
25374 This option is enabled by default.  It only affects the generation of
25375 atomic libcalls by the HPPA backend.
25377 Both the sync and @file{libatomic} libcall implementations use locking.
25378 As a result, processor stores are not atomic with respect to other
25379 atomic operations.  Processor loads up to DImode are atomic with
25380 respect to other atomic operations provided they are implemented as
25381 a single access.
25383 The PA-RISC architecture does not support any atomic operations in
25384 hardware except for the @code{ldcw} instruction.  Thus, all atomic
25385 support is implemented using sync and atomic libcalls.  Sync libcall
25386 support is in @file{libgcc.a}.  Atomic libcall support is in
25387 @file{libatomic}.
25389 This option generates @code{__atomic_exchange} calls for atomic stores.
25390 It also provides special handling for atomic DImode accesses on 32-bit
25391 targets.
25393 @opindex mbig-switch
25394 @item -mbig-switch
25395 Does nothing.  Preserved for backward compatibility.
25397 @opindex mcaller-copies
25398 @item -mcaller-copies
25399 The caller copies function arguments passed by hidden reference.  This
25400 option should be used with care as it is not compatible with the default
25401 32-bit runtime.  However, only aggregates larger than eight bytes are
25402 passed by hidden reference and the option provides better compatibility
25403 with OpenMP.
25405 @opindex mcoherent-ldcw
25406 @item -mcoherent-ldcw
25407 Use ldcw/ldcd coherent cache-control hint.
25409 @opindex mdisable-fpregs
25410 @item -mdisable-fpregs
25411 Disable floating-point registers.  Equivalent to @code{-msoft-float}.
25413 @opindex mdisable-indexing
25414 @item -mdisable-indexing
25415 Prevent the compiler from using indexing address modes.  This avoids some
25416 rather obscure problems when compiling MIG generated code under MACH@.
25418 @opindex mfast-indirect-calls
25419 @item -mfast-indirect-calls
25420 Generate code that assumes calls never cross space boundaries.  This
25421 allows GCC to emit code that performs faster indirect calls.
25423 This option does not work in the presence of shared libraries or nested
25424 functions.
25426 @opindex mfixed-range
25427 @item -mfixed-range=@var{register-range}
25428 Generate code treating the given register range as fixed registers.
25429 A fixed register is one that the register allocator cannot use.  This is
25430 useful when compiling kernel code.  A register range is specified as
25431 two registers separated by a dash.  Multiple register ranges can be
25432 specified separated by a comma.
25434 @opindex mgas
25435 @item -mgas
25436 Enable the use of assembler directives only GAS understands.
25438 @opindex mgnu-ld
25439 @item -mgnu-ld
25440 Use options specific to GNU @command{ld}.
25441 This passes @option{-shared} to @command{ld} when
25442 building a shared library.  It is the default when GCC is configured,
25443 explicitly or implicitly, with the GNU linker.  This option does not
25444 affect which @command{ld} is called; it only changes what parameters
25445 are passed to that @command{ld}.
25446 The @command{ld} that is called is determined by the
25447 @option{--with-ld} configure option, GCC's program search path, and
25448 finally by the user's @env{PATH}.  The linker used by GCC can be printed
25449 using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
25450 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25452 @opindex mhp-ld
25453 @item -mhp-ld
25454 Use options specific to HP @command{ld}.
25455 This passes @option{-b} to @command{ld} when building
25456 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
25457 links.  It is the default when GCC is configured, explicitly or
25458 implicitly, with the HP linker.  This option does not affect
25459 which @command{ld} is called; it only changes what parameters are passed to that
25460 @command{ld}.
25461 The @command{ld} that is called is determined by the @option{--with-ld}
25462 configure option, GCC's program search path, and finally by the user's
25463 @env{PATH}.  The linker used by GCC can be printed using @samp{which
25464 `gcc -print-prog-name=ld`}.  This option is only available on the 64-bit
25465 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
25467 @opindex mlinker-opt
25468 @item -mlinker-opt
25469 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
25470 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
25471 linkers in which they give bogus error messages when linking some programs.
25473 @opindex mno-long-calls
25474 @opindex mlong-calls
25475 @item -mlong-calls
25476 Generate code that uses long call sequences.  This ensures that a call
25477 is always able to reach linker generated stubs.  The default is to generate
25478 long calls only when the distance from the call site to the beginning
25479 of the function or translation unit, as the case may be, exceeds a
25480 predefined limit set by the branch type being used.  The limits for
25481 normal calls are 7,600,000 and 240,000 bytes, respectively for the
25482 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
25483 240,000 bytes.
25485 Distances are measured from the beginning of functions when using the
25486 @option{-ffunction-sections} option, or when using the @option{-mgas}
25487 and @option{-mno-portable-runtime} options together under HP-UX with
25488 the SOM linker.
25490 It is normally not desirable to use this option as it degrades
25491 performance.  However, it may be useful in large applications,
25492 particularly when partial linking is used to build the application.
25494 The types of long calls used depends on the capabilities of the
25495 assembler and linker, and the type of code being generated.  The
25496 impact on systems that support long absolute calls, and long pic
25497 symbol-difference or pc-relative calls should be relatively small.
25498 However, an indirect call is used on 32-bit ELF systems in pic code
25499 and it is quite long.
25501 @opindex mlong-load-store
25502 @item -mlong-load-store
25503 Generate 3-instruction load and store sequences as sometimes required by
25504 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
25505 the HP compilers.
25507 @opindex mjump-in-delay
25508 @item -mjump-in-delay
25509 This option is ignored and provided for compatibility purposes only.
25511 @opindex mno-space-regs
25512 @opindex mspace-regs
25513 @item -mno-space-regs
25514 Generate code that assumes the target has no space registers.  This allows
25515 GCC to generate faster indirect calls and use unscaled index address modes.
25517 Such code is suitable for level 0 PA systems and kernels.
25519 @opindex mordered
25520 @item -mordered
25521 Assume memory references are ordered and barriers are not needed.
25523 @opindex mportable-runtime
25524 @item -mportable-runtime
25525 Use the portable calling conventions proposed by HP for ELF systems.
25527 @opindex mschedule
25528 @item -mschedule=@var{cpu-type}
25529 Schedule code according to the constraints for the machine type
25530 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
25531 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
25532 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
25533 proper scheduling option for your machine.  The default scheduling is
25534 @samp{8000}.
25536 @opindex msio
25537 @item -msio
25538 Generate the predefine, @code{_SIO}, for server IO@.  The default is
25539 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
25540 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
25541 options are available under HP-UX and HI-UX@.
25543 @opindex msoft-float
25544 @item -msoft-float
25545 Generate output containing library calls for floating point.
25546 @strong{Warning:} the requisite libraries are not available for all HPPA
25547 targets.  Normally the facilities of the machine's usual C compiler are
25548 used, but this cannot be done directly in cross-compilation.  You must make
25549 your own arrangements to provide suitable library functions for
25550 cross-compilation.
25552 @option{-msoft-float} changes the calling convention in the output file;
25553 therefore, it is only useful if you compile @emph{all} of a program with
25554 this option.  In particular, you need to compile @file{libgcc.a}, the
25555 library that comes with GCC, with @option{-msoft-float} in order for
25556 this to work.
25558 @opindex msoft-mult
25559 @item -msoft-mult
25560 Use software integer multiplication.
25562 This disables the use of the @code{xmpyu} instruction.
25564 @opindex march
25565 @item -munix=@var{unix-std}
25566 Generate compiler predefines and select a startfile for the specified
25567 UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
25568 and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
25569 is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
25570 11.11 and later.  The default values are @samp{93} for HP-UX 10.00,
25571 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
25572 and later.
25574 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
25575 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
25576 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
25577 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
25578 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
25579 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
25581 It is @emph{important} to note that this option changes the interfaces
25582 for various library routines.  It also affects the operational behavior
25583 of the C library.  Thus, @emph{extreme} care is needed in using this
25584 option.
25586 Library code that is intended to operate with more than one UNIX
25587 standard must test, set and restore the variable @code{__xpg4_extended_mask}
25588 as appropriate.  Most GNU software doesn't provide this capability.
25590 @opindex nolibdld
25591 @item -nolibdld
25592 Suppress the generation of link options to search libdld.sl when the
25593 @option{-static} option is specified on HP-UX 10 and later.
25595 @opindex static
25596 @item -static
25597 The HP-UX implementation of setlocale in libc has a dependency on
25598 libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
25599 when the @option{-static} option is specified, special link options
25600 are needed to resolve this dependency.
25602 On HP-UX 10 and later, the GCC driver adds the necessary options to
25603 link with libdld.sl when the @option{-static} option is specified.
25604 This causes the resulting binary to be dynamic.  On the 64-bit port,
25605 the linkers generate dynamic binaries by default in any case.  The
25606 @option{-nolibdld} option can be used to prevent the GCC driver from
25607 adding these link options.
25609 @opindex threads
25610 @item -threads
25611 Add support for multithreading with the @dfn{dce thread} library
25612 under HP-UX@.  This option sets flags for both the preprocessor and
25613 linker.
25614 @end table
25616 @node IA-64 Options
25617 @subsection IA-64 Options
25618 @cindex IA-64 Options
25620 These are the @samp{-m} options defined for the Intel IA-64 architecture.
25622 @table @gcctabopt
25623 @opindex mbig-endian
25624 @item -mbig-endian
25625 Generate code for a big-endian target.  This is the default for HP-UX@.
25627 @opindex mlittle-endian
25628 @item -mlittle-endian
25629 Generate code for a little-endian target.  This is the default for AIX5
25630 and GNU/Linux.
25632 @opindex mgnu-as
25633 @opindex mno-gnu-as
25634 @item -mgnu-as
25635 @itemx -mno-gnu-as
25636 Generate (or don't) code for the GNU assembler.  This is the default.
25637 @c Also, this is the default if the configure option @option{--with-gnu-as}
25638 @c is used.
25640 @opindex mgnu-ld
25641 @opindex mno-gnu-ld
25642 @item -mgnu-ld
25643 @itemx -mno-gnu-ld
25644 Generate (or don't) code for the GNU linker.  This is the default.
25645 @c Also, this is the default if the configure option @option{--with-gnu-ld}
25646 @c is used.
25648 @opindex mno-pic
25649 @item -mno-pic
25650 Generate code that does not use a global pointer register.  The result
25651 is not position independent code, and violates the IA-64 ABI@.
25653 @opindex mvolatile-asm-stop
25654 @opindex mno-volatile-asm-stop
25655 @item -mvolatile-asm-stop
25656 @itemx -mno-volatile-asm-stop
25657 Generate (or don't) a stop bit immediately before and after volatile asm
25658 statements.
25660 @opindex mregister-names
25661 @opindex mno-register-names
25662 @item -mregister-names
25663 @itemx -mno-register-names
25664 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
25665 the stacked registers.  This may make assembler output more readable.
25667 @opindex mno-sdata
25668 @opindex msdata
25669 @item -mno-sdata
25670 @itemx -msdata
25671 Disable (or enable) optimizations that use the small data section.  This may
25672 be useful for working around optimizer bugs.
25674 @opindex mconstant-gp
25675 @item -mconstant-gp
25676 Generate code that uses a single constant global pointer value.  This is
25677 useful when compiling kernel code.
25679 @opindex mauto-pic
25680 @item -mauto-pic
25681 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
25682 This is useful when compiling firmware code.
25684 @opindex minline-float-divide-min-latency
25685 @item -minline-float-divide-min-latency
25686 Generate code for inline divides of floating-point values
25687 using the minimum latency algorithm.
25689 @opindex minline-float-divide-max-throughput
25690 @item -minline-float-divide-max-throughput
25691 Generate code for inline divides of floating-point values
25692 using the maximum throughput algorithm.
25694 @opindex mno-inline-float-divide
25695 @item -mno-inline-float-divide
25696 Do not generate inline code for divides of floating-point values.
25698 @opindex minline-int-divide-min-latency
25699 @item -minline-int-divide-min-latency
25700 Generate code for inline divides of integer values
25701 using the minimum latency algorithm.
25703 @opindex minline-int-divide-max-throughput
25704 @item -minline-int-divide-max-throughput
25705 Generate code for inline divides of integer values
25706 using the maximum throughput algorithm.
25708 @opindex mno-inline-int-divide
25709 @opindex minline-int-divide
25710 @item -mno-inline-int-divide
25711 Do not generate inline code for divides of integer values.
25713 @opindex minline-sqrt-min-latency
25714 @item -minline-sqrt-min-latency
25715 Generate code for inline square roots
25716 using the minimum latency algorithm.
25718 @opindex minline-sqrt-max-throughput
25719 @item -minline-sqrt-max-throughput
25720 Generate code for inline square roots
25721 using the maximum throughput algorithm.
25723 @opindex mno-inline-sqrt
25724 @item -mno-inline-sqrt
25725 Do not generate inline code for @code{sqrt}.
25727 @opindex mfused-madd
25728 @opindex mno-fused-madd
25729 @item -mfused-madd
25730 @itemx -mno-fused-madd
25731 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
25732 instructions.  The default is to use these instructions.
25734 @opindex mno-dwarf2-asm
25735 @opindex mdwarf2-asm
25736 @item -mno-dwarf2-asm
25737 @itemx -mdwarf2-asm
25738 Don't (or do) generate assembler code for the DWARF line number debugging
25739 info.  This may be useful when not using the GNU assembler.
25741 @opindex mearly-stop-bits
25742 @opindex mno-early-stop-bits
25743 @item -mearly-stop-bits
25744 @itemx -mno-early-stop-bits
25745 Allow stop bits to be placed earlier than immediately preceding the
25746 instruction that triggered the stop bit.  This can improve instruction
25747 scheduling, but does not always do so.
25749 @opindex mfixed-range
25750 @item -mfixed-range=@var{register-range}
25751 Generate code treating the given register range as fixed registers.
25752 A fixed register is one that the register allocator cannot use.  This is
25753 useful when compiling kernel code.  A register range is specified as
25754 two registers separated by a dash.  Multiple register ranges can be
25755 specified separated by a comma.
25757 @opindex mtls-size
25758 @item -mtls-size=@var{tls-size}
25759 Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
25762 @opindex mtune
25763 @item -mtune=@var{cpu-type}
25764 Tune the instruction scheduling for a particular CPU, Valid values are
25765 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
25766 and @samp{mckinley}.
25768 @opindex milp32
25769 @opindex mlp64
25770 @item -milp32
25771 @itemx -mlp64
25772 Generate code for a 32-bit or 64-bit environment.
25773 The 32-bit environment sets int, long and pointer to 32 bits.
25774 The 64-bit environment sets int to 32 bits and long and pointer
25775 to 64 bits.  These are HP-UX specific flags.
25777 @opindex mno-sched-br-data-spec
25778 @opindex msched-br-data-spec
25779 @item -mno-sched-br-data-spec
25780 @itemx -msched-br-data-spec
25781 (Dis/En)able data speculative scheduling before reload.
25782 This results in generation of @code{ld.a} instructions and
25783 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25784 The default setting is disabled.
25786 @opindex msched-ar-data-spec
25787 @opindex mno-sched-ar-data-spec
25788 @item -msched-ar-data-spec
25789 @itemx -mno-sched-ar-data-spec
25790 (En/Dis)able data speculative scheduling after reload.
25791 This results in generation of @code{ld.a} instructions and
25792 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
25793 The default setting is enabled.
25795 @opindex mno-sched-control-spec
25796 @opindex msched-control-spec
25797 @item -mno-sched-control-spec
25798 @itemx -msched-control-spec
25799 (Dis/En)able control speculative scheduling.  This feature is
25800 available only during region scheduling (i.e.@: before reload).
25801 This results in generation of the @code{ld.s} instructions and
25802 the corresponding check instructions @code{chk.s}.
25803 The default setting is disabled.
25805 @opindex msched-br-in-data-spec
25806 @opindex mno-sched-br-in-data-spec
25807 @item -msched-br-in-data-spec
25808 @itemx -mno-sched-br-in-data-spec
25809 (En/Dis)able speculative scheduling of the instructions that
25810 are dependent on the data speculative loads before reload.
25811 This is effective only with @option{-msched-br-data-spec} enabled.
25812 The default setting is enabled.
25814 @opindex msched-ar-in-data-spec
25815 @opindex mno-sched-ar-in-data-spec
25816 @item -msched-ar-in-data-spec
25817 @itemx -mno-sched-ar-in-data-spec
25818 (En/Dis)able speculative scheduling of the instructions that
25819 are dependent on the data speculative loads after reload.
25820 This is effective only with @option{-msched-ar-data-spec} enabled.
25821 The default setting is enabled.
25823 @opindex msched-in-control-spec
25824 @opindex mno-sched-in-control-spec
25825 @item -msched-in-control-spec
25826 @itemx -mno-sched-in-control-spec
25827 (En/Dis)able speculative scheduling of the instructions that
25828 are dependent on the control speculative loads.
25829 This is effective only with @option{-msched-control-spec} enabled.
25830 The default setting is enabled.
25832 @opindex mno-sched-prefer-non-data-spec-insns
25833 @opindex msched-prefer-non-data-spec-insns
25834 @item -mno-sched-prefer-non-data-spec-insns
25835 @itemx -msched-prefer-non-data-spec-insns
25836 If enabled, data-speculative instructions are chosen for schedule
25837 only if there are no other choices at the moment.  This makes
25838 the use of the data speculation much more conservative.
25839 The default setting is disabled.
25841 @opindex mno-sched-prefer-non-control-spec-insns
25842 @opindex msched-prefer-non-control-spec-insns
25843 @item -mno-sched-prefer-non-control-spec-insns
25844 @itemx -msched-prefer-non-control-spec-insns
25845 If enabled, control-speculative instructions are chosen for schedule
25846 only if there are no other choices at the moment.  This makes
25847 the use of the control speculation much more conservative.
25848 The default setting is disabled.
25850 @opindex mno-sched-count-spec-in-critical-path
25851 @opindex msched-count-spec-in-critical-path
25852 @item -mno-sched-count-spec-in-critical-path
25853 @itemx -msched-count-spec-in-critical-path
25854 If enabled, speculative dependencies are considered during
25855 computation of the instructions priorities.  This makes the use of the
25856 speculation a bit more conservative.
25857 The default setting is disabled.
25859 @opindex msched-spec-ldc
25860 @item -msched-spec-ldc
25861 Use a simple data speculation check.  This option is on by default.
25863 @opindex msched-spec-ldc
25864 @item -msched-control-spec-ldc
25865 Use a simple check for control speculation.  This option is on by default.
25867 @opindex msched-stop-bits-after-every-cycle
25868 @item -msched-stop-bits-after-every-cycle
25869 Place a stop bit after every cycle when scheduling.  This option is on
25870 by default.
25872 @opindex msched-fp-mem-deps-zero-cost
25873 @item -msched-fp-mem-deps-zero-cost
25874 Assume that floating-point stores and loads are not likely to cause a conflict
25875 when placed into the same instruction group.  This option is disabled by
25876 default.
25878 @opindex msel-sched-dont-check-control-spec
25879 @item -msel-sched-dont-check-control-spec
25880 Generate checks for control speculation in selective scheduling.
25881 This flag is disabled by default.
25883 @opindex msched-max-memory-insns
25884 @item -msched-max-memory-insns=@var{max-insns}
25885 Limit on the number of memory insns per instruction group, giving lower
25886 priority to subsequent memory insns attempting to schedule in the same
25887 instruction group. Frequently useful to prevent cache bank conflicts.
25888 The default value is 1.
25890 @opindex msched-max-memory-insns-hard-limit
25891 @item -msched-max-memory-insns-hard-limit
25892 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
25893 disallowing more than that number in an instruction group.
25894 Otherwise, the limit is ``soft'', meaning that non-memory operations
25895 are preferred when the limit is reached, but memory operations may still
25896 be scheduled.
25898 @end table
25900 @node LM32 Options
25901 @subsection LM32 Options
25902 @cindex LM32 options
25904 These @option{-m} options are defined for the LatticeMico32 architecture:
25906 @table @gcctabopt
25907 @opindex mbarrel-shift-enabled
25908 @item -mbarrel-shift-enabled
25909 Enable barrel-shift instructions.
25911 @opindex mdivide-enabled
25912 @item -mdivide-enabled
25913 Enable divide and modulus instructions.
25915 @opindex multiply-enabled
25916 @item -mmultiply-enabled
25917 Enable multiply instructions.
25919 @opindex msign-extend-enabled
25920 @item -msign-extend-enabled
25921 Enable sign extend instructions.
25923 @opindex muser-enabled
25924 @item -muser-enabled
25925 Enable user-defined instructions.
25927 @end table
25929 @node LoongArch Options
25930 @subsection LoongArch Options
25931 @cindex LoongArch Options
25933 These command-line options are defined for LoongArch targets:
25935 @table @gcctabopt
25936 @opindex march
25937 @item -march=@var{cpu-type}
25938 Generate instructions for the machine type @var{cpu-type}.  In contrast to
25939 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
25940 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
25941 to generate code that may not run at all on processors other than the one
25942 indicated.  Specifying @option{-march=@var{cpu-type}} implies
25943 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
25945 The choices for @var{cpu-type} are:
25947 @table @samp
25948 @item native
25949 This selects the CPU to generate code for at compilation time by determining
25950 the processor type of the compiling machine.  Using @option{-march=native}
25951 enables all instruction subsets supported by the local machine (hence
25952 the result might not run on different machines).  Using @option{-mtune=native}
25953 produces code optimized for the local machine under the constraints
25954 of the selected instruction set.
25955 @item loongarch64
25956 A generic CPU with 64-bit extensions.
25957 @item la464
25958 LoongArch LA464 CPU with LBT, LSX, LASX, LVZ.
25959 @end table
25961 @opindex mtune
25962 @item -mtune=@var{cpu-type}
25963 Optimize the output for the given processor, specified by microarchitecture
25964 name.
25966 @opindex mabi
25967 @item -mabi=@var{base-abi-type}
25968 Generate code for the specified calling convention.
25969 @var{base-abi-type} can be one of:
25970 @table @samp
25971 @item lp64d
25972 Uses 64-bit general purpose registers and 32/64-bit floating-point
25973 registers for parameter passing.  Data model is LP64, where @samp{int}
25974 is 32 bits, while @samp{long int} and pointers are 64 bits.
25975 @item lp64f
25976 Uses 64-bit general purpose registers and 32-bit floating-point
25977 registers for parameter passing.  Data model is LP64, where @samp{int}
25978 is 32 bits, while @samp{long int} and pointers are 64 bits.
25979 @item lp64s
25980 Uses 64-bit general purpose registers and no floating-point
25981 registers for parameter passing.  Data model is LP64, where @samp{int}
25982 is 32 bits, while @samp{long int} and pointers are 64 bits.
25983 @end table
25985 @opindex mfpu
25986 @item -mfpu=@var{fpu-type}
25987 Generate code for the specified FPU type, which can be one of:
25988 @table @samp
25989 @item 64
25990 Allow the use of hardware floating-point instructions for 32-bit
25991 and 64-bit operations.
25992 @item 32
25993 Allow the use of hardware floating-point instructions for 32-bit
25994 operations.
25995 @item none
25996 @item 0
25997 Prevent the use of hardware floating-point instructions.
25998 @end table
26000 @opindex msoft-float
26001 @item -msoft-float
26002 Force @option{-mfpu=none} and prevents the use of floating-point
26003 registers for parameter passing.  This option may change the target
26004 ABI.
26006 @opindex msingle-float
26007 @item -msingle-float
26008 Force @option{-mfpu=32} and allow the use of 32-bit floating-point
26009 registers for parameter passing.  This option may change the target
26010 ABI.
26012 @opindex mdouble-float
26013 @item -mdouble-float
26014 Force @option{-mfpu=64} and allow the use of 32/64-bit floating-point
26015 registers for parameter passing.  This option may change the target
26016 ABI.
26018 @opindex mbranch-cost
26019 @item -mbranch-cost=@var{n}
26020 Set the cost of branches to roughly @var{n} instructions.
26022 @opindex mcheck-zero-division
26023 @item -mcheck-zero-division
26024 @itemx -mno-check-zero-divison
26025 Trap (do not trap) on integer division by zero.  The default is
26026 @option{-mcheck-zero-division} for @option{-O0} or @option{-Og}, and
26027 @option{-mno-check-zero-division} for other optimization levels.
26029 @opindex mcond-move-int
26030 @item -mcond-move-int
26031 @itemx -mno-cond-move-int
26032 Conditional moves for integral data in general-purpose registers
26033 are enabled (disabled).  The default is @option{-mcond-move-int}.
26035 @opindex mcond-move-float
26036 @item -mcond-move-float
26037 @itemx -mno-cond-move-float
26038 Conditional moves for floating-point registers are enabled (disabled).
26039 The default is @option{-mcond-move-float}.
26041 @opindex mmemcpy
26042 @item -mmemcpy
26043 @itemx -mno-memcpy
26044 Force (do not force) the use of @code{memcpy} for non-trivial block moves.
26045 The default is @option{-mno-memcpy}, which allows GCC to inline most
26046 constant-sized copies.  Setting optimization level to @option{-Os} also
26047 forces the use of @code{memcpy}, but @option{-mno-memcpy} may override this
26048 behavior if explicitly specified, regardless of the order these options on
26049 the command line.
26051 @opindex mstrict-align
26052 @item -mstrict-align
26053 @itemx -mno-strict-align
26054 Avoid or allow generating memory accesses that may not be aligned on a natural
26055 object boundary as described in the architecture specification. The default is
26056 @option{-mno-strict-align}.
26058 @opindex msmall-data-limit
26059 @item -msmall-data-limit=@var{number}
26060 Put global and static data smaller than @var{number} bytes into a special
26061 section (on some targets).  The default value is 0.
26063 @opindex mmax-inline-memcpy-size
26064 @item -mmax-inline-memcpy-size=@var{n}
26065 Inline all block moves (such as calls to @code{memcpy} or structure copies)
26066 less than or equal to @var{n} bytes.  The default value of @var{n} is 1024.
26068 @item -mcmodel=@var{code-model}
26069 Set the code model to one of:
26070 @table @samp
26071 @item tiny-static (Not implemented yet)
26072 @item tiny (Not implemented yet)
26074 @item normal
26075 The text segment must be within 128MB addressing space.  The data segment must
26076 be within 2GB addressing space.
26078 @item medium
26079 The text segment and data segment must be within 2GB addressing space.
26081 @item large (Not implemented yet)
26083 @item extreme
26084 This mode does not limit the size of the code segment and data segment.
26085 The @option{-mcmodel=extreme} option is incompatible with @option{-fplt} and
26086 @option{-mno-explicit-relocs}.
26087 @end table
26088 The default code model is @code{normal}.
26090 @opindex mexplicit-relocs
26091 @opindex mno-explicit-relocs
26092 @item -mexplicit-relocs
26093 @itemx -mno-explicit-relocs
26094 Use or do not use assembler relocation operators when dealing with symbolic
26095 addresses.  The alternative is to use assembler macros instead, which may
26096 limit optimization.  The default value for the option is determined during
26097 GCC build-time by detecting corresponding assembler support:
26098 @code{-mexplicit-relocs} if said support is present,
26099 @code{-mno-explicit-relocs} otherwise.  This option is mostly useful for
26100 debugging, or interoperation with assemblers different from the build-time
26101 one.
26103 @opindex mdirect-extern-access
26104 @item -mdirect-extern-access
26105 @itemx -mno-direct-extern-access
26106 Do not use or use GOT to access external symbols.  The default is
26107 @option{-mno-direct-extern-access}: GOT is used for external symbols with
26108 default visibility, but not used for other external symbols.
26110 With @option{-mdirect-extern-access}, GOT is not used and all external
26111 symbols are PC-relatively addressed.  It is @strong{only} suitable for
26112 environments where no dynamic link is performed, like firmwares, OS
26113 kernels, executables linked with @option{-static} or @option{-static-pie}.
26114 @option{-mdirect-extern-access} is not compatible with @option{-fPIC} or
26115 @option{-fpic}.
26116 @end table
26118 @node M32C Options
26119 @subsection M32C Options
26120 @cindex M32C options
26122 @table @gcctabopt
26123 @opindex mcpu=
26124 @item -mcpu=@var{name}
26125 Select the CPU for which code is generated.  @var{name} may be one of
26126 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
26127 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
26128 the M32C/80 series.
26130 @opindex msim
26131 @item -msim
26132 Specifies that the program will be run on the simulator.  This causes
26133 an alternate runtime library to be linked in which supports, for
26134 example, file I/O@.  You must not use this option when generating
26135 programs that will run on real hardware; you must provide your own
26136 runtime library for whatever I/O functions are needed.
26138 @opindex memregs=
26139 @item -memregs=@var{number}
26140 Specifies the number of memory-based pseudo-registers GCC uses
26141 during code generation.  These pseudo-registers are used like real
26142 registers, so there is a tradeoff between GCC's ability to fit the
26143 code into available registers, and the performance penalty of using
26144 memory instead of registers.  Note that all modules in a program must
26145 be compiled with the same value for this option.  Because of that, you
26146 must not use this option with GCC's default runtime libraries.
26148 @end table
26150 @node M32R/D Options
26151 @subsection M32R/D Options
26152 @cindex M32R/D options
26154 These @option{-m} options are defined for Renesas M32R/D architectures:
26156 @table @gcctabopt
26157 @opindex m32r2
26158 @item -m32r2
26159 Generate code for the M32R/2@.
26161 @opindex m32rx
26162 @item -m32rx
26163 Generate code for the M32R/X@.
26165 @opindex m32r
26166 @item -m32r
26167 Generate code for the M32R@.  This is the default.
26169 @opindex mmodel=small
26170 @item -mmodel=small
26171 Assume all objects live in the lower 16MB of memory (so that their addresses
26172 can be loaded with the @code{ld24} instruction), and assume all subroutines
26173 are reachable with the @code{bl} instruction.
26174 This is the default.
26176 The addressability of a particular object can be set with the
26177 @code{model} attribute.
26179 @opindex mmodel=medium
26180 @item -mmodel=medium
26181 Assume objects may be anywhere in the 32-bit address space (the compiler
26182 generates @code{seth/add3} instructions to load their addresses), and
26183 assume all subroutines are reachable with the @code{bl} instruction.
26185 @opindex mmodel=large
26186 @item -mmodel=large
26187 Assume objects may be anywhere in the 32-bit address space (the compiler
26188 generates @code{seth/add3} instructions to load their addresses), and
26189 assume subroutines may not be reachable with the @code{bl} instruction
26190 (the compiler generates the much slower @code{seth/add3/jl}
26191 instruction sequence).
26193 @opindex msdata=none
26194 @item -msdata=none
26195 Disable use of the small data area.  Variables are put into
26196 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
26197 @code{section} attribute has been specified).
26198 This is the default.
26200 The small data area consists of sections @code{.sdata} and @code{.sbss}.
26201 Objects may be explicitly put in the small data area with the
26202 @code{section} attribute using one of these sections.
26204 @opindex msdata=sdata
26205 @item -msdata=sdata
26206 Put small global and static data in the small data area, but do not
26207 generate special code to reference them.
26209 @opindex msdata=use
26210 @item -msdata=use
26211 Put small global and static data in the small data area, and generate
26212 special instructions to reference them.
26214 @opindex G
26215 @cindex smaller data references
26216 @item -G @var{num}
26217 Put global and static objects less than or equal to @var{num} bytes
26218 into the small data or BSS sections instead of the normal data or BSS
26219 sections.  The default value of @var{num} is 8.
26220 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
26221 for this option to have any effect.
26223 All modules should be compiled with the same @option{-G @var{num}} value.
26224 Compiling with different values of @var{num} may or may not work; if it
26225 doesn't the linker gives an error message---incorrect code is not
26226 generated.
26228 @opindex mdebug
26229 @item -mdebug
26230 Makes the M32R-specific code in the compiler display some statistics
26231 that might help in debugging programs.
26233 @opindex malign-loops
26234 @item -malign-loops
26235 Align all loops to a 32-byte boundary.
26237 @opindex mno-align-loops
26238 @item -mno-align-loops
26239 Do not enforce a 32-byte alignment for loops.  This is the default.
26241 @opindex missue-rate=@var{number}
26242 @item -missue-rate=@var{number}
26243 Issue @var{number} instructions per cycle.  @var{number} can only be 1
26244 or 2.
26246 @opindex mbranch-cost=@var{number}
26247 @item -mbranch-cost=@var{number}
26248 @var{number} can only be 1 or 2.  If it is 1 then branches are
26249 preferred over conditional code, if it is 2, then the opposite applies.
26251 @opindex mflush-trap=@var{number}
26252 @item -mflush-trap=@var{number}
26253 Specifies the trap number to use to flush the cache.  The default is
26254 12.  Valid numbers are between 0 and 15 inclusive.
26256 @opindex mno-flush-trap
26257 @item -mno-flush-trap
26258 Specifies that the cache cannot be flushed by using a trap.
26260 @opindex mflush-func=@var{name}
26261 @item -mflush-func=@var{name}
26262 Specifies the name of the operating system function to call to flush
26263 the cache.  The default is @samp{_flush_cache}, but a function call
26264 is only used if a trap is not available.
26266 @opindex mno-flush-func
26267 @item -mno-flush-func
26268 Indicates that there is no OS function for flushing the cache.
26270 @end table
26272 @node M680x0 Options
26273 @subsection M680x0 Options
26274 @cindex M680x0 options
26276 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
26277 The default settings depend on which architecture was selected when
26278 the compiler was configured; the defaults for the most common choices
26279 are given below.
26281 @table @gcctabopt
26282 @opindex march
26283 @item -march=@var{arch}
26284 Generate code for a specific M680x0 or ColdFire instruction set
26285 architecture.  Permissible values of @var{arch} for M680x0
26286 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
26287 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
26288 architectures are selected according to Freescale's ISA classification
26289 and the permissible values are: @samp{isaa}, @samp{isaaplus},
26290 @samp{isab} and @samp{isac}.
26292 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
26293 code for a ColdFire target.  The @var{arch} in this macro is one of the
26294 @option{-march} arguments given above.
26296 When used together, @option{-march} and @option{-mtune} select code
26297 that runs on a family of similar processors but that is optimized
26298 for a particular microarchitecture.
26300 @opindex mcpu
26301 @item -mcpu=@var{cpu}
26302 Generate code for a specific M680x0 or ColdFire processor.
26303 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
26304 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
26305 and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
26306 below, which also classifies the CPUs into families:
26308 @multitable @columnfractions 0.20 0.80
26309 @headitem @strong{Family} @tab @strong{@samp{-mcpu} arguments}
26310 @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}
26311 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
26312 @item @samp{5206e} @tab @samp{5206e}
26313 @item @samp{5208} @tab @samp{5207} @samp{5208}
26314 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
26315 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
26316 @item @samp{5216} @tab @samp{5214} @samp{5216}
26317 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
26318 @item @samp{5225} @tab @samp{5224} @samp{5225}
26319 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
26320 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
26321 @item @samp{5249} @tab @samp{5249}
26322 @item @samp{5250} @tab @samp{5250}
26323 @item @samp{5271} @tab @samp{5270} @samp{5271}
26324 @item @samp{5272} @tab @samp{5272}
26325 @item @samp{5275} @tab @samp{5274} @samp{5275}
26326 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
26327 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
26328 @item @samp{5307} @tab @samp{5307}
26329 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
26330 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
26331 @item @samp{5407} @tab @samp{5407}
26332 @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}
26333 @end multitable
26335 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
26336 @var{arch} is compatible with @var{cpu}.  Other combinations of
26337 @option{-mcpu} and @option{-march} are rejected.
26339 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
26340 @var{cpu} is selected.  It also defines @code{__mcf_family_@var{family}},
26341 where the value of @var{family} is given by the table above.
26343 @opindex mtune
26344 @item -mtune=@var{tune}
26345 Tune the code for a particular microarchitecture within the
26346 constraints set by @option{-march} and @option{-mcpu}.
26347 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
26348 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
26349 and @samp{cpu32}.  The ColdFire microarchitectures
26350 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
26352 You can also use @option{-mtune=68020-40} for code that needs
26353 to run relatively well on 68020, 68030 and 68040 targets.
26354 @option{-mtune=68020-60} is similar but includes 68060 targets
26355 as well.  These two options select the same tuning decisions as
26356 @option{-m68020-40} and @option{-m68020-60} respectively.
26358 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
26359 when tuning for 680x0 architecture @var{arch}.  It also defines
26360 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
26361 option is used.  If GCC is tuning for a range of architectures,
26362 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
26363 it defines the macros for every architecture in the range.
26365 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
26366 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
26367 of the arguments given above.
26369 @opindex m68000
26370 @opindex mc68000
26371 @item -m68000
26372 @itemx -mc68000
26373 Generate output for a 68000.  This is the default
26374 when the compiler is configured for 68000-based systems.
26375 It is equivalent to @option{-march=68000}.
26377 Use this option for microcontrollers with a 68000 or EC000 core,
26378 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
26380 @opindex m68010
26381 @item -m68010
26382 Generate output for a 68010.  This is the default
26383 when the compiler is configured for 68010-based systems.
26384 It is equivalent to @option{-march=68010}.
26386 @opindex m68020
26387 @opindex mc68020
26388 @item -m68020
26389 @itemx -mc68020
26390 Generate output for a 68020.  This is the default
26391 when the compiler is configured for 68020-based systems.
26392 It is equivalent to @option{-march=68020}.
26394 @opindex m68030
26395 @item -m68030
26396 Generate output for a 68030.  This is the default when the compiler is
26397 configured for 68030-based systems.  It is equivalent to
26398 @option{-march=68030}.
26400 @opindex m68040
26401 @item -m68040
26402 Generate output for a 68040.  This is the default when the compiler is
26403 configured for 68040-based systems.  It is equivalent to
26404 @option{-march=68040}.
26406 This option inhibits the use of 68881/68882 instructions that have to be
26407 emulated by software on the 68040.  Use this option if your 68040 does not
26408 have code to emulate those instructions.
26410 @opindex m68060
26411 @item -m68060
26412 Generate output for a 68060.  This is the default when the compiler is
26413 configured for 68060-based systems.  It is equivalent to
26414 @option{-march=68060}.
26416 This option inhibits the use of 68020 and 68881/68882 instructions that
26417 have to be emulated by software on the 68060.  Use this option if your 68060
26418 does not have code to emulate those instructions.
26420 @opindex mcpu32
26421 @item -mcpu32
26422 Generate output for a CPU32.  This is the default
26423 when the compiler is configured for CPU32-based systems.
26424 It is equivalent to @option{-march=cpu32}.
26426 Use this option for microcontrollers with a
26427 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
26428 68336, 68340, 68341, 68349 and 68360.
26430 @opindex m5200
26431 @item -m5200
26432 Generate output for a 520X ColdFire CPU@.  This is the default
26433 when the compiler is configured for 520X-based systems.
26434 It is equivalent to @option{-mcpu=5206}, and is now deprecated
26435 in favor of that option.
26437 Use this option for microcontroller with a 5200 core, including
26438 the MCF5202, MCF5203, MCF5204 and MCF5206.
26440 @opindex m5206e
26441 @item -m5206e
26442 Generate output for a 5206e ColdFire CPU@.  The option is now
26443 deprecated in favor of the equivalent @option{-mcpu=5206e}.
26445 @opindex m528x
26446 @item -m528x
26447 Generate output for a member of the ColdFire 528X family.
26448 The option is now deprecated in favor of the equivalent
26449 @option{-mcpu=528x}.
26451 @opindex m5307
26452 @item -m5307
26453 Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
26454 in favor of the equivalent @option{-mcpu=5307}.
26456 @opindex m5407
26457 @item -m5407
26458 Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
26459 in favor of the equivalent @option{-mcpu=5407}.
26461 @opindex mcfv4e
26462 @item -mcfv4e
26463 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
26464 This includes use of hardware floating-point instructions.
26465 The option is equivalent to @option{-mcpu=547x}, and is now
26466 deprecated in favor of that option.
26468 @opindex m68020-40
26469 @item -m68020-40
26470 Generate output for a 68040, without using any of the new instructions.
26471 This results in code that can run relatively efficiently on either a
26472 68020/68881 or a 68030 or a 68040.  The generated code does use the
26473 68881 instructions that are emulated on the 68040.
26475 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
26477 @opindex m68020-60
26478 @item -m68020-60
26479 Generate output for a 68060, without using any of the new instructions.
26480 This results in code that can run relatively efficiently on either a
26481 68020/68881 or a 68030 or a 68040.  The generated code does use the
26482 68881 instructions that are emulated on the 68060.
26484 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
26486 @opindex mhard-float
26487 @opindex m68881
26488 @item -mhard-float
26489 @itemx -m68881
26490 Generate floating-point instructions.  This is the default for 68020
26491 and above, and for ColdFire devices that have an FPU@.  It defines the
26492 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
26493 on ColdFire targets.
26495 @opindex msoft-float
26496 @item -msoft-float
26497 Do not generate floating-point instructions; use library calls instead.
26498 This is the default for 68000, 68010, and 68832 targets.  It is also
26499 the default for ColdFire devices that have no FPU.
26501 @opindex mdiv
26502 @opindex mno-div
26503 @item -mdiv
26504 @itemx -mno-div
26505 Generate (do not generate) ColdFire hardware divide and remainder
26506 instructions.  If @option{-march} is used without @option{-mcpu},
26507 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
26508 architectures.  Otherwise, the default is taken from the target CPU
26509 (either the default CPU, or the one specified by @option{-mcpu}).  For
26510 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
26511 @option{-mcpu=5206e}.
26513 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
26515 @opindex mshort
26516 @item -mshort
26517 Consider type @code{int} to be 16 bits wide, like @code{short int}.
26518 Additionally, parameters passed on the stack are also aligned to a
26519 16-bit boundary even on targets whose API mandates promotion to 32-bit.
26521 @opindex mno-short
26522 @item -mno-short
26523 Do not consider type @code{int} to be 16 bits wide.  This is the default.
26525 @opindex mnobitfield
26526 @opindex mno-bitfield
26527 @item -mnobitfield
26528 @itemx -mno-bitfield
26529 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
26530 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
26532 @opindex mbitfield
26533 @item -mbitfield
26534 Do use the bit-field instructions.  The @option{-m68020} option implies
26535 @option{-mbitfield}.  This is the default if you use a configuration
26536 designed for a 68020.
26538 @opindex mrtd
26539 @item -mrtd
26540 Use a different function-calling convention, in which functions
26541 that take a fixed number of arguments return with the @code{rtd}
26542 instruction, which pops their arguments while returning.  This
26543 saves one instruction in the caller since there is no need to pop
26544 the arguments there.
26546 This calling convention is incompatible with the one normally
26547 used on Unix, so you cannot use it if you need to call libraries
26548 compiled with the Unix compiler.
26550 Also, you must provide function prototypes for all functions that
26551 take variable numbers of arguments (including @code{printf});
26552 otherwise incorrect code is generated for calls to those
26553 functions.
26555 In addition, seriously incorrect code results if you call a
26556 function with too many arguments.  (Normally, extra arguments are
26557 harmlessly ignored.)
26559 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
26560 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
26562 The default is @option{-mno-rtd}.
26564 @opindex malign-int
26565 @opindex mno-align-int
26566 @item -malign-int
26567 @itemx -mno-align-int
26568 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
26569 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
26570 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
26571 Aligning variables on 32-bit boundaries produces code that runs somewhat
26572 faster on processors with 32-bit busses at the expense of more memory.
26574 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
26575 aligns structures containing the above types differently than
26576 most published application binary interface specifications for the m68k.
26578 @opindex mpcrel
26579 Use the pc-relative addressing mode of the 68000 directly, instead of
26580 using a global offset table.  At present, this option implies @option{-fpic},
26581 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
26582 not presently supported with @option{-mpcrel}, though this could be supported for
26583 68020 and higher processors.
26585 @opindex mno-strict-align
26586 @opindex mstrict-align
26587 @item -mno-strict-align
26588 @itemx -mstrict-align
26589 Do not (do) assume that unaligned memory references are handled by
26590 the system.
26592 @item -msep-data
26593 Generate code that allows the data segment to be located in a different
26594 area of memory from the text segment.  This allows for execute-in-place in
26595 an environment without virtual memory management.  This option implies
26596 @option{-fPIC}.
26598 @item -mno-sep-data
26599 Generate code that assumes that the data segment follows the text segment.
26600 This is the default.
26602 @item -mid-shared-library
26603 Generate code that supports shared libraries via the library ID method.
26604 This allows for execute-in-place and shared libraries in an environment
26605 without virtual memory management.  This option implies @option{-fPIC}.
26607 @item -mno-id-shared-library
26608 Generate code that doesn't assume ID-based shared libraries are being used.
26609 This is the default.
26611 @item -mshared-library-id=n
26612 Specifies the identification number of the ID-based shared library being
26613 compiled.  Specifying a value of 0 generates more compact code; specifying
26614 other values forces the allocation of that number to the current
26615 library, but is no more space- or time-efficient than omitting this option.
26617 @opindex mxgot
26618 @opindex mno-xgot
26619 @item -mxgot
26620 @itemx -mno-xgot
26621 When generating position-independent code for ColdFire, generate code
26622 that works if the GOT has more than 8192 entries.  This code is
26623 larger and slower than code generated without this option.  On M680x0
26624 processors, this option is not needed; @option{-fPIC} suffices.
26626 GCC normally uses a single instruction to load values from the GOT@.
26627 While this is relatively efficient, it only works if the GOT
26628 is smaller than about 64k.  Anything larger causes the linker
26629 to report an error such as:
26631 @cindex relocation truncated to fit (ColdFire)
26632 @smallexample
26633 relocation truncated to fit: R_68K_GOT16O foobar
26634 @end smallexample
26636 If this happens, you should recompile your code with @option{-mxgot}.
26637 It should then work with very large GOTs.  However, code generated with
26638 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
26639 the value of a global symbol.
26641 Note that some linkers, including newer versions of the GNU linker,
26642 can create multiple GOTs and sort GOT entries.  If you have such a linker,
26643 you should only need to use @option{-mxgot} when compiling a single
26644 object file that accesses more than 8192 GOT entries.  Very few do.
26646 These options have no effect unless GCC is generating
26647 position-independent code.
26649 @opindex mlong-jump-table-offsets
26650 @item -mlong-jump-table-offsets
26651 Use 32-bit offsets in @code{switch} tables.  The default is to use
26652 16-bit offsets.
26654 @end table
26656 @node MCore Options
26657 @subsection MCore Options
26658 @cindex MCore options
26660 These are the @samp{-m} options defined for the Motorola M*Core
26661 processors.
26663 @table @gcctabopt
26665 @opindex mhardlit
26666 @opindex mno-hardlit
26667 @item -mhardlit
26668 @itemx -mno-hardlit
26669 Inline constants into the code stream if it can be done in two
26670 instructions or less.
26672 @opindex mdiv
26673 @opindex mno-div
26674 @item -mdiv
26675 @itemx -mno-div
26676 Use the divide instruction.  (Enabled by default).
26678 @opindex mrelax-immediate
26679 @opindex mno-relax-immediate
26680 @item -mrelax-immediate
26681 @itemx -mno-relax-immediate
26682 Allow arbitrary-sized immediates in bit operations.
26684 @opindex mwide-bitfields
26685 @opindex mno-wide-bitfields
26686 @item -mwide-bitfields
26687 @itemx -mno-wide-bitfields
26688 Always treat bit-fields as @code{int}-sized.
26690 @opindex m4byte-functions
26691 @opindex mno-4byte-functions
26692 @item -m4byte-functions
26693 @itemx -mno-4byte-functions
26694 Force all functions to be aligned to a 4-byte boundary.
26696 @opindex mcallgraph-data
26697 @opindex mno-callgraph-data
26698 @item -mcallgraph-data
26699 @itemx -mno-callgraph-data
26700 Emit callgraph information.
26702 @opindex mslow-bytes
26703 @opindex mno-slow-bytes
26704 @item -mslow-bytes
26705 @itemx -mno-slow-bytes
26706 Prefer word access when reading byte quantities.
26708 @opindex mlittle-endian
26709 @opindex mbig-endian
26710 @item -mlittle-endian
26711 @itemx -mbig-endian
26712 Generate code for a little-endian target.
26714 @opindex m210
26715 @opindex m340
26716 @item -m210
26717 @itemx -m340
26718 Generate code for the 210 processor.
26720 @opindex mno-lsim
26721 @item -mno-lsim
26722 Assume that runtime support has been provided and so omit the
26723 simulator library (@file{libsim.a)} from the linker command line.
26725 @opindex mstack-increment
26726 @item -mstack-increment=@var{size}
26727 Set the maximum amount for a single stack increment operation.  Large
26728 values can increase the speed of programs that contain functions
26729 that need a large amount of stack space, but they can also trigger a
26730 segmentation fault if the stack is extended too much.  The default
26731 value is 0x1000.
26733 @end table
26735 @node MicroBlaze Options
26736 @subsection MicroBlaze Options
26737 @cindex MicroBlaze Options
26739 @table @gcctabopt
26741 @opindex msoft-float
26742 @item -msoft-float
26743 Use software emulation for floating point (default).
26745 @opindex mhard-float
26746 @item -mhard-float
26747 Use hardware floating-point instructions.
26749 @opindex mmemcpy
26750 @item -mmemcpy
26751 Do not optimize block moves, use @code{memcpy}.
26753 @opindex mno-clearbss
26754 @item -mno-clearbss
26755 This option is deprecated.  Use @option{-fno-zero-initialized-in-bss} instead.
26757 @opindex mcpu=
26758 @item -mcpu=@var{cpu-type}
26759 Use features of, and schedule code for, the given CPU.
26760 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
26761 where @var{X} is a major version, @var{YY} is the minor version, and
26762 @var{Z} is compatibility code.  Example values are @samp{v3.00.a},
26763 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
26765 @opindex mxl-soft-mul
26766 @item -mxl-soft-mul
26767 Use software multiply emulation (default).
26769 @opindex mxl-soft-div
26770 @item -mxl-soft-div
26771 Use software emulation for divides (default).
26773 @opindex mxl-barrel-shift
26774 @item -mxl-barrel-shift
26775 Use the hardware barrel shifter.
26777 @opindex mxl-pattern-compare
26778 @item -mxl-pattern-compare
26779 Use pattern compare instructions.
26781 @opindex msmall-divides
26782 @item -msmall-divides
26783 Use table lookup optimization for small signed integer divisions.
26785 @opindex mxl-stack-check
26786 @item -mxl-stack-check
26787 This option is deprecated.  Use @option{-fstack-check} instead.
26789 @opindex mxl-gp-opt
26790 @item -mxl-gp-opt
26791 Use GP-relative @code{.sdata}/@code{.sbss} sections.
26793 @opindex mxl-multiply-high
26794 @item -mxl-multiply-high
26795 Use multiply high instructions for high part of 32x32 multiply.
26797 @opindex mxl-float-convert
26798 @item -mxl-float-convert
26799 Use hardware floating-point conversion instructions.
26801 @opindex mxl-float-sqrt
26802 @item -mxl-float-sqrt
26803 Use hardware floating-point square root instruction.
26805 @opindex mbig-endian
26806 @item -mbig-endian
26807 Generate code for a big-endian target.
26809 @opindex mlittle-endian
26810 @item -mlittle-endian
26811 Generate code for a little-endian target.
26813 @opindex mxl-reorder
26814 @item -mxl-reorder
26815 Use reorder instructions (swap and byte reversed load/store).
26817 @item -mxl-mode-@var{app-model}
26818 Select application model @var{app-model}.  Valid models are
26819 @table @samp
26820 @item executable
26821 normal executable (default), uses startup code @file{crt0.o}.
26823 @item xmdstub
26824 for use with Xilinx Microprocessor Debugger (XMD) based
26825 software intrusive debug agent called xmdstub. This uses startup file
26826 @file{crt1.o} and sets the start address of the program to 0x800.
26828 @item bootstrap
26829 for applications that are loaded using a bootloader.
26830 This model uses startup file @file{crt2.o} which does not contain a processor
26831 reset vector handler. This is suitable for transferring control on a
26832 processor reset to the bootloader rather than the application.
26834 @item novectors
26835 for applications that do not require any of the
26836 MicroBlaze vectors. This option may be useful for applications running
26837 within a monitoring application. This model uses @file{crt3.o} as a startup file.
26838 @end table
26840 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
26841 @option{-mxl-mode-@var{app-model}}.
26843 @opindex mpic-data-is-text-relative
26844 @item -mpic-data-is-text-relative
26845 Assume that the displacement between the text and data segments is fixed
26846 at static link time.  This allows data to be referenced by offset from start of
26847 text address instead of GOT since PC-relative addressing is not supported.
26849 @end table
26851 @node MIPS Options
26852 @subsection MIPS Options
26853 @cindex MIPS options
26855 @table @gcctabopt
26857 @opindex EB
26858 @item -EB
26859 Generate big-endian code.
26861 @opindex EL
26862 @item -EL
26863 Generate little-endian code.  This is the default for @samp{mips*el-*-*}
26864 configurations.
26866 @opindex march
26867 @item -march=@var{arch}
26868 Generate code that runs on @var{arch}, which can be the name of a
26869 generic MIPS ISA, or the name of a particular processor.
26870 The ISA names are:
26871 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
26872 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
26873 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
26874 @samp{mips64r5} and @samp{mips64r6}.
26875 The processor names are:
26876 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
26877 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
26878 @samp{5kc}, @samp{5kf},
26879 @samp{20kc},
26880 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
26881 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
26882 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
26883 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
26884 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
26885 @samp{i6400}, @samp{i6500},
26886 @samp{interaptiv},
26887 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
26888 @samp{gs464e}, @samp{gs264e},
26889 @samp{m4k},
26890 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
26891 @samp{m5100}, @samp{m5101},
26892 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
26893 @samp{orion},
26894 @samp{p5600}, @samp{p6600},
26895 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
26896 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
26897 @samp{r6000}, @samp{r8000},
26898 @samp{rm7000}, @samp{rm9000},
26899 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
26900 @samp{sb1},
26901 @samp{sr71000},
26902 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
26903 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
26904 @samp{xlr} and @samp{xlp}.
26905 The special value @samp{from-abi} selects the
26906 most compatible architecture for the selected ABI (that is,
26907 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
26909 The native Linux/GNU toolchain also supports the value @samp{native},
26910 which selects the best architecture option for the host processor.
26911 @option{-march=native} has no effect if GCC does not recognize
26912 the processor.
26914 In processor names, a final @samp{000} can be abbreviated as @samp{k}
26915 (for example, @option{-march=r2k}).  Prefixes are optional, and
26916 @samp{vr} may be written @samp{r}.
26918 Names of the form @samp{@var{n}f2_1} refer to processors with
26919 FPUs clocked at half the rate of the core, names of the form
26920 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
26921 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
26922 processors with FPUs clocked a ratio of 3:2 with respect to the core.
26923 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
26924 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
26925 accepted as synonyms for @samp{@var{n}f1_1}.
26927 GCC defines two macros based on the value of this option.  The first
26928 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
26929 a string.  The second has the form @code{_MIPS_ARCH_@var{foo}},
26930 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
26931 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
26932 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
26934 Note that the @code{_MIPS_ARCH} macro uses the processor names given
26935 above.  In other words, it has the full prefix and does not
26936 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
26937 the macro names the resolved architecture (either @code{"mips1"} or
26938 @code{"mips3"}).  It names the default architecture when no
26939 @option{-march} option is given.
26941 @opindex mtune
26942 @item -mtune=@var{arch}
26943 Optimize for @var{arch}.  Among other things, this option controls
26944 the way instructions are scheduled, and the perceived cost of arithmetic
26945 operations.  The list of @var{arch} values is the same as for
26946 @option{-march}.
26948 When this option is not used, GCC optimizes for the processor
26949 specified by @option{-march}.  By using @option{-march} and
26950 @option{-mtune} together, it is possible to generate code that
26951 runs on a family of processors, but optimize the code for one
26952 particular member of that family.
26954 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
26955 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
26956 @option{-march} ones described above.
26958 @opindex mips1
26959 @item -mips1
26960 Equivalent to @option{-march=mips1}.
26962 @opindex mips2
26963 @item -mips2
26964 Equivalent to @option{-march=mips2}.
26966 @opindex mips3
26967 @item -mips3
26968 Equivalent to @option{-march=mips3}.
26970 @opindex mips4
26971 @item -mips4
26972 Equivalent to @option{-march=mips4}.
26974 @opindex mips32
26975 @item -mips32
26976 Equivalent to @option{-march=mips32}.
26978 @opindex mips32r3
26979 @item -mips32r3
26980 Equivalent to @option{-march=mips32r3}.
26982 @opindex mips32r5
26983 @item -mips32r5
26984 Equivalent to @option{-march=mips32r5}.
26986 @opindex mips32r6
26987 @item -mips32r6
26988 Equivalent to @option{-march=mips32r6}.
26990 @opindex mips64
26991 @item -mips64
26992 Equivalent to @option{-march=mips64}.
26994 @opindex mips64r2
26995 @item -mips64r2
26996 Equivalent to @option{-march=mips64r2}.
26998 @opindex mips64r3
26999 @item -mips64r3
27000 Equivalent to @option{-march=mips64r3}.
27002 @opindex mips64r5
27003 @item -mips64r5
27004 Equivalent to @option{-march=mips64r5}.
27006 @opindex mips64r6
27007 @item -mips64r6
27008 Equivalent to @option{-march=mips64r6}.
27010 @opindex mips16
27011 @opindex mno-mips16
27012 @item -mips16
27013 @itemx -mno-mips16
27014 Generate (do not generate) MIPS16 code.  If GCC is targeting a
27015 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
27017 MIPS16 code generation can also be controlled on a per-function basis
27018 by means of @code{mips16} and @code{nomips16} attributes.
27019 @xref{Function Attributes}, for more information.
27021 @opindex mmips16e2
27022 @opindex mno-mips16e2
27023 @item -mmips16e2
27024 @itemx -mno-mips16e2
27025 Use (do not use) the MIPS16e2 ASE.  This option modifies the behavior
27026 of the @option{-mips16} option such that it targets the MIPS16e2 ASE@.
27028 @opindex mflip-mips16
27029 @item -mflip-mips16
27030 Generate MIPS16 code on alternating functions.  This option is provided
27031 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
27032 not intended for ordinary use in compiling user code.
27034 @opindex minterlink-compressed
27035 @opindex mno-interlink-compressed
27036 @item -minterlink-compressed
27037 @itemx -mno-interlink-compressed
27038 Require (do not require) that code using the standard (uncompressed) MIPS ISA
27039 be link-compatible with MIPS16 and microMIPS code, and vice versa.
27041 For example, code using the standard ISA encoding cannot jump directly
27042 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
27043 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
27044 knows that the target of the jump is not compressed.
27046 @opindex minterlink-mips16
27047 @opindex mno-interlink-mips16
27048 @item -minterlink-mips16
27049 @itemx -mno-interlink-mips16
27050 Aliases of @option{-minterlink-compressed} and
27051 @option{-mno-interlink-compressed}.  These options predate the microMIPS ASE
27052 and are retained for backwards compatibility.
27054 @opindex mabi=32
27055 @opindex mabi=o64
27056 @opindex mabi=n32
27057 @opindex mabi=64
27058 @opindex mabi=eabi
27059 @item -mabi=32
27060 @itemx -mabi=o64
27061 @itemx -mabi=n32
27062 @itemx -mabi=64
27063 @itemx -mabi=eabi
27064 Generate code for the given ABI@.
27066 Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
27067 generates 64-bit code when you select a 64-bit architecture, but you
27068 can use @option{-mgp32} to get 32-bit code instead.
27070 For information about the O64 ABI, see
27071 @uref{https://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
27073 GCC supports a variant of the o32 ABI in which floating-point registers
27074 are 64 rather than 32 bits wide.  You can select this combination with
27075 @option{-mabi=32} @option{-mfp64}.  This ABI relies on the @code{mthc1}
27076 and @code{mfhc1} instructions and is therefore only supported for
27077 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
27079 The register assignments for arguments and return values remain the
27080 same, but each scalar value is passed in a single 64-bit register
27081 rather than a pair of 32-bit registers.  For example, scalar
27082 floating-point values are returned in @samp{$f0} only, not a
27083 @samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
27084 remains the same in that the even-numbered double-precision registers
27085 are saved.
27087 Two additional variants of the o32 ABI are supported to enable
27088 a transition from 32-bit to 64-bit registers.  These are FPXX
27089 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
27090 The FPXX extension mandates that all code must execute correctly
27091 when run using 32-bit or 64-bit registers.  The code can be interlinked
27092 with either FP32 or FP64, but not both.
27093 The FP64A extension is similar to the FP64 extension but forbids the
27094 use of odd-numbered single-precision registers.  This can be used
27095 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
27096 processors and allows both FP32 and FP64A code to interlink and
27097 run in the same process without changing FPU modes.
27099 @opindex mabicalls
27100 @opindex mno-abicalls
27101 @item -mabicalls
27102 @itemx -mno-abicalls
27103 Generate (do not generate) code that is suitable for SVR4-style
27104 dynamic objects.  @option{-mabicalls} is the default for SVR4-based
27105 systems.
27107 @item -mshared
27108 @itemx -mno-shared
27109 Generate (do not generate) code that is fully position-independent,
27110 and that can therefore be linked into shared libraries.  This option
27111 only affects @option{-mabicalls}.
27113 All @option{-mabicalls} code has traditionally been position-independent,
27114 regardless of options like @option{-fPIC} and @option{-fpic}.  However,
27115 as an extension, the GNU toolchain allows executables to use absolute
27116 accesses for locally-binding symbols.  It can also use shorter GP
27117 initialization sequences and generate direct calls to locally-defined
27118 functions.  This mode is selected by @option{-mno-shared}.
27120 @option{-mno-shared} depends on binutils 2.16 or higher and generates
27121 objects that can only be linked by the GNU linker.  However, the option
27122 does not affect the ABI of the final executable; it only affects the ABI
27123 of relocatable objects.  Using @option{-mno-shared} generally makes
27124 executables both smaller and quicker.
27126 @option{-mshared} is the default.
27128 @opindex mplt
27129 @opindex mno-plt
27130 @item -mplt
27131 @itemx -mno-plt
27132 Assume (do not assume) that the static and dynamic linkers
27133 support PLTs and copy relocations.  This option only affects
27134 @option{-mno-shared -mabicalls}.  For the n64 ABI, this option
27135 has no effect without @option{-msym32}.
27137 You can make @option{-mplt} the default by configuring
27138 GCC with @option{--with-mips-plt}.  The default is
27139 @option{-mno-plt} otherwise.
27141 @opindex mxgot
27142 @opindex mno-xgot
27143 @item -mxgot
27144 @itemx -mno-xgot
27145 Lift (do not lift) the usual restrictions on the size of the global
27146 offset table.
27148 GCC normally uses a single instruction to load values from the GOT@.
27149 While this is relatively efficient, it only works if the GOT
27150 is smaller than about 64k.  Anything larger causes the linker
27151 to report an error such as:
27153 @cindex relocation truncated to fit (MIPS)
27154 @smallexample
27155 relocation truncated to fit: R_MIPS_GOT16 foobar
27156 @end smallexample
27158 If this happens, you should recompile your code with @option{-mxgot}.
27159 This works with very large GOTs, although the code is also
27160 less efficient, since it takes three instructions to fetch the
27161 value of a global symbol.
27163 Note that some linkers can create multiple GOTs.  If you have such a
27164 linker, you should only need to use @option{-mxgot} when a single object
27165 file accesses more than 64k's worth of GOT entries.  Very few do.
27167 These options have no effect unless GCC is generating position
27168 independent code.
27170 @opindex mgp32
27171 @item -mgp32
27172 Assume that general-purpose registers are 32 bits wide.
27174 @opindex mgp64
27175 @item -mgp64
27176 Assume that general-purpose registers are 64 bits wide.
27178 @opindex mfp32
27179 @item -mfp32
27180 Assume that floating-point registers are 32 bits wide.
27182 @opindex mfp64
27183 @item -mfp64
27184 Assume that floating-point registers are 64 bits wide.
27186 @opindex mfpxx
27187 @item -mfpxx
27188 Do not assume the width of floating-point registers.
27190 @opindex mhard-float
27191 @item -mhard-float
27192 Use floating-point coprocessor instructions.
27194 @opindex msoft-float
27195 @item -msoft-float
27196 Do not use floating-point coprocessor instructions.  Implement
27197 floating-point calculations using library calls instead.
27199 @opindex mno-float
27200 @item -mno-float
27201 Equivalent to @option{-msoft-float}, but additionally asserts that the
27202 program being compiled does not perform any floating-point operations.
27203 This option is presently supported only by some bare-metal MIPS
27204 configurations, where it may select a special set of libraries
27205 that lack all floating-point support (including, for example, the
27206 floating-point @code{printf} formats).  
27207 If code compiled with @option{-mno-float} accidentally contains
27208 floating-point operations, it is likely to suffer a link-time
27209 or run-time failure.
27211 @opindex msingle-float
27212 @item -msingle-float
27213 Assume that the floating-point coprocessor only supports single-precision
27214 operations.
27216 @opindex mdouble-float
27217 @item -mdouble-float
27218 Assume that the floating-point coprocessor supports double-precision
27219 operations.  This is the default.
27221 @opindex modd-spreg
27222 @opindex mno-odd-spreg
27223 @item -modd-spreg
27224 @itemx -mno-odd-spreg
27225 Enable the use of odd-numbered single-precision floating-point registers
27226 for the o32 ABI.  This is the default for processors that are known to
27227 support these registers.  When using the o32 FPXX ABI, @option{-mno-odd-spreg}
27228 is set by default.
27230 @opindex mabs=2008
27231 @opindex mabs=legacy
27232 @item -mabs=2008
27233 @itemx -mabs=legacy
27234 These options control the treatment of the special not-a-number (NaN)
27235 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
27236 @code{neg.@i{fmt}} machine instructions.
27238 By default or when @option{-mabs=legacy} is used the legacy
27239 treatment is selected.  In this case these instructions are considered
27240 arithmetic and avoided where correct operation is required and the
27241 input operand might be a NaN.  A longer sequence of instructions that
27242 manipulate the sign bit of floating-point datum manually is used
27243 instead unless the @option{-ffinite-math-only} option has also been
27244 specified.
27246 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment.  In
27247 this case these instructions are considered non-arithmetic and therefore
27248 operating correctly in all cases, including in particular where the
27249 input operand is a NaN.  These instructions are therefore always used
27250 for the respective operations.
27252 @opindex mnan=2008
27253 @opindex mnan=legacy
27254 @item -mnan=2008
27255 @itemx -mnan=legacy
27256 These options control the encoding of the special not-a-number (NaN)
27257 IEEE 754 floating-point data.
27259 The @option{-mnan=legacy} option selects the legacy encoding.  In this
27260 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
27261 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
27262 by the first bit of their trailing significand field being 1.
27264 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding.  In
27265 this case qNaNs are denoted by the first bit of their trailing
27266 significand field being 1, whereas sNaNs are denoted by the first bit of
27267 their trailing significand field being 0.
27269 The default is @option{-mnan=legacy} unless GCC has been configured with
27270 @option{--with-nan=2008}.
27272 @opindex mllsc
27273 @opindex mno-llsc
27274 @item -mllsc
27275 @itemx -mno-llsc
27276 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
27277 implement atomic memory built-in functions.  When neither option is
27278 specified, GCC uses the instructions if the target architecture
27279 supports them.
27281 @option{-mllsc} is useful if the runtime environment can emulate the
27282 instructions and @option{-mno-llsc} can be useful when compiling for
27283 nonstandard ISAs.  You can make either option the default by
27284 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
27285 respectively.  @option{--with-llsc} is the default for some
27286 configurations; see the installation documentation for details.
27288 @opindex mdsp
27289 @opindex mno-dsp
27290 @item -mdsp
27291 @itemx -mno-dsp
27292 Use (do not use) revision 1 of the MIPS DSP ASE@.
27293 @xref{MIPS DSP Built-in Functions}.  This option defines the
27294 preprocessor macro @code{__mips_dsp}.  It also defines
27295 @code{__mips_dsp_rev} to 1.
27297 @opindex mdspr2
27298 @opindex mno-dspr2
27299 @item -mdspr2
27300 @itemx -mno-dspr2
27301 Use (do not use) revision 2 of the MIPS DSP ASE@.
27302 @xref{MIPS DSP Built-in Functions}.  This option defines the
27303 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
27304 It also defines @code{__mips_dsp_rev} to 2.
27306 @opindex msmartmips
27307 @opindex mno-smartmips
27308 @item -msmartmips
27309 @itemx -mno-smartmips
27310 Use (do not use) the MIPS SmartMIPS ASE.
27312 @opindex mpaired-single
27313 @opindex mno-paired-single
27314 @item -mpaired-single
27315 @itemx -mno-paired-single
27316 Use (do not use) paired-single floating-point instructions.
27317 @xref{MIPS Paired-Single Support}.  This option requires
27318 hardware floating-point support to be enabled.
27320 @opindex mdmx
27321 @opindex mno-mdmx
27322 @item -mdmx
27323 @itemx -mno-mdmx
27324 Use (do not use) MIPS Digital Media Extension instructions.
27325 This option can only be used when generating 64-bit code and requires
27326 hardware floating-point support to be enabled.
27328 @opindex mips3d
27329 @opindex mno-mips3d
27330 @item -mips3d
27331 @itemx -mno-mips3d
27332 Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
27333 The option @option{-mips3d} implies @option{-mpaired-single}.
27335 @opindex mmicromips
27336 @opindex mno-mmicromips
27337 @item -mmicromips
27338 @itemx -mno-micromips
27339 Generate (do not generate) microMIPS code.
27341 MicroMIPS code generation can also be controlled on a per-function basis
27342 by means of @code{micromips} and @code{nomicromips} attributes.
27343 @xref{Function Attributes}, for more information.
27345 @opindex mmt
27346 @opindex mno-mt
27347 @item -mmt
27348 @itemx -mno-mt
27349 Use (do not use) MT Multithreading instructions.
27351 @opindex mmcu
27352 @opindex mno-mcu
27353 @item -mmcu
27354 @itemx -mno-mcu
27355 Use (do not use) the MIPS MCU ASE instructions.
27357 @opindex meva
27358 @opindex mno-eva
27359 @item -meva
27360 @itemx -mno-eva
27361 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
27363 @opindex mvirt
27364 @opindex mno-virt
27365 @item -mvirt
27366 @itemx -mno-virt
27367 Use (do not use) the MIPS Virtualization (VZ) instructions.
27369 @opindex mxpa
27370 @opindex mno-xpa
27371 @item -mxpa
27372 @itemx -mno-xpa
27373 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
27375 @opindex mcrc
27376 @opindex mno-crc
27377 @item -mcrc
27378 @itemx -mno-crc
27379 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
27381 @opindex mginv
27382 @opindex mno-ginv
27383 @item -mginv
27384 @itemx -mno-ginv
27385 Use (do not use) the MIPS Global INValidate (GINV) instructions.
27387 @opindex mloongson-mmi
27388 @opindex mno-loongson-mmi
27389 @item -mloongson-mmi
27390 @itemx -mno-loongson-mmi
27391 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
27393 @opindex mloongson-ext
27394 @opindex mno-loongson-ext
27395 @item -mloongson-ext
27396 @itemx -mno-loongson-ext
27397 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
27399 @opindex mloongson-ext2
27400 @opindex mno-loongson-ext2
27401 @item -mloongson-ext2
27402 @itemx -mno-loongson-ext2
27403 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
27405 @opindex mlong64
27406 @item -mlong64
27407 Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
27408 an explanation of the default and the way that the pointer size is
27409 determined.
27411 @opindex mlong32
27412 @item -mlong32
27413 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
27415 The default size of @code{int}s, @code{long}s and pointers depends on
27416 the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
27417 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
27418 32-bit @code{long}s.  Pointers are the same size as @code{long}s,
27419 or the same size as integer registers, whichever is smaller.
27421 @opindex msym32
27422 @opindex mno-sym32
27423 @item -msym32
27424 @itemx -mno-sym32
27425 Assume (do not assume) that all symbols have 32-bit values, regardless
27426 of the selected ABI@.  This option is useful in combination with
27427 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
27428 to generate shorter and faster references to symbolic addresses.
27430 @opindex G
27431 @item -G @var{num}
27432 Put definitions of externally-visible data in a small data section
27433 if that data is no bigger than @var{num} bytes.  GCC can then generate
27434 more efficient accesses to the data; see @option{-mgpopt} for details.
27436 The default @option{-G} option depends on the configuration.
27438 @opindex mlocal-sdata
27439 @opindex mno-local-sdata
27440 @item -mlocal-sdata
27441 @itemx -mno-local-sdata
27442 Extend (do not extend) the @option{-G} behavior to local data too,
27443 such as to static variables in C@.  @option{-mlocal-sdata} is the
27444 default for all configurations.
27446 If the linker complains that an application is using too much small data,
27447 you might want to try rebuilding the less performance-critical parts with
27448 @option{-mno-local-sdata}.  You might also want to build large
27449 libraries with @option{-mno-local-sdata}, so that the libraries leave
27450 more room for the main program.
27452 @opindex mextern-sdata
27453 @opindex mno-extern-sdata
27454 @item -mextern-sdata
27455 @itemx -mno-extern-sdata
27456 Assume (do not assume) that externally-defined data is in
27457 a small data section if the size of that data is within the @option{-G} limit.
27458 @option{-mextern-sdata} is the default for all configurations.
27460 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
27461 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
27462 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
27463 is placed in a small data section.  If @var{Var} is defined by another
27464 module, you must either compile that module with a high-enough
27465 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
27466 definition.  If @var{Var} is common, you must link the application
27467 with a high-enough @option{-G} setting.
27469 The easiest way of satisfying these restrictions is to compile
27470 and link every module with the same @option{-G} option.  However,
27471 you may wish to build a library that supports several different
27472 small data limits.  You can do this by compiling the library with
27473 the highest supported @option{-G} setting and additionally using
27474 @option{-mno-extern-sdata} to stop the library from making assumptions
27475 about externally-defined data.
27477 @opindex mgpopt
27478 @opindex mno-gpopt
27479 @item -mgpopt
27480 @itemx -mno-gpopt
27481 Use (do not use) GP-relative accesses for symbols that are known to be
27482 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
27483 @option{-mextern-sdata}.  @option{-mgpopt} is the default for all
27484 configurations.
27486 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
27487 might not hold the value of @code{_gp}.  For example, if the code is
27488 part of a library that might be used in a boot monitor, programs that
27489 call boot monitor routines pass an unknown value in @code{$gp}.
27490 (In such situations, the boot monitor itself is usually compiled
27491 with @option{-G0}.)
27493 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
27494 @option{-mno-extern-sdata}.
27496 @opindex membedded-data
27497 @opindex mno-embedded-data
27498 @item -membedded-data
27499 @itemx -mno-embedded-data
27500 Allocate variables to the read-only data section first if possible, then
27501 next in the small data section if possible, otherwise in data.  This gives
27502 slightly slower code than the default, but reduces the amount of RAM required
27503 when executing, and thus may be preferred for some embedded systems.
27505 @opindex muninit-const-in-rodata
27506 @opindex mno-uninit-const-in-rodata
27507 @item -muninit-const-in-rodata
27508 @itemx -mno-uninit-const-in-rodata
27509 Put uninitialized @code{const} variables in the read-only data section.
27510 This option is only meaningful in conjunction with @option{-membedded-data}.
27512 @opindex mcode-readable
27513 @item -mcode-readable=@var{setting}
27514 Specify whether GCC may generate code that reads from executable sections.
27515 There are three possible settings:
27517 @table @gcctabopt
27518 @item -mcode-readable=yes
27519 Instructions may freely access executable sections.  This is the
27520 default setting.
27522 @item -mcode-readable=pcrel
27523 MIPS16 PC-relative load instructions can access executable sections,
27524 but other instructions must not do so.  This option is useful on 4KSc
27525 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
27526 It is also useful on processors that can be configured to have a dual
27527 instruction/data SRAM interface and that, like the M4K, automatically
27528 redirect PC-relative loads to the instruction RAM.
27530 @item -mcode-readable=no
27531 Instructions must not access executable sections.  This option can be
27532 useful on targets that are configured to have a dual instruction/data
27533 SRAM interface but that (unlike the M4K) do not automatically redirect
27534 PC-relative loads to the instruction RAM.
27535 @end table
27537 @opindex msplit-addresses
27538 @opindex mno-split-addresses
27539 @item -msplit-addresses
27540 @itemx -mno-split-addresses
27541 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
27542 relocation operators.  This option has been superseded by
27543 @option{-mexplicit-relocs} but is retained for backwards compatibility.
27545 @opindex mexplicit-relocs
27546 @opindex mno-explicit-relocs
27547 @item -mexplicit-relocs
27548 @itemx -mno-explicit-relocs
27549 Use (do not use) assembler relocation operators when dealing with symbolic
27550 addresses.  The alternative, selected by @option{-mno-explicit-relocs},
27551 is to use assembler macros instead.
27553 @option{-mexplicit-relocs} is the default if GCC was configured
27554 to use an assembler that supports relocation operators.
27556 @opindex mcheck-zero-division
27557 @opindex mno-check-zero-division
27558 @item -mcheck-zero-division
27559 @itemx -mno-check-zero-division
27560 Trap (do not trap) on integer division by zero.
27562 The default is @option{-mcheck-zero-division}.
27564 @opindex mdivide-traps
27565 @opindex mdivide-breaks
27566 @item -mdivide-traps
27567 @itemx -mdivide-breaks
27568 MIPS systems check for division by zero by generating either a
27569 conditional trap or a break instruction.  Using traps results in
27570 smaller code, but is only supported on MIPS II and later.  Also, some
27571 versions of the Linux kernel have a bug that prevents trap from
27572 generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
27573 allow conditional traps on architectures that support them and
27574 @option{-mdivide-breaks} to force the use of breaks.
27576 The default is usually @option{-mdivide-traps}, but this can be
27577 overridden at configure time using @option{--with-divide=breaks}.
27578 Divide-by-zero checks can be completely disabled using
27579 @option{-mno-check-zero-division}.
27581 @opindex mload-store-pairs
27582 @opindex mno-load-store-pairs
27583 @item -mload-store-pairs
27584 @itemx -mno-load-store-pairs
27585 Enable (disable) an optimization that pairs consecutive load or store
27586 instructions to enable load/store bonding.  This option is enabled by
27587 default but only takes effect when the selected architecture is known
27588 to support bonding.
27590 @opindex munaligned-access
27591 @opindex mno-unaligned-access
27592 @item -munaligned-access
27593 @itemx -mno-unaligned-access
27594 Enable (disable) direct unaligned access for MIPS Release 6.
27595 MIPSr6 requires load/store unaligned-access support,
27596 by hardware or trap&emulate.
27597 So @option{-mno-unaligned-access} may be needed by kernel.
27599 @opindex mmemcpy
27600 @opindex mno-memcpy
27601 @item -mmemcpy
27602 @itemx -mno-memcpy
27603 Force (do not force) the use of @code{memcpy} for non-trivial block
27604 moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
27605 most constant-sized copies.
27607 @opindex mlong-calls
27608 @opindex mno-long-calls
27609 @item -mlong-calls
27610 @itemx -mno-long-calls
27611 Disable (do not disable) use of the @code{jal} instruction.  Calling
27612 functions using @code{jal} is more efficient but requires the caller
27613 and callee to be in the same 256 megabyte segment.
27615 This option has no effect on abicalls code.  The default is
27616 @option{-mno-long-calls}.
27618 @opindex mmad
27619 @opindex mno-mad
27620 @item -mmad
27621 @itemx -mno-mad
27622 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
27623 instructions, as provided by the R4650 ISA@.
27625 @opindex mimadd
27626 @opindex mno-imadd
27627 @item -mimadd
27628 @itemx -mno-imadd
27629 Enable (disable) use of the @code{madd} and @code{msub} integer
27630 instructions.  The default is @option{-mimadd} on architectures
27631 that support @code{madd} and @code{msub} except for the 74k 
27632 architecture where it was found to generate slower code.
27634 @opindex mfused-madd
27635 @opindex mno-fused-madd
27636 @item -mfused-madd
27637 @itemx -mno-fused-madd
27638 Enable (disable) use of the floating-point multiply-accumulate
27639 instructions, when they are available.  The default is
27640 @option{-mfused-madd}.
27642 On the R8000 CPU when multiply-accumulate instructions are used,
27643 the intermediate product is calculated to infinite precision
27644 and is not subject to the FCSR Flush to Zero bit.  This may be
27645 undesirable in some circumstances.  On other processors the result
27646 is numerically identical to the equivalent computation using
27647 separate multiply, add, subtract and negate instructions.
27649 @opindex nocpp
27650 @item -nocpp
27651 Tell the MIPS assembler to not run its preprocessor over user
27652 assembler files (with a @samp{.s} suffix) when assembling them.
27654 @opindex mfix-24k
27655 @opindex mno-fix-24k
27656 @item -mfix-24k
27657 @itemx -mno-fix-24k
27658 Work around the 24K E48 (lost data on stores during refill) errata.
27659 The workarounds are implemented by the assembler rather than by GCC@.
27661 @opindex mfix-r4000
27662 @opindex mno-fix-r4000
27663 @item -mfix-r4000
27664 @itemx -mno-fix-r4000
27665 Work around certain R4000 CPU errata:
27666 @itemize @minus
27667 @item
27668 A double-word or a variable shift may give an incorrect result if executed
27669 immediately after starting an integer division.
27670 @item
27671 A double-word or a variable shift may give an incorrect result if executed
27672 while an integer multiplication is in progress.
27673 @item
27674 An integer division may give an incorrect result if started in a delay slot
27675 of a taken branch or a jump.
27676 @end itemize
27678 @opindex mfix-r4400
27679 @opindex mno-fix-r4400
27680 @item -mfix-r4400
27681 @itemx -mno-fix-r4400
27682 Work around certain R4400 CPU errata:
27683 @itemize @minus
27684 @item
27685 A double-word or a variable shift may give an incorrect result if executed
27686 immediately after starting an integer division.
27687 @end itemize
27689 @opindex mfix-r10000
27690 @opindex mno-fix-r10000
27691 @item -mfix-r10000
27692 @itemx -mno-fix-r10000
27693 Work around certain R10000 errata:
27694 @itemize @minus
27695 @item
27696 @code{ll}/@code{sc} sequences may not behave atomically on revisions
27697 prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
27698 @end itemize
27700 This option can only be used if the target architecture supports
27701 branch-likely instructions.  @option{-mfix-r10000} is the default when
27702 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
27703 otherwise.
27705 @opindex mfix-r5900
27706 @item -mfix-r5900
27707 @itemx -mno-fix-r5900
27708 Do not attempt to schedule the preceding instruction into the delay slot
27709 of a branch instruction placed at the end of a short loop of six
27710 instructions or fewer and always schedule a @code{nop} instruction there
27711 instead.  The short loop bug under certain conditions causes loops to
27712 execute only once or twice, due to a hardware bug in the R5900 chip.  The
27713 workaround is implemented by the assembler rather than by GCC@.
27715 @opindex mfix-rm7000
27716 @item -mfix-rm7000
27717 @itemx -mno-fix-rm7000
27718 Work around the RM7000 @code{dmult}/@code{dmultu} errata.  The
27719 workarounds are implemented by the assembler rather than by GCC@.
27721 @opindex mfix-vr4120
27722 @item -mfix-vr4120
27723 @itemx -mno-fix-vr4120
27724 Work around certain VR4120 errata:
27725 @itemize @minus
27726 @item
27727 @code{dmultu} does not always produce the correct result.
27728 @item
27729 @code{div} and @code{ddiv} do not always produce the correct result if one
27730 of the operands is negative.
27731 @end itemize
27732 The workarounds for the division errata rely on special functions in
27733 @file{libgcc.a}.  At present, these functions are only provided by
27734 the @code{mips64vr*-elf} configurations.
27736 Other VR4120 errata require a NOP to be inserted between certain pairs of
27737 instructions.  These errata are handled by the assembler, not by GCC itself.
27739 @opindex mfix-vr4130
27740 @item -mfix-vr4130
27741 Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
27742 workarounds are implemented by the assembler rather than by GCC,
27743 although GCC avoids using @code{mflo} and @code{mfhi} if the
27744 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
27745 instructions are available instead.
27747 @opindex mfix-sb1
27748 @item -mfix-sb1
27749 @itemx -mno-fix-sb1
27750 Work around certain SB-1 CPU core errata.
27751 (This flag currently works around the SB-1 revision 2
27752 ``F1'' and ``F2'' floating-point errata.)
27754 @opindex mr10k-cache-barrier
27755 @item -mr10k-cache-barrier=@var{setting}
27756 Specify whether GCC should insert cache barriers to avoid the
27757 side effects of speculation on R10K processors.
27759 In common with many processors, the R10K tries to predict the outcome
27760 of a conditional branch and speculatively executes instructions from
27761 the ``taken'' branch.  It later aborts these instructions if the
27762 predicted outcome is wrong.  However, on the R10K, even aborted
27763 instructions can have side effects.
27765 This problem only affects kernel stores and, depending on the system,
27766 kernel loads.  As an example, a speculatively-executed store may load
27767 the target memory into cache and mark the cache line as dirty, even if
27768 the store itself is later aborted.  If a DMA operation writes to the
27769 same area of memory before the ``dirty'' line is flushed, the cached
27770 data overwrites the DMA-ed data.  See the R10K processor manual
27771 for a full description, including other potential problems.
27773 One workaround is to insert cache barrier instructions before every memory
27774 access that might be speculatively executed and that might have side
27775 effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
27776 controls GCC's implementation of this workaround.  It assumes that
27777 aborted accesses to any byte in the following regions does not have
27778 side effects:
27780 @enumerate
27781 @item
27782 the memory occupied by the current function's stack frame;
27784 @item
27785 the memory occupied by an incoming stack argument;
27787 @item
27788 the memory occupied by an object with a link-time-constant address.
27789 @end enumerate
27791 It is the kernel's responsibility to ensure that speculative
27792 accesses to these regions are indeed safe.
27794 If the input program contains a function declaration such as:
27796 @smallexample
27797 void foo (void);
27798 @end smallexample
27800 then the implementation of @code{foo} must allow @code{j foo} and
27801 @code{jal foo} to be executed speculatively.  GCC honors this
27802 restriction for functions it compiles itself.  It expects non-GCC
27803 functions (such as hand-written assembly code) to do the same.
27805 The option has three forms:
27807 @table @gcctabopt
27808 @item -mr10k-cache-barrier=load-store
27809 Insert a cache barrier before a load or store that might be
27810 speculatively executed and that might have side effects even
27811 if aborted.
27813 @item -mr10k-cache-barrier=store
27814 Insert a cache barrier before a store that might be speculatively
27815 executed and that might have side effects even if aborted.
27817 @item -mr10k-cache-barrier=none
27818 Disable the insertion of cache barriers.  This is the default setting.
27819 @end table
27821 @opindex mflush-func
27822 @item -mflush-func=@var{func}
27823 @itemx -mno-flush-func
27824 Specifies the function to call to flush the I and D caches, or to not
27825 call any such function.  If called, the function must take the same
27826 arguments as the common @code{_flush_func}, that is, the address of the
27827 memory range for which the cache is being flushed, the size of the
27828 memory range, and the number 3 (to flush both caches).  The default
27829 depends on the target GCC was configured for, but commonly is either
27830 @code{_flush_func} or @code{__cpu_flush}.
27832 @opindex mbranch-cost
27833 @item mbranch-cost=@var{num}
27834 Set the cost of branches to roughly @var{num} ``simple'' instructions.
27835 This cost is only a heuristic and is not guaranteed to produce
27836 consistent results across releases.  A zero cost redundantly selects
27837 the default, which is based on the @option{-mtune} setting.
27839 @opindex mbranch-likely
27840 @opindex mno-branch-likely
27841 @item -mbranch-likely
27842 @itemx -mno-branch-likely
27843 Enable or disable use of Branch Likely instructions, regardless of the
27844 default for the selected architecture.  By default, Branch Likely
27845 instructions may be generated if they are supported by the selected
27846 architecture.  An exception is for the MIPS32 and MIPS64 architectures
27847 and processors that implement those architectures; for those, Branch
27848 Likely instructions are not be generated by default because the MIPS32
27849 and MIPS64 architectures specifically deprecate their use.
27851 @opindex mcompact-branches=never
27852 @opindex mcompact-branches=optimal
27853 @opindex mcompact-branches=always
27854 @item -mcompact-branches=never
27855 @itemx -mcompact-branches=optimal
27856 @itemx -mcompact-branches=always
27857 These options control which form of branches will be generated.  The
27858 default is @option{-mcompact-branches=optimal}.
27860 The @option{-mcompact-branches=never} option ensures that compact branch
27861 instructions will never be generated.
27863 The @option{-mcompact-branches=always} option ensures that a compact
27864 branch instruction will be generated if available for MIPS Release 6 onwards.
27865 If a compact branch instruction is not available (or pre-R6),
27866 a delay slot form of the branch will be used instead.
27868 If it is used for MIPS16/microMIPS targets, it will be just ignored now.
27869 The behaviour for MIPS16/microMIPS may change in future,
27870 since they do have some compact branch instructions.
27872 The @option{-mcompact-branches=optimal} option will cause a delay slot
27873 branch to be used if one is available in the current ISA and the delay
27874 slot is successfully filled.  If the delay slot is not filled, a compact
27875 branch will be chosen if one is available.
27877 @opindex mfp-exceptions
27878 @item -mfp-exceptions
27879 @itemx -mno-fp-exceptions
27880 Specifies whether FP exceptions are enabled.  This affects how
27881 FP instructions are scheduled for some processors.
27882 The default is that FP exceptions are
27883 enabled.
27885 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
27886 64-bit code, then we can use both FP pipes.  Otherwise, we can only use one
27887 FP pipe.
27889 @opindex mvr4130-align
27890 @item -mvr4130-align
27891 @itemx -mno-vr4130-align
27892 The VR4130 pipeline is two-way superscalar, but can only issue two
27893 instructions together if the first one is 8-byte aligned.  When this
27894 option is enabled, GCC aligns pairs of instructions that it
27895 thinks should execute in parallel.
27897 This option only has an effect when optimizing for the VR4130.
27898 It normally makes code faster, but at the expense of making it bigger.
27899 It is enabled by default at optimization level @option{-O3}.
27901 @opindex msynci
27902 @item -msynci
27903 @itemx -mno-synci
27904 Enable (disable) generation of @code{synci} instructions on
27905 architectures that support it.  The @code{synci} instructions (if
27906 enabled) are generated when @code{__builtin___clear_cache} is
27907 compiled.
27909 This option defaults to @option{-mno-synci}, but the default can be
27910 overridden by configuring GCC with @option{--with-synci}.
27912 When compiling code for single processor systems, it is generally safe
27913 to use @code{synci}.  However, on many multi-core (SMP) systems, it
27914 does not invalidate the instruction caches on all cores and may lead
27915 to undefined behavior.
27917 @opindex mrelax-pic-calls
27918 @item -mrelax-pic-calls
27919 @itemx -mno-relax-pic-calls
27920 Try to turn PIC calls that are normally dispatched via register
27921 @code{$25} into direct calls.  This is only possible if the linker can
27922 resolve the destination at link time and if the destination is within
27923 range for a direct call.
27925 @option{-mrelax-pic-calls} is the default if GCC was configured to use
27926 an assembler and a linker that support the @code{.reloc} assembly
27927 directive and @option{-mexplicit-relocs} is in effect.  With
27928 @option{-mno-explicit-relocs}, this optimization can be performed by the
27929 assembler and the linker alone without help from the compiler.
27931 @opindex mmcount-ra-address
27932 @opindex mno-mcount-ra-address
27933 @item -mmcount-ra-address
27934 @itemx -mno-mcount-ra-address
27935 Emit (do not emit) code that allows @code{_mcount} to modify the
27936 calling function's return address.  When enabled, this option extends
27937 the usual @code{_mcount} interface with a new @var{ra-address}
27938 parameter, which has type @code{intptr_t *} and is passed in register
27939 @code{$12}.  @code{_mcount} can then modify the return address by
27940 doing both of the following:
27941 @itemize
27942 @item
27943 Returning the new address in register @code{$31}.
27944 @item
27945 Storing the new address in @code{*@var{ra-address}},
27946 if @var{ra-address} is nonnull.
27947 @end itemize
27949 The default is @option{-mno-mcount-ra-address}.
27951 @opindex mframe-header-opt
27952 @item -mframe-header-opt
27953 @itemx -mno-frame-header-opt
27954 Enable (disable) frame header optimization in the o32 ABI.  When using the
27955 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
27956 function to write out register arguments.  When enabled, this optimization
27957 will suppress the allocation of the frame header if it can be determined that
27958 it is unused.
27960 This optimization is off by default at all optimization levels.
27962 @opindex mlxc1-sxc1
27963 @item -mlxc1-sxc1
27964 @itemx -mno-lxc1-sxc1
27965 When applicable, enable (disable) the generation of @code{lwxc1},
27966 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions.  Enabled by default.
27968 @opindex mmadd4
27969 @item -mmadd4
27970 @itemx -mno-madd4
27971 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
27972 @code{madd.d} and related instructions.  Enabled by default.
27974 @end table
27976 @node MMIX Options
27977 @subsection MMIX Options
27978 @cindex MMIX Options
27980 These options are defined for the MMIX:
27982 @table @gcctabopt
27983 @opindex mlibfuncs
27984 @opindex mno-libfuncs
27985 @item -mlibfuncs
27986 @itemx -mno-libfuncs
27987 Specify that intrinsic library functions are being compiled, passing all
27988 values in registers, no matter the size.
27990 @opindex mepsilon
27991 @opindex mno-epsilon
27992 @item -mepsilon
27993 @itemx -mno-epsilon
27994 Generate floating-point comparison instructions that compare with respect
27995 to the @code{rE} epsilon register.
27997 @opindex mabi=mmixware
27998 @opindex mabi=gnu
27999 @item -mabi=mmixware
28000 @itemx -mabi=gnu
28001 Generate code that passes function parameters and return values that (in
28002 the called function) are seen as registers @code{$0} and up, as opposed to
28003 the GNU ABI which uses global registers @code{$231} and up.
28005 @opindex mzero-extend
28006 @opindex mno-zero-extend
28007 @item -mzero-extend
28008 @itemx -mno-zero-extend
28009 When reading data from memory in sizes shorter than 64 bits, use (do not
28010 use) zero-extending load instructions by default, rather than
28011 sign-extending ones.
28013 @opindex mknuthdiv
28014 @opindex mno-knuthdiv
28015 @item -mknuthdiv
28016 @itemx -mno-knuthdiv
28017 Make the result of a division yielding a remainder have the same sign as
28018 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
28019 remainder follows the sign of the dividend.  Both methods are
28020 arithmetically valid, the latter being almost exclusively used.
28022 @opindex mtoplevel-symbols
28023 @opindex mno-toplevel-symbols
28024 @item -mtoplevel-symbols
28025 @itemx -mno-toplevel-symbols
28026 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
28027 code can be used with the @code{PREFIX} assembly directive.
28029 @opindex melf
28030 @item -melf
28031 Generate an executable in the ELF format, rather than the default
28032 @samp{mmo} format used by the @command{mmix} simulator.
28034 @opindex mbranch-predict
28035 @opindex mno-branch-predict
28036 @item -mbranch-predict
28037 @itemx -mno-branch-predict
28038 Use (do not use) the probable-branch instructions, when static branch
28039 prediction indicates a probable branch.
28041 @opindex mbase-addresses
28042 @opindex mno-base-addresses
28043 @item -mbase-addresses
28044 @itemx -mno-base-addresses
28045 Generate (do not generate) code that uses @emph{base addresses}.  Using a
28046 base address automatically generates a request (handled by the assembler
28047 and the linker) for a constant to be set up in a global register.  The
28048 register is used for one or more base address requests within the range 0
28049 to 255 from the value held in the register.  The generally leads to short
28050 and fast code, but the number of different data items that can be
28051 addressed is limited.  This means that a program that uses lots of static
28052 data may require @option{-mno-base-addresses}.
28054 @opindex msingle-exit
28055 @opindex mno-single-exit
28056 @item -msingle-exit
28057 @itemx -mno-single-exit
28058 Force (do not force) generated code to have a single exit point in each
28059 function.
28060 @end table
28062 @node MN10300 Options
28063 @subsection MN10300 Options
28064 @cindex MN10300 options
28066 These @option{-m} options are defined for Matsushita MN10300 architectures:
28068 @table @gcctabopt
28069 @opindex mmult-bug
28070 @item -mmult-bug
28071 Generate code to avoid bugs in the multiply instructions for the MN10300
28072 processors.  This is the default.
28074 @opindex mno-mult-bug
28075 @item -mno-mult-bug
28076 Do not generate code to avoid bugs in the multiply instructions for the
28077 MN10300 processors.
28079 @opindex mam33
28080 @item -mam33
28081 Generate code using features specific to the AM33 processor.
28083 @opindex mno-am33
28084 @item -mno-am33
28085 Do not generate code using features specific to the AM33 processor.  This
28086 is the default.
28088 @opindex mam33-2
28089 @item -mam33-2
28090 Generate code using features specific to the AM33/2.0 processor.
28092 @opindex mam34
28093 @item -mam34
28094 Generate code using features specific to the AM34 processor.
28096 @opindex mtune
28097 @item -mtune=@var{cpu-type}
28098 Use the timing characteristics of the indicated CPU type when
28099 scheduling instructions.  This does not change the targeted processor
28100 type.  The CPU type must be one of @samp{mn10300}, @samp{am33},
28101 @samp{am33-2} or @samp{am34}.
28103 @opindex mreturn-pointer-on-d0
28104 @item -mreturn-pointer-on-d0
28105 When generating a function that returns a pointer, return the pointer
28106 in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
28107 only in @code{a0}, and attempts to call such functions without a prototype
28108 result in errors.  Note that this option is on by default; use
28109 @option{-mno-return-pointer-on-d0} to disable it.
28111 @opindex mno-crt0
28112 @item -mno-crt0
28113 Do not link in the C run-time initialization object file.
28115 @opindex mrelax
28116 @item -mrelax
28117 Indicate to the linker that it should perform a relaxation optimization pass
28118 to shorten branches, calls and absolute memory addresses.  This option only
28119 has an effect when used on the command line for the final link step.
28121 This option makes symbolic debugging impossible.
28123 @opindex mliw
28124 @item -mliw
28125 Allow the compiler to generate @emph{Long Instruction Word}
28126 instructions if the target is the @samp{AM33} or later.  This is the
28127 default.  This option defines the preprocessor macro @code{__LIW__}.
28129 @opindex mno-liw
28130 @item -mno-liw
28131 Do not allow the compiler to generate @emph{Long Instruction Word}
28132 instructions.  This option defines the preprocessor macro
28133 @code{__NO_LIW__}.
28135 @opindex msetlb
28136 @item -msetlb
28137 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
28138 instructions if the target is the @samp{AM33} or later.  This is the
28139 default.  This option defines the preprocessor macro @code{__SETLB__}.
28141 @opindex mno-setlb
28142 @item -mno-setlb
28143 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
28144 instructions.  This option defines the preprocessor macro
28145 @code{__NO_SETLB__}.
28147 @end table
28149 @node Moxie Options
28150 @subsection Moxie Options
28151 @cindex Moxie Options
28153 @table @gcctabopt
28155 @opindex meb
28156 @item -meb
28157 Generate big-endian code.  This is the default for @samp{moxie-*-*}
28158 configurations.
28160 @opindex mel
28161 @item -mel
28162 Generate little-endian code.
28164 @opindex mmul.x
28165 @item -mmul.x
28166 Generate mul.x and umul.x instructions.  This is the default for
28167 @samp{moxiebox-*-*} configurations.
28169 @opindex mno-crt0
28170 @item -mno-crt0
28171 Do not link in the C run-time initialization object file.
28173 @end table
28175 @node MSP430 Options
28176 @subsection MSP430 Options
28177 @cindex MSP430 Options
28179 These options are defined for the MSP430:
28181 @table @gcctabopt
28183 @opindex masm-hex
28184 @item -masm-hex
28185 Force assembly output to always use hex constants.  Normally such
28186 constants are signed decimals, but this option is available for
28187 testsuite and/or aesthetic purposes.
28189 @opindex mmcu=
28190 @item -mmcu=
28191 Select the MCU to target.  This is used to create a C preprocessor
28192 symbol based upon the MCU name, converted to upper case and pre- and
28193 post-fixed with @samp{__}.  This in turn is used by the
28194 @file{msp430.h} header file to select an MCU-specific supplementary
28195 header file.
28197 The option also sets the ISA to use.  If the MCU name is one that is
28198 known to only support the 430 ISA then that is selected, otherwise the
28199 430X ISA is selected.  A generic MCU name of @samp{msp430} can also be
28200 used to select the 430 ISA.  Similarly the generic @samp{msp430x} MCU
28201 name selects the 430X ISA.
28203 In addition an MCU-specific linker script is added to the linker
28204 command line.  The script's name is the name of the MCU with
28205 @file{.ld} appended.  Thus specifying @option{-mmcu=xxx} on the @command{gcc}
28206 command line defines the C preprocessor symbol @code{__XXX__} and
28207 cause the linker to search for a script called @file{xxx.ld}.
28209 The ISA and hardware multiply supported for the different MCUs is hard-coded
28210 into GCC.  However, an external @samp{devices.csv} file can be used to
28211 extend device support beyond those that have been hard-coded.
28213 GCC searches for the @samp{devices.csv} file using the following methods in the
28214 given precedence order, where the first method takes precendence over the
28215 second which takes precedence over the third.
28217 @table @asis
28218 @item Include path specified with @code{-I} and @code{-L}
28219 @samp{devices.csv} will be searched for in each of the directories specified by
28220 include paths and linker library search paths.
28221 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
28222 Define the value of the global environment variable
28223 @samp{MSP430_GCC_INCLUDE_DIR}
28224 to the full path to the directory containing devices.csv, and GCC will search
28225 this directory for devices.csv.  If devices.csv is found, this directory will
28226 also be registered as an include path, and linker library path.  Header files
28227 and linker scripts in this directory can therefore be used without manually
28228 specifying @code{-I} and @code{-L} on the command line.
28229 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
28230 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
28231 toolchain root directory.  This directory does not exist in a default
28232 installation, but if the user has created it and copied @samp{devices.csv}
28233 there, then the MCU data will be read.  As above, this directory will
28234 also be registered as an include path, and linker library path.
28236 @end table
28237 If none of the above search methods find @samp{devices.csv}, then the
28238 hard-coded MCU data is used.
28241 @opindex mwarn-mcu
28242 @opindex mno-warn-mcu
28243 @item -mwarn-mcu
28244 @itemx -mno-warn-mcu
28245 This option enables or disables warnings about conflicts between the
28246 MCU name specified by the @option{-mmcu} option and the ISA set by the
28247 @option{-mcpu} option and/or the hardware multiply support set by the
28248 @option{-mhwmult} option.  It also toggles warnings about unrecognized
28249 MCU names.  This option is on by default.
28251 @opindex mcpu=
28252 @item -mcpu=
28253 Specifies the ISA to use.  Accepted values are @samp{msp430},
28254 @samp{msp430x} and @samp{msp430xv2}.  This option is deprecated.  The
28255 @option{-mmcu=} option should be used to select the ISA.
28257 @opindex msim
28258 @item -msim
28259 Link to the simulator runtime libraries and linker script.  Overrides
28260 any scripts that would be selected by the @option{-mmcu=} option.
28262 @opindex mlarge
28263 @item -mlarge
28264 Use large-model addressing (20-bit pointers, 20-bit @code{size_t}).
28266 @opindex msmall
28267 @item -msmall
28268 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
28270 @opindex mrelax
28271 @item -mrelax
28272 This option is passed to the assembler and linker, and allows the
28273 linker to perform certain optimizations that cannot be done until
28274 the final link.
28276 @opindex mhwmult=
28277 @item mhwmult=
28278 Describes the type of hardware multiply supported by the target.
28279 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
28280 for the original 16-bit-only multiply supported by early MCUs.
28281 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
28282 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
28283 A value of @samp{auto} can also be given.  This tells GCC to deduce
28284 the hardware multiply support based upon the MCU name provided by the
28285 @option{-mmcu} option.  If no @option{-mmcu} option is specified or if
28286 the MCU name is not recognized then no hardware multiply support is
28287 assumed.  @code{auto} is the default setting.
28289 Hardware multiplies are normally performed by calling a library
28290 routine.  This saves space in the generated code.  When compiling at
28291 @option{-O3} or higher however the hardware multiplier is invoked
28292 inline.  This makes for bigger, but faster code.
28294 The hardware multiply routines disable interrupts whilst running and
28295 restore the previous interrupt state when they finish.  This makes
28296 them safe to use inside interrupt handlers as well as in normal code.
28298 @opindex minrt
28299 @item -minrt
28300 Enable the use of a minimum runtime environment - no static
28301 initializers or constructors.  This is intended for memory-constrained
28302 devices.  The compiler includes special symbols in some objects
28303 that tell the linker and runtime which code fragments are required.
28305 @opindex mtiny-printf
28306 @item -mtiny-printf
28307 Enable reduced code size @code{printf} and @code{puts} library functions.
28308 The @samp{tiny} implementations of these functions are not reentrant, so
28309 must be used with caution in multi-threaded applications.
28311 Support for streams has been removed and the string to be printed will
28312 always be sent to stdout via the @code{write} syscall.  The string is not
28313 buffered before it is sent to write.
28315 This option requires Newlib Nano IO, so GCC must be configured with
28316 @samp{--enable-newlib-nano-formatted-io}.
28318 @opindex mmax-inline-shift=
28319 @item -mmax-inline-shift=
28320 This option takes an integer between 0 and 64 inclusive, and sets
28321 the maximum number of inline shift instructions which should be emitted to
28322 perform a shift operation by a constant amount.  When this value needs to be
28323 exceeded, an mspabi helper function is used instead.  The default value is 4.
28325 This only affects cases where a shift by multiple positions cannot be
28326 completed with a single instruction (e.g. all shifts >1 on the 430 ISA).
28328 Shifts of a 32-bit value are at least twice as costly, so the value passed for
28329 this option is divided by 2 and the resulting value used instead.
28331 @opindex mcode-region
28332 @opindex mdata-region
28333 @item -mcode-region=
28334 @itemx -mdata-region=
28335 These options tell the compiler where to place functions and data that
28336 do not have one of the @code{lower}, @code{upper}, @code{either} or
28337 @code{section} attributes.  Possible values are @code{lower},
28338 @code{upper}, @code{either} or @code{any}.  The first three behave
28339 like the corresponding attribute.  The fourth possible value -
28340 @code{any} - is the default.  It leaves placement entirely up to the
28341 linker script and how it assigns the standard sections
28342 (@code{.text}, @code{.data}, etc) to the memory regions.
28344 @opindex msilicon-errata
28345 @item -msilicon-errata=
28346 This option passes on a request to assembler to enable the fixes for
28347 the named silicon errata.
28349 @opindex msilicon-errata-warn
28350 @item -msilicon-errata-warn=
28351 This option passes on a request to the assembler to enable warning
28352 messages when a silicon errata might need to be applied.
28354 @opindex mwarn-devices-csv
28355 @opindex mno-warn-devices-csv
28356 @item -mwarn-devices-csv
28357 @itemx -mno-warn-devices-csv
28358 Warn if @samp{devices.csv} is not found or there are problem parsing it
28359 (default: on).
28361 @end table
28363 @node NDS32 Options
28364 @subsection NDS32 Options
28365 @cindex NDS32 Options
28367 These options are defined for NDS32 implementations:
28369 @table @gcctabopt
28371 @opindex mbig-endian
28372 @item -mbig-endian
28373 Generate code in big-endian mode.
28375 @opindex mlittle-endian
28376 @item -mlittle-endian
28377 Generate code in little-endian mode.
28379 @opindex mreduced-regs
28380 @item -mreduced-regs
28381 Use reduced-set registers for register allocation.
28383 @opindex mfull-regs
28384 @item -mfull-regs
28385 Use full-set registers for register allocation.
28387 @opindex mcmov
28388 @item -mcmov
28389 Generate conditional move instructions.
28391 @opindex mno-cmov
28392 @item -mno-cmov
28393 Do not generate conditional move instructions.
28395 @opindex mext-perf
28396 @item -mext-perf
28397 Generate performance extension instructions.
28399 @opindex mno-ext-perf
28400 @item -mno-ext-perf
28401 Do not generate performance extension instructions.
28403 @opindex mext-perf2
28404 @item -mext-perf2
28405 Generate performance extension 2 instructions.
28407 @opindex mno-ext-perf2
28408 @item -mno-ext-perf2
28409 Do not generate performance extension 2 instructions.
28411 @opindex mext-string
28412 @item -mext-string
28413 Generate string extension instructions.
28415 @opindex mno-ext-string
28416 @item -mno-ext-string
28417 Do not generate string extension instructions.
28419 @opindex mv3push
28420 @item -mv3push
28421 Generate v3 push25/pop25 instructions.
28423 @opindex mno-v3push
28424 @item -mno-v3push
28425 Do not generate v3 push25/pop25 instructions.
28427 @opindex m16-bit
28428 @item -m16-bit
28429 Generate 16-bit instructions.
28431 @opindex mno-16-bit
28432 @item -mno-16-bit
28433 Do not generate 16-bit instructions.
28435 @opindex misr-vector-size
28436 @item -misr-vector-size=@var{num}
28437 Specify the size of each interrupt vector, which must be 4 or 16.
28439 @opindex mcache-block-size
28440 @item -mcache-block-size=@var{num}
28441 Specify the size of each cache block,
28442 which must be a power of 2 between 4 and 512.
28444 @opindex march
28445 @item -march=@var{arch}
28446 Specify the name of the target architecture.
28448 @opindex mcmodel
28449 @item -mcmodel=@var{code-model}
28450 Set the code model to one of
28451 @table @asis
28452 @item @samp{small}
28453 All the data and read-only data segments must be within 512KB addressing space.
28454 The text segment must be within 16MB addressing space.
28455 @item @samp{medium}
28456 The data segment must be within 512KB while the read-only data segment can be
28457 within 4GB addressing space.  The text segment should be still within 16MB
28458 addressing space.
28459 @item @samp{large}
28460 All the text and data segments can be within 4GB addressing space.
28461 @end table
28463 @opindex mctor-dtor
28464 @item -mctor-dtor
28465 Enable constructor/destructor feature.
28467 @opindex mrelax
28468 @item -mrelax
28469 Guide linker to relax instructions.
28471 @end table
28473 @node Nios II Options
28474 @subsection Nios II Options
28475 @cindex Nios II options
28476 @cindex Altera Nios II options
28478 These are the options defined for the Altera Nios II processor.
28480 @table @gcctabopt
28482 @opindex G
28483 @cindex smaller data references
28484 @item -G @var{num}
28485 Put global and static objects less than or equal to @var{num} bytes
28486 into the small data or BSS sections instead of the normal data or BSS
28487 sections.  The default value of @var{num} is 8.
28489 @opindex mgpopt
28490 @opindex mno-gpopt
28491 @item -mgpopt=@var{option}
28492 @itemx -mgpopt
28493 @itemx -mno-gpopt
28494 Generate (do not generate) GP-relative accesses.  The following 
28495 @var{option} names are recognized:
28497 @table @samp
28499 @item none
28500 Do not generate GP-relative accesses.
28502 @item local
28503 Generate GP-relative accesses for small data objects that are not 
28504 external, weak, or uninitialized common symbols.  
28505 Also use GP-relative addressing for objects that
28506 have been explicitly placed in a small data section via a @code{section}
28507 attribute.
28509 @item global
28510 As for @samp{local}, but also generate GP-relative accesses for
28511 small data objects that are external, weak, or common.  If you use this option,
28512 you must ensure that all parts of your program (including libraries) are
28513 compiled with the same @option{-G} setting.
28515 @item data
28516 Generate GP-relative accesses for all data objects in the program.  If you
28517 use this option, the entire data and BSS segments
28518 of your program must fit in 64K of memory and you must use an appropriate
28519 linker script to allocate them within the addressable range of the
28520 global pointer.
28522 @item all
28523 Generate GP-relative addresses for function pointers as well as data
28524 pointers.  If you use this option, the entire text, data, and BSS segments
28525 of your program must fit in 64K of memory and you must use an appropriate
28526 linker script to allocate them within the addressable range of the
28527 global pointer.
28529 @end table
28531 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
28532 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
28534 The default is @option{-mgpopt} except when @option{-fpic} or
28535 @option{-fPIC} is specified to generate position-independent code.
28536 Note that the Nios II ABI does not permit GP-relative accesses from
28537 shared libraries.
28539 You may need to specify @option{-mno-gpopt} explicitly when building
28540 programs that include large amounts of small data, including large
28541 GOT data sections.  In this case, the 16-bit offset for GP-relative
28542 addressing may not be large enough to allow access to the entire 
28543 small data section.
28545 @opindex mgprel-sec
28546 @item -mgprel-sec=@var{regexp}
28547 This option specifies additional section names that can be accessed via
28548 GP-relative addressing.  It is most useful in conjunction with 
28549 @code{section} attributes on variable declarations 
28550 (@pxref{Common Variable Attributes}) and a custom linker script.  
28551 The @var{regexp} is a POSIX Extended Regular Expression.
28553 This option does not affect the behavior of the @option{-G} option, and 
28554 the specified sections are in addition to the standard @code{.sdata}
28555 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
28557 @opindex mr0rel-sec
28558 @item -mr0rel-sec=@var{regexp}
28559 This option specifies names of sections that can be accessed via a 
28560 16-bit offset from @code{r0}; that is, in the low 32K or high 32K 
28561 of the 32-bit address space.  It is most useful in conjunction with 
28562 @code{section} attributes on variable declarations 
28563 (@pxref{Common Variable Attributes}) and a custom linker script.  
28564 The @var{regexp} is a POSIX Extended Regular Expression.
28566 In contrast to the use of GP-relative addressing for small data, 
28567 zero-based addressing is never generated by default and there are no 
28568 conventional section names used in standard linker scripts for sections
28569 in the low or high areas of memory.
28571 @opindex mel
28572 @opindex meb
28573 @item -mel
28574 @itemx -meb
28575 Generate little-endian (default) or big-endian (experimental) code,
28576 respectively.
28578 @opindex march
28579 @item -march=@var{arch}
28580 This specifies the name of the target Nios II architecture.  GCC uses this
28581 name to determine what kind of instructions it can emit when generating
28582 assembly code.  Permissible names are: @samp{r1}, @samp{r2}.
28584 The preprocessor macro @code{__nios2_arch__} is available to programs,
28585 with value 1 or 2, indicating the targeted ISA level.
28587 @opindex mno-bypass-cache
28588 @opindex mbypass-cache
28589 @item -mbypass-cache
28590 @itemx -mno-bypass-cache
28591 Force all load and store instructions to always bypass cache by 
28592 using I/O variants of the instructions. The default is not to
28593 bypass the cache.
28595 @opindex mcache-volatile 
28596 @opindex mno-cache-volatile
28597 @item -mno-cache-volatile 
28598 @itemx -mcache-volatile       
28599 Volatile memory access bypass the cache using the I/O variants of 
28600 the load and store instructions. The default is not to bypass the cache.
28602 @opindex mno-fast-sw-div
28603 @opindex mfast-sw-div
28604 @item -mno-fast-sw-div
28605 @itemx -mfast-sw-div
28606 Do not use table-based fast divide for small numbers. The default 
28607 is to use the fast divide at @option{-O3} and above.
28609 @opindex mno-hw-mul
28610 @opindex mhw-mul
28611 @opindex mno-hw-mulx
28612 @opindex mhw-mulx
28613 @opindex mno-hw-div
28614 @opindex mhw-div
28615 @item -mno-hw-mul
28616 @itemx -mhw-mul
28617 @itemx -mno-hw-mulx
28618 @itemx -mhw-mulx
28619 @itemx -mno-hw-div
28620 @itemx -mhw-div
28621 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of 
28622 instructions by the compiler. The default is to emit @code{mul}
28623 and not emit @code{div} and @code{mulx}.
28625 @item -mbmx
28626 @itemx -mno-bmx
28627 @itemx -mcdx
28628 @itemx -mno-cdx
28629 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
28630 CDX (code density) instructions.  Enabling these instructions also
28631 requires @option{-march=r2}.  Since these instructions are optional
28632 extensions to the R2 architecture, the default is not to emit them.
28634 @opindex mcustom-@var{insn}
28635 @opindex mno-custom-@var{insn}
28636 @item -mcustom-@var{insn}=@var{N}
28637 @itemx -mno-custom-@var{insn}
28638 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
28639 custom instruction with encoding @var{N} when generating code that uses 
28640 @var{insn}.  For example, @option{-mcustom-fadds=253} generates custom
28641 instruction 253 for single-precision floating-point add operations instead
28642 of the default behavior of using a library call.
28644 The following values of @var{insn} are supported.  Except as otherwise
28645 noted, floating-point operations are expected to be implemented with
28646 normal IEEE 754 semantics and correspond directly to the C operators or the
28647 equivalent GCC built-in functions (@pxref{Other Builtins}).
28649 Single-precision floating point:
28650 @table @asis
28652 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
28653 Binary arithmetic operations.
28655 @item @samp{fnegs}
28656 Unary negation.
28658 @item @samp{fabss}
28659 Unary absolute value.
28661 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
28662 Comparison operations.
28664 @item @samp{fmins}, @samp{fmaxs}
28665 Floating-point minimum and maximum.  These instructions are only
28666 generated if @option{-ffinite-math-only} is specified.
28668 @item @samp{fsqrts}
28669 Unary square root operation.
28671 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
28672 Floating-point trigonometric and exponential functions.  These instructions
28673 are only generated if @option{-funsafe-math-optimizations} is also specified.
28675 @end table
28677 Double-precision floating point:
28678 @table @asis
28680 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
28681 Binary arithmetic operations.
28683 @item @samp{fnegd}
28684 Unary negation.
28686 @item @samp{fabsd}
28687 Unary absolute value.
28689 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
28690 Comparison operations.
28692 @item @samp{fmind}, @samp{fmaxd}
28693 Double-precision minimum and maximum.  These instructions are only
28694 generated if @option{-ffinite-math-only} is specified.
28696 @item @samp{fsqrtd}
28697 Unary square root operation.
28699 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
28700 Double-precision trigonometric and exponential functions.  These instructions
28701 are only generated if @option{-funsafe-math-optimizations} is also specified.
28703 @end table
28705 Conversions:
28706 @table @asis
28707 @item @samp{fextsd}
28708 Conversion from single precision to double precision.
28710 @item @samp{ftruncds}
28711 Conversion from double precision to single precision.
28713 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
28714 Conversion from floating point to signed or unsigned integer types, with
28715 truncation towards zero.
28717 @item @samp{round}
28718 Conversion from single-precision floating point to signed integer,
28719 rounding to the nearest integer and ties away from zero.
28720 This corresponds to the @code{__builtin_lroundf} function when
28721 @option{-fno-math-errno} is used.
28723 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
28724 Conversion from signed or unsigned integer types to floating-point types.
28726 @end table
28728 In addition, all of the following transfer instructions for internal
28729 registers X and Y must be provided to use any of the double-precision
28730 floating-point instructions.  Custom instructions taking two
28731 double-precision source operands expect the first operand in the
28732 64-bit register X.  The other operand (or only operand of a unary
28733 operation) is given to the custom arithmetic instruction with the
28734 least significant half in source register @var{src1} and the most
28735 significant half in @var{src2}.  A custom instruction that returns a
28736 double-precision result returns the most significant 32 bits in the
28737 destination register and the other half in 32-bit register Y.  
28738 GCC automatically generates the necessary code sequences to write
28739 register X and/or read register Y when double-precision floating-point
28740 instructions are used.
28742 @table @asis
28744 @item @samp{fwrx}
28745 Write @var{src1} into the least significant half of X and @var{src2} into
28746 the most significant half of X.
28748 @item @samp{fwry}
28749 Write @var{src1} into Y.
28751 @item @samp{frdxhi}, @samp{frdxlo}
28752 Read the most or least (respectively) significant half of X and store it in
28753 @var{dest}.
28755 @item @samp{frdy}
28756 Read the value of Y and store it into @var{dest}.
28757 @end table
28759 Note that you can gain more local control over generation of Nios II custom
28760 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
28761 and @code{target("no-custom-@var{insn}")} function attributes
28762 (@pxref{Function Attributes})
28763 or pragmas (@pxref{Function Specific Option Pragmas}).
28765 @opindex mcustom-fpu-cfg
28766 @item -mcustom-fpu-cfg=@var{name}
28768 This option enables a predefined, named set of custom instruction encodings
28769 (see @option{-mcustom-@var{insn}} above).  
28770 Currently, the following sets are defined:
28772 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
28773 @gccoptlist{-mcustom-fmuls=252
28774 -mcustom-fadds=253
28775 -mcustom-fsubs=254
28776 -fsingle-precision-constant}
28778 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
28779 @gccoptlist{-mcustom-fmuls=252
28780 -mcustom-fadds=253
28781 -mcustom-fsubs=254
28782 -mcustom-fdivs=255
28783 -fsingle-precision-constant}
28785 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
28786 @gccoptlist{-mcustom-floatus=243
28787 -mcustom-fixsi=244
28788 -mcustom-floatis=245
28789 -mcustom-fcmpgts=246
28790 -mcustom-fcmples=249
28791 -mcustom-fcmpeqs=250
28792 -mcustom-fcmpnes=251
28793 -mcustom-fmuls=252
28794 -mcustom-fadds=253
28795 -mcustom-fsubs=254
28796 -mcustom-fdivs=255
28797 -fsingle-precision-constant}
28799 @option{-mcustom-fpu-cfg=fph2} is equivalent to:
28800 @gccoptlist{-mcustom-fabss=224
28801 -mcustom-fnegs=225
28802 -mcustom-fcmpnes=226
28803 -mcustom-fcmpeqs=227
28804 -mcustom-fcmpges=228
28805 -mcustom-fcmpgts=229
28806 -mcustom-fcmples=230
28807 -mcustom-fcmplts=231
28808 -mcustom-fmaxs=232
28809 -mcustom-fmins=233
28810 -mcustom-round=248
28811 -mcustom-fixsi=249
28812 -mcustom-floatis=250
28813 -mcustom-fsqrts=251
28814 -mcustom-fmuls=252
28815 -mcustom-fadds=253
28816 -mcustom-fsubs=254
28817 -mcustom-fdivs=255}
28819 Custom instruction assignments given by individual
28820 @option{-mcustom-@var{insn}=} options override those given by
28821 @option{-mcustom-fpu-cfg=}, regardless of the
28822 order of the options on the command line.
28824 Note that you can gain more local control over selection of a FPU
28825 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
28826 function attribute (@pxref{Function Attributes})
28827 or pragma (@pxref{Function Specific Option Pragmas}).
28829 The name @var{fph2} is an abbreviation for @emph{Nios II Floating Point
28830 Hardware 2 Component}.  Please note that the custom instructions enabled by
28831 @option{-mcustom-fmins=233} and @option{-mcustom-fmaxs=234} are only generated
28832 if @option{-ffinite-math-only} is specified.  The custom instruction enabled by
28833 @option{-mcustom-round=248} is only generated if @option{-fno-math-errno} is
28834 specified.  In contrast to the other configurations,
28835 @option{-fsingle-precision-constant} is not set.
28837 @end table
28839 These additional @samp{-m} options are available for the Altera Nios II
28840 ELF (bare-metal) target:
28842 @table @gcctabopt
28844 @opindex mhal
28845 @item -mhal
28846 Link with HAL BSP.  This suppresses linking with the GCC-provided C runtime
28847 startup and termination code, and is typically used in conjunction with
28848 @option{-msys-crt0=} to specify the location of the alternate startup code
28849 provided by the HAL BSP.
28851 @opindex msmallc
28852 @item -msmallc
28853 Link with a limited version of the C library, @option{-lsmallc}, rather than
28854 Newlib.
28856 @opindex msys-crt0
28857 @item -msys-crt0=@var{startfile}
28858 @var{startfile} is the file name of the startfile (crt0) to use 
28859 when linking.  This option is only useful in conjunction with @option{-mhal}.
28861 @opindex msys-lib
28862 @item -msys-lib=@var{systemlib}
28863 @var{systemlib} is the library name of the library that provides
28864 low-level system calls required by the C library,
28865 e.g.@: @code{read} and @code{write}.
28866 This option is typically used to link with a library provided by a HAL BSP.
28868 @end table
28870 @node Nvidia PTX Options
28871 @subsection Nvidia PTX Options
28872 @cindex Nvidia PTX options
28873 @cindex nvptx options
28875 These options are defined for Nvidia PTX:
28877 @table @gcctabopt
28879 @opindex m64
28880 @item -m64
28881 Ignored, but preserved for backward compatibility.  Only 64-bit ABI is
28882 supported.
28884 @opindex march
28885 @item -march=@var{architecture-string}
28886 Generate code for the specified PTX ISA target architecture
28887 (e.g.@: @samp{sm_35}).  Valid architecture strings are @samp{sm_30},
28888 @samp{sm_35}, @samp{sm_53}, @samp{sm_70}, @samp{sm_75} and
28889 @samp{sm_80}.
28890 The default depends on how the compiler has been configured, see
28891 @option{--with-arch}.
28893 This option sets the value of the preprocessor macro
28894 @code{__PTX_SM__}; for instance, for @samp{sm_35}, it has the value
28895 @samp{350}.
28897 @opindex misa
28898 @item -misa=@var{architecture-string}
28899 Alias of @option{-march=}.
28901 @opindex march
28902 @item -march-map=@var{architecture-string}
28903 Select the closest available @option{-march=} value that is not more
28904 capable.  For instance, for @option{-march-map=sm_50} select
28905 @option{-march=sm_35}, and for @option{-march-map=sm_53} select
28906 @option{-march=sm_53}.
28908 @opindex mptx
28909 @item -mptx=@var{version-string}
28910 Generate code for the specified PTX ISA version (e.g.@: @samp{7.0}).
28911 Valid version strings include @samp{3.1}, @samp{6.0}, @samp{6.3}, and
28912 @samp{7.0}.  The default PTX ISA version is 6.0, unless a higher
28913 version is required for specified PTX ISA target architecture via
28914 option @option{-march=}.
28916 This option sets the values of the preprocessor macros
28917 @code{__PTX_ISA_VERSION_MAJOR__} and @code{__PTX_ISA_VERSION_MINOR__};
28918 for instance, for @samp{3.1} the macros have the values @samp{3} and
28919 @samp{1}, respectively.
28921 @opindex mmainkernel
28922 @item -mmainkernel
28923 Link in code for a __main kernel.  This is for stand-alone instead of
28924 offloading execution.
28926 @opindex moptimize
28927 @item -moptimize
28928 Apply partitioned execution optimizations.  This is the default when any
28929 level of optimization is selected.
28931 @opindex msoft-stack
28932 @item -msoft-stack
28933 Generate code that does not use @code{.local} memory
28934 directly for stack storage. Instead, a per-warp stack pointer is
28935 maintained explicitly. This enables variable-length stack allocation (with
28936 variable-length arrays or @code{alloca}), and when global memory is used for
28937 underlying storage, makes it possible to access automatic variables from other
28938 threads, or with atomic instructions. This code generation variant is used
28939 for OpenMP offloading, but the option is exposed on its own for the purpose
28940 of testing the compiler; to generate code suitable for linking into programs
28941 using OpenMP offloading, use option @option{-mgomp}.
28943 @opindex muniform-simt
28944 @item -muniform-simt
28945 Switch to code generation variant that allows to execute all threads in each
28946 warp, while maintaining memory state and side effects as if only one thread
28947 in each warp was active outside of OpenMP SIMD regions.  All atomic operations
28948 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
28949 current lane index equals the master lane index), and the register being
28950 assigned is copied via a shuffle instruction from the master lane.  Outside of
28951 SIMD regions lane 0 is the master; inside, each thread sees itself as the
28952 master.  Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
28953 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
28954 regions).  Each thread can bitwise-and the bitmask at position @code{tid.y}
28955 with current lane index to compute the master lane index.
28957 @opindex mgomp
28958 @item -mgomp
28959 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
28960 @option{-muniform-simt} options, and selects corresponding multilib variant.
28962 @end table
28964 @node OpenRISC Options
28965 @subsection OpenRISC Options
28966 @cindex OpenRISC Options
28968 These options are defined for OpenRISC:
28970 @table @gcctabopt
28972 @opindex mboard
28973 @item -mboard=@var{name}
28974 Configure a board specific runtime.  This will be passed to the linker for
28975 newlib board library linking.  The default is @code{or1ksim}.
28977 @opindex mnewlib
28978 @item -mnewlib
28979 This option is ignored; it is for compatibility purposes only.  This used to
28980 select linker and preprocessor options for use with newlib.
28982 @opindex msoft-div
28983 @opindex mhard-div
28984 @item -msoft-div
28985 @itemx -mhard-div
28986 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
28987 This default is hardware divide.
28989 @opindex msoft-mul
28990 @opindex mhard-mul
28991 @item -msoft-mul
28992 @itemx -mhard-mul
28993 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
28994 This default is hardware multiply.
28996 @opindex msoft-float
28997 @opindex mhard-float
28998 @item -msoft-float
28999 @itemx -mhard-float
29000 Select software or hardware for floating point operations.
29001 The default is software.
29003 @opindex mdouble-float
29004 @item -mdouble-float
29005 When @option{-mhard-float} is selected, enables generation of double-precision
29006 floating point instructions.  By default functions from @file{libgcc} are used
29007 to perform double-precision floating point operations.
29009 @opindex munordered-float
29010 @item -munordered-float
29011 When @option{-mhard-float} is selected, enables generation of unordered
29012 floating point compare and set flag (@code{lf.sfun*}) instructions.  By default
29013 functions from @file{libgcc} are used to perform unordered floating point
29014 compare and set flag operations.
29016 @opindex mcmov
29017 @item -mcmov
29018 Enable generation of conditional move (@code{l.cmov}) instructions.  By
29019 default the equivalent will be generated using set and branch.
29021 @opindex mror
29022 @item -mror
29023 Enable generation of rotate right (@code{l.ror}) instructions.  By default
29024 functions from @file{libgcc} are used to perform rotate right operations.
29026 @opindex mrori
29027 @item -mrori
29028 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
29029 By default functions from @file{libgcc} are used to perform rotate right with
29030 immediate operations.
29032 @opindex msext
29033 @item -msext
29034 Enable generation of sign extension (@code{l.ext*}) instructions.  By default
29035 memory loads are used to perform sign extension.
29037 @opindex msfimm
29038 @item -msfimm
29039 Enable generation of compare and set flag with immediate (@code{l.sf*i})
29040 instructions.  By default extra instructions will be generated to store the
29041 immediate to a register first.
29043 @opindex mshftimm
29044 @item -mshftimm
29045 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
29046 @code{l.slli}) instructions.  By default extra instructions will be generated
29047 to store the immediate to a register first.
29049 @opindex mcmodel=small
29050 @item -mcmodel=small
29051 Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
29052 the default model.
29054 @opindex mcmodel=large
29055 @item -mcmodel=large
29056 Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
29059 @end table
29061 @node PDP-11 Options
29062 @subsection PDP-11 Options
29063 @cindex PDP-11 Options
29065 These options are defined for the PDP-11:
29067 @table @gcctabopt
29068 @opindex mfpu
29069 @item -mfpu
29070 Use hardware FPP floating point.  This is the default.  (FIS floating
29071 point on the PDP-11/40 is not supported.)  Implies -m45.
29073 @opindex msoft-float
29074 @item -msoft-float
29075 Do not use hardware floating point.
29077 @opindex mac0
29078 @item -mac0
29079 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
29081 @opindex mno-ac0
29082 @item -mno-ac0
29083 Return floating-point results in memory.  This is the default.
29085 @opindex m40
29086 @item -m40
29087 Generate code for a PDP-11/40.  Implies -msoft-float -mno-split.
29089 @opindex m45
29090 @item -m45
29091 Generate code for a PDP-11/45.  This is the default.
29093 @opindex m10
29094 @item -m10
29095 Generate code for a PDP-11/10.  Implies -msoft-float -mno-split.
29097 @opindex mint16
29098 @opindex mno-int32
29099 @item -mint16
29100 @itemx -mno-int32
29101 Use 16-bit @code{int}.  This is the default.
29103 @opindex mint32
29104 @opindex mno-int16
29105 @item -mint32
29106 @itemx -mno-int16
29107 Use 32-bit @code{int}.
29109 @opindex msplit
29110 @item -msplit
29111 Target has split instruction and data space.  Implies -m45.
29113 @opindex munix-asm
29114 @item -munix-asm
29115 Use Unix assembler syntax.
29117 @opindex mdec-asm
29118 @item -mdec-asm
29119 Use DEC assembler syntax.
29121 @opindex mgnu-asm
29122 @item -mgnu-asm
29123 Use GNU assembler syntax.  This is the default.
29125 @opindex mlra
29126 @item -mlra
29127 Use the new LRA register allocator.  By default, the old ``reload''
29128 allocator is used.
29129 @end table
29131 @node PowerPC Options
29132 @subsection PowerPC Options
29133 @cindex PowerPC options
29135 These are listed under @xref{RS/6000 and PowerPC Options}.
29137 @node PRU Options
29138 @subsection PRU Options
29139 @cindex PRU Options
29141 These command-line options are defined for PRU target:
29143 @table @gcctabopt
29144 @opindex minrt
29145 @item -minrt
29146 Link with a minimum runtime environment, with no support for static
29147 initializers and constructors.  Using this option can significantly reduce
29148 the size of the final ELF binary.  Beware that the compiler could still
29149 generate code with static initializers and constructors.  It is up to the
29150 programmer to ensure that the source program will not use those features.
29152 @opindex mmcu
29153 @item -mmcu=@var{mcu}
29154 Specify the PRU MCU variant to use.  Check Newlib for the exact list of
29155 supported MCUs.
29157 @opindex mno-relax
29158 @item -mno-relax
29159 Make GCC pass the @option{--no-relax} command-line option to the linker
29160 instead of the @option{--relax} option.
29162 @opindex mloop
29163 @item -mloop
29164 Allow (or do not allow) GCC to use the LOOP instruction.
29166 @opindex mabi
29167 @item -mabi=@var{variant}
29168 Specify the ABI variant to output code for.  @option{-mabi=ti} selects the
29169 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
29170 more naturally with certain GCC assumptions.  These are the differences:
29172 @table @samp
29173 @item Function Pointer Size
29174 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
29175 supports only 32-bit data and code pointers.
29177 @item Optional Return Value Pointer
29178 Function return values larger than 64 bits are passed by using a hidden
29179 pointer as the first argument of the function.  TI ABI, though, mandates that
29180 the pointer can be NULL in case the caller is not using the returned value.
29181 GNU always passes and expects a valid return value pointer.
29183 @end table
29185 The current @option{-mabi=ti} implementation simply raises a compile error
29186 when any of the above code constructs is detected.  As a consequence
29187 the standard C library cannot be built and it is omitted when linking with
29188 @option{-mabi=ti}.
29190 Relaxation is a GNU feature and for safety reasons is disabled when using
29191 @option{-mabi=ti}.  The TI toolchain does not emit relocations for QBBx
29192 instructions, so the GNU linker cannot adjust them when shortening adjacent
29193 LDI32 pseudo instructions.
29195 @end table
29197 @node RISC-V Options
29198 @subsection RISC-V Options
29199 @cindex RISC-V Options
29201 These command-line options are defined for RISC-V targets:
29203 @table @gcctabopt
29204 @opindex mbranch-cost
29205 @item -mbranch-cost=@var{n}
29206 Set the cost of branches to roughly @var{n} instructions.
29208 @opindex plt
29209 @item -mplt
29210 @itemx -mno-plt
29211 When generating PIC code, do or don't allow the use of PLTs. Ignored for
29212 non-PIC.  The default is @option{-mplt}.
29214 @opindex mabi
29215 @item -mabi=@var{ABI-string}
29216 Specify integer and floating-point calling convention.  @var{ABI-string}
29217 contains two parts: the size of integer types and the registers used for
29218 floating-point types.  For example @samp{-march=rv64ifd -mabi=lp64d} means that
29219 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
29220 32-bit), and that floating-point values up to 64 bits wide are passed in F
29221 registers.  Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
29222 allows the compiler to generate code that uses the F and D extensions but only
29223 allows floating-point values up to 32 bits long to be passed in registers; or
29224 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
29225 passed in registers.
29227 The default for this argument is system dependent, users who want a specific
29228 calling convention should specify one explicitly.  The valid calling
29229 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
29230 @samp{lp64f}, and @samp{lp64d}.  Some calling conventions are impossible to
29231 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
29232 invalid because the ABI requires 64-bit values be passed in F registers, but F
29233 registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI that can
29234 only be used with the @samp{rv32e} architecture.  This ABI is not well
29235 specified at present, and is subject to change.
29237 @opindex mfdiv
29238 @item -mfdiv
29239 @itemx -mno-fdiv
29240 Do or don't use hardware floating-point divide and square root instructions.
29241 This requires the F or D extensions for floating-point registers.  The default
29242 is to use them if the specified architecture has these instructions.
29244 @opindex mdiv
29245 @item -mdiv
29246 @itemx -mno-div
29247 Do or don't use hardware instructions for integer division.  This requires the
29248 M extension.  The default is to use them if the specified architecture has
29249 these instructions.
29251 @opindex misa-spec
29252 @item -misa-spec=@var{ISA-spec-string}
29253 Specify the version of the RISC-V Unprivileged (formerly User-Level)
29254 ISA specification to produce code conforming to.  The possibilities
29255 for @var{ISA-spec-string} are:
29256 @table @code
29257 @item 2.2
29258 Produce code conforming to version 2.2.
29259 @item 20190608
29260 Produce code conforming to version 20190608.
29261 @item 20191213
29262 Produce code conforming to version 20191213.
29263 @end table
29264 The default is @option{-misa-spec=20191213} unless GCC has been configured
29265 with @option{--with-isa-spec=} specifying a different default version.
29267 @opindex march
29268 @item -march=@var{ISA-string}
29269 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}).  ISA strings must be
29270 lower-case.  Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
29271 @samp{rv32imaf}.
29273 When @option{-march=} is not specified, use the setting from @option{-mcpu}.
29275 If both @option{-march} and @option{-mcpu=} are not specified, the default for
29276 this argument is system dependent, users who want a specific architecture
29277 extensions should specify one explicitly.
29279 @opindex mcpu
29280 @item -mcpu=@var{processor-string}
29281 Use architecture of and optimize the output for the given processor, specified
29282 by particular CPU name.
29283 Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21},
29284 @samp{sifive-e24}, @samp{sifive-e31}, @samp{sifive-e34}, @samp{sifive-e76},
29285 @samp{sifive-s21}, @samp{sifive-s51}, @samp{sifive-s54}, @samp{sifive-s76},
29286 @samp{sifive-u54}, and @samp{sifive-u74}.
29288 @opindex mtune
29289 @item -mtune=@var{processor-string}
29290 Optimize the output for the given processor, specified by microarchitecture or
29291 particular CPU name.  Permissible values for this option are: @samp{rocket},
29292 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
29293 @samp{thead-c906}, @samp{size}, and all valid options for @option{-mcpu=}.
29295 When @option{-mtune=} is not specified, use the setting from @option{-mcpu},
29296 the default is @samp{rocket} if both are not specified.
29298 The @samp{size} choice is not intended for use by end-users.  This is used
29299 when @option{-Os} is specified.  It overrides the instruction cost info
29300 provided by @option{-mtune=}, but does not override the pipeline info.  This
29301 helps reduce code size while still giving good performance.
29303 @opindex mpreferred-stack-boundary
29304 @item -mpreferred-stack-boundary=@var{num}
29305 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29306 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
29307 the default is 4 (16 bytes or 128-bits).
29309 @strong{Warning:} If you use this switch, then you must build all modules with
29310 the same value, including any libraries.  This includes the system libraries
29311 and startup modules.
29313 @opindex msmall-data-limit
29314 @item -msmall-data-limit=@var{n}
29315 Put global and static data smaller than @var{n} bytes into a special section
29316 (on some targets).
29318 @opindex msave-restore
29319 @item -msave-restore
29320 @itemx -mno-save-restore
29321 Do or don't use smaller but slower prologue and epilogue code that uses
29322 library function calls.  The default is to use fast inline prologues and
29323 epilogues.
29325 @opindex minline-atomics
29326 @item -minline-atomics
29327 @itemx -mno-inline-atomics
29328 Do or don't use smaller but slower subword atomic emulation code that uses
29329 libatomic function calls.  The default is to use fast inline subword atomics
29330 that do not require libatomic.
29332 @opindex mshorten-memrefs
29333 @item -mshorten-memrefs
29334 @itemx -mno-shorten-memrefs
29335 Do or do not attempt to make more use of compressed load/store instructions by
29336 replacing a load/store of 'base register + large offset' with a new load/store
29337 of 'new base + small offset'.  If the new base gets stored in a compressed
29338 register, then the new load/store can be compressed.  Currently targets 32-bit
29339 integer load/stores only.
29341 @opindex mstrict-align
29342 @item -mstrict-align
29343 @itemx -mno-strict-align
29344 Do not or do generate unaligned memory accesses.  The default is set depending
29345 on whether the processor we are optimizing for supports fast unaligned access
29346 or not.
29348 @opindex mcmodel=medlow
29349 @item -mcmodel=medlow
29350 Generate code for the medium-low code model. The program and its statically
29351 defined symbols must lie within a single 2 GiB address range and must lie
29352 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
29353 statically or dynamically linked. This is the default code model.
29355 @opindex mcmodel=medany
29356 @item -mcmodel=medany
29357 Generate code for the medium-any code model. The program and its statically
29358 defined symbols must be within any single 2 GiB address range. Programs can be
29359 statically or dynamically linked.
29361 The code generated by the medium-any code model is position-independent, but is
29362 not guaranteed to function correctly when linked into position-independent
29363 executables or libraries.
29365 @item -mexplicit-relocs
29366 @itemx -mno-exlicit-relocs
29367 Use or do not use assembler relocation operators when dealing with symbolic
29368 addresses.  The alternative is to use assembler macros instead, which may
29369 limit optimization.
29371 @opindex mrelax
29372 @item -mrelax
29373 @itemx -mno-relax
29374 Take advantage of linker relaxations to reduce the number of instructions
29375 required to materialize symbol addresses. The default is to take advantage of
29376 linker relaxations.
29378 @opindex mriscv-attribute
29379 @item -mriscv-attribute
29380 @itemx -mno-riscv-attribute
29381 Emit (do not emit) RISC-V attribute to record extra information into ELF
29382 objects.  This feature requires at least binutils 2.32.
29384 @opindex mcsr-check
29385 @item -mcsr-check
29386 @itemx -mno-csr-check
29387 Enables or disables the CSR checking.
29389 @opindex malign-data
29390 @item -malign-data=@var{type}
29391 Control how GCC aligns variables and constants of array, structure, or union
29392 types.  Supported values for @var{type} are @samp{xlen} which uses x register
29393 width as the alignment value, and @samp{natural} which uses natural alignment.
29394 @samp{xlen} is the default.
29396 @opindex mbig-endian
29397 @item -mbig-endian
29398 Generate big-endian code.  This is the default when GCC is configured for a
29399 @samp{riscv64be-*-*} or @samp{riscv32be-*-*} target.
29401 @opindex mlittle-endian
29402 @item -mlittle-endian
29403 Generate little-endian code.  This is the default when GCC is configured for a
29404 @samp{riscv64-*-*} or @samp{riscv32-*-*} but not a @samp{riscv64be-*-*} or
29405 @samp{riscv32be-*-*} target.
29407 @opindex mstack-protector-guard
29408 @opindex mstack-protector-guard-reg
29409 @opindex mstack-protector-guard-offset
29410 @item -mstack-protector-guard=@var{guard}
29411 @itemx -mstack-protector-guard-reg=@var{reg}
29412 @itemx -mstack-protector-guard-offset=@var{offset}
29413 Generate stack protection code using canary at @var{guard}.  Supported
29414 locations are @samp{global} for a global canary or @samp{tls} for per-thread
29415 canary in the TLS block.
29417 With the latter choice the options
29418 @option{-mstack-protector-guard-reg=@var{reg}} and
29419 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
29420 which register to use as base register for reading the canary,
29421 and from what offset from that base register. There is no default
29422 register or offset as this is entirely for use within the Linux
29423 kernel.
29424 @end table
29426 @node RL78 Options
29427 @subsection RL78 Options
29428 @cindex RL78 Options
29430 @table @gcctabopt
29432 @opindex msim
29433 @item -msim
29434 Links in additional target libraries to support operation within a
29435 simulator.
29437 @opindex mmul
29438 @item -mmul=none
29439 @itemx -mmul=g10
29440 @itemx -mmul=g13
29441 @itemx -mmul=g14
29442 @itemx -mmul=rl78
29443 Specifies the type of hardware multiplication and division support to
29444 be used.  The simplest is @code{none}, which uses software for both
29445 multiplication and division.  This is the default.  The @code{g13}
29446 value is for the hardware multiply/divide peripheral found on the
29447 RL78/G13 (S2 core) targets.  The @code{g14} value selects the use of
29448 the multiplication and division instructions supported by the RL78/G14
29449 (S3 core) parts.  The value @code{rl78} is an alias for @code{g14} and
29450 the value @code{mg10} is an alias for @code{none}.
29452 In addition a C preprocessor macro is defined, based upon the setting
29453 of this option.  Possible values are: @code{__RL78_MUL_NONE__},
29454 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
29456 @opindex mcpu
29457 @item -mcpu=g10
29458 @itemx -mcpu=g13
29459 @itemx -mcpu=g14
29460 @itemx -mcpu=rl78
29461 Specifies the RL78 core to target.  The default is the G14 core, also
29462 known as an S3 core or just RL78.  The G13 or S2 core does not have
29463 multiply or divide instructions, instead it uses a hardware peripheral
29464 for these operations.  The G10 or S1 core does not have register
29465 banks, so it uses a different calling convention.
29467 If this option is set it also selects the type of hardware multiply
29468 support to use, unless this is overridden by an explicit
29469 @option{-mmul=none} option on the command line.  Thus specifying
29470 @option{-mcpu=g13} enables the use of the G13 hardware multiply
29471 peripheral and specifying @option{-mcpu=g10} disables the use of
29472 hardware multiplications altogether.
29474 Note, although the RL78/G14 core is the default target, specifying
29475 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
29476 change the behavior of the toolchain since it also enables G14
29477 hardware multiply support.  If these options are not specified on the
29478 command line then software multiplication routines will be used even
29479 though the code targets the RL78 core.  This is for backwards
29480 compatibility with older toolchains which did not have hardware
29481 multiply and divide support.
29483 In addition a C preprocessor macro is defined, based upon the setting
29484 of this option.  Possible values are: @code{__RL78_G10__},
29485 @code{__RL78_G13__} or @code{__RL78_G14__}.
29487 @opindex mg10
29488 @opindex mg13
29489 @opindex mg14
29490 @opindex mrl78
29491 @item -mg10
29492 @itemx -mg13
29493 @itemx -mg14
29494 @itemx -mrl78
29495 These are aliases for the corresponding @option{-mcpu=} option.  They
29496 are provided for backwards compatibility.
29498 @opindex mallregs
29499 @item -mallregs
29500 Allow the compiler to use all of the available registers.  By default
29501 registers @code{r24..r31} are reserved for use in interrupt handlers.
29502 With this option enabled these registers can be used in ordinary
29503 functions as well.
29505 @opindex m64bit-doubles
29506 @opindex m32bit-doubles
29507 @item -m64bit-doubles
29508 @itemx -m32bit-doubles
29509 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
29510 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
29511 @option{-m32bit-doubles}.
29513 @opindex msave-mduc-in-interrupts
29514 @opindex mno-save-mduc-in-interrupts
29515 @item -msave-mduc-in-interrupts
29516 @itemx -mno-save-mduc-in-interrupts
29517 Specifies that interrupt handler functions should preserve the
29518 MDUC registers.  This is only necessary if normal code might use
29519 the MDUC registers, for example because it performs multiplication
29520 and division operations.  The default is to ignore the MDUC registers
29521 as this makes the interrupt handlers faster.  The target option -mg13
29522 needs to be passed for this to work as this feature is only available
29523 on the G13 target (S2 core).  The MDUC registers will only be saved
29524 if the interrupt handler performs a multiplication or division
29525 operation or it calls another function.
29527 @end table
29529 @node RS/6000 and PowerPC Options
29530 @subsection IBM RS/6000 and PowerPC Options
29531 @cindex RS/6000 and PowerPC Options
29532 @cindex IBM RS/6000 and PowerPC Options
29534 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
29535 @table @gcctabopt
29536 @item -mpowerpc-gpopt
29537 @itemx -mno-powerpc-gpopt
29538 @itemx -mpowerpc-gfxopt
29539 @itemx -mno-powerpc-gfxopt
29540 @need 800
29541 @itemx -mpowerpc64
29542 @itemx -mno-powerpc64
29543 @itemx -mmfcrf
29544 @itemx -mno-mfcrf
29545 @itemx -mpopcntb
29546 @itemx -mno-popcntb
29547 @itemx -mpopcntd
29548 @itemx -mno-popcntd
29549 @itemx -mfprnd
29550 @itemx -mno-fprnd
29551 @need 800
29552 @opindex mpowerpc-gpopt
29553 @opindex mno-powerpc-gpopt
29554 @opindex mpowerpc-gfxopt
29555 @opindex mno-powerpc-gfxopt
29556 @opindex mpowerpc64
29557 @opindex mno-powerpc64
29558 @opindex mmfcrf
29559 @opindex mno-mfcrf
29560 @opindex mpopcntb
29561 @opindex mno-popcntb
29562 @opindex mpopcntd
29563 @opindex mno-popcntd
29564 @opindex mfprnd
29565 @opindex mno-fprnd
29566 @opindex mcmpb
29567 @opindex mno-cmpb
29568 @opindex mhard-dfp
29569 @opindex mno-hard-dfp
29570 @itemx -mcmpb
29571 @itemx -mno-cmpb
29572 @itemx -mhard-dfp
29573 @itemx -mno-hard-dfp
29574 You use these options to specify which instructions are available on the
29575 processor you are using.  The default value of these options is
29576 determined when configuring GCC@.  Specifying the
29577 @option{-mcpu=@var{cpu_type}} overrides the specification of these
29578 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
29579 rather than the options listed above.
29581 Specifying @option{-mpowerpc-gpopt} allows
29582 GCC to use the optional PowerPC architecture instructions in the
29583 General Purpose group, including floating-point square root.  Specifying
29584 @option{-mpowerpc-gfxopt} allows GCC to
29585 use the optional PowerPC architecture instructions in the Graphics
29586 group, including floating-point select.
29588 The @option{-mmfcrf} option allows GCC to generate the move from
29589 condition register field instruction implemented on the POWER4
29590 processor and other processors that support the PowerPC V2.01
29591 architecture.
29592 The @option{-mpopcntb} option allows GCC to generate the popcount and
29593 double-precision FP reciprocal estimate instruction implemented on the
29594 POWER5 processor and other processors that support the PowerPC V2.02
29595 architecture.
29596 The @option{-mpopcntd} option allows GCC to generate the popcount
29597 instruction implemented on the POWER7 processor and other processors
29598 that support the PowerPC V2.06 architecture.
29599 The @option{-mfprnd} option allows GCC to generate the FP round to
29600 integer instructions implemented on the POWER5+ processor and other
29601 processors that support the PowerPC V2.03 architecture.
29602 The @option{-mcmpb} option allows GCC to generate the compare bytes
29603 instruction implemented on the POWER6 processor and other processors
29604 that support the PowerPC V2.05 architecture.
29605 The @option{-mhard-dfp} option allows GCC to generate the decimal
29606 floating-point instructions implemented on some POWER processors.
29608 The @option{-mpowerpc64} option allows GCC to generate the additional
29609 64-bit instructions that are found in the full PowerPC64 architecture
29610 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
29611 @option{-mno-powerpc64}.
29613 @opindex mcpu
29614 @item -mcpu=@var{cpu_type}
29615 Set architecture type, register usage, and
29616 instruction scheduling parameters for machine type @var{cpu_type}.
29617 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
29618 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
29619 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
29620 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
29621 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
29622 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
29623 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
29624 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
29625 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
29626 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
29627 @samp{power9}, @samp{power10}, @samp{powerpc}, @samp{powerpc64},
29628 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
29630 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
29631 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
29632 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
29633 architecture machine types, with an appropriate, generic processor
29634 model assumed for scheduling purposes.
29636 Specifying @samp{native} as cpu type detects and selects the
29637 architecture option that corresponds to the host processor of the
29638 system performing the compilation.
29639 @option{-mcpu=native} has no effect if GCC does not recognize the
29640 processor.
29642 The other options specify a specific processor.  Code generated under
29643 those options runs best on that processor, and may not run at all on
29644 others.
29646 The @option{-mcpu} options automatically enable or disable the
29647 following options:
29649 @gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple
29650 -mpopcntb  -mpopcntd  -mpowerpc64
29651 -mpowerpc-gpopt  -mpowerpc-gfxopt
29652 -mmulhw  -mdlmzb  -mmfpgpr  -mvsx
29653 -mcrypto  -mhtm  -mpower8-fusion  -mpower8-vector
29654 -mquad-memory  -mquad-memory-atomic  -mfloat128
29655 -mfloat128-hardware -mprefixed -mpcrel -mmma
29656 -mrop-protect}
29658 The particular options set for any particular CPU varies between
29659 compiler versions, depending on what setting seems to produce optimal
29660 code for that CPU; it doesn't necessarily reflect the actual hardware's
29661 capabilities.  If you wish to set an individual option to a particular
29662 value, you may specify it after the @option{-mcpu} option, like
29663 @option{-mcpu=970 -mno-altivec}.
29665 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
29666 not enabled or disabled by the @option{-mcpu} option at present because
29667 AIX does not have full support for these options.  You may still
29668 enable or disable them individually if you're sure it'll work in your
29669 environment.
29671 @opindex mtune
29672 @item -mtune=@var{cpu_type}
29673 Set the instruction scheduling parameters for machine type
29674 @var{cpu_type}, but do not set the architecture type or register usage,
29675 as @option{-mcpu=@var{cpu_type}} does.  The same
29676 values for @var{cpu_type} are used for @option{-mtune} as for
29677 @option{-mcpu}.  If both are specified, the code generated uses the
29678 architecture and registers set by @option{-mcpu}, but the
29679 scheduling parameters set by @option{-mtune}.
29681 @opindex mcmodel=small
29682 @item -mcmodel=small
29683 Generate PowerPC64 code for the small model: The TOC is limited to
29684 64k.
29686 @opindex mcmodel=medium
29687 @item -mcmodel=medium
29688 Generate PowerPC64 code for the medium model: The TOC and other static
29689 data may be up to a total of 4G in size.  This is the default for 64-bit
29690 Linux.
29692 @opindex mcmodel=large
29693 @item -mcmodel=large
29694 Generate PowerPC64 code for the large model: The TOC may be up to 4G
29695 in size.  Other data and code is only limited by the 64-bit address
29696 space.
29698 @opindex maltivec
29699 @opindex mno-altivec
29700 @item -maltivec
29701 @itemx -mno-altivec
29702 Generate code that uses (does not use) AltiVec instructions, and also
29703 enable the use of built-in functions that allow more direct access to
29704 the AltiVec instruction set.  You may also need to set
29705 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
29706 enhancements.
29708 When @option{-maltivec} is used, the element order for AltiVec intrinsics
29709 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} 
29710 match array element order corresponding to the endianness of the
29711 target.  That is, element zero identifies the leftmost element in a
29712 vector register when targeting a big-endian platform, and identifies
29713 the rightmost element in a vector register when targeting a
29714 little-endian platform.
29716 @opindex mvrsave
29717 @opindex mno-vrsave
29718 @item -mvrsave
29719 @itemx -mno-vrsave
29720 Generate VRSAVE instructions when generating AltiVec code.
29722 @opindex msecure-plt
29723 @item -msecure-plt
29724 Generate code that allows @command{ld} and @command{ld.so}
29725 to build executables and shared
29726 libraries with non-executable @code{.plt} and @code{.got} sections.
29727 This is a PowerPC
29728 32-bit SYSV ABI option.
29730 @opindex mbss-plt
29731 @item -mbss-plt
29732 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
29733 fills in, and
29734 requires @code{.plt} and @code{.got}
29735 sections that are both writable and executable.
29736 This is a PowerPC 32-bit SYSV ABI option.
29738 @opindex misel
29739 @opindex mno-isel
29740 @item -misel
29741 @itemx -mno-isel
29742 This switch enables or disables the generation of ISEL instructions.
29744 @opindex mvsx
29745 @opindex mno-vsx
29746 @item -mvsx
29747 @itemx -mno-vsx
29748 Generate code that uses (does not use) vector/scalar (VSX)
29749 instructions, and also enable the use of built-in functions that allow
29750 more direct access to the VSX instruction set.
29752 @opindex mcrypto
29753 @opindex mno-crypto
29754 @item -mcrypto
29755 @itemx -mno-crypto
29756 Enable the use (disable) of the built-in functions that allow direct
29757 access to the cryptographic instructions that were added in version
29758 2.07 of the PowerPC ISA.
29760 @opindex mhtm
29761 @opindex mno-htm
29762 @item -mhtm
29763 @itemx -mno-htm
29764 Enable (disable) the use of the built-in functions that allow direct
29765 access to the Hardware Transactional Memory (HTM) instructions that
29766 were added in version 2.07 of the PowerPC ISA.
29768 @opindex mpower8-fusion
29769 @opindex mno-power8-fusion
29770 @item -mpower8-fusion
29771 @itemx -mno-power8-fusion
29772 Generate code that keeps (does not keeps) some integer operations
29773 adjacent so that the instructions can be fused together on power8 and
29774 later processors.
29776 @opindex mpower8-vector
29777 @opindex mno-power8-vector
29778 @item -mpower8-vector
29779 @itemx -mno-power8-vector
29780 Generate code that uses (does not use) the vector and scalar
29781 instructions that were added in version 2.07 of the PowerPC ISA.  Also
29782 enable the use of built-in functions that allow more direct access to
29783 the vector instructions.
29785 @opindex mquad-memory
29786 @opindex mno-quad-memory
29787 @item -mquad-memory
29788 @itemx -mno-quad-memory
29789 Generate code that uses (does not use) the non-atomic quad word memory
29790 instructions.  The @option{-mquad-memory} option requires use of
29791 64-bit mode.
29793 @opindex mquad-memory-atomic
29794 @opindex mno-quad-memory-atomic
29795 @item -mquad-memory-atomic
29796 @itemx -mno-quad-memory-atomic
29797 Generate code that uses (does not use) the atomic quad word memory
29798 instructions.  The @option{-mquad-memory-atomic} option requires use of
29799 64-bit mode.
29801 @opindex mfloat128
29802 @opindex mno-float128
29803 @item -mfloat128
29804 @itemx -mno-float128
29805 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
29806 and use either software emulation for IEEE 128-bit floating point or
29807 hardware instructions.
29809 The VSX instruction set (@option{-mvsx}) must be enabled to use the IEEE
29810 128-bit floating point support.  The IEEE 128-bit floating point is only
29811 supported on Linux.
29813 The default for @option{-mfloat128} is enabled on PowerPC Linux
29814 systems using the VSX instruction set, and disabled on other systems.
29816 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
29817 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
29818 point support will also enable the generation of ISA 3.0 IEEE 128-bit
29819 floating point instructions.  Otherwise, if you do not specify to
29820 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
29821 system, IEEE 128-bit floating point will be done with software
29822 emulation.
29824 @opindex mfloat128-hardware
29825 @opindex mno-float128-hardware
29826 @item -mfloat128-hardware
29827 @itemx -mno-float128-hardware
29828 Enable/disable using ISA 3.0 hardware instructions to support the
29829 @var{__float128} data type.
29831 The default for @option{-mfloat128-hardware} is enabled on PowerPC
29832 Linux systems using the ISA 3.0 instruction set, and disabled on other
29833 systems.
29835 @opindex m32
29836 @opindex m64
29837 @item -m32
29838 @itemx -m64
29839 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
29840 targets (including GNU/Linux).  The 32-bit environment sets int, long
29841 and pointer to 32 bits and generates code that runs on any PowerPC
29842 variant.  The 64-bit environment sets int to 32 bits and long and
29843 pointer to 64 bits, and generates code for PowerPC64, as for
29844 @option{-mpowerpc64}.
29846 @opindex mfull-toc
29847 @opindex mno-fp-in-toc
29848 @opindex mno-sum-in-toc
29849 @opindex mminimal-toc
29850 @item -mfull-toc
29851 @itemx -mno-fp-in-toc
29852 @itemx -mno-sum-in-toc
29853 @itemx -mminimal-toc
29854 Modify generation of the TOC (Table Of Contents), which is created for
29855 every executable file.  The @option{-mfull-toc} option is selected by
29856 default.  In that case, GCC allocates at least one TOC entry for
29857 each unique non-automatic variable reference in your program.  GCC
29858 also places floating-point constants in the TOC@.  However, only
29859 16,384 entries are available in the TOC@.
29861 If you receive a linker error message that saying you have overflowed
29862 the available TOC space, you can reduce the amount of TOC space used
29863 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
29864 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
29865 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
29866 generate code to calculate the sum of an address and a constant at
29867 run time instead of putting that sum into the TOC@.  You may specify one
29868 or both of these options.  Each causes GCC to produce very slightly
29869 slower and larger code at the expense of conserving TOC space.
29871 If you still run out of space in the TOC even when you specify both of
29872 these options, specify @option{-mminimal-toc} instead.  This option causes
29873 GCC to make only one TOC entry for every file.  When you specify this
29874 option, GCC produces code that is slower and larger but which
29875 uses extremely little TOC space.  You may wish to use this option
29876 only on files that contain less frequently-executed code.
29878 @opindex maix64
29879 @opindex maix32
29880 @item -maix64
29881 @itemx -maix32
29882 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
29883 @code{long} type, and the infrastructure needed to support them.
29884 Specifying @option{-maix64} implies @option{-mpowerpc64},
29885 while @option{-maix32} disables the 64-bit ABI and
29886 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
29888 @opindex mxl-compat
29889 @opindex mno-xl-compat
29890 @item -mxl-compat
29891 @itemx -mno-xl-compat
29892 Produce code that conforms more closely to IBM XL compiler semantics
29893 when using AIX-compatible ABI@.  Pass floating-point arguments to
29894 prototyped functions beyond the register save area (RSA) on the stack
29895 in addition to argument FPRs.  Do not assume that most significant
29896 double in 128-bit long double value is properly rounded when comparing
29897 values and converting to double.  Use XL symbol names for long double
29898 support routines.
29900 The AIX calling convention was extended but not initially documented to
29901 handle an obscure K&R C case of calling a function that takes the
29902 address of its arguments with fewer arguments than declared.  IBM XL
29903 compilers access floating-point arguments that do not fit in the
29904 RSA from the stack when a subroutine is compiled without
29905 optimization.  Because always storing floating-point arguments on the
29906 stack is inefficient and rarely needed, this option is not enabled by
29907 default and only is necessary when calling subroutines compiled by IBM
29908 XL compilers without optimization.
29910 @opindex mpe
29911 @item -mpe
29912 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
29913 application written to use message passing with special startup code to
29914 enable the application to run.  The system must have PE installed in the
29915 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
29916 must be overridden with the @option{-specs=} option to specify the
29917 appropriate directory location.  The Parallel Environment does not
29918 support threads, so the @option{-mpe} option and the @option{-pthread}
29919 option are incompatible.
29921 @opindex malign-natural
29922 @opindex malign-power
29923 @item -malign-natural
29924 @itemx -malign-power
29925 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
29926 @option{-malign-natural} overrides the ABI-defined alignment of larger
29927 types, such as floating-point doubles, on their natural size-based boundary.
29928 The option @option{-malign-power} instructs GCC to follow the ABI-specified
29929 alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
29931 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
29932 is not supported.
29934 @opindex msoft-float
29935 @opindex mhard-float
29936 @item -msoft-float
29937 @itemx -mhard-float
29938 Generate code that does not use (uses) the floating-point register set.
29939 Software floating-point emulation is provided if you use the
29940 @option{-msoft-float} option, and pass the option to GCC when linking.
29942 @opindex mmultiple
29943 @opindex mno-multiple
29944 @item -mmultiple
29945 @itemx -mno-multiple
29946 Generate code that uses (does not use) the load multiple word
29947 instructions and the store multiple word instructions.  These
29948 instructions are generated by default on POWER systems, and not
29949 generated on PowerPC systems.  Do not use @option{-mmultiple} on little-endian
29950 PowerPC systems, since those instructions do not work when the
29951 processor is in little-endian mode.  The exceptions are PPC740 and
29952 PPC750 which permit these instructions in little-endian mode.
29954 @opindex mupdate
29955 @opindex mno-update
29956 @item -mupdate
29957 @itemx -mno-update
29958 Generate code that uses (does not use) the load or store instructions
29959 that update the base register to the address of the calculated memory
29960 location.  These instructions are generated by default.  If you use
29961 @option{-mno-update}, there is a small window between the time that the
29962 stack pointer is updated and the address of the previous frame is
29963 stored, which means code that walks the stack frame across interrupts or
29964 signals may get corrupted data.
29966 @opindex mavoid-indexed-addresses
29967 @opindex mno-avoid-indexed-addresses
29968 @item -mavoid-indexed-addresses
29969 @itemx -mno-avoid-indexed-addresses
29970 Generate code that tries to avoid (not avoid) the use of indexed load
29971 or store instructions. These instructions can incur a performance
29972 penalty on Power6 processors in certain situations, such as when
29973 stepping through large arrays that cross a 16M boundary.  This option
29974 is enabled by default when targeting Power6 and disabled otherwise.
29976 @opindex mfused-madd
29977 @opindex mno-fused-madd
29978 @item -mfused-madd
29979 @itemx -mno-fused-madd
29980 Generate code that uses (does not use) the floating-point multiply and
29981 accumulate instructions.  These instructions are generated by default
29982 if hardware floating point is used.  The machine-dependent
29983 @option{-mfused-madd} option is now mapped to the machine-independent
29984 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
29985 mapped to @option{-ffp-contract=off}.
29987 @opindex mmulhw
29988 @opindex mno-mulhw
29989 @item -mmulhw
29990 @itemx -mno-mulhw
29991 Generate code that uses (does not use) the half-word multiply and
29992 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
29993 These instructions are generated by default when targeting those
29994 processors.
29996 @opindex mdlmzb
29997 @opindex mno-dlmzb
29998 @item -mdlmzb
29999 @itemx -mno-dlmzb
30000 Generate code that uses (does not use) the string-search @samp{dlmzb}
30001 instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
30002 generated by default when targeting those processors.
30004 @opindex mno-bit-align
30005 @opindex mbit-align
30006 @item -mno-bit-align
30007 @itemx -mbit-align
30008 On System V.4 and embedded PowerPC systems do not (do) force structures
30009 and unions that contain bit-fields to be aligned to the base type of the
30010 bit-field.
30012 For example, by default a structure containing nothing but 8
30013 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
30014 boundary and has a size of 4 bytes.  By using @option{-mno-bit-align},
30015 the structure is aligned to a 1-byte boundary and is 1 byte in
30016 size.
30018 @opindex mno-strict-align
30019 @opindex mstrict-align
30020 @item -mno-strict-align
30021 @itemx -mstrict-align
30022 On System V.4 and embedded PowerPC systems do not (do) assume that
30023 unaligned memory references are handled by the system.
30025 @opindex mrelocatable
30026 @opindex mno-relocatable
30027 @item -mrelocatable
30028 @itemx -mno-relocatable
30029 Generate code that allows (does not allow) a static executable to be
30030 relocated to a different address at run time.  A simple embedded
30031 PowerPC system loader should relocate the entire contents of
30032 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
30033 a table of 32-bit addresses generated by this option.  For this to
30034 work, all objects linked together must be compiled with
30035 @option{-mrelocatable} or @option{-mrelocatable-lib}.
30036 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
30038 @opindex mrelocatable-lib
30039 @opindex mno-relocatable-lib
30040 @item -mrelocatable-lib
30041 @itemx -mno-relocatable-lib
30042 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
30043 @code{.fixup} section to allow static executables to be relocated at
30044 run time, but @option{-mrelocatable-lib} does not use the smaller stack
30045 alignment of @option{-mrelocatable}.  Objects compiled with
30046 @option{-mrelocatable-lib} may be linked with objects compiled with
30047 any combination of the @option{-mrelocatable} options.
30049 @opindex mno-toc
30050 @opindex mtoc
30051 @item -mno-toc
30052 @itemx -mtoc
30053 On System V.4 and embedded PowerPC systems do not (do) assume that
30054 register 2 contains a pointer to a global area pointing to the addresses
30055 used in the program.
30057 @opindex mlittle
30058 @opindex mlittle-endian
30059 @item -mlittle
30060 @itemx -mlittle-endian
30061 On System V.4 and embedded PowerPC systems compile code for the
30062 processor in little-endian mode.  The @option{-mlittle-endian} option is
30063 the same as @option{-mlittle}.
30065 @opindex mbig
30066 @opindex mbig-endian
30067 @item -mbig
30068 @itemx -mbig-endian
30069 On System V.4 and embedded PowerPC systems compile code for the
30070 processor in big-endian mode.  The @option{-mbig-endian} option is
30071 the same as @option{-mbig}.
30073 @opindex mdynamic-no-pic
30074 @item -mdynamic-no-pic
30075 On Darwin / macOS systems, compile code so that it is not
30076 relocatable, but that its external references are relocatable.  The
30077 resulting code is suitable for applications, but not shared
30078 libraries.
30080 @opindex msingle-pic-base
30081 @item -msingle-pic-base
30082 Treat the register used for PIC addressing as read-only, rather than
30083 loading it in the prologue for each function.  The runtime system is
30084 responsible for initializing this register with an appropriate value
30085 before execution begins.
30087 @opindex mprioritize-restricted-insns
30088 @item -mprioritize-restricted-insns=@var{priority}
30089 This option controls the priority that is assigned to
30090 dispatch-slot restricted instructions during the second scheduling
30091 pass.  The argument @var{priority} takes the value @samp{0}, @samp{1},
30092 or @samp{2} to assign no, highest, or second-highest (respectively) 
30093 priority to dispatch-slot restricted
30094 instructions.
30096 @opindex msched-costly-dep
30097 @item -msched-costly-dep=@var{dependence_type}
30098 This option controls which dependences are considered costly
30099 by the target during instruction scheduling.  The argument
30100 @var{dependence_type} takes one of the following values:
30102 @table @asis
30103 @item @samp{no}
30104 No dependence is costly.
30106 @item @samp{all}
30107 All dependences are costly.
30109 @item @samp{true_store_to_load}
30110 A true dependence from store to load is costly.
30112 @item @samp{store_to_load}
30113 Any dependence from store to load is costly.
30115 @item @var{number}
30116 Any dependence for which the latency is greater than or equal to 
30117 @var{number} is costly.
30118 @end table
30120 @opindex minsert-sched-nops
30121 @item -minsert-sched-nops=@var{scheme}
30122 This option controls which NOP insertion scheme is used during
30123 the second scheduling pass.  The argument @var{scheme} takes one of the
30124 following values:
30126 @table @asis
30127 @item @samp{no}
30128 Don't insert NOPs.
30130 @item @samp{pad}
30131 Pad with NOPs any dispatch group that has vacant issue slots,
30132 according to the scheduler's grouping.
30134 @item @samp{regroup_exact}
30135 Insert NOPs to force costly dependent insns into
30136 separate groups.  Insert exactly as many NOPs as needed to force an insn
30137 to a new group, according to the estimated processor grouping.
30139 @item @var{number}
30140 Insert NOPs to force costly dependent insns into
30141 separate groups.  Insert @var{number} NOPs to force an insn to a new group.
30142 @end table
30144 @opindex mcall-sysv
30145 @item -mcall-sysv
30146 On System V.4 and embedded PowerPC systems compile code using calling
30147 conventions that adhere to the March 1995 draft of the System V
30148 Application Binary Interface, PowerPC processor supplement.  This is the
30149 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
30151 @opindex mcall-sysv-eabi
30152 @opindex mcall-eabi
30153 @item -mcall-sysv-eabi
30154 @itemx -mcall-eabi
30155 Specify both @option{-mcall-sysv} and @option{-meabi} options.
30157 @opindex mcall-sysv-noeabi
30158 @item -mcall-sysv-noeabi
30159 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
30161 @opindex mcall-aixdesc
30162 @item -mcall-aixdesc
30163 On System V.4 and embedded PowerPC systems compile code for the AIX
30164 operating system.
30166 @opindex mcall-linux
30167 @item -mcall-linux
30168 On System V.4 and embedded PowerPC systems compile code for the
30169 Linux-based GNU system.
30171 @opindex mcall-freebsd
30172 @item -mcall-freebsd
30173 On System V.4 and embedded PowerPC systems compile code for the
30174 FreeBSD operating system.
30176 @opindex mcall-netbsd
30177 @item -mcall-netbsd
30178 On System V.4 and embedded PowerPC systems compile code for the
30179 NetBSD operating system.
30181 @opindex mcall-openbsd
30182 @item -mcall-openbsd
30183 On System V.4 and embedded PowerPC systems compile code for the
30184 OpenBSD operating system.
30186 @opindex mtraceback
30187 @item -mtraceback=@var{traceback_type}
30188 Select the type of traceback table. Valid values for @var{traceback_type}
30189 are @samp{full}, @samp{part}, and @samp{no}.
30191 @opindex maix-struct-return
30192 @item -maix-struct-return
30193 Return all structures in memory (as specified by the AIX ABI)@.
30195 @opindex msvr4-struct-return
30196 @item -msvr4-struct-return
30197 Return structures smaller than 8 bytes in registers (as specified by the
30198 SVR4 ABI)@.
30200 @opindex mabi
30201 @item -mabi=@var{abi-type}
30202 Extend the current ABI with a particular extension, or remove such extension.
30203 Valid values are: @samp{altivec}, @samp{no-altivec},
30204 @samp{ibmlongdouble}, @samp{ieeelongdouble},
30205 @samp{elfv1}, @samp{elfv2},
30206 and for AIX: @samp{vec-extabi}, @samp{vec-default}@.
30208 @opindex mabi=ibmlongdouble
30209 @item -mabi=ibmlongdouble
30210 Change the current ABI to use IBM extended-precision long double.
30211 This is not likely to work if your system defaults to using IEEE
30212 extended-precision long double.  If you change the long double type
30213 from IEEE extended-precision, the compiler will issue a warning unless
30214 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30215 to be enabled.
30217 @opindex mabi=ieeelongdouble
30218 @item -mabi=ieeelongdouble
30219 Change the current ABI to use IEEE extended-precision long double.
30220 This is not likely to work if your system defaults to using IBM
30221 extended-precision long double.  If you change the long double type
30222 from IBM extended-precision, the compiler will issue a warning unless
30223 you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
30224 to be enabled.
30226 @opindex mabi=elfv1
30227 @item -mabi=elfv1
30228 Change the current ABI to use the ELFv1 ABI.
30229 This is the default ABI for big-endian PowerPC 64-bit Linux.
30230 Overriding the default ABI requires special system support and is
30231 likely to fail in spectacular ways.
30233 @opindex mabi=elfv2
30234 @item -mabi=elfv2
30235 Change the current ABI to use the ELFv2 ABI.
30236 This is the default ABI for little-endian PowerPC 64-bit Linux.
30237 Overriding the default ABI requires special system support and is
30238 likely to fail in spectacular ways.
30240 @opindex mgnu-attribute
30241 @opindex mno-gnu-attribute
30242 @item -mgnu-attribute
30243 @itemx -mno-gnu-attribute
30244 Emit .gnu_attribute assembly directives to set tag/value pairs in a
30245 .gnu.attributes section that specify ABI variations in function
30246 parameters or return values.
30248 @opindex mprototype
30249 @opindex mno-prototype
30250 @item -mprototype
30251 @itemx -mno-prototype
30252 On System V.4 and embedded PowerPC systems assume that all calls to
30253 variable argument functions are properly prototyped.  Otherwise, the
30254 compiler must insert an instruction before every non-prototyped call to
30255 set or clear bit 6 of the condition code register (@code{CR}) to
30256 indicate whether floating-point values are passed in the floating-point
30257 registers in case the function takes variable arguments.  With
30258 @option{-mprototype}, only calls to prototyped variable argument functions
30259 set or clear the bit.
30261 @opindex msim
30262 @item -msim
30263 On embedded PowerPC systems, assume that the startup module is called
30264 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
30265 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
30266 configurations.
30268 @opindex mmvme
30269 @item -mmvme
30270 On embedded PowerPC systems, assume that the startup module is called
30271 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
30272 @file{libc.a}.
30274 @opindex mads
30275 @item -mads
30276 On embedded PowerPC systems, assume that the startup module is called
30277 @file{crt0.o} and the standard C libraries are @file{libads.a} and
30278 @file{libc.a}.
30280 @opindex myellowknife
30281 @item -myellowknife
30282 On embedded PowerPC systems, assume that the startup module is called
30283 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
30284 @file{libc.a}.
30286 @opindex mvxworks
30287 @item -mvxworks
30288 On System V.4 and embedded PowerPC systems, specify that you are
30289 compiling for a VxWorks system.
30291 @opindex memb
30292 @item -memb
30293 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
30294 header to indicate that @samp{eabi} extended relocations are used.
30296 @opindex meabi
30297 @opindex mno-eabi
30298 @item -meabi
30299 @itemx -mno-eabi
30300 On System V.4 and embedded PowerPC systems do (do not) adhere to the
30301 Embedded Applications Binary Interface (EABI), which is a set of
30302 modifications to the System V.4 specifications.  Selecting @option{-meabi}
30303 means that the stack is aligned to an 8-byte boundary, a function
30304 @code{__eabi} is called from @code{main} to set up the EABI
30305 environment, and the @option{-msdata} option can use both @code{r2} and
30306 @code{r13} to point to two separate small data areas.  Selecting
30307 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
30308 no EABI initialization function is called from @code{main}, and the
30309 @option{-msdata} option only uses @code{r13} to point to a single
30310 small data area.  The @option{-meabi} option is on by default if you
30311 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
30313 @opindex msdata=eabi
30314 @item -msdata=eabi
30315 On System V.4 and embedded PowerPC systems, put small initialized
30316 @code{const} global and static data in the @code{.sdata2} section, which
30317 is pointed to by register @code{r2}.  Put small initialized
30318 non-@code{const} global and static data in the @code{.sdata} section,
30319 which is pointed to by register @code{r13}.  Put small uninitialized
30320 global and static data in the @code{.sbss} section, which is adjacent to
30321 the @code{.sdata} section.  The @option{-msdata=eabi} option is
30322 incompatible with the @option{-mrelocatable} option.  The
30323 @option{-msdata=eabi} option also sets the @option{-memb} option.
30325 @opindex msdata=sysv
30326 @item -msdata=sysv
30327 On System V.4 and embedded PowerPC systems, put small global and static
30328 data in the @code{.sdata} section, which is pointed to by register
30329 @code{r13}.  Put small uninitialized global and static data in the
30330 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
30331 The @option{-msdata=sysv} option is incompatible with the
30332 @option{-mrelocatable} option.
30334 @opindex msdata=default
30335 @opindex msdata
30336 @item -msdata=default
30337 @itemx -msdata
30338 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
30339 compile code the same as @option{-msdata=eabi}, otherwise compile code the
30340 same as @option{-msdata=sysv}.
30342 @opindex msdata=data
30343 @item -msdata=data
30344 On System V.4 and embedded PowerPC systems, put small global
30345 data in the @code{.sdata} section.  Put small uninitialized global
30346 data in the @code{.sbss} section.  Do not use register @code{r13}
30347 to address small data however.  This is the default behavior unless
30348 other @option{-msdata} options are used.
30350 @opindex msdata=none
30351 @opindex mno-sdata
30352 @item -msdata=none
30353 @itemx -mno-sdata
30354 On embedded PowerPC systems, put all initialized global and static data
30355 in the @code{.data} section, and all uninitialized data in the
30356 @code{.bss} section.
30358 @opindex mreadonly-in-sdata
30359 @opindex mno-readonly-in-sdata
30360 @item -mreadonly-in-sdata
30361 Put read-only objects in the @code{.sdata} section as well.  This is the
30362 default.
30364 @opindex mblock-move-inline-limit
30365 @item -mblock-move-inline-limit=@var{num}
30366 Inline all block moves (such as calls to @code{memcpy} or structure
30367 copies) less than or equal to @var{num} bytes.  The minimum value for
30368 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
30369 targets.  The default value is target-specific.
30371 @opindex mblock-compare-inline-limit
30372 @item -mblock-compare-inline-limit=@var{num}
30373 Generate non-looping inline code for all block compares (such as calls
30374 to @code{memcmp} or structure compares) less than or equal to @var{num}
30375 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
30376 block compare is disabled. The default value is target-specific.
30378 @opindex mblock-compare-inline-loop-limit
30379 @item -mblock-compare-inline-loop-limit=@var{num}
30380 Generate an inline expansion using loop code for all block compares that
30381 are less than or equal to @var{num} bytes, but greater than the limit
30382 for non-loop inline block compare expansion. If the block length is not
30383 constant, at most @var{num} bytes will be compared before @code{memcmp}
30384 is called to compare the remainder of the block. The default value is
30385 target-specific.
30387 @opindex mstring-compare-inline-limit
30388 @item -mstring-compare-inline-limit=@var{num}
30389 Compare at most @var{num} string bytes with inline code.
30390 If the difference or end of string is not found at the
30391 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
30392 take care of the rest of the comparison. The default is 64 bytes.
30394 @opindex G
30395 @cindex smaller data references (PowerPC)
30396 @cindex .sdata/.sdata2 references (PowerPC)
30397 @item -G @var{num}
30398 On embedded PowerPC systems, put global and static items less than or
30399 equal to @var{num} bytes into the small data or BSS sections instead of
30400 the normal data or BSS section.  By default, @var{num} is 8.  The
30401 @option{-G @var{num}} switch is also passed to the linker.
30402 All modules should be compiled with the same @option{-G @var{num}} value.
30404 @opindex mregnames
30405 @opindex mno-regnames
30406 @item -mregnames
30407 @itemx -mno-regnames
30408 On System V.4 and embedded PowerPC systems do (do not) emit register
30409 names in the assembly language output using symbolic forms.
30411 @opindex mlongcall
30412 @opindex mno-longcall
30413 @item -mlongcall
30414 @itemx -mno-longcall
30415 By default assume that all calls are far away so that a longer and more
30416 expensive calling sequence is required.  This is required for calls
30417 farther than 32 megabytes (33,554,432 bytes) from the current location.
30418 A short call is generated if the compiler knows
30419 the call cannot be that far away.  This setting can be overridden by
30420 the @code{shortcall} function attribute, or by @code{#pragma
30421 longcall(0)}.
30423 Some linkers are capable of detecting out-of-range calls and generating
30424 glue code on the fly.  On these systems, long calls are unnecessary and
30425 generate slower code.  As of this writing, the AIX linker can do this,
30426 as can the GNU linker for PowerPC/64.  It is planned to add this feature
30427 to the GNU linker for 32-bit PowerPC systems as well.
30429 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
30430 GCC can generate long calls using an inline PLT call sequence (see
30431 @option{-mpltseq}).  PowerPC with @option{-mbss-plt} and PowerPC64
30432 ELFv1 (big-endian) do not support inline PLT calls.
30434 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
30435 callee, L42}, plus a @dfn{branch island} (glue code).  The two target
30436 addresses represent the callee and the branch island.  The
30437 Darwin/PPC linker prefers the first address and generates a @code{bl
30438 callee} if the PPC @code{bl} instruction reaches the callee directly;
30439 otherwise, the linker generates @code{bl L42} to call the branch
30440 island.  The branch island is appended to the body of the
30441 calling function; it computes the full 32-bit address of the callee
30442 and jumps to it.
30444 On Mach-O (Darwin) systems, this option directs the compiler emit to
30445 the glue for every direct call, and the Darwin linker decides whether
30446 to use or discard it.
30448 In the future, GCC may ignore all longcall specifications
30449 when the linker is known to generate glue.
30451 @opindex mpltseq
30452 @opindex mno-pltseq
30453 @item -mpltseq
30454 @itemx -mno-pltseq
30455 Implement (do not implement) -fno-plt and long calls using an inline
30456 PLT call sequence that supports lazy linking and long calls to
30457 functions in dlopen'd shared libraries.  Inline PLT calls are only
30458 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
30459 linkers, and are enabled by default if the support is detected when
30460 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
30461 configured with @option{--enable-secureplt}.  @option{-mpltseq} code
30462 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
30463 linked together.
30465 @opindex mtls-markers
30466 @opindex mno-tls-markers
30467 @item -mtls-markers
30468 @itemx -mno-tls-markers
30469 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
30470 specifying the function argument.  The relocation allows the linker to
30471 reliably associate function call with argument setup instructions for
30472 TLS optimization, which in turn allows GCC to better schedule the
30473 sequence.
30475 @opindex mrecip
30476 @item -mrecip
30477 @itemx -mno-recip
30478 This option enables use of the reciprocal estimate and
30479 reciprocal square root estimate instructions with additional
30480 Newton-Raphson steps to increase precision instead of doing a divide or
30481 square root and divide for floating-point arguments.  You should use
30482 the @option{-ffast-math} option when using @option{-mrecip} (or at
30483 least @option{-funsafe-math-optimizations},
30484 @option{-ffinite-math-only}, @option{-freciprocal-math} and
30485 @option{-fno-trapping-math}).  Note that while the throughput of the
30486 sequence is generally higher than the throughput of the non-reciprocal
30487 instruction, the precision of the sequence can be decreased by up to 2
30488 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
30489 roots.
30491 @opindex mrecip=opt
30492 @item -mrecip=@var{opt}
30493 This option controls which reciprocal estimate instructions
30494 may be used.  @var{opt} is a comma-separated list of options, which may
30495 be preceded by a @code{!} to invert the option:
30497 @table @samp
30499 @item all
30500 Enable all estimate instructions.
30502 @item default 
30503 Enable the default instructions, equivalent to @option{-mrecip}.
30505 @item none 
30506 Disable all estimate instructions, equivalent to @option{-mno-recip}.
30508 @item div 
30509 Enable the reciprocal approximation instructions for both 
30510 single and double precision.
30512 @item divf 
30513 Enable the single-precision reciprocal approximation instructions.
30515 @item divd 
30516 Enable the double-precision reciprocal approximation instructions.
30518 @item rsqrt 
30519 Enable the reciprocal square root approximation instructions for both
30520 single and double precision.
30522 @item rsqrtf 
30523 Enable the single-precision reciprocal square root approximation instructions.
30525 @item rsqrtd 
30526 Enable the double-precision reciprocal square root approximation instructions.
30528 @end table
30530 So, for example, @option{-mrecip=all,!rsqrtd} enables
30531 all of the reciprocal estimate instructions, except for the
30532 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
30533 which handle the double-precision reciprocal square root calculations.
30535 @opindex mrecip-precision
30536 @item -mrecip-precision
30537 @itemx -mno-recip-precision
30538 Assume (do not assume) that the reciprocal estimate instructions
30539 provide higher-precision estimates than is mandated by the PowerPC
30540 ABI.  Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
30541 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
30542 The double-precision square root estimate instructions are not generated by
30543 default on low-precision machines, since they do not provide an
30544 estimate that converges after three steps.
30546 @opindex mveclibabi
30547 @item -mveclibabi=@var{type}
30548 Specifies the ABI type to use for vectorizing intrinsics using an
30549 external library.  The only type supported at present is @samp{mass},
30550 which specifies to use IBM's Mathematical Acceleration Subsystem
30551 (MASS) libraries for vectorizing intrinsics using external libraries.
30552 GCC currently emits calls to @code{acosd2}, @code{acosf4},
30553 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
30554 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
30555 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
30556 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
30557 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
30558 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
30559 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
30560 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
30561 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
30562 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
30563 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
30564 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
30565 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
30566 for power7.  Both @option{-ftree-vectorize} and
30567 @option{-funsafe-math-optimizations} must also be enabled.  The MASS
30568 libraries must be specified at link time.
30570 @opindex mfriz
30571 @item -mfriz
30572 @itemx -mno-friz
30573 Generate (do not generate) the @code{friz} instruction when the
30574 @option{-funsafe-math-optimizations} option is used to optimize
30575 rounding of floating-point values to 64-bit integer and back to floating
30576 point.  The @code{friz} instruction does not return the same value if
30577 the floating-point number is too large to fit in an integer.
30579 @opindex mpointers-to-nested-functions
30580 @item -mpointers-to-nested-functions
30581 @itemx -mno-pointers-to-nested-functions
30582 Generate (do not generate) code to load up the static chain register
30583 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
30584 systems where a function pointer points to a 3-word descriptor giving
30585 the function address, TOC value to be loaded in register @code{r2}, and
30586 static chain value to be loaded in register @code{r11}.  The
30587 @option{-mpointers-to-nested-functions} is on by default.  You cannot
30588 call through pointers to nested functions or pointers
30589 to functions compiled in other languages that use the static chain if
30590 you use @option{-mno-pointers-to-nested-functions}.
30592 @opindex msave-toc-indirect
30593 @item -msave-toc-indirect
30594 @itemx -mno-save-toc-indirect
30595 Generate (do not generate) code to save the TOC value in the reserved
30596 stack location in the function prologue if the function calls through
30597 a pointer on AIX and 64-bit Linux systems.  If the TOC value is not
30598 saved in the prologue, it is saved just before the call through the
30599 pointer.  The @option{-mno-save-toc-indirect} option is the default.
30601 @opindex mcompat-align-parm
30602 @item -mcompat-align-parm
30603 @itemx -mno-compat-align-parm
30604 Generate (do not generate) code to pass structure parameters with a
30605 maximum alignment of 64 bits, for compatibility with older versions
30606 of GCC.
30608 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
30609 structure parameter on a 128-bit boundary when that structure contained
30610 a member requiring 128-bit alignment.  This is corrected in more
30611 recent versions of GCC.  This option may be used to generate code
30612 that is compatible with functions compiled with older versions of
30613 GCC.
30615 The @option{-mno-compat-align-parm} option is the default.
30617 @opindex mstack-protector-guard
30618 @opindex mstack-protector-guard-reg
30619 @opindex mstack-protector-guard-offset
30620 @opindex mstack-protector-guard-symbol
30621 @item -mstack-protector-guard=@var{guard}
30622 @itemx -mstack-protector-guard-reg=@var{reg}
30623 @itemx -mstack-protector-guard-offset=@var{offset}
30624 @itemx -mstack-protector-guard-symbol=@var{symbol}
30625 Generate stack protection code using canary at @var{guard}.  Supported
30626 locations are @samp{global} for global canary or @samp{tls} for per-thread
30627 canary in the TLS block (the default with GNU libc version 2.4 or later).
30629 With the latter choice the options
30630 @option{-mstack-protector-guard-reg=@var{reg}} and
30631 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30632 which register to use as base register for reading the canary, and from what
30633 offset from that base register. The default for those is as specified in the
30634 relevant ABI.  @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
30635 the offset with a symbol reference to a canary in the TLS block.
30637 @opindex mpcrel
30638 @opindex mno-pcrel
30639 @item -mpcrel
30640 @itemx -mno-pcrel
30641 Generate (do not generate) pc-relative addressing.  The @option{-mpcrel}
30642 option requires that the medium code model (@option{-mcmodel=medium})
30643 and prefixed addressing (@option{-mprefixed}) options are enabled.
30645 @opindex mprefixed
30646 @opindex mno-prefixed
30647 @item -mprefixed
30648 @itemx -mno-prefixed
30649 Generate (do not generate) addressing modes using prefixed load and
30650 store instructions.  The @option{-mprefixed} option requires that
30651 the option @option{-mcpu=power10} (or later) is enabled.
30653 @opindex mmma
30654 @opindex mno-mma
30655 @item -mmma
30656 @itemx -mno-mma
30657 Generate (do not generate) the MMA instructions.  The @option{-mma}
30658 option requires that the option @option{-mcpu=power10} (or later)
30659 is enabled.
30661 @opindex mrop-protect
30662 @opindex mno-rop-protect
30663 @item -mrop-protect
30664 @itemx -mno-rop-protect
30665 Generate (do not generate) ROP protection instructions when the target
30666 processor supports them.  Currently this option disables the shrink-wrap
30667 optimization (@option{-fshrink-wrap}).
30669 @opindex mprivileged
30670 @opindex mno-privileged
30671 @item -mprivileged
30672 @itemx -mno-privileged
30673 Generate (do not generate) code that will run in privileged state.
30675 @opindex block-ops-unaligned-vsx
30676 @opindex no-block-ops-unaligned-vsx
30677 @item -mblock-ops-unaligned-vsx
30678 @itemx -mno-block-ops-unaligned-vsx
30679 Generate (do not generate) unaligned vsx loads and stores for
30680 inline expansion of @code{memcpy} and @code{memmove}.
30682 @item --param rs6000-vect-unroll-limit=
30683 The vectorizer will check with target information to determine whether it
30684 would be beneficial to unroll the main vectorized loop and by how much.  This
30685 parameter sets the upper bound of how much the vectorizer will unroll the main
30686 loop.  The default value is four.
30688 @end table
30690 @node RX Options
30691 @subsection RX Options
30692 @cindex RX Options
30694 These command-line options are defined for RX targets:
30696 @table @gcctabopt
30697 @opindex m64bit-doubles
30698 @opindex m32bit-doubles
30699 @item -m64bit-doubles
30700 @itemx -m32bit-doubles
30701 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
30702 or 32 bits (@option{-m32bit-doubles}) in size.  The default is
30703 @option{-m32bit-doubles}.  @emph{Note} RX floating-point hardware only
30704 works on 32-bit values, which is why the default is
30705 @option{-m32bit-doubles}.
30707 @opindex fpu
30708 @opindex nofpu
30709 @item -fpu
30710 @itemx -nofpu
30711 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
30712 floating-point hardware.  The default is enabled for the RX600
30713 series and disabled for the RX200 series.
30715 Floating-point instructions are only generated for 32-bit floating-point 
30716 values, however, so the FPU hardware is not used for doubles if the
30717 @option{-m64bit-doubles} option is used.
30719 @emph{Note} If the @option{-fpu} option is enabled then
30720 @option{-funsafe-math-optimizations} is also enabled automatically.
30721 This is because the RX FPU instructions are themselves unsafe.
30723 @opindex mcpu
30724 @item -mcpu=@var{name}
30725 Selects the type of RX CPU to be targeted.  Currently three types are
30726 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
30727 the specific @samp{RX610} CPU.  The default is @samp{RX600}.
30729 The only difference between @samp{RX600} and @samp{RX610} is that the
30730 @samp{RX610} does not support the @code{MVTIPL} instruction.
30732 The @samp{RX200} series does not have a hardware floating-point unit
30733 and so @option{-nofpu} is enabled by default when this type is
30734 selected.
30736 @opindex mbig-endian-data
30737 @opindex mlittle-endian-data
30738 @item -mbig-endian-data
30739 @itemx -mlittle-endian-data
30740 Store data (but not code) in the big-endian format.  The default is
30741 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
30742 format.
30744 @opindex msmall-data-limit
30745 @item -msmall-data-limit=@var{N}
30746 Specifies the maximum size in bytes of global and static variables
30747 which can be placed into the small data area.  Using the small data
30748 area can lead to smaller and faster code, but the size of area is
30749 limited and it is up to the programmer to ensure that the area does
30750 not overflow.  Also when the small data area is used one of the RX's
30751 registers (usually @code{r13}) is reserved for use pointing to this
30752 area, so it is no longer available for use by the compiler.  This
30753 could result in slower and/or larger code if variables are pushed onto
30754 the stack instead of being held in this register.
30756 Note, common variables (variables that have not been initialized) and
30757 constants are not placed into the small data area as they are assigned
30758 to other sections in the output executable.
30760 The default value is zero, which disables this feature.  Note, this
30761 feature is not enabled by default with higher optimization levels
30762 (@option{-O2} etc) because of the potentially detrimental effects of
30763 reserving a register.  It is up to the programmer to experiment and
30764 discover whether this feature is of benefit to their program.  See the
30765 description of the @option{-mpid} option for a description of how the
30766 actual register to hold the small data area pointer is chosen.
30768 @opindex msim
30769 @opindex mno-sim
30770 @item -msim
30771 @itemx -mno-sim
30772 Use the simulator runtime.  The default is to use the libgloss
30773 board-specific runtime.
30775 @opindex mas100-syntax
30776 @opindex mno-as100-syntax
30777 @item -mas100-syntax
30778 @itemx -mno-as100-syntax
30779 When generating assembler output use a syntax that is compatible with
30780 Renesas's AS100 assembler.  This syntax can also be handled by the GAS
30781 assembler, but it has some restrictions so it is not generated by default.
30783 @opindex mmax-constant-size
30784 @item -mmax-constant-size=@var{N}
30785 Specifies the maximum size, in bytes, of a constant that can be used as
30786 an operand in a RX instruction.  Although the RX instruction set does
30787 allow constants of up to 4 bytes in length to be used in instructions,
30788 a longer value equates to a longer instruction.  Thus in some
30789 circumstances it can be beneficial to restrict the size of constants
30790 that are used in instructions.  Constants that are too big are instead
30791 placed into a constant pool and referenced via register indirection.
30793 The value @var{N} can be between 0 and 4.  A value of 0 (the default)
30794 or 4 means that constants of any size are allowed.
30796 @opindex mrelax
30797 @item -mrelax
30798 Enable linker relaxation.  Linker relaxation is a process whereby the
30799 linker attempts to reduce the size of a program by finding shorter
30800 versions of various instructions.  Disabled by default.
30802 @opindex mint-register
30803 @item -mint-register=@var{N}
30804 Specify the number of registers to reserve for fast interrupt handler
30805 functions.  The value @var{N} can be between 0 and 4.  A value of 1
30806 means that register @code{r13} is reserved for the exclusive use
30807 of fast interrupt handlers.  A value of 2 reserves @code{r13} and
30808 @code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
30809 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
30810 A value of 0, the default, does not reserve any registers.
30812 @opindex msave-acc-in-interrupts
30813 @item -msave-acc-in-interrupts
30814 Specifies that interrupt handler functions should preserve the
30815 accumulator register.  This is only necessary if normal code might use
30816 the accumulator register, for example because it performs 64-bit
30817 multiplications.  The default is to ignore the accumulator as this
30818 makes the interrupt handlers faster.
30820 @opindex mpid
30821 @opindex mno-pid
30822 @item -mpid
30823 @itemx -mno-pid
30824 Enables the generation of position independent data.  When enabled any
30825 access to constant data is done via an offset from a base address
30826 held in a register.  This allows the location of constant data to be
30827 determined at run time without requiring the executable to be
30828 relocated, which is a benefit to embedded applications with tight
30829 memory constraints.  Data that can be modified is not affected by this
30830 option.
30832 Note, using this feature reserves a register, usually @code{r13}, for
30833 the constant data base address.  This can result in slower and/or
30834 larger code, especially in complicated functions.
30836 The actual register chosen to hold the constant data base address
30837 depends upon whether the @option{-msmall-data-limit} and/or the
30838 @option{-mint-register} command-line options are enabled.  Starting
30839 with register @code{r13} and proceeding downwards, registers are
30840 allocated first to satisfy the requirements of @option{-mint-register},
30841 then @option{-mpid} and finally @option{-msmall-data-limit}.  Thus it
30842 is possible for the small data area register to be @code{r8} if both
30843 @option{-mint-register=4} and @option{-mpid} are specified on the
30844 command line.
30846 By default this feature is not enabled.  The default can be restored
30847 via the @option{-mno-pid} command-line option.
30849 @opindex mno-warn-multiple-fast-interrupts
30850 @opindex mwarn-multiple-fast-interrupts
30851 @item -mno-warn-multiple-fast-interrupts
30852 @itemx -mwarn-multiple-fast-interrupts
30853 Prevents GCC from issuing a warning message if it finds more than one
30854 fast interrupt handler when it is compiling a file.  The default is to
30855 issue a warning for each extra fast interrupt handler found, as the RX
30856 only supports one such interrupt.
30858 @opindex mallow-string-insns
30859 @opindex mno-allow-string-insns
30860 @item -mallow-string-insns
30861 @itemx -mno-allow-string-insns
30862 Enables or disables the use of the string manipulation instructions
30863 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
30864 @code{SWHILE} and also the @code{RMPA} instruction.  These
30865 instructions may prefetch data, which is not safe to do if accessing
30866 an I/O register.  (See section 12.2.7 of the RX62N Group User's Manual
30867 for more information).
30869 The default is to allow these instructions, but it is not possible for
30870 GCC to reliably detect all circumstances where a string instruction
30871 might be used to access an I/O register, so their use cannot be
30872 disabled automatically.  Instead it is reliant upon the programmer to
30873 use the @option{-mno-allow-string-insns} option if their program
30874 accesses I/O space.
30876 When the instructions are enabled GCC defines the C preprocessor
30877 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
30878 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
30880 @opindex mjsr
30881 @opindex mno-jsr
30882 @item -mjsr
30883 @itemx -mno-jsr
30884 Use only (or not only) @code{JSR} instructions to access functions.
30885 This option can be used when code size exceeds the range of @code{BSR}
30886 instructions.  Note that @option{-mno-jsr} does not mean to not use
30887 @code{JSR} but instead means that any type of branch may be used.
30888 @end table
30890 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
30891 has special significance to the RX port when used with the
30892 @code{interrupt} function attribute.  This attribute indicates a
30893 function intended to process fast interrupts.  GCC ensures
30894 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
30895 and/or @code{r13} and only provided that the normal use of the
30896 corresponding registers have been restricted via the
30897 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
30898 options.
30900 @node S/390 and zSeries Options
30901 @subsection S/390 and zSeries Options
30902 @cindex S/390 and zSeries Options
30904 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
30906 @table @gcctabopt
30907 @opindex mhard-float
30908 @opindex msoft-float
30909 @item -mhard-float
30910 @itemx -msoft-float
30911 Use (do not use) the hardware floating-point instructions and registers
30912 for floating-point operations.  When @option{-msoft-float} is specified,
30913 functions in @file{libgcc.a} are used to perform floating-point
30914 operations.  When @option{-mhard-float} is specified, the compiler
30915 generates IEEE floating-point instructions.  This is the default.
30917 @opindex mhard-dfp
30918 @opindex mno-hard-dfp
30919 @item -mhard-dfp
30920 @itemx -mno-hard-dfp
30921 Use (do not use) the hardware decimal-floating-point instructions for
30922 decimal-floating-point operations.  When @option{-mno-hard-dfp} is
30923 specified, functions in @file{libgcc.a} are used to perform
30924 decimal-floating-point operations.  When @option{-mhard-dfp} is
30925 specified, the compiler generates decimal-floating-point hardware
30926 instructions.  This is the default for @option{-march=z9-ec} or higher.
30928 @opindex mlong-double-64
30929 @opindex mlong-double-128
30930 @item -mlong-double-64
30931 @itemx -mlong-double-128
30932 These switches control the size of @code{long double} type. A size
30933 of 64 bits makes the @code{long double} type equivalent to the @code{double}
30934 type. This is the default.
30936 @opindex mbackchain
30937 @opindex mno-backchain
30938 @item -mbackchain
30939 @itemx -mno-backchain
30940 Store (do not store) the address of the caller's frame as backchain pointer
30941 into the callee's stack frame.
30942 A backchain may be needed to allow debugging using tools that do not understand
30943 DWARF call frame information.
30944 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
30945 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
30946 the backchain is placed into the topmost word of the 96/160 byte register
30947 save area.
30949 In general, code compiled with @option{-mbackchain} is call-compatible with
30950 code compiled with @option{-mno-backchain}; however, use of the backchain
30951 for debugging purposes usually requires that the whole binary is built with
30952 @option{-mbackchain}.  Note that the combination of @option{-mbackchain},
30953 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
30954 to build a linux kernel use @option{-msoft-float}.
30956 The default is to not maintain the backchain.
30958 @opindex mpacked-stack
30959 @opindex mno-packed-stack
30960 @item -mpacked-stack
30961 @itemx -mno-packed-stack
30962 Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
30963 specified, the compiler uses the all fields of the 96/160 byte register save
30964 area only for their default purpose; unused fields still take up stack space.
30965 When @option{-mpacked-stack} is specified, register save slots are densely
30966 packed at the top of the register save area; unused space is reused for other
30967 purposes, allowing for more efficient use of the available stack space.
30968 However, when @option{-mbackchain} is also in effect, the topmost word of
30969 the save area is always used to store the backchain, and the return address
30970 register is always saved two words below the backchain.
30972 As long as the stack frame backchain is not used, code generated with
30973 @option{-mpacked-stack} is call-compatible with code generated with
30974 @option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
30975 S/390 or zSeries generated code that uses the stack frame backchain at run
30976 time, not just for debugging purposes.  Such code is not call-compatible
30977 with code compiled with @option{-mpacked-stack}.  Also, note that the
30978 combination of @option{-mbackchain},
30979 @option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
30980 to build a linux kernel use @option{-msoft-float}.
30982 The default is to not use the packed stack layout.
30984 @opindex msmall-exec
30985 @opindex mno-small-exec
30986 @item -msmall-exec
30987 @itemx -mno-small-exec
30988 Generate (or do not generate) code using the @code{bras} instruction
30989 to do subroutine calls.
30990 This only works reliably if the total executable size does not
30991 exceed 64k.  The default is to use the @code{basr} instruction instead,
30992 which does not have this limitation.
30994 @opindex m64
30995 @opindex m31
30996 @item -m64
30997 @itemx -m31
30998 When @option{-m31} is specified, generate code compliant to the
30999 GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
31000 code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
31001 particular to generate 64-bit instructions.  For the @samp{s390}
31002 targets, the default is @option{-m31}, while the @samp{s390x}
31003 targets default to @option{-m64}.
31005 @opindex mzarch
31006 @opindex mesa
31007 @item -mzarch
31008 @itemx -mesa
31009 When @option{-mzarch} is specified, generate code using the
31010 instructions available on z/Architecture.
31011 When @option{-mesa} is specified, generate code using the
31012 instructions available on ESA/390.  Note that @option{-mesa} is
31013 not possible with @option{-m64}.
31014 When generating code compliant to the GNU/Linux for S/390 ABI,
31015 the default is @option{-mesa}.  When generating code compliant
31016 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
31018 @opindex mhtm
31019 @opindex mno-htm
31020 @item -mhtm
31021 @itemx -mno-htm
31022 The @option{-mhtm} option enables a set of builtins making use of
31023 instructions available with the transactional execution facility
31024 introduced with the IBM zEnterprise EC12 machine generation
31025 @ref{S/390 System z Built-in Functions}.
31026 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
31028 @opindex mvx
31029 @opindex mno-vx
31030 @item -mvx
31031 @itemx -mno-vx
31032 When @option{-mvx} is specified, generate code using the instructions
31033 available with the vector extension facility introduced with the IBM
31034 z13 machine generation.
31035 This option changes the ABI for some vector type values with regard to
31036 alignment and calling conventions.  In case vector type values are
31037 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
31038 command will be added to mark the resulting binary with the ABI used.
31039 @option{-mvx} is enabled by default when using @option{-march=z13}.
31041 @opindex mzvector
31042 @opindex mno-zvector
31043 @item -mzvector
31044 @itemx -mno-zvector
31045 The @option{-mzvector} option enables vector language extensions and
31046 builtins using instructions available with the vector extension
31047 facility introduced with the IBM z13 machine generation.
31048 This option adds support for @samp{vector} to be used as a keyword to
31049 define vector type variables and arguments.  @samp{vector} is only
31050 available when GNU extensions are enabled.  It will not be expanded
31051 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
31052 In addition to the GCC low-level builtins @option{-mzvector} enables
31053 a set of builtins added for compatibility with AltiVec-style
31054 implementations like Power and Cell.  In order to make use of these
31055 builtins the header file @file{vecintrin.h} needs to be included.
31056 @option{-mzvector} is disabled by default.
31058 @opindex mmvcle
31059 @opindex mno-mvcle
31060 @item -mmvcle
31061 @itemx -mno-mvcle
31062 Generate (or do not generate) code using the @code{mvcle} instruction
31063 to perform block moves.  When @option{-mno-mvcle} is specified,
31064 use a @code{mvc} loop instead.  This is the default unless optimizing for
31065 size.
31067 @opindex mdebug
31068 @opindex mno-debug
31069 @item -mdebug
31070 @itemx -mno-debug
31071 Print (or do not print) additional debug information when compiling.
31072 The default is to not print debug information.
31074 @opindex march
31075 @item -march=@var{cpu-type}
31076 Generate code that runs on @var{cpu-type}, which is the name of a
31077 system representing a certain processor type.  Possible values for
31078 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
31079 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
31080 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
31081 @samp{z14}/@samp{arch12}, @samp{z15}/@samp{arch13},
31082 @samp{z16}/@samp{arch14}, and @samp{native}.
31084 The default is @option{-march=z900}.
31086 Specifying @samp{native} as cpu type can be used to select the best
31087 architecture option for the host processor.
31088 @option{-march=native} has no effect if GCC does not recognize the
31089 processor.
31091 @opindex mtune
31092 @item -mtune=@var{cpu-type}
31093 Tune to @var{cpu-type} everything applicable about the generated code,
31094 except for the ABI and the set of available instructions.
31095 The list of @var{cpu-type} values is the same as for @option{-march}.
31096 The default is the value used for @option{-march}.
31098 @opindex mtpf-trace
31099 @opindex mno-tpf-trace
31100 @item -mtpf-trace
31101 @itemx -mno-tpf-trace
31102 Generate code that adds (does not add) in TPF OS specific branches to trace
31103 routines in the operating system.  This option is off by default, even
31104 when compiling for the TPF OS@.
31106 @opindex mtpf-trace-skip
31107 @opindex mno-tpf-trace-skip
31108 @item -mtpf-trace-skip
31109 @itemx -mno-tpf-trace-skip
31110 Generate code that changes (does not change) the default branch
31111 targets enabled by @option{-mtpf-trace} to point to specialized trace
31112 routines providing the ability of selectively skipping function trace
31113 entries for the TPF OS.  This option is off by default, even when
31114 compiling for the TPF OS and specifying @option{-mtpf-trace}.
31116 @opindex mfused-madd
31117 @opindex mno-fused-madd
31118 @item -mfused-madd
31119 @itemx -mno-fused-madd
31120 Generate code that uses (does not use) the floating-point multiply and
31121 accumulate instructions.  These instructions are generated by default if
31122 hardware floating point is used.
31124 @opindex mwarn-framesize
31125 @item -mwarn-framesize=@var{framesize}
31126 Emit a warning if the current function exceeds the given frame size.  Because
31127 this is a compile-time check it doesn't need to be a real problem when the program
31128 runs.  It is intended to identify functions that most probably cause
31129 a stack overflow.  It is useful to be used in an environment with limited stack
31130 size e.g.@: the linux kernel.
31132 @opindex mwarn-dynamicstack
31133 @item -mwarn-dynamicstack
31134 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
31135 arrays.  This is generally a bad idea with a limited stack size.
31137 @opindex mstack-guard
31138 @opindex mstack-size
31139 @item -mstack-guard=@var{stack-guard}
31140 @itemx -mstack-size=@var{stack-size}
31141 If these options are provided the S/390 back end emits additional instructions in
31142 the function prologue that trigger a trap if the stack size is @var{stack-guard}
31143 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
31144 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
31145 the frame size of the compiled function is chosen.
31146 These options are intended to be used to help debugging stack overflow problems.
31147 The additionally emitted code causes only little overhead and hence can also be
31148 used in production-like systems without greater performance degradation.  The given
31149 values have to be exact powers of 2 and @var{stack-size} has to be greater than
31150 @var{stack-guard} without exceeding 64k.
31151 In order to be efficient the extra code makes the assumption that the stack starts
31152 at an address aligned to the value given by @var{stack-size}.
31153 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
31155 @opindex mhotpatch
31156 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
31157 If the hotpatch option is enabled, a ``hot-patching'' function
31158 prologue is generated for all functions in the compilation unit.
31159 The funtion label is prepended with the given number of two-byte
31160 NOP instructions (@var{pre-halfwords}, maximum 1000000).  After
31161 the label, 2 * @var{post-halfwords} bytes are appended, using the
31162 largest NOP like instructions the architecture allows (maximum
31163 1000000).
31165 If both arguments are zero, hotpatching is disabled.
31167 This option can be overridden for individual functions with the
31168 @code{hotpatch} attribute.
31169 @end table
31171 @node SH Options
31172 @subsection SH Options
31174 These @samp{-m} options are defined for the SH implementations:
31176 @table @gcctabopt
31177 @opindex m1
31178 @item -m1
31179 Generate code for the SH1.
31181 @opindex m2
31182 @item -m2
31183 Generate code for the SH2.
31185 @item -m2e
31186 Generate code for the SH2e.
31188 @opindex m2a-nofpu
31189 @item -m2a-nofpu
31190 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
31191 that the floating-point unit is not used.
31193 @opindex m2a-single-only
31194 @item -m2a-single-only
31195 Generate code for the SH2a-FPU, in such a way that no double-precision
31196 floating-point operations are used.
31198 @opindex m2a-single
31199 @item -m2a-single
31200 Generate code for the SH2a-FPU assuming the floating-point unit is in
31201 single-precision mode by default.
31203 @opindex m2a
31204 @item -m2a
31205 Generate code for the SH2a-FPU assuming the floating-point unit is in
31206 double-precision mode by default.
31208 @opindex m3
31209 @item -m3
31210 Generate code for the SH3.
31212 @opindex m3e
31213 @item -m3e
31214 Generate code for the SH3e.
31216 @opindex m4-nofpu
31217 @item -m4-nofpu
31218 Generate code for the SH4 without a floating-point unit.
31220 @opindex m4-single-only
31221 @item -m4-single-only
31222 Generate code for the SH4 with a floating-point unit that only
31223 supports single-precision arithmetic.
31225 @opindex m4-single
31226 @item -m4-single
31227 Generate code for the SH4 assuming the floating-point unit is in
31228 single-precision mode by default.
31230 @opindex m4
31231 @item -m4
31232 Generate code for the SH4.
31234 @opindex m4-100
31235 @item -m4-100
31236 Generate code for SH4-100.
31238 @opindex m4-100-nofpu
31239 @item -m4-100-nofpu
31240 Generate code for SH4-100 in such a way that the
31241 floating-point unit is not used.
31243 @opindex m4-100-single
31244 @item -m4-100-single
31245 Generate code for SH4-100 assuming the floating-point unit is in
31246 single-precision mode by default.
31248 @opindex m4-100-single-only
31249 @item -m4-100-single-only
31250 Generate code for SH4-100 in such a way that no double-precision
31251 floating-point operations are used.
31253 @opindex m4-200
31254 @item -m4-200
31255 Generate code for SH4-200.
31257 @opindex m4-200-nofpu
31258 @item -m4-200-nofpu
31259 Generate code for SH4-200 without in such a way that the
31260 floating-point unit is not used.
31262 @opindex m4-200-single
31263 @item -m4-200-single
31264 Generate code for SH4-200 assuming the floating-point unit is in
31265 single-precision mode by default.
31267 @opindex m4-200-single-only
31268 @item -m4-200-single-only
31269 Generate code for SH4-200 in such a way that no double-precision
31270 floating-point operations are used.
31272 @opindex m4-300
31273 @item -m4-300
31274 Generate code for SH4-300.
31276 @opindex m4-300-nofpu
31277 @item -m4-300-nofpu
31278 Generate code for SH4-300 without in such a way that the
31279 floating-point unit is not used.
31281 @opindex m4-300-single
31282 @item -m4-300-single
31283 Generate code for SH4-300 in such a way that no double-precision
31284 floating-point operations are used.
31286 @opindex m4-300-single-only
31287 @item -m4-300-single-only
31288 Generate code for SH4-300 in such a way that no double-precision
31289 floating-point operations are used.
31291 @opindex m4-340
31292 @item -m4-340
31293 Generate code for SH4-340 (no MMU, no FPU).
31295 @opindex m4-500
31296 @item -m4-500
31297 Generate code for SH4-500 (no FPU).  Passes @option{-isa=sh4-nofpu} to the
31298 assembler.
31300 @opindex m4a-nofpu
31301 @item -m4a-nofpu
31302 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
31303 floating-point unit is not used.
31305 @opindex m4a-single-only
31306 @item -m4a-single-only
31307 Generate code for the SH4a, in such a way that no double-precision
31308 floating-point operations are used.
31310 @opindex m4a-single
31311 @item -m4a-single
31312 Generate code for the SH4a assuming the floating-point unit is in
31313 single-precision mode by default.
31315 @opindex m4a
31316 @item -m4a
31317 Generate code for the SH4a.
31319 @opindex m4al
31320 @item -m4al
31321 Same as @option{-m4a-nofpu}, except that it implicitly passes
31322 @option{-dsp} to the assembler.  GCC doesn't generate any DSP
31323 instructions at the moment.
31325 @opindex mb
31326 @item -mb
31327 Compile code for the processor in big-endian mode.
31329 @opindex ml
31330 @item -ml
31331 Compile code for the processor in little-endian mode.
31333 @opindex mdalign
31334 @item -mdalign
31335 Align doubles at 64-bit boundaries.  Note that this changes the calling
31336 conventions, and thus some functions from the standard C library do
31337 not work unless you recompile it first with @option{-mdalign}.
31339 @opindex mrelax
31340 @item -mrelax
31341 Shorten some address references at link time, when possible; uses the
31342 linker option @option{-relax}.
31344 @opindex mbigtable
31345 @item -mbigtable
31346 Use 32-bit offsets in @code{switch} tables.  The default is to use
31347 16-bit offsets.
31349 @opindex mbitops
31350 @item -mbitops
31351 Enable the use of bit manipulation instructions on SH2A.
31353 @opindex mfmovd
31354 @item -mfmovd
31355 Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
31356 alignment constraints.
31358 @opindex mrenesas
31359 @item -mrenesas
31360 Comply with the calling conventions defined by Renesas.
31362 @opindex mno-renesas
31363 @item -mno-renesas
31364 Comply with the calling conventions defined for GCC before the Renesas
31365 conventions were available.  This option is the default for all
31366 targets of the SH toolchain.
31368 @opindex mnomacsave
31369 @item -mnomacsave
31370 Mark the @code{MAC} register as call-clobbered, even if
31371 @option{-mrenesas} is given.
31373 @opindex mieee
31374 @opindex mno-ieee
31375 @item -mieee
31376 @itemx -mno-ieee
31377 Control the IEEE compliance of floating-point comparisons, which affects the
31378 handling of cases where the result of a comparison is unordered.  By default
31379 @option{-mieee} is implicitly enabled.  If @option{-ffinite-math-only} is
31380 enabled @option{-mno-ieee} is implicitly set, which results in faster
31381 floating-point greater-equal and less-equal comparisons.  The implicit settings
31382 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
31384 @opindex minline-ic_invalidate
31385 @item -minline-ic_invalidate
31386 Inline code to invalidate instruction cache entries after setting up
31387 nested function trampolines.
31388 This option has no effect if @option{-musermode} is in effect and the selected
31389 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
31390 instruction.
31391 If the selected code generation option does not allow the use of the @code{icbi}
31392 instruction, and @option{-musermode} is not in effect, the inlined code
31393 manipulates the instruction cache address array directly with an associative
31394 write.  This not only requires privileged mode at run time, but it also
31395 fails if the cache line had been mapped via the TLB and has become unmapped.
31397 @opindex misize
31398 @item -misize
31399 Dump instruction size and location in the assembly code.
31401 @opindex mpadstruct
31402 @item -mpadstruct
31403 This option is deprecated.  It pads structures to multiple of 4 bytes,
31404 which is incompatible with the SH ABI@.
31406 @opindex matomic-model=@var{model}
31407 @item -matomic-model=@var{model}
31408 Sets the model of atomic operations and additional parameters as a comma
31409 separated list.  For details on the atomic built-in functions see
31410 @ref{__atomic Builtins}.  The following models and parameters are supported:
31412 @table @samp
31414 @item none
31415 Disable compiler generated atomic sequences and emit library calls for atomic
31416 operations.  This is the default if the target is not @code{sh*-*-linux*}.
31418 @item soft-gusa
31419 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
31420 built-in functions.  The generated atomic sequences require additional support
31421 from the interrupt/exception handling code of the system and are only suitable
31422 for SH3* and SH4* single-core systems.  This option is enabled by default when
31423 the target is @code{sh*-*-linux*} and SH3* or SH4*.  When the target is SH4A,
31424 this option also partially utilizes the hardware atomic instructions
31425 @code{movli.l} and @code{movco.l} to create more efficient code, unless
31426 @samp{strict} is specified.  
31428 @item soft-tcb
31429 Generate software atomic sequences that use a variable in the thread control
31430 block.  This is a variation of the gUSA sequences which can also be used on
31431 SH1* and SH2* targets.  The generated atomic sequences require additional
31432 support from the interrupt/exception handling code of the system and are only
31433 suitable for single-core systems.  When using this model, the @samp{gbr-offset=}
31434 parameter has to be specified as well.
31436 @item soft-imask
31437 Generate software atomic sequences that temporarily disable interrupts by
31438 setting @code{SR.IMASK = 1111}.  This model works only when the program runs
31439 in privileged mode and is only suitable for single-core systems.  Additional
31440 support from the interrupt/exception handling code of the system is not
31441 required.  This model is enabled by default when the target is
31442 @code{sh*-*-linux*} and SH1* or SH2*.
31444 @item hard-llcs
31445 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
31446 instructions only.  This is only available on SH4A and is suitable for
31447 multi-core systems.  Since the hardware instructions support only 32 bit atomic
31448 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
31449 Code compiled with this option is also compatible with other software
31450 atomic model interrupt/exception handling systems if executed on an SH4A
31451 system.  Additional support from the interrupt/exception handling code of the
31452 system is not required for this model.
31454 @item gbr-offset=
31455 This parameter specifies the offset in bytes of the variable in the thread
31456 control block structure that should be used by the generated atomic sequences
31457 when the @samp{soft-tcb} model has been selected.  For other models this
31458 parameter is ignored.  The specified value must be an integer multiple of four
31459 and in the range 0-1020.
31461 @item strict
31462 This parameter prevents mixed usage of multiple atomic models, even if they
31463 are compatible, and makes the compiler generate atomic sequences of the
31464 specified model only.
31466 @end table
31468 @opindex mtas
31469 @item -mtas
31470 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
31471 Notice that depending on the particular hardware and software configuration
31472 this can degrade overall performance due to the operand cache line flushes
31473 that are implied by the @code{tas.b} instruction.  On multi-core SH4A
31474 processors the @code{tas.b} instruction must be used with caution since it
31475 can result in data corruption for certain cache configurations.
31477 @opindex mprefergot
31478 @item -mprefergot
31479 When generating position-independent code, emit function calls using
31480 the Global Offset Table instead of the Procedure Linkage Table.
31482 @opindex musermode
31483 @opindex mno-usermode
31484 @item -musermode
31485 @itemx -mno-usermode
31486 Don't allow (allow) the compiler generating privileged mode code.  Specifying
31487 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
31488 inlined code would not work in user mode.  @option{-musermode} is the default
31489 when the target is @code{sh*-*-linux*}.  If the target is SH1* or SH2*
31490 @option{-musermode} has no effect, since there is no user mode.
31492 @opindex multcost=@var{number}
31493 @item -multcost=@var{number}
31494 Set the cost to assume for a multiply insn.
31496 @opindex mdiv=@var{strategy}
31497 @item -mdiv=@var{strategy}
31498 Set the division strategy to be used for integer division operations.
31499 @var{strategy} can be one of: 
31501 @table @samp
31503 @item call-div1
31504 Calls a library function that uses the single-step division instruction
31505 @code{div1} to perform the operation.  Division by zero calculates an
31506 unspecified result and does not trap.  This is the default except for SH4,
31507 SH2A and SHcompact.
31509 @item call-fp
31510 Calls a library function that performs the operation in double precision
31511 floating point.  Division by zero causes a floating-point exception.  This is
31512 the default for SHcompact with FPU.  Specifying this for targets that do not
31513 have a double precision FPU defaults to @code{call-div1}.
31515 @item call-table
31516 Calls a library function that uses a lookup table for small divisors and
31517 the @code{div1} instruction with case distinction for larger divisors.  Division
31518 by zero calculates an unspecified result and does not trap.  This is the default
31519 for SH4.  Specifying this for targets that do not have dynamic shift
31520 instructions defaults to @code{call-div1}.
31522 @end table
31524 When a division strategy has not been specified the default strategy is
31525 selected based on the current target.  For SH2A the default strategy is to
31526 use the @code{divs} and @code{divu} instructions instead of library function
31527 calls.
31529 @opindex maccumulate-outgoing-args
31530 @item -maccumulate-outgoing-args
31531 Reserve space once for outgoing arguments in the function prologue rather
31532 than around each call.  Generally beneficial for performance and size.  Also
31533 needed for unwinding to avoid changing the stack frame around conditional code.
31535 @opindex mdivsi3_libfunc=@var{name}
31536 @item -mdivsi3_libfunc=@var{name}
31537 Set the name of the library function used for 32-bit signed division to
31538 @var{name}.
31539 This only affects the name used in the @samp{call} division strategies, and
31540 the compiler still expects the same sets of input/output/clobbered registers as
31541 if this option were not present.
31543 @opindex mfixed-range
31544 @item -mfixed-range=@var{register-range}
31545 Generate code treating the given register range as fixed registers.
31546 A fixed register is one that the register allocator cannot use.  This is
31547 useful when compiling kernel code.  A register range is specified as
31548 two registers separated by a dash.  Multiple register ranges can be
31549 specified separated by a comma.
31551 @opindex mbranch-cost=@var{num}
31552 @item -mbranch-cost=@var{num}
31553 Assume @var{num} to be the cost for a branch instruction.  Higher numbers
31554 make the compiler try to generate more branch-free code if possible.  
31555 If not specified the value is selected depending on the processor type that
31556 is being compiled for.
31558 @opindex mzdcbranch
31559 @opindex mno-zdcbranch
31560 @item -mzdcbranch
31561 @itemx -mno-zdcbranch
31562 Assume (do not assume) that zero displacement conditional branch instructions
31563 @code{bt} and @code{bf} are fast.  If @option{-mzdcbranch} is specified, the
31564 compiler prefers zero displacement branch code sequences.  This is
31565 enabled by default when generating code for SH4 and SH4A.  It can be explicitly
31566 disabled by specifying @option{-mno-zdcbranch}.
31568 @opindex mcbranch-force-delay-slot
31569 @item -mcbranch-force-delay-slot
31570 Force the usage of delay slots for conditional branches, which stuffs the delay
31571 slot with a @code{nop} if a suitable instruction cannot be found.  By default
31572 this option is disabled.  It can be enabled to work around hardware bugs as
31573 found in the original SH7055.
31575 @opindex mfused-madd
31576 @opindex mno-fused-madd
31577 @item -mfused-madd
31578 @itemx -mno-fused-madd
31579 Generate code that uses (does not use) the floating-point multiply and
31580 accumulate instructions.  These instructions are generated by default
31581 if hardware floating point is used.  The machine-dependent
31582 @option{-mfused-madd} option is now mapped to the machine-independent
31583 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
31584 mapped to @option{-ffp-contract=off}.
31586 @opindex mfsca
31587 @opindex mno-fsca
31588 @item -mfsca
31589 @itemx -mno-fsca
31590 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
31591 and cosine approximations.  The option @option{-mfsca} must be used in
31592 combination with @option{-funsafe-math-optimizations}.  It is enabled by default
31593 when generating code for SH4A.  Using @option{-mno-fsca} disables sine and cosine
31594 approximations even if @option{-funsafe-math-optimizations} is in effect.
31596 @opindex mfsrra
31597 @opindex mno-fsrra
31598 @item -mfsrra
31599 @itemx -mno-fsrra
31600 Allow or disallow the compiler to emit the @code{fsrra} instruction for
31601 reciprocal square root approximations.  The option @option{-mfsrra} must be used
31602 in combination with @option{-funsafe-math-optimizations} and
31603 @option{-ffinite-math-only}.  It is enabled by default when generating code for
31604 SH4A.  Using @option{-mno-fsrra} disables reciprocal square root approximations
31605 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
31606 in effect.
31608 @opindex mpretend-cmove
31609 @item -mpretend-cmove
31610 Prefer zero-displacement conditional branches for conditional move instruction
31611 patterns.  This can result in faster code on the SH4 processor.
31613 @opindex fdpic
31614 @item -mfdpic
31615 Generate code using the FDPIC ABI.
31617 @end table
31619 @node Solaris 2 Options
31620 @subsection Solaris 2 Options
31621 @cindex Solaris 2 options
31623 These @samp{-m} options are supported on Solaris 2:
31625 @table @gcctabopt
31626 @opindex mclear-hwcap
31627 @item -mclear-hwcap
31628 @option{-mclear-hwcap} tells the compiler to remove the hardware
31629 capabilities generated by the Solaris assembler.  This is only necessary
31630 when object files use ISA extensions not supported by the current
31631 machine, but check at runtime whether or not to use them.
31633 @opindex mimpure-text
31634 @item -mimpure-text
31635 @option{-mimpure-text}, used in addition to @option{-shared}, tells
31636 the compiler to not pass @option{-z text} to the linker when linking a
31637 shared object.  Using this option, you can link position-dependent
31638 code into a shared object.
31640 @option{-mimpure-text} suppresses the ``relocations remain against
31641 allocatable but non-writable sections'' linker error message.
31642 However, the necessary relocations trigger copy-on-write, and the
31643 shared object is not actually shared across processes.  Instead of
31644 using @option{-mimpure-text}, you should compile all source code with
31645 @option{-fpic} or @option{-fPIC}.
31647 @end table
31649 These switches are supported in addition to the above on Solaris 2:
31651 @table @gcctabopt
31652 @opindex pthreads
31653 @item -pthreads
31654 This is a synonym for @option{-pthread}.
31655 @end table
31657 @node SPARC Options
31658 @subsection SPARC Options
31659 @cindex SPARC options
31661 These @samp{-m} options are supported on the SPARC:
31663 @table @gcctabopt
31664 @opindex mno-app-regs
31665 @opindex mapp-regs
31666 @item -mno-app-regs
31667 @itemx -mapp-regs
31668 Specify @option{-mapp-regs} to generate output using the global registers
31669 2 through 4, which the SPARC SVR4 ABI reserves for applications.  Like the
31670 global register 1, each global register 2 through 4 is then treated as an
31671 allocable register that is clobbered by function calls.  This is the default.
31673 To be fully SVR4 ABI-compliant at the cost of some performance loss,
31674 specify @option{-mno-app-regs}.  You should compile libraries and system
31675 software with this option.
31677 @opindex mflat
31678 @opindex mno-flat
31679 @item -mflat
31680 @itemx -mno-flat
31681 With @option{-mflat}, the compiler does not generate save/restore instructions
31682 and uses a ``flat'' or single register window model.  This model is compatible
31683 with the regular register window model.  The local registers and the input
31684 registers (0--5) are still treated as ``call-saved'' registers and are
31685 saved on the stack as needed.
31687 With @option{-mno-flat} (the default), the compiler generates save/restore
31688 instructions (except for leaf functions).  This is the normal operating mode.
31690 @opindex mfpu
31691 @opindex mhard-float
31692 @item -mfpu
31693 @itemx -mhard-float
31694 Generate output containing floating-point instructions.  This is the
31695 default.
31697 @opindex mno-fpu
31698 @opindex msoft-float
31699 @item -mno-fpu
31700 @itemx -msoft-float
31701 Generate output containing library calls for floating point.
31702 @strong{Warning:} the requisite libraries are not available for all SPARC
31703 targets.  Normally the facilities of the machine's usual C compiler are
31704 used, but this cannot be done directly in cross-compilation.  You must make
31705 your own arrangements to provide suitable library functions for
31706 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
31707 @samp{sparclite-*-*} do provide software floating-point support.
31709 @option{-msoft-float} changes the calling convention in the output file;
31710 therefore, it is only useful if you compile @emph{all} of a program with
31711 this option.  In particular, you need to compile @file{libgcc.a}, the
31712 library that comes with GCC, with @option{-msoft-float} in order for
31713 this to work.
31715 @opindex mhard-quad-float
31716 @item -mhard-quad-float
31717 Generate output containing quad-word (long double) floating-point
31718 instructions.
31720 @opindex msoft-quad-float
31721 @item -msoft-quad-float
31722 Generate output containing library calls for quad-word (long double)
31723 floating-point instructions.  The functions called are those specified
31724 in the SPARC ABI@.  This is the default.
31726 As of this writing, there are no SPARC implementations that have hardware
31727 support for the quad-word floating-point instructions.  They all invoke
31728 a trap handler for one of these instructions, and then the trap handler
31729 emulates the effect of the instruction.  Because of the trap handler overhead,
31730 this is much slower than calling the ABI library routines.  Thus the
31731 @option{-msoft-quad-float} option is the default.
31733 @opindex mno-unaligned-doubles
31734 @opindex munaligned-doubles
31735 @item -mno-unaligned-doubles
31736 @itemx -munaligned-doubles
31737 Assume that doubles have 8-byte alignment.  This is the default.
31739 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
31740 alignment only if they are contained in another type, or if they have an
31741 absolute address.  Otherwise, it assumes they have 4-byte alignment.
31742 Specifying this option avoids some rare compatibility problems with code
31743 generated by other compilers.  It is not the default because it results
31744 in a performance loss, especially for floating-point code.
31746 @opindex muser-mode
31747 @opindex mno-user-mode
31748 @item -muser-mode
31749 @itemx -mno-user-mode
31750 Do not generate code that can only run in supervisor mode.  This is relevant
31751 only for the @code{casa} instruction emitted for the LEON3 processor.  This
31752 is the default.
31754 @opindex mfaster-structs
31755 @opindex mno-faster-structs
31756 @item -mfaster-structs
31757 @itemx -mno-faster-structs
31758 With @option{-mfaster-structs}, the compiler assumes that structures
31759 should have 8-byte alignment.  This enables the use of pairs of
31760 @code{ldd} and @code{std} instructions for copies in structure
31761 assignment, in place of twice as many @code{ld} and @code{st} pairs.
31762 However, the use of this changed alignment directly violates the SPARC
31763 ABI@.  Thus, it's intended only for use on targets where the developer
31764 acknowledges that their resulting code is not directly in line with
31765 the rules of the ABI@.
31767 @opindex mstd-struct-return
31768 @opindex mno-std-struct-return
31769 @item -mstd-struct-return
31770 @itemx -mno-std-struct-return
31771 With @option{-mstd-struct-return}, the compiler generates checking code
31772 in functions returning structures or unions to detect size mismatches
31773 between the two sides of function calls, as per the 32-bit ABI@.
31775 The default is @option{-mno-std-struct-return}.  This option has no effect
31776 in 64-bit mode.
31778 @opindex mlra
31779 @opindex mno-lra
31780 @item -mlra
31781 @itemx -mno-lra
31782 Enable Local Register Allocation.  This is the default for SPARC since GCC 7
31783 so @option{-mno-lra} needs to be passed to get old Reload.
31785 @opindex mcpu
31786 @item -mcpu=@var{cpu_type}
31787 Set the instruction set, register set, and instruction scheduling parameters
31788 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
31789 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
31790 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{sparclite},
31791 @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701},
31792 @samp{v9}, @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara},
31793 @samp{niagara2}, @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and
31794 @samp{m8}.
31796 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
31797 which selects the best architecture option for the host processor.
31798 @option{-mcpu=native} has no effect if GCC does not recognize
31799 the processor.
31801 Default instruction scheduling parameters are used for values that select
31802 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
31803 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
31805 Here is a list of each supported architecture and their supported
31806 implementations.
31808 @table @asis
31809 @item v7
31810 cypress, leon3v7
31812 @item v8
31813 supersparc, hypersparc, leon, leon3, leon5
31815 @item sparclite
31816 f930, f934, sparclite86x
31818 @item sparclet
31819 tsc701
31821 @item v9
31822 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
31823 niagara7, m8
31824 @end table
31826 By default (unless configured otherwise), GCC generates code for the V7
31827 variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
31828 additionally optimizes it for the Cypress CY7C602 chip, as used in the
31829 SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
31830 SPARCStation 1, 2, IPX etc.
31832 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
31833 architecture.  The only difference from V7 code is that the compiler emits
31834 the integer multiply and integer divide instructions which exist in SPARC-V8
31835 but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
31836 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
31837 2000 series.
31839 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
31840 the SPARC architecture.  This adds the integer multiply, integer divide step
31841 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
31842 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
31843 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
31844 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
31845 MB86934 chip, which is the more recent SPARClite with FPU@.
31847 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
31848 the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
31849 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
31850 but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
31851 optimizes it for the TEMIC SPARClet chip.
31853 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
31854 architecture.  This adds 64-bit integer and floating-point move instructions,
31855 3 additional floating-point condition code registers and conditional move
31856 instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
31857 optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
31858 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
31859 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
31860 @option{-mcpu=niagara}, the compiler additionally optimizes it for
31861 Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
31862 additionally optimizes it for Sun UltraSPARC T2 chips. With
31863 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
31864 UltraSPARC T3 chips.  With @option{-mcpu=niagara4}, the compiler
31865 additionally optimizes it for Sun UltraSPARC T4 chips.  With
31866 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
31867 Oracle SPARC M7 chips.  With @option{-mcpu=m8}, the compiler
31868 additionally optimizes it for Oracle M8 chips.
31870 @opindex mtune
31871 @item -mtune=@var{cpu_type}
31872 Set the instruction scheduling parameters for machine type
31873 @var{cpu_type}, but do not set the instruction set or register set that the
31874 option @option{-mcpu=@var{cpu_type}} does.
31876 The same values for @option{-mcpu=@var{cpu_type}} can be used for
31877 @option{-mtune=@var{cpu_type}}, but the only useful values are those
31878 that select a particular CPU implementation.  Those are
31879 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
31880 @samp{leon3}, @samp{leon3v7}, @samp{leon5}, @samp{f930}, @samp{f934},
31881 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
31882 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
31883 @samp{niagara4}, @samp{niagara7} and @samp{m8}.  With native Solaris
31884 and GNU/Linux toolchains, @samp{native} can also be used.
31886 @opindex mv8plus
31887 @opindex mno-v8plus
31888 @item -mv8plus
31889 @itemx -mno-v8plus
31890 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
31891 difference from the V8 ABI is that the global and out registers are
31892 considered 64 bits wide.  This is enabled by default on Solaris in 32-bit
31893 mode for all SPARC-V9 processors.
31895 @opindex mvis
31896 @opindex mno-vis
31897 @item -mvis
31898 @itemx -mno-vis
31899 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
31900 Visual Instruction Set extensions.  The default is @option{-mno-vis}.
31902 @opindex mvis2
31903 @opindex mno-vis2
31904 @item -mvis2
31905 @itemx -mno-vis2
31906 With @option{-mvis2}, GCC generates code that takes advantage of
31907 version 2.0 of the UltraSPARC Visual Instruction Set extensions.  The
31908 default is @option{-mvis2} when targeting a cpu that supports such
31909 instructions, such as UltraSPARC-III and later.  Setting @option{-mvis2}
31910 also sets @option{-mvis}.
31912 @opindex mvis3
31913 @opindex mno-vis3
31914 @item -mvis3
31915 @itemx -mno-vis3
31916 With @option{-mvis3}, GCC generates code that takes advantage of
31917 version 3.0 of the UltraSPARC Visual Instruction Set extensions.  The
31918 default is @option{-mvis3} when targeting a cpu that supports such
31919 instructions, such as niagara-3 and later.  Setting @option{-mvis3}
31920 also sets @option{-mvis2} and @option{-mvis}.
31922 @opindex mvis4
31923 @opindex mno-vis4
31924 @item -mvis4
31925 @itemx -mno-vis4
31926 With @option{-mvis4}, GCC generates code that takes advantage of
31927 version 4.0 of the UltraSPARC Visual Instruction Set extensions.  The
31928 default is @option{-mvis4} when targeting a cpu that supports such
31929 instructions, such as niagara-7 and later.  Setting @option{-mvis4}
31930 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
31932 @opindex mvis4b
31933 @opindex mno-vis4b
31934 @item -mvis4b
31935 @itemx -mno-vis4b
31936 With @option{-mvis4b}, GCC generates code that takes advantage of
31937 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
31938 the additional VIS instructions introduced in the Oracle SPARC
31939 Architecture 2017.  The default is @option{-mvis4b} when targeting a
31940 cpu that supports such instructions, such as m8 and later.  Setting
31941 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
31942 @option{-mvis2} and @option{-mvis}.
31944 @opindex mcbcond
31945 @opindex mno-cbcond
31946 @item -mcbcond
31947 @itemx -mno-cbcond
31948 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
31949 Compare-and-Branch-on-Condition instructions.  The default is @option{-mcbcond}
31950 when targeting a CPU that supports such instructions, such as Niagara-4 and
31951 later.
31953 @opindex mfmaf
31954 @opindex mno-fmaf
31955 @item -mfmaf
31956 @itemx -mno-fmaf
31957 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
31958 Fused Multiply-Add Floating-point instructions.  The default is @option{-mfmaf}
31959 when targeting a CPU that supports such instructions, such as Niagara-3 and
31960 later.
31962 @opindex mfsmuld
31963 @opindex mno-fsmuld
31964 @item -mfsmuld
31965 @itemx -mno-fsmuld
31966 With @option{-mfsmuld}, GCC generates code that takes advantage of the
31967 Floating-point Multiply Single to Double (FsMULd) instruction.  The default is
31968 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
31969 or V9 with FPU except @option{-mcpu=leon}.
31971 @opindex mpopc
31972 @opindex mno-popc
31973 @item -mpopc
31974 @itemx -mno-popc
31975 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
31976 Population Count instruction.  The default is @option{-mpopc}
31977 when targeting a CPU that supports such an instruction, such as Niagara-2 and
31978 later.
31980 @opindex msubxc
31981 @opindex mno-subxc
31982 @item -msubxc
31983 @itemx -mno-subxc
31984 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
31985 Subtract-Extended-with-Carry instruction.  The default is @option{-msubxc}
31986 when targeting a CPU that supports such an instruction, such as Niagara-7 and
31987 later.
31989 @opindex mfix-at697f
31990 @item -mfix-at697f
31991 Enable the documented workaround for the single erratum of the Atmel AT697F
31992 processor (which corresponds to erratum #13 of the AT697E processor).
31994 @opindex mfix-ut699
31995 @item -mfix-ut699
31996 Enable the documented workarounds for the floating-point errata and the data
31997 cache nullify errata of the UT699 processor.
31999 @opindex mfix-ut700
32000 @item -mfix-ut700
32001 Enable the documented workaround for the back-to-back store errata of
32002 the UT699E/UT700 processor.
32004 @opindex mfix-gr712rc
32005 @item -mfix-gr712rc
32006 Enable the documented workaround for the back-to-back store errata of
32007 the GR712RC processor.
32008 @end table
32010 These @samp{-m} options are supported in addition to the above
32011 on SPARC-V9 processors in 64-bit environments:
32013 @table @gcctabopt
32014 @opindex m32
32015 @opindex m64
32016 @item -m32
32017 @itemx -m64
32018 Generate code for a 32-bit or 64-bit environment.
32019 The 32-bit environment sets int, long and pointer to 32 bits.
32020 The 64-bit environment sets int to 32 bits and long and pointer
32021 to 64 bits.
32023 @opindex mcmodel
32024 @item -mcmodel=@var{which}
32025 Set the code model to one of
32027 @table @samp
32028 @item medlow
32029 The Medium/Low code model: 64-bit addresses, programs
32030 must be linked in the low 32 bits of memory.  Programs can be statically
32031 or dynamically linked.
32033 @item medmid
32034 The Medium/Middle code model: 64-bit addresses, programs
32035 must be linked in the low 44 bits of memory, the text and data segments must
32036 be less than 2GB in size and the data segment must be located within 2GB of
32037 the text segment.
32039 @item medany
32040 The Medium/Anywhere code model: 64-bit addresses, programs
32041 may be linked anywhere in memory, the text and data segments must be less
32042 than 2GB in size and the data segment must be located within 2GB of the
32043 text segment.
32045 @item embmedany
32046 The Medium/Anywhere code model for embedded systems:
32047 64-bit addresses, the text and data segments must be less than 2GB in
32048 size, both starting anywhere in memory (determined at link time).  The
32049 global register %g4 points to the base of the data segment.  Programs
32050 are statically linked and PIC is not supported.
32051 @end table
32053 @opindex mmemory-model
32054 @item -mmemory-model=@var{mem-model}
32055 Set the memory model in force on the processor to one of
32057 @table @samp
32058 @item default
32059 The default memory model for the processor and operating system.
32061 @item rmo
32062 Relaxed Memory Order
32064 @item pso
32065 Partial Store Order
32067 @item tso
32068 Total Store Order
32070 @item sc
32071 Sequential Consistency
32072 @end table
32074 These memory models are formally defined in Appendix D of the SPARC-V9
32075 architecture manual, as set in the processor's @code{PSTATE.MM} field.
32077 @opindex mstack-bias
32078 @opindex mno-stack-bias
32079 @item -mstack-bias
32080 @itemx -mno-stack-bias
32081 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
32082 frame pointer if present, are offset by @minus{}2047 which must be added back
32083 when making stack frame references.  This is the default in 64-bit mode.
32084 Otherwise, assume no such offset is present.
32085 @end table
32087 @node System V Options
32088 @subsection Options for System V
32090 These additional options are available on System V Release 4 for
32091 compatibility with other compilers on those systems:
32093 @table @gcctabopt
32094 @opindex G
32095 @item -G
32096 Create a shared object.
32097 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
32099 @opindex Qy
32100 @item -Qy
32101 Identify the versions of each tool used by the compiler, in a
32102 @code{.ident} assembler directive in the output.
32104 @opindex Qn
32105 @item -Qn
32106 Refrain from adding @code{.ident} directives to the output file (this is
32107 the default).
32109 @opindex YP
32110 @item -YP,@var{dirs}
32111 Search the directories @var{dirs}, and no others, for libraries
32112 specified with @option{-l}.
32114 @opindex Ym
32115 @item -Ym,@var{dir}
32116 Look in the directory @var{dir} to find the M4 preprocessor.
32117 The assembler uses this option.
32118 @c This is supposed to go with a -Yd for predefined M4 macro files, but
32119 @c the generic assembler that comes with Solaris takes just -Ym.
32120 @end table
32122 @node V850 Options
32123 @subsection V850 Options
32124 @cindex V850 Options
32126 These @samp{-m} options are defined for V850 implementations:
32128 @table @gcctabopt
32129 @opindex mlong-calls
32130 @opindex mno-long-calls
32131 @item -mlong-calls
32132 @itemx -mno-long-calls
32133 Treat all calls as being far away (near).  If calls are assumed to be
32134 far away, the compiler always loads the function's address into a
32135 register, and calls indirect through the pointer.
32137 @opindex mno-ep
32138 @opindex mep
32139 @item -mno-ep
32140 @itemx -mep
32141 Do not optimize (do optimize) basic blocks that use the same index
32142 pointer 4 or more times to copy pointer into the @code{ep} register, and
32143 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
32144 option is on by default if you optimize.
32146 @opindex mno-prolog-function
32147 @opindex mprolog-function
32148 @item -mno-prolog-function
32149 @itemx -mprolog-function
32150 Do not use (do use) external functions to save and restore registers
32151 at the prologue and epilogue of a function.  The external functions
32152 are slower, but use less code space if more than one function saves
32153 the same number of registers.  The @option{-mprolog-function} option
32154 is on by default if you optimize.
32156 @opindex mspace
32157 @item -mspace
32158 Try to make the code as small as possible.  At present, this just turns
32159 on the @option{-mep} and @option{-mprolog-function} options.
32161 @opindex mtda
32162 @item -mtda=@var{n}
32163 Put static or global variables whose size is @var{n} bytes or less into
32164 the tiny data area that register @code{ep} points to.  The tiny data
32165 area can hold up to 256 bytes in total (128 bytes for byte references).
32167 @opindex msda
32168 @item -msda=@var{n}
32169 Put static or global variables whose size is @var{n} bytes or less into
32170 the small data area that register @code{gp} points to.  The small data
32171 area can hold up to 64 kilobytes.
32173 @opindex mzda
32174 @item -mzda=@var{n}
32175 Put static or global variables whose size is @var{n} bytes or less into
32176 the first 32 kilobytes of memory.
32178 @opindex mv850
32179 @item -mv850
32180 Specify that the target processor is the V850.
32182 @opindex mv850e3v5
32183 @item -mv850e3v5
32184 Specify that the target processor is the V850E3V5.  The preprocessor
32185 constant @code{__v850e3v5__} is defined if this option is used.
32187 @opindex mv850e2v4
32188 @item -mv850e2v4
32189 Specify that the target processor is the V850E3V5.  This is an alias for
32190 the @option{-mv850e3v5} option.
32192 @opindex mv850e2v3
32193 @item -mv850e2v3
32194 Specify that the target processor is the V850E2V3.  The preprocessor
32195 constant @code{__v850e2v3__} is defined if this option is used.
32197 @opindex mv850e2
32198 @item -mv850e2
32199 Specify that the target processor is the V850E2.  The preprocessor
32200 constant @code{__v850e2__} is defined if this option is used.
32202 @opindex mv850e1
32203 @item -mv850e1
32204 Specify that the target processor is the V850E1.  The preprocessor
32205 constants @code{__v850e1__} and @code{__v850e__} are defined if
32206 this option is used.
32208 @opindex mv850es
32209 @item -mv850es
32210 Specify that the target processor is the V850ES.  This is an alias for
32211 the @option{-mv850e1} option.
32213 @opindex mv850e
32214 @item -mv850e
32215 Specify that the target processor is the V850E@.  The preprocessor
32216 constant @code{__v850e__} is defined if this option is used.
32218 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
32219 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
32220 are defined then a default target processor is chosen and the
32221 relevant @samp{__v850*__} preprocessor constant is defined.
32223 The preprocessor constants @code{__v850} and @code{__v851__} are always
32224 defined, regardless of which processor variant is the target.
32226 @opindex mdisable-callt
32227 @opindex mno-disable-callt
32228 @item -mdisable-callt
32229 @itemx -mno-disable-callt
32230 This option suppresses generation of the @code{CALLT} instruction for the
32231 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
32232 architecture.
32234 This option is enabled by default when the RH850 ABI is
32235 in use (see @option{-mrh850-abi}), and disabled by default when the
32236 GCC ABI is in use.  If @code{CALLT} instructions are being generated
32237 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
32239 @opindex mrelax
32240 @opindex mno-relax
32241 @item -mrelax
32242 @itemx -mno-relax
32243 Pass on (or do not pass on) the @option{-mrelax} command-line option
32244 to the assembler.
32246 @opindex mlong-jumps
32247 @opindex mno-long-jumps
32248 @item -mlong-jumps
32249 @itemx -mno-long-jumps
32250 Disable (or re-enable) the generation of PC-relative jump instructions.
32252 @opindex msoft-float
32253 @opindex mhard-float
32254 @item -msoft-float
32255 @itemx -mhard-float
32256 Disable (or re-enable) the generation of hardware floating point
32257 instructions.  This option is only significant when the target
32258 architecture is @samp{V850E2V3} or higher.  If hardware floating point
32259 instructions are being generated then the C preprocessor symbol
32260 @code{__FPU_OK__} is defined, otherwise the symbol
32261 @code{__NO_FPU__} is defined.
32263 @opindex mloop
32264 @item -mloop
32265 Enables the use of the e3v5 LOOP instruction.  The use of this
32266 instruction is not enabled by default when the e3v5 architecture is
32267 selected because its use is still experimental.
32269 @opindex mrh850-abi
32270 @opindex mghs
32271 @item -mrh850-abi
32272 @itemx -mghs
32273 Enables support for the RH850 version of the V850 ABI.  This is the
32274 default.  With this version of the ABI the following rules apply:
32276 @itemize
32277 @item
32278 Integer sized structures and unions are returned via a memory pointer
32279 rather than a register.
32281 @item
32282 Large structures and unions (more than 8 bytes in size) are passed by
32283 value.
32285 @item
32286 Functions are aligned to 16-bit boundaries.
32288 @item
32289 The @option{-m8byte-align} command-line option is supported.
32291 @item
32292 The @option{-mdisable-callt} command-line option is enabled by
32293 default.  The @option{-mno-disable-callt} command-line option is not
32294 supported.
32295 @end itemize
32297 When this version of the ABI is enabled the C preprocessor symbol
32298 @code{__V850_RH850_ABI__} is defined.
32300 @opindex mgcc-abi
32301 @item -mgcc-abi
32302 Enables support for the old GCC version of the V850 ABI.  With this
32303 version of the ABI the following rules apply:
32305 @itemize
32306 @item
32307 Integer sized structures and unions are returned in register @code{r10}.
32309 @item
32310 Large structures and unions (more than 8 bytes in size) are passed by
32311 reference.
32313 @item
32314 Functions are aligned to 32-bit boundaries, unless optimizing for
32315 size.
32317 @item
32318 The @option{-m8byte-align} command-line option is not supported.
32320 @item
32321 The @option{-mdisable-callt} command-line option is supported but not
32322 enabled by default.
32323 @end itemize
32325 When this version of the ABI is enabled the C preprocessor symbol
32326 @code{__V850_GCC_ABI__} is defined.
32328 @opindex m8byte-align
32329 @opindex mno-8byte-align
32330 @item -m8byte-align
32331 @itemx -mno-8byte-align
32332 Enables support for @code{double} and @code{long long} types to be
32333 aligned on 8-byte boundaries.  The default is to restrict the
32334 alignment of all objects to at most 4-bytes.  When
32335 @option{-m8byte-align} is in effect the C preprocessor symbol
32336 @code{__V850_8BYTE_ALIGN__} is defined.
32338 @opindex mbig-switch
32339 @item -mbig-switch
32340 Generate code suitable for big switch tables.  Use this option only if
32341 the assembler/linker complain about out of range branches within a switch
32342 table.
32344 @opindex mapp-regs
32345 @item -mapp-regs
32346 This option causes r2 and r5 to be used in the code generated by
32347 the compiler.  This setting is the default.
32349 @opindex mno-app-regs
32350 @item -mno-app-regs
32351 This option causes r2 and r5 to be treated as fixed registers.
32353 @end table
32355 @node VAX Options
32356 @subsection VAX Options
32357 @cindex VAX options
32359 These @samp{-m} options are defined for the VAX:
32361 @table @gcctabopt
32362 @opindex munix
32363 @item -munix
32364 Do not output certain jump instructions (@code{aobleq} and so on)
32365 that the Unix assembler for the VAX cannot handle across long
32366 ranges.
32368 @opindex mgnu
32369 @item -mgnu
32370 Do output those jump instructions, on the assumption that the
32371 GNU assembler is being used.
32373 @opindex mg
32374 @item -mg
32375 Output code for G-format floating-point numbers instead of D-format.
32377 @opindex mlra
32378 @opindex mno-lra
32379 @item -mlra
32380 @itemx -mno-lra
32381 Enable Local Register Allocation.  This is still experimental for the VAX,
32382 so by default the compiler uses standard reload.
32383 @end table
32385 @node Visium Options
32386 @subsection Visium Options
32387 @cindex Visium options
32389 @table @gcctabopt
32391 @opindex mdebug
32392 @item -mdebug
32393 A program which performs file I/O and is destined to run on an MCM target
32394 should be linked with this option.  It causes the libraries libc.a and
32395 libdebug.a to be linked.  The program should be run on the target under
32396 the control of the GDB remote debugging stub.
32398 @opindex msim
32399 @item -msim
32400 A program which performs file I/O and is destined to run on the simulator
32401 should be linked with option.  This causes libraries libc.a and libsim.a to
32402 be linked.
32404 @opindex mfpu
32405 @opindex mhard-float
32406 @item -mfpu
32407 @itemx -mhard-float
32408 Generate code containing floating-point instructions.  This is the
32409 default.
32411 @opindex mno-fpu
32412 @opindex msoft-float
32413 @item -mno-fpu
32414 @itemx -msoft-float
32415 Generate code containing library calls for floating-point.
32417 @option{-msoft-float} changes the calling convention in the output file;
32418 therefore, it is only useful if you compile @emph{all} of a program with
32419 this option.  In particular, you need to compile @file{libgcc.a}, the
32420 library that comes with GCC, with @option{-msoft-float} in order for
32421 this to work.
32423 @opindex mcpu
32424 @item -mcpu=@var{cpu_type}
32425 Set the instruction set, register set, and instruction scheduling parameters
32426 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
32427 @samp{mcm}, @samp{gr5} and @samp{gr6}.
32429 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
32431 By default (unless configured otherwise), GCC generates code for the GR5
32432 variant of the Visium architecture.  
32434 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
32435 architecture.  The only difference from GR5 code is that the compiler will
32436 generate block move instructions.
32438 @opindex mtune
32439 @item -mtune=@var{cpu_type}
32440 Set the instruction scheduling parameters for machine type @var{cpu_type},
32441 but do not set the instruction set or register set that the option
32442 @option{-mcpu=@var{cpu_type}} would.
32444 @opindex msv-mode
32445 @item -msv-mode
32446 Generate code for the supervisor mode, where there are no restrictions on
32447 the access to general registers.  This is the default.
32449 @opindex muser-mode
32450 @item -muser-mode
32451 Generate code for the user mode, where the access to some general registers
32452 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
32453 mode; on the GR6, only registers r29 to r31 are affected.
32454 @end table
32456 @node VMS Options
32457 @subsection VMS Options
32459 These @samp{-m} options are defined for the VMS implementations:
32461 @table @gcctabopt
32462 @opindex mvms-return-codes
32463 @item -mvms-return-codes
32464 Return VMS condition codes from @code{main}. The default is to return POSIX-style
32465 condition (e.g.@: error) codes.
32467 @opindex mdebug-main=@var{prefix}
32468 @item -mdebug-main=@var{prefix}
32469 Flag the first routine whose name starts with @var{prefix} as the main
32470 routine for the debugger.
32472 @opindex mmalloc64
32473 @item -mmalloc64
32474 Default to 64-bit memory allocation routines.
32476 @opindex mpointer-size=@var{size}
32477 @item -mpointer-size=@var{size}
32478 Set the default size of pointers. Possible options for @var{size} are
32479 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
32480 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
32481 The later option disables @code{pragma pointer_size}.
32482 @end table
32484 @node VxWorks Options
32485 @subsection VxWorks Options
32486 @cindex VxWorks Options
32488 The options in this section are defined for all VxWorks targets.
32489 Options specific to the target hardware are listed with the other
32490 options for that target.
32492 @table @gcctabopt
32493 @opindex mrtp
32494 @item -mrtp
32495 GCC can generate code for both VxWorks kernels and real time processes
32496 (RTPs).  This option switches from the former to the latter.  It also
32497 defines the preprocessor macro @code{__RTP__}.
32499 @opindex msmp
32500 @item -msmp
32501 Select SMP runtimes for linking.  Not available on architectures other
32502 than PowerPC, nor on VxWorks version 7 or later, in which the selection
32503 is part of the VxWorks build configuration and the library paths are the
32504 same for either choice.
32506 @opindex non-static
32507 @item -non-static
32508 Link an RTP executable against shared libraries rather than static
32509 libraries.  The options @option{-static} and @option{-shared} can
32510 also be used for RTPs (@pxref{Link Options}); @option{-static}
32511 is the default.
32513 @opindex Bstatic
32514 @opindex Bdynamic
32515 @item -Bstatic
32516 @itemx -Bdynamic
32517 These options are passed down to the linker.  They are defined for
32518 compatibility with Diab.
32520 @opindex Xbind-lazy
32521 @item -Xbind-lazy
32522 Enable lazy binding of function calls.  This option is equivalent to
32523 @option{-Wl,-z,now} and is defined for compatibility with Diab.
32525 @opindex Xbind-now
32526 @item -Xbind-now
32527 Disable lazy binding of function calls.  This option is the default and
32528 is defined for compatibility with Diab.
32529 @end table
32531 @node x86 Options
32532 @subsection x86 Options
32533 @cindex x86 Options
32535 These @samp{-m} options are defined for the x86 family of computers.
32537 @table @gcctabopt
32539 @opindex march
32540 @item -march=@var{cpu-type}
32541 Generate instructions for the machine type @var{cpu-type}.  In contrast to
32542 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code 
32543 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
32544 to generate code that may not run at all on processors other than the one
32545 indicated.  Specifying @option{-march=@var{cpu-type}} implies 
32546 @option{-mtune=@var{cpu-type}}, except where noted otherwise.
32548 The choices for @var{cpu-type} are:
32550 @table @samp
32551 @item native
32552 This selects the CPU to generate code for at compilation time by determining
32553 the processor type of the compiling machine.  Using @option{-march=native}
32554 enables all instruction subsets supported by the local machine (hence
32555 the result might not run on different machines).  Using @option{-mtune=native}
32556 produces code optimized for the local machine under the constraints
32557 of the selected instruction set.  
32559 @item x86-64
32560 A generic CPU with 64-bit extensions.
32562 @item x86-64-v2
32563 @itemx x86-64-v3
32564 @itemx x86-64-v4
32565 These choices for @var{cpu-type} select the corresponding
32566 micro-architecture level from the x86-64 psABI.  On ABIs other than
32567 the x86-64 psABI they select the same CPU features as the x86-64 psABI
32568 documents for the particular micro-architecture level.
32570 Since these @var{cpu-type} values do not have a corresponding
32571 @option{-mtune} setting, using @option{-march} with these values enables
32572 generic tuning.  Specific tuning can be enabled using the
32573 @option{-mtune=@var{other-cpu-type}} option with an appropriate
32574 @var{other-cpu-type} value.
32576 @item i386
32577 Original Intel i386 CPU@.
32579 @item i486
32580 Intel i486 CPU@.  (No scheduling is implemented for this chip.)
32582 @item i586
32583 @itemx pentium
32584 Intel Pentium CPU with no MMX support.
32586 @item lakemont
32587 Intel Lakemont MCU, based on Intel Pentium CPU.
32589 @item pentium-mmx
32590 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
32592 @item pentiumpro
32593 Intel Pentium Pro CPU@.
32595 @item i686
32596 When used with @option{-march}, the Pentium Pro
32597 instruction set is used, so the code runs on all i686 family chips.
32598 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
32600 @item pentium2
32601 Intel Pentium II CPU, based on Pentium Pro core with MMX and FXSR instruction
32602 set support.
32604 @item pentium3
32605 @itemx pentium3m
32606 Intel Pentium III CPU, based on Pentium Pro core with MMX, FXSR and SSE
32607 instruction set support.
32609 @item pentium-m
32610 Intel Pentium M; low-power version of Intel Pentium III CPU
32611 with MMX, SSE, SSE2 and FXSR instruction set support.  Used by Centrino
32612 notebooks.
32614 @item pentium4
32615 @itemx pentium4m
32616 Intel Pentium 4 CPU with MMX, SSE, SSE2 and FXSR instruction set support.
32618 @item prescott
32619 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2, SSE3 and FXSR
32620 instruction set support.
32622 @item nocona
32623 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
32624 SSE2, SSE3 and FXSR instruction set support.
32626 @item core2
32627 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, CX16,
32628 SAHF and FXSR instruction set support.
32630 @item nehalem
32631 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32632 SSE4.1, SSE4.2, POPCNT, CX16, SAHF and FXSR instruction set support.
32634 @item westmere
32635 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32636 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR and PCLMUL instruction set support.
32638 @item sandybridge
32639 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32640 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE and PCLMUL instruction set
32641 support.
32643 @item ivybridge
32644 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
32645 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND
32646 and F16C instruction set support.
32648 @item haswell
32649 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32650 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32651 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE and HLE instruction set support.
32653 @item broadwell
32654 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32655 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32656 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX and PREFETCHW
32657 instruction set support.
32659 @item skylake
32660 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32661 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32662 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32663 CLFLUSHOPT, XSAVEC, XSAVES and SGX instruction set support.
32665 @item bonnell
32666 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
32667 instruction set support.
32669 @item silvermont
32670 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32671 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW and RDRND
32672 instruction set support.
32674 @item goldmont
32675 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32676 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32677 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT and FSGSBASE instruction
32678 set support.
32680 @item goldmont-plus
32681 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32682 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES,
32683 SHA, RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE,
32684 RDPID and SGX instruction set support.
32686 @item tremont
32687 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32688 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, PCLMUL, PREFETCHW, RDRND, AES, SHA,
32689 RDSEED, XSAVE, XSAVEC, XSAVES, XSAVEOPT, CLFLUSHOPT, FSGSBASE, PTWRITE, RDPID,
32690 SGX, CLWB, GFNI-SSE, MOVDIRI, MOVDIR64B, CLDEMOTE and WAITPKG instruction set
32691 support.
32693 @item sierraforest
32694 Intel Sierra Forest CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32695 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32696 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32697 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32698 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32699 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD and UINTR instruction set
32700 support.
32702 @item grandridge
32703 Intel Grand Ridge CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32704 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32705 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32706 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32707 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32708 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, ENQCMD, UINTR and RAOINT
32709 instruction set support.
32711 @item arrowlake
32712 Intel Arrow Lake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32713 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32714 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32715 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32716 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32717 AVXIFMA, AVXVNNIINT8, AVXNECONVERT and CMPCCXADD instruction set support.
32719 @item arrowlake-s
32720 Intel Arrow Lake S CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32721 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC,
32722 XSAVES, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI,
32723 MOVDIR64B, CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT,
32724 PCONFIG, PKU, VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL, AVX-VNNI,
32725 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AVXVNNIINT16, SHA512, SM3
32726 and SM4 instruction set support.
32728 @item knl
32729 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32730 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32731 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32732 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1 instruction set support.
32734 @item knm
32735 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32736 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32737 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32738 AVX512PF, AVX512ER, AVX512F, AVX512CD and PREFETCHWT1, AVX5124VNNIW,
32739 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
32741 @item skylake-avx512
32742 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32743 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32744 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32745 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW,
32746 AVX512DQ and AVX512CD instruction set support.
32748 @item cannonlake
32749 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
32750 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL,
32751 FSGSBASE, RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX,
32752 PREFETCHW, AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW,
32753 AVX512DQ, AVX512CD, PKU, AVX512VBMI, AVX512IFMA and SHA instruction set
32754 support.
32756 @item icelake-client
32757 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32758 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32759 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32760 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32761 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32762 , VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32764 @item icelake-server
32765 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32766 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32767 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32768 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32769 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2
32770 , VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD and CLWB
32771 instruction set support.
32773 @item cascadelake
32774 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32775 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32776 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32777 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32778 AVX512CD and AVX512VNNI instruction set support.
32780 @item cooperlake
32781 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32782 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32783 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32784 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, CLWB, AVX512VL, AVX512BW, AVX512DQ,
32785 AVX512CD, AVX512VNNI and AVX512BF16 instruction set support.
32787 @item tigerlake
32788 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32789 SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32790 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32791 CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32792 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32793 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, MOVDIRI, MOVDIR64B, CLWB,
32794 AVX512VP2INTERSECT and KEYLOCKER instruction set support.
32796 @item sapphirerapids
32797 Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32798 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32799 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32800 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32801 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32802 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32803 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32804 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16 and AVX512BF16
32805 instruction set support.
32807 @item alderlake
32808 Intel Alderlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
32809 SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW, PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES,
32810 XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
32811 CLDEMOTE, WAITPKG, ADCX, AVX, AVX2, BMI, BMI2, F16C, FMA, LZCNT, PCONFIG, PKU,
32812 VAES, VPCLMULQDQ, SERIALIZE, HRESET, KL, WIDEKL and AVX-VNNI instruction set
32813 support.
32815 @item rocketlake
32816 Intel Rocketlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3
32817 , SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, RDRND,
32818 F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, AES,
32819 CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD
32820 PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32821 VPCLMULQDQ, AVX512BITALG, RDPID and AVX512VPOPCNTDQ instruction set support.
32823 @item graniterapids
32824 Intel graniterapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32825 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32826 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32827 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32828 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32829 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32830 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32831 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512-FP16, AVX512BF16, AMX-FP16
32832 and PREFETCHI instruction set support.
32834 @item graniterapids-d
32835 Intel graniterapids D CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
32836 SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE,
32837 RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW,
32838 AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ,
32839 AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2,
32840 VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB,
32841 MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, TSXLDTRK,
32842 UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI, AVX512FP16, AVX512BF16, AMX-FP16,
32843 PREFETCHI and AMX-COMPLEX instruction set support.
32845 @item k6
32846 AMD K6 CPU with MMX instruction set support.
32848 @item k6-2
32849 @itemx k6-3
32850 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
32852 @item athlon
32853 @itemx athlon-tbird
32854 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
32855 support.
32857 @item athlon-4
32858 @itemx athlon-xp
32859 @itemx athlon-mp
32860 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
32861 instruction set support.
32863 @item k8
32864 @itemx opteron
32865 @itemx athlon64
32866 @itemx athlon-fx
32867 Processors based on the AMD K8 core with x86-64 instruction set support,
32868 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
32869 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
32870 instruction set extensions.)
32872 @item k8-sse3
32873 @itemx opteron-sse3
32874 @itemx athlon64-sse3
32875 Improved versions of AMD K8 cores with SSE3 instruction set support.
32877 @item amdfam10
32878 @itemx barcelona
32879 CPUs based on AMD Family 10h cores with x86-64 instruction set support.  (This
32880 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
32881 instruction set extensions.)
32883 @item bdver1
32884 CPUs based on AMD Family 15h cores with x86-64 instruction set support.  (This
32885 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
32886 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
32888 @item bdver2
32889 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32890 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
32891 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set 
32892 extensions.)
32894 @item bdver3
32895 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32896 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES, 
32897 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
32898 64-bit instruction set extensions.)
32900 @item bdver4
32901 AMD Family 15h core based CPUs with x86-64 instruction set support.  (This
32902 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP, 
32903 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
32904 SSE4.2, ABM and 64-bit instruction set extensions.)
32906 @item znver1
32907 AMD Family 17h core based CPUs with x86-64 instruction set support.  (This
32908 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
32909 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
32910 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
32911 instruction set extensions.)
32913 @item znver2
32914 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
32915 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32916 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32917 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32918 WBNOINVD, and 64-bit instruction set extensions.)
32920 @item znver3
32921 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32922 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32923 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32924 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32925 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set extensions.)
32927 @item znver4
32928 AMD Family 19h core based CPUs with x86-64 instruction set support. (This
32929 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
32930 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
32931 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
32932 WBNOINVD, PKU, VPCLMULQDQ, VAES, AVX512F, AVX512DQ, AVX512IFMA, AVX512CD,
32933 AVX512BW, AVX512VL, AVX512BF16, AVX512VBMI, AVX512VBMI2, AVX512VNNI,
32934 AVX512BITALG, AVX512VPOPCNTDQ, GFNI and 64-bit instruction set extensions.)
32936 @item btver1
32937 CPUs based on AMD Family 14h cores with x86-64 instruction set support.  (This
32938 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
32939 instruction set extensions.)
32941 @item btver2
32942 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
32943 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
32944 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
32946 @item winchip-c6
32947 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
32948 set support.
32950 @item winchip2
32951 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
32952 instruction set support.
32954 @item c3
32955 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
32956 (No scheduling is implemented for this chip.)
32958 @item c3-2
32959 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
32960 (No scheduling is implemented for this chip.)
32962 @item c7
32963 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32964 (No scheduling is implemented for this chip.)
32966 @item samuel-2
32967 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
32968 (No scheduling is implemented for this chip.)
32970 @item nehemiah
32971 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
32972 (No scheduling is implemented for this chip.)
32974 @item esther
32975 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
32976 (No scheduling is implemented for this chip.)
32978 @item eden-x2
32979 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
32980 (No scheduling is implemented for this chip.)
32982 @item eden-x4
32983 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
32984 AVX and AVX2 instruction set support.
32985 (No scheduling is implemented for this chip.)
32987 @item nano
32988 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32989 instruction set support.
32990 (No scheduling is implemented for this chip.)
32992 @item nano-1000
32993 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32994 instruction set support.
32995 (No scheduling is implemented for this chip.)
32997 @item nano-2000
32998 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
32999 instruction set support.
33000 (No scheduling is implemented for this chip.)
33002 @item nano-3000
33003 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33004 instruction set support.
33005 (No scheduling is implemented for this chip.)
33007 @item nano-x2
33008 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33009 instruction set support.
33010 (No scheduling is implemented for this chip.)
33012 @item nano-x4
33013 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
33014 instruction set support.
33015 (No scheduling is implemented for this chip.)
33017 @item lujiazui
33018 ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
33019 SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16,
33020 ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support.
33022 @item geode
33023 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
33024 @end table
33026 @opindex mtune
33027 @item -mtune=@var{cpu-type}
33028 Tune to @var{cpu-type} everything applicable about the generated code, except
33029 for the ABI and the set of available instructions.  
33030 While picking a specific @var{cpu-type} schedules things appropriately
33031 for that particular chip, the compiler does not generate any code that
33032 cannot run on the default machine type unless you use a
33033 @option{-march=@var{cpu-type}} option.
33034 For example, if GCC is configured for i686-pc-linux-gnu
33035 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
33036 but still runs on i686 machines.
33038 The choices for @var{cpu-type} are the same as for @option{-march}.
33039 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
33041 @table @samp
33042 @item generic
33043 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
33044 If you know the CPU on which your code will run, then you should use
33045 the corresponding @option{-mtune} or @option{-march} option instead of
33046 @option{-mtune=generic}.  But, if you do not know exactly what CPU users
33047 of your application will have, then you should use this option.
33049 As new processors are deployed in the marketplace, the behavior of this
33050 option will change.  Therefore, if you upgrade to a newer version of
33051 GCC, code generation controlled by this option will change to reflect
33052 the processors
33053 that are most common at the time that version of GCC is released.
33055 There is no @option{-march=generic} option because @option{-march}
33056 indicates the instruction set the compiler can use, and there is no
33057 generic instruction set applicable to all processors.  In contrast,
33058 @option{-mtune} indicates the processor (or, in this case, collection of
33059 processors) for which the code is optimized.
33061 @item intel
33062 Produce code optimized for the most current Intel processors, which are
33063 Haswell and Silvermont for this version of GCC.  If you know the CPU
33064 on which your code will run, then you should use the corresponding
33065 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
33066 But, if you want your application performs better on both Haswell and
33067 Silvermont, then you should use this option.
33069 As new Intel processors are deployed in the marketplace, the behavior of
33070 this option will change.  Therefore, if you upgrade to a newer version of
33071 GCC, code generation controlled by this option will change to reflect
33072 the most current Intel processors at the time that version of GCC is
33073 released.
33075 There is no @option{-march=intel} option because @option{-march} indicates
33076 the instruction set the compiler can use, and there is no common
33077 instruction set applicable to all processors.  In contrast,
33078 @option{-mtune} indicates the processor (or, in this case, collection of
33079 processors) for which the code is optimized.
33080 @end table
33082 @opindex mcpu
33083 @item -mcpu=@var{cpu-type}
33084 A deprecated synonym for @option{-mtune}.
33086 @opindex mfpmath
33087 @item -mfpmath=@var{unit}
33088 Generate floating-point arithmetic for selected unit @var{unit}.  The choices
33089 for @var{unit} are:
33091 @table @samp
33092 @item 387
33093 Use the standard 387 floating-point coprocessor present on the majority of chips and
33094 emulated otherwise.  Code compiled with this option runs almost everywhere.
33095 The temporary results are computed in 80-bit precision instead of the precision
33096 specified by the type, resulting in slightly different results compared to most
33097 of other chips.  See @option{-ffloat-store} for more detailed description.
33099 This is the default choice for non-Darwin x86-32 targets.
33101 @item sse
33102 Use scalar floating-point instructions present in the SSE instruction set.
33103 This instruction set is supported by Pentium III and newer chips,
33104 and in the AMD line
33105 by Athlon-4, Athlon XP and Athlon MP chips.  The earlier version of the SSE
33106 instruction set supports only single-precision arithmetic, thus the double and
33107 extended-precision arithmetic are still done using 387.  A later version, present
33108 only in Pentium 4 and AMD x86-64 chips, supports double-precision
33109 arithmetic too.
33111 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
33112 or @option{-msse2} switches to enable SSE extensions and make this option
33113 effective.  For the x86-64 compiler, these extensions are enabled by default.
33115 The resulting code should be considerably faster in the majority of cases and avoid
33116 the numerical instability problems of 387 code, but may break some existing
33117 code that expects temporaries to be 80 bits.
33119 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
33120 and the default choice for x86-32 targets with the SSE2 instruction set
33121 when @option{-ffast-math} is enabled.
33123 @item sse,387
33124 @itemx sse+387
33125 @itemx both
33126 Attempt to utilize both instruction sets at once.  This effectively doubles the
33127 amount of available registers, and on chips with separate execution units for
33128 387 and SSE the execution resources too.  Use this option with care, as it is
33129 still experimental, because the GCC register allocator does not model separate
33130 functional units well, resulting in unstable performance.
33131 @end table
33133 @opindex masm=@var{dialect}
33134 @item -masm=@var{dialect}
33135 Output assembly instructions using selected @var{dialect}.  Also affects
33136 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
33137 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
33138 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
33139 not support @samp{intel}.
33141 @opindex mieee-fp
33142 @opindex mno-ieee-fp
33143 @item -mieee-fp
33144 @itemx -mno-ieee-fp
33145 Control whether or not the compiler uses IEEE floating-point
33146 comparisons.  These correctly handle the case where the result of a
33147 comparison is unordered.
33149 @opindex m80387
33150 @opindex mhard-float
33151 @item -m80387
33152 @itemx -mhard-float
33153 Generate output containing 80387 instructions for floating point.
33155 @opindex no-80387
33156 @opindex msoft-float
33157 @item -mno-80387
33158 @itemx -msoft-float
33159 Generate output containing library calls for floating point.
33161 @strong{Warning:} the requisite libraries are not part of GCC@.
33162 Normally the facilities of the machine's usual C compiler are used, but
33163 this cannot be done directly in cross-compilation.  You must make your
33164 own arrangements to provide suitable library functions for
33165 cross-compilation.
33167 On machines where a function returns floating-point results in the 80387
33168 register stack, some floating-point opcodes may be emitted even if
33169 @option{-msoft-float} is used.
33171 @opindex mno-fp-ret-in-387
33172 @opindex mfp-ret-in-387
33173 @item -mno-fp-ret-in-387
33174 Do not use the FPU registers for return values of functions.
33176 The usual calling convention has functions return values of types
33177 @code{float} and @code{double} in an FPU register, even if there
33178 is no FPU@.  The idea is that the operating system should emulate
33179 an FPU@.
33181 The option @option{-mno-fp-ret-in-387} causes such values to be returned
33182 in ordinary CPU registers instead.
33184 @opindex mno-fancy-math-387
33185 @opindex mfancy-math-387
33186 @item -mno-fancy-math-387
33187 Some 387 emulators do not support the @code{sin}, @code{cos} and
33188 @code{sqrt} instructions for the 387.  Specify this option to avoid
33189 generating those instructions.
33190 This option is overridden when @option{-march}
33191 indicates that the target CPU always has an FPU and so the
33192 instruction does not need emulation.  These
33193 instructions are not generated unless you also use the
33194 @option{-funsafe-math-optimizations} switch.
33196 @opindex malign-double
33197 @opindex mno-align-double
33198 @item -malign-double
33199 @itemx -mno-align-double
33200 Control whether GCC aligns @code{double}, @code{long double}, and
33201 @code{long long} variables on a two-word boundary or a one-word
33202 boundary.  Aligning @code{double} variables on a two-word boundary
33203 produces code that runs somewhat faster on a Pentium at the
33204 expense of more memory.
33206 On x86-64, @option{-malign-double} is enabled by default.
33208 @strong{Warning:} if you use the @option{-malign-double} switch,
33209 structures containing the above types are aligned differently than
33210 the published application binary interface specifications for the x86-32
33211 and are not binary compatible with structures in code compiled
33212 without that switch.
33214 @opindex m96bit-long-double
33215 @opindex m128bit-long-double
33216 @item -m96bit-long-double
33217 @itemx -m128bit-long-double
33218 These switches control the size of @code{long double} type.  The x86-32
33219 application binary interface specifies the size to be 96 bits,
33220 so @option{-m96bit-long-double} is the default in 32-bit mode.
33222 Modern architectures (Pentium and newer) prefer @code{long double}
33223 to be aligned to an 8- or 16-byte boundary.  In arrays or structures
33224 conforming to the ABI, this is not possible.  So specifying
33225 @option{-m128bit-long-double} aligns @code{long double}
33226 to a 16-byte boundary by padding the @code{long double} with an additional
33227 32-bit zero.
33229 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
33230 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
33232 Notice that neither of these options enable any extra precision over the x87
33233 standard of 80 bits for a @code{long double}.
33235 @strong{Warning:} if you override the default value for your target ABI, this
33236 changes the size of 
33237 structures and arrays containing @code{long double} variables,
33238 as well as modifying the function calling convention for functions taking
33239 @code{long double}.  Hence they are not binary-compatible
33240 with code compiled without that switch.
33242 @opindex mlong-double-64
33243 @opindex mlong-double-80
33244 @opindex mlong-double-128
33245 @item -mlong-double-64
33246 @itemx -mlong-double-80
33247 @itemx -mlong-double-128
33248 These switches control the size of @code{long double} type. A size
33249 of 64 bits makes the @code{long double} type equivalent to the @code{double}
33250 type. This is the default for 32-bit Bionic C library.  A size
33251 of 128 bits makes the @code{long double} type equivalent to the
33252 @code{__float128} type. This is the default for 64-bit Bionic C library.
33254 @strong{Warning:} if you override the default value for your target ABI, this
33255 changes the size of
33256 structures and arrays containing @code{long double} variables,
33257 as well as modifying the function calling convention for functions taking
33258 @code{long double}.  Hence they are not binary-compatible
33259 with code compiled without that switch.
33261 @opindex malign-data
33262 @item -malign-data=@var{type}
33263 Control how GCC aligns variables.  Supported values for @var{type} are
33264 @samp{compat} uses increased alignment value compatible uses GCC 4.8
33265 and earlier, @samp{abi} uses alignment value as specified by the
33266 psABI, and @samp{cacheline} uses increased alignment value to match
33267 the cache line size.  @samp{compat} is the default.
33269 @opindex mlarge-data-threshold
33270 @item -mlarge-data-threshold=@var{threshold}
33271 When @option{-mcmodel=medium} is specified, data objects larger than
33272 @var{threshold} are placed in the large data section.  This value must be the
33273 same across all objects linked into the binary, and defaults to 65535.
33275 @opindex mrtd
33276 @item -mrtd
33277 Use a different function-calling convention, in which functions that
33278 take a fixed number of arguments return with the @code{ret @var{num}}
33279 instruction, which pops their arguments while returning.  This saves one
33280 instruction in the caller since there is no need to pop the arguments
33281 there.
33283 You can specify that an individual function is called with this calling
33284 sequence with the function attribute @code{stdcall}.  You can also
33285 override the @option{-mrtd} option by using the function attribute
33286 @code{cdecl}.  @xref{Function Attributes}.
33288 @strong{Warning:} this calling convention is incompatible with the one
33289 normally used on Unix, so you cannot use it if you need to call
33290 libraries compiled with the Unix compiler.
33292 Also, you must provide function prototypes for all functions that
33293 take variable numbers of arguments (including @code{printf});
33294 otherwise incorrect code is generated for calls to those
33295 functions.
33297 In addition, seriously incorrect code results if you call a
33298 function with too many arguments.  (Normally, extra arguments are
33299 harmlessly ignored.)
33301 @opindex mregparm
33302 @item -mregparm=@var{num}
33303 Control how many registers are used to pass integer arguments.  By
33304 default, no registers are used to pass arguments, and at most 3
33305 registers can be used.  You can control this behavior for a specific
33306 function by using the function attribute @code{regparm}.
33307 @xref{Function Attributes}.
33309 @strong{Warning:} if you use this switch, and
33310 @var{num} is nonzero, then you must build all modules with the same
33311 value, including any libraries.  This includes the system libraries and
33312 startup modules.
33314 @opindex msseregparm
33315 @item -msseregparm
33316 Use SSE register passing conventions for float and double arguments
33317 and return values.  You can control this behavior for a specific
33318 function by using the function attribute @code{sseregparm}.
33319 @xref{Function Attributes}.
33321 @strong{Warning:} if you use this switch then you must build all
33322 modules with the same value, including any libraries.  This includes
33323 the system libraries and startup modules.
33325 @opindex mvect8-ret-in-mem
33326 @item -mvect8-ret-in-mem
33327 Return 8-byte vectors in memory instead of MMX registers.  This is the
33328 default on VxWorks to match the ABI of the Sun Studio compilers until
33329 version 12.  @emph{Only} use this option if you need to remain
33330 compatible with existing code produced by those previous compiler
33331 versions or older versions of GCC@.
33333 @opindex mpc32
33334 @opindex mpc64
33335 @opindex mpc80
33336 @item -mpc32
33337 @itemx -mpc64
33338 @itemx -mpc80
33340 Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
33341 is specified, the significands of results of floating-point operations are
33342 rounded to 24 bits (single precision); @option{-mpc64} rounds the
33343 significands of results of floating-point operations to 53 bits (double
33344 precision) and @option{-mpc80} rounds the significands of results of
33345 floating-point operations to 64 bits (extended double precision), which is
33346 the default.  When this option is used, floating-point operations in higher
33347 precisions are not available to the programmer without setting the FPU
33348 control word explicitly.
33350 Setting the rounding of floating-point operations to less than the default
33351 80 bits can speed some programs by 2% or more.  Note that some mathematical
33352 libraries assume that extended-precision (80-bit) floating-point operations
33353 are enabled by default; routines in such libraries could suffer significant
33354 loss of accuracy, typically through so-called ``catastrophic cancellation'',
33355 when this option is used to set the precision to less than extended precision.
33357 @opindex mdaz-ftz
33358 @item -mdaz-ftz
33360 The flush-to-zero (FTZ) and denormals-are-zero (DAZ) flags in the MXCSR register
33361 are used to control floating-point calculations.SSE and AVX instructions
33362 including scalar and vector instructions could benefit from enabling the FTZ
33363 and DAZ flags when @option{-mdaz-ftz} is specified. Don't set FTZ/DAZ flags
33364 when @option{-mno-daz-ftz} or @option{-shared} is specified, @option{-mdaz-ftz}
33365 will set FTZ/DAZ flags even with @option{-shared}.
33367 @opindex mstackrealign
33368 @item -mstackrealign
33369 Realign the stack at entry.  On the x86, the @option{-mstackrealign}
33370 option generates an alternate prologue and epilogue that realigns the
33371 run-time stack if necessary.  This supports mixing legacy codes that keep
33372 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
33373 SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
33374 applicable to individual functions.
33376 @opindex mpreferred-stack-boundary
33377 @item -mpreferred-stack-boundary=@var{num}
33378 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
33379 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
33380 the default is 4 (16 bytes or 128 bits).
33382 @strong{Warning:} When generating code for the x86-64 architecture with
33383 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
33384 used to keep the stack boundary aligned to 8 byte boundary.  Since
33385 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
33386 intended to be used in controlled environment where stack space is
33387 important limitation.  This option leads to wrong code when functions
33388 compiled with 16 byte stack alignment (such as functions from a standard
33389 library) are called with misaligned stack.  In this case, SSE
33390 instructions may lead to misaligned memory access traps.  In addition,
33391 variable arguments are handled incorrectly for 16 byte aligned
33392 objects (including x87 long double and __int128), leading to wrong
33393 results.  You must build all modules with
33394 @option{-mpreferred-stack-boundary=3}, including any libraries.  This
33395 includes the system libraries and startup modules.
33397 @opindex mincoming-stack-boundary
33398 @item -mincoming-stack-boundary=@var{num}
33399 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
33400 boundary.  If @option{-mincoming-stack-boundary} is not specified,
33401 the one specified by @option{-mpreferred-stack-boundary} is used.
33403 On Pentium and Pentium Pro, @code{double} and @code{long double} values
33404 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
33405 suffer significant run time performance penalties.  On Pentium III, the
33406 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
33407 properly if it is not 16-byte aligned.
33409 To ensure proper alignment of this values on the stack, the stack boundary
33410 must be as aligned as that required by any value stored on the stack.
33411 Further, every function must be generated such that it keeps the stack
33412 aligned.  Thus calling a function compiled with a higher preferred
33413 stack boundary from a function compiled with a lower preferred stack
33414 boundary most likely misaligns the stack.  It is recommended that
33415 libraries that use callbacks always use the default setting.
33417 This extra alignment does consume extra stack space, and generally
33418 increases code size.  Code that is sensitive to stack space usage, such
33419 as embedded systems and operating system kernels, may want to reduce the
33420 preferred alignment to @option{-mpreferred-stack-boundary=2}.
33422 @need 200
33423 @opindex mmmx
33424 @item -mmmx
33425 @need 200
33426 @opindex msse
33427 @itemx -msse
33428 @need 200
33429 @opindex msse2
33430 @itemx -msse2
33431 @need 200
33432 @opindex msse3
33433 @itemx -msse3
33434 @need 200
33435 @opindex mssse3
33436 @itemx -mssse3
33437 @need 200
33438 @opindex msse4
33439 @itemx -msse4
33440 @need 200
33441 @opindex msse4a
33442 @itemx -msse4a
33443 @need 200
33444 @opindex msse4.1
33445 @itemx -msse4.1
33446 @need 200
33447 @opindex msse4.2
33448 @itemx -msse4.2
33449 @need 200
33450 @opindex mavx
33451 @itemx -mavx
33452 @need 200
33453 @opindex mavx2
33454 @itemx -mavx2
33455 @need 200
33456 @opindex mavx512f
33457 @itemx -mavx512f
33458 @need 200
33459 @opindex mavx512pf
33460 @itemx -mavx512pf
33461 @need 200
33462 @opindex mavx512er
33463 @itemx -mavx512er
33464 @need 200
33465 @opindex mavx512cd
33466 @itemx -mavx512cd
33467 @need 200
33468 @opindex mavx512vl
33469 @itemx -mavx512vl
33470 @need 200
33471 @opindex mavx512bw
33472 @itemx -mavx512bw
33473 @need 200
33474 @opindex mavx512dq
33475 @itemx -mavx512dq
33476 @need 200
33477 @opindex mavx512ifma
33478 @itemx -mavx512ifma
33479 @need 200
33480 @opindex mavx512vbmi
33481 @itemx -mavx512vbmi
33482 @need 200
33483 @opindex msha
33484 @itemx -msha
33485 @need 200
33486 @opindex maes
33487 @itemx -maes
33488 @need 200
33489 @opindex mpclmul
33490 @itemx -mpclmul
33491 @need 200
33492 @opindex mclflushopt
33493 @itemx -mclflushopt
33494 @need 200
33495 @opindex mclwb
33496 @itemx -mclwb
33497 @need 200
33498 @opindex mfsgsbase
33499 @itemx -mfsgsbase
33500 @need 200
33501 @opindex mptwrite
33502 @itemx -mptwrite
33503 @need 200
33504 @opindex mrdrnd
33505 @itemx -mrdrnd
33506 @need 200
33507 @opindex mf16c
33508 @itemx -mf16c
33509 @need 200
33510 @opindex mfma
33511 @itemx -mfma
33512 @need 200
33513 @opindex mpconfig
33514 @itemx -mpconfig
33515 @need 200
33516 @opindex mwbnoinvd
33517 @itemx -mwbnoinvd
33518 @need 200
33519 @opindex mfma4
33520 @itemx -mfma4
33521 @need 200
33522 @opindex mprfchw
33523 @itemx -mprfchw
33524 @need 200
33525 @opindex mrdpid
33526 @itemx -mrdpid
33527 @need 200
33528 @opindex mprefetchwt1
33529 @itemx -mprefetchwt1
33530 @need 200
33531 @opindex mrdseed
33532 @itemx -mrdseed
33533 @need 200
33534 @opindex msgx
33535 @itemx -msgx
33536 @need 200
33537 @opindex mxop
33538 @itemx -mxop
33539 @need 200
33540 @opindex mlwp
33541 @itemx -mlwp
33542 @need 200
33543 @opindex m3dnow
33544 @itemx -m3dnow
33545 @need 200
33546 @opindex m3dnowa
33547 @itemx -m3dnowa
33548 @need 200
33549 @opindex mpopcnt
33550 @itemx -mpopcnt
33551 @need 200
33552 @opindex mabm
33553 @itemx -mabm
33554 @need 200
33555 @opindex madx
33556 @itemx -madx
33557 @need 200
33558 @opindex mbmi
33559 @itemx -mbmi
33560 @need 200
33561 @opindex mbmi2
33562 @itemx -mbmi2
33563 @need 200
33564 @opindex mlzcnt
33565 @itemx -mlzcnt
33566 @need 200
33567 @opindex mfxsr
33568 @itemx -mfxsr
33569 @need 200
33570 @opindex mxsave
33571 @itemx -mxsave
33572 @need 200
33573 @opindex mxsaveopt
33574 @itemx -mxsaveopt
33575 @need 200
33576 @opindex mxsavec
33577 @itemx -mxsavec
33578 @need 200
33579 @opindex mxsaves
33580 @itemx -mxsaves
33581 @need 200
33582 @opindex mrtm
33583 @itemx -mrtm
33584 @need 200
33585 @opindex mhle
33586 @itemx -mhle
33587 @need 200
33588 @opindex mtbm
33589 @itemx -mtbm
33590 @need 200
33591 @opindex mmwaitx
33592 @itemx -mmwaitx
33593 @need 200
33594 @opindex mclzero
33595 @itemx -mclzero
33596 @need 200
33597 @opindex mpku
33598 @itemx -mpku
33599 @need 200
33600 @opindex mavx512vbmi2
33601 @itemx -mavx512vbmi2
33602 @need 200
33603 @opindex mavx512bf16
33604 @itemx -mavx512bf16
33605 @need 200
33606 @opindex mavx512fp16
33607 @itemx -mavx512fp16
33608 @need 200
33609 @opindex mgfni
33610 @itemx -mgfni
33611 @need 200
33612 @opindex mvaes
33613 @itemx -mvaes
33614 @need 200
33615 @opindex mwaitpkg
33616 @itemx -mwaitpkg
33617 @need 200
33618 @opindex mvpclmulqdq
33619 @itemx -mvpclmulqdq
33620 @need 200
33621 @opindex mavx512bitalg
33622 @itemx -mavx512bitalg
33623 @need 200
33624 @opindex mmovdiri
33625 @itemx -mmovdiri
33626 @need 200
33627 @opindex mmovdir64b
33628 @itemx -mmovdir64b
33629 @need 200
33630 @opindex menqcmd
33631 @opindex muintr
33632 @itemx -menqcmd
33633 @itemx -muintr
33634 @need 200
33635 @opindex mtsxldtrk
33636 @itemx -mtsxldtrk
33637 @need 200
33638 @opindex mavx512vpopcntdq
33639 @itemx -mavx512vpopcntdq
33640 @need 200
33641 @opindex mavx512vp2intersect
33642 @itemx -mavx512vp2intersect
33643 @need 200
33644 @opindex mavx5124fmaps
33645 @itemx -mavx5124fmaps
33646 @need 200
33647 @opindex mavx512vnni
33648 @itemx -mavx512vnni
33649 @need 200
33650 @opindex mavxvnni
33651 @itemx -mavxvnni
33652 @need 200
33653 @opindex mavx5124vnniw
33654 @itemx -mavx5124vnniw
33655 @need 200
33656 @opindex mcldemote
33657 @itemx -mcldemote
33658 @need 200
33659 @opindex mserialize
33660 @itemx -mserialize
33661 @need 200
33662 @opindex mamx-tile
33663 @itemx -mamx-tile
33664 @need 200
33665 @opindex mamx-int8
33666 @itemx -mamx-int8
33667 @need 200
33668 @opindex mamx-bf16
33669 @itemx -mamx-bf16
33670 @need 200
33671 @opindex mhreset
33672 @opindex mkl
33673 @itemx -mhreset
33674 @itemx -mkl
33675 @need 200
33676 @opindex mwidekl
33677 @itemx -mwidekl
33678 @need 200
33679 @opindex mavxifma
33680 @itemx -mavxifma
33681 @need 200
33682 @opindex mavxvnniint8
33683 @itemx -mavxvnniint8
33684 @need 200
33685 @opindex mavxneconvert
33686 @itemx -mavxneconvert
33687 @need 200
33688 @opindex mcmpccxadd
33689 @itemx -mcmpccxadd
33690 @need 200
33691 @opindex mamx-fp16
33692 @itemx -mamx-fp16
33693 @need 200
33694 @opindex mprefetchi
33695 @itemx -mprefetchi
33696 @need 200
33697 @opindex mraoint
33698 @itemx -mraoint
33699 @need 200
33700 @opindex mamx-complex
33701 @itemx -mamx-complex
33702 @need 200
33703 @opindex mavxvnniint16
33704 @itemx -mavxvnniint16
33705 @need 200
33706 @opindex msm3
33707 @itemx -msm3
33708 @need 200
33709 @opindex msha512
33710 @itemx -msha512
33711 @need 200
33712 @opindex msm4
33713 @itemx -msm4
33714 These switches enable the use of instructions in the MMX, SSE,
33715 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
33716 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
33717 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
33718 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
33719 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
33720 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
33721 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, SERIALIZE,
33722 UINTR, HRESET, AMXTILE, AMXINT8, AMXBF16, KL, WIDEKL, AVXVNNI, AVX512-FP16,
33723 AVXIFMA, AVXVNNIINT8, AVXNECONVERT, CMPCCXADD, AMX-FP16, PREFETCHI, RAOINT,
33724 AMX-COMPLEX, AVXVNNIINT16, SM3, SHA512, SM4 or CLDEMOTE extended instruction
33725 sets. Each has a corresponding @option{-mno-} option to disable use of these
33726 instructions.
33728 These extensions are also available as built-in functions: see
33729 @ref{x86 Built-in Functions}, for details of the functions enabled and
33730 disabled by these switches.
33732 To generate SSE/SSE2 instructions automatically from floating-point
33733 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
33735 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
33736 generates new AVX instructions or AVX equivalence for all SSEx instructions
33737 when needed.
33739 These options enable GCC to use these extended instructions in
33740 generated code, even without @option{-mfpmath=sse}.  Applications that
33741 perform run-time CPU detection must compile separate files for each
33742 supported architecture, using the appropriate flags.  In particular,
33743 the file containing the CPU detection code should be compiled without
33744 these options.
33746 @opindex mdump-tune-features
33747 @item -mdump-tune-features
33748 This option instructs GCC to dump the names of the x86 performance 
33749 tuning features and default settings. The names can be used in 
33750 @option{-mtune-ctrl=@var{feature-list}}.
33752 @opindex mtune-ctrl=@var{feature-list}
33753 @item -mtune-ctrl=@var{feature-list}
33754 This option is used to do fine grain control of x86 code generation features.
33755 @var{feature-list} is a comma separated list of @var{feature} names. See also
33756 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
33757 on if it is not preceded with @samp{^}, otherwise, it is turned off. 
33758 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
33759 developers. Using it may lead to code paths not covered by testing and can
33760 potentially result in compiler ICEs or runtime errors.
33762 @opindex mno-default
33763 @item -mno-default
33764 This option instructs GCC to turn off all tunable features. See also 
33765 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
33767 @opindex mcld
33768 @item -mcld
33769 This option instructs GCC to emit a @code{cld} instruction in the prologue
33770 of functions that use string instructions.  String instructions depend on
33771 the DF flag to select between autoincrement or autodecrement mode.  While the
33772 ABI specifies the DF flag to be cleared on function entry, some operating
33773 systems violate this specification by not clearing the DF flag in their
33774 exception dispatchers.  The exception handler can be invoked with the DF flag
33775 set, which leads to wrong direction mode when string instructions are used.
33776 This option can be enabled by default on 32-bit x86 targets by configuring
33777 GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
33778 instructions can be suppressed with the @option{-mno-cld} compiler option
33779 in this case.
33781 @opindex mvzeroupper
33782 @item -mvzeroupper
33783 This option instructs GCC to emit a @code{vzeroupper} instruction
33784 before a transfer of control flow out of the function to minimize
33785 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
33786 intrinsics.
33788 @opindex mprefer-avx128
33789 @item -mprefer-avx128
33790 This option instructs GCC to use 128-bit AVX instructions instead of
33791 256-bit AVX instructions in the auto-vectorizer.
33793 @opindex mprefer-vector-width
33794 @item -mprefer-vector-width=@var{opt}
33795 This option instructs GCC to use @var{opt}-bit vector width in instructions
33796 instead of default on the selected platform.
33798 @opindex mpartial-vector-fp-math
33799 @item -mpartial-vector-fp-math
33800 This option enables GCC to generate floating-point operations that might
33801 affect the set of floating-point status flags on partial vectors, where
33802 vector elements reside in the low part of the 128-bit SSE register.  Unless
33803 @option{-fno-trapping-math} is specified, the compiler guarantees correct
33804 behavior by sanitizing all input operands to have zeroes in the unused
33805 upper part of the vector register.  Note that by using built-in functions
33806 or inline assembly with partial vector arguments, NaNs, denormal or invalid
33807 values can leak into the upper part of the vector, causing possible
33808 performance issues when @option{-fno-trapping-math} is in effect.  These
33809 issues can be mitigated by manually sanitizing the upper part of the partial
33810 vector argument register or by using @option{-mdaz-ftz} to set
33811 denormals-are-zero (DAZ) flag in the MXCSR register.
33813 This option is enabled by default.
33815 @opindex mmove-max
33816 @item -mmove-max=@var{bits}
33817 This option instructs GCC to set the maximum number of bits can be
33818 moved from memory to memory efficiently to @var{bits}.  The valid
33819 @var{bits} are 128, 256 and 512.
33821 @opindex mstore-max
33822 @item -mstore-max=@var{bits}
33823 This option instructs GCC to set the maximum number of bits can be
33824 stored to memory efficiently to @var{bits}.  The valid @var{bits} are
33825 128, 256 and 512.
33827 @table @samp
33828 @item none
33829 No extra limitations applied to GCC other than defined by the selected platform.
33831 @item 128
33832 Prefer 128-bit vector width for instructions.
33834 @item 256
33835 Prefer 256-bit vector width for instructions.
33837 @item 512
33838 Prefer 512-bit vector width for instructions.
33839 @end table
33841 @opindex mcx16
33842 @item -mcx16
33843 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
33844 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
33845 objects.  This is useful for atomic updates of data structures exceeding one
33846 machine word in size.  The compiler uses this instruction to implement
33847 @ref{__sync Builtins}.  However, for @ref{__atomic Builtins} operating on
33848 128-bit integers, a library call is always used.
33850 @opindex msahf
33851 @item -msahf
33852 This option enables generation of @code{SAHF} instructions in 64-bit code.
33853 Early Intel Pentium 4 CPUs with Intel 64 support,
33854 prior to the introduction of Pentium 4 G1 step in December 2005,
33855 lacked the @code{LAHF} and @code{SAHF} instructions
33856 which are supported by AMD64.
33857 These are load and store instructions, respectively, for certain status flags.
33858 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
33859 @code{drem}, and @code{remainder} built-in functions;
33860 see @ref{Other Builtins} for details.
33862 @opindex mmovbe
33863 @item -mmovbe
33864 This option enables use of the @code{movbe} instruction to implement
33865 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
33867 @opindex mshstk
33868 @item -mshstk
33869 The @option{-mshstk} option enables shadow stack built-in functions
33870 from x86 Control-flow Enforcement Technology (CET).
33872 @opindex mcrc32
33873 @item -mcrc32
33874 This option enables built-in functions @code{__builtin_ia32_crc32qi},
33875 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
33876 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
33878 @opindex mmwait
33879 @item -mmwait
33880 This option enables built-in functions @code{__builtin_ia32_monitor},
33881 and @code{__builtin_ia32_mwait} to generate the @code{monitor} and
33882 @code{mwait} machine instructions.
33884 @opindex mrecip
33885 @item -mrecip
33886 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
33887 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
33888 with an additional Newton-Raphson step
33889 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
33890 (and their vectorized
33891 variants) for single-precision floating-point arguments.  These instructions
33892 are generated only when @option{-funsafe-math-optimizations} is enabled
33893 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
33894 Note that while the throughput of the sequence is higher than the throughput
33895 of the non-reciprocal instruction, the precision of the sequence can be
33896 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
33898 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
33899 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
33900 combination), and doesn't need @option{-mrecip}.
33902 Also note that GCC emits the above sequence with additional Newton-Raphson step
33903 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
33904 already with @option{-ffast-math} (or the above option combination), and
33905 doesn't need @option{-mrecip}.
33907 @opindex mrecip=opt
33908 @item -mrecip=@var{opt}
33909 This option controls which reciprocal estimate instructions
33910 may be used.  @var{opt} is a comma-separated list of options, which may
33911 be preceded by a @samp{!} to invert the option:
33913 @table @samp
33914 @item all
33915 Enable all estimate instructions.
33917 @item default
33918 Enable the default instructions, equivalent to @option{-mrecip}.
33920 @item none
33921 Disable all estimate instructions, equivalent to @option{-mno-recip}.
33923 @item div
33924 Enable the approximation for scalar division.
33926 @item vec-div
33927 Enable the approximation for vectorized division.
33929 @item sqrt
33930 Enable the approximation for scalar square root.
33932 @item vec-sqrt
33933 Enable the approximation for vectorized square root.
33934 @end table
33936 So, for example, @option{-mrecip=all,!sqrt} enables
33937 all of the reciprocal approximations, except for square root.
33939 @opindex mveclibabi
33940 @item -mveclibabi=@var{type}
33941 Specifies the ABI type to use for vectorizing intrinsics using an
33942 external library.  Supported values for @var{type} are @samp{svml} 
33943 for the Intel short
33944 vector math library and @samp{acml} for the AMD math core library.
33945 To use this option, both @option{-ftree-vectorize} and
33946 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML 
33947 ABI-compatible library must be specified at link time.
33949 GCC currently emits calls to @code{vmldExp2},
33950 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
33951 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
33952 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
33953 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
33954 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
33955 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
33956 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
33957 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
33958 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
33959 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
33960 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
33961 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
33962 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
33963 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
33964 when @option{-mveclibabi=acml} is used.  
33966 @opindex mabi
33967 @item -mabi=@var{name}
33968 Generate code for the specified calling convention.  Permissible values
33969 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
33970 @samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
33971 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
33972 You can control this behavior for specific functions by
33973 using the function attributes @code{ms_abi} and @code{sysv_abi}.
33974 @xref{Function Attributes}.
33976 @opindex mforce-indirect-call
33977 @item -mforce-indirect-call
33978 Force all calls to functions to be indirect. This is useful
33979 when using Intel Processor Trace where it generates more precise timing
33980 information for function calls.
33982 @opindex mmanual-endbr
33983 @item -mmanual-endbr
33984 Insert ENDBR instruction at function entry only via the @code{cf_check}
33985 function attribute. This is useful when used with the option
33986 @option{-fcf-protection=branch} to control ENDBR insertion at the
33987 function entry.
33989 @opindex mcet-switch
33990 @item -mcet-switch
33991 By default, CET instrumentation is turned off on switch statements that
33992 use a jump table and indirect branch track is disabled.  Since jump
33993 tables are stored in read-only memory, this does not result in a direct
33994 loss of hardening.  But if the jump table index is attacker-controlled,
33995 the indirect jump may not be constrained by CET.  This option turns on
33996 CET instrumentation to enable indirect branch track for switch statements
33997 with jump tables which leads to the jump targets reachable via any indirect
33998 jumps.
34000 @opindex mcall-ms2sysv-xlogues
34001 @opindex mno-call-ms2sysv-xlogues
34002 @item -mcall-ms2sysv-xlogues
34003 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
34004 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered.  By
34005 default, the code for saving and restoring these registers is emitted inline,
34006 resulting in fairly lengthy prologues and epilogues.  Using
34007 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
34008 use stubs in the static portion of libgcc to perform these saves and restores,
34009 thus reducing function size at the cost of a few extra instructions.
34011 @opindex mtls-dialect
34012 @item -mtls-dialect=@var{type}
34013 Generate code to access thread-local storage using the @samp{gnu} or
34014 @samp{gnu2} conventions.  @samp{gnu} is the conservative default;
34015 @samp{gnu2} is more efficient, but it may add compile- and run-time
34016 requirements that cannot be satisfied on all systems.
34018 @opindex mpush-args
34019 @opindex mno-push-args
34020 @item -mpush-args
34021 @itemx -mno-push-args
34022 Use PUSH operations to store outgoing parameters.  This method is shorter
34023 and usually equally fast as method using SUB/MOV operations and is enabled
34024 by default.  In some cases disabling it may improve performance because of
34025 improved scheduling and reduced dependencies.
34027 @opindex maccumulate-outgoing-args
34028 @item -maccumulate-outgoing-args
34029 If enabled, the maximum amount of space required for outgoing arguments is
34030 computed in the function prologue.  This is faster on most modern CPUs
34031 because of reduced dependencies, improved scheduling and reduced stack usage
34032 when the preferred stack boundary is not equal to 2.  The drawback is a notable
34033 increase in code size.  This switch implies @option{-mno-push-args}.
34035 @opindex mthreads
34036 @item -mthreads
34037 Support thread-safe exception handling on MinGW.  Programs that rely
34038 on thread-safe exception handling must compile and link all code with the
34039 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
34040 @option{-D_MT}; when linking, it links in a special thread helper library
34041 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
34043 @opindex mms-bitfields
34044 @opindex mno-ms-bitfields
34045 @item -mms-bitfields
34046 @itemx -mno-ms-bitfields
34048 Enable/disable bit-field layout compatible with the native Microsoft
34049 Windows compiler.  
34051 If @code{packed} is used on a structure, or if bit-fields are used,
34052 it may be that the Microsoft ABI lays out the structure differently
34053 than the way GCC normally does.  Particularly when moving packed
34054 data between functions compiled with GCC and the native Microsoft compiler
34055 (either via function call or as data in a file), it may be necessary to access
34056 either format.
34058 This option is enabled by default for Microsoft Windows
34059 targets.  This behavior can also be controlled locally by use of variable
34060 or type attributes.  For more information, see @ref{x86 Variable Attributes}
34061 and @ref{x86 Type Attributes}.
34063 The Microsoft structure layout algorithm is fairly simple with the exception
34064 of the bit-field packing.  
34065 The padding and alignment of members of structures and whether a bit-field 
34066 can straddle a storage-unit boundary are determine by these rules:
34068 @enumerate
34069 @item Structure members are stored sequentially in the order in which they are
34070 declared: the first member has the lowest memory address and the last member
34071 the highest.
34073 @item Every data object has an alignment requirement.  The alignment requirement
34074 for all data except structures, unions, and arrays is either the size of the
34075 object or the current packing size (specified with either the
34076 @code{aligned} attribute or the @code{pack} pragma),
34077 whichever is less.  For structures, unions, and arrays,
34078 the alignment requirement is the largest alignment requirement of its members.
34079 Every object is allocated an offset so that:
34081 @smallexample
34082 offset % alignment_requirement == 0
34083 @end smallexample
34085 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
34086 unit if the integral types are the same size and if the next bit-field fits
34087 into the current allocation unit without crossing the boundary imposed by the
34088 common alignment requirements of the bit-fields.
34089 @end enumerate
34091 MSVC interprets zero-length bit-fields in the following ways:
34093 @enumerate
34094 @item If a zero-length bit-field is inserted between two bit-fields that
34095 are normally coalesced, the bit-fields are not coalesced.
34097 For example:
34099 @smallexample
34100 struct
34101  @{
34102    unsigned long bf_1 : 12;
34103    unsigned long : 0;
34104    unsigned long bf_2 : 12;
34105  @} t1;
34106 @end smallexample
34108 @noindent
34109 The size of @code{t1} is 8 bytes with the zero-length bit-field.  If the
34110 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
34112 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
34113 alignment of the zero-length bit-field is greater than the member that follows it,
34114 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
34116 For example:
34118 @smallexample
34119 struct
34120  @{
34121    char foo : 4;
34122    short : 0;
34123    char bar;
34124  @} t2;
34126 struct
34127  @{
34128    char foo : 4;
34129    short : 0;
34130    double bar;
34131  @} t3;
34132 @end smallexample
34134 @noindent
34135 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
34136 Accordingly, the size of @code{t2} is 4.  For @code{t3}, the zero-length
34137 bit-field does not affect the alignment of @code{bar} or, as a result, the size
34138 of the structure.
34140 Taking this into account, it is important to note the following:
34142 @enumerate
34143 @item If a zero-length bit-field follows a normal bit-field, the type of the
34144 zero-length bit-field may affect the alignment of the structure as whole. For
34145 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
34146 normal bit-field, and is of type short.
34148 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
34149 still affect the alignment of the structure:
34151 @smallexample
34152 struct
34153  @{
34154    char foo : 6;
34155    long : 0;
34156  @} t4;
34157 @end smallexample
34159 @noindent
34160 Here, @code{t4} takes up 4 bytes.
34161 @end enumerate
34163 @item Zero-length bit-fields following non-bit-field members are ignored:
34165 @smallexample
34166 struct
34167  @{
34168    char foo;
34169    long : 0;
34170    char bar;
34171  @} t5;
34172 @end smallexample
34174 @noindent
34175 Here, @code{t5} takes up 2 bytes.
34176 @end enumerate
34179 @opindex mno-align-stringops
34180 @opindex malign-stringops
34181 @item -mno-align-stringops
34182 Do not align the destination of inlined string operations.  This switch reduces
34183 code size and improves performance in case the destination is already aligned,
34184 but GCC doesn't know about it.
34186 @opindex minline-all-stringops
34187 @item -minline-all-stringops
34188 By default GCC inlines string operations only when the destination is 
34189 known to be aligned to least a 4-byte boundary.  
34190 This enables more inlining and increases code
34191 size, but may improve performance of code that depends on fast
34192 @code{memcpy} and @code{memset} for short lengths.
34193 The option enables inline expansion of @code{strlen} for all
34194 pointer alignments.
34196 @opindex minline-stringops-dynamically
34197 @item -minline-stringops-dynamically
34198 For string operations of unknown size, use run-time checks with
34199 inline code for small blocks and a library call for large blocks.
34201 @opindex mstringop-strategy=@var{alg}
34202 @item -mstringop-strategy=@var{alg}
34203 Override the internal decision heuristic for the particular algorithm to use
34204 for inlining string operations.  The allowed values for @var{alg} are:
34206 @table @samp
34207 @item rep_byte
34208 @itemx rep_4byte
34209 @itemx rep_8byte
34210 Expand using i386 @code{rep} prefix of the specified size.
34212 @item byte_loop
34213 @itemx loop
34214 @itemx unrolled_loop
34215 Expand into an inline loop.
34217 @item libcall
34218 Always use a library call.
34219 @end table
34221 @opindex mmemcpy-strategy=@var{strategy}
34222 @item -mmemcpy-strategy=@var{strategy}
34223 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
34224 should be inlined and what inline algorithm to use when the expected size
34225 of the copy operation is known. @var{strategy} 
34226 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets. 
34227 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
34228 the max byte size with which inline algorithm @var{alg} is allowed.  For the last
34229 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
34230 in the list must be specified in increasing order.  The minimal byte size for 
34231 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the 
34232 preceding range.
34234 @opindex mmemset-strategy=@var{strategy}
34235 @item -mmemset-strategy=@var{strategy}
34236 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
34237 @code{__builtin_memset} expansion.
34239 @opindex momit-leaf-frame-pointer
34240 @item -momit-leaf-frame-pointer
34241 Don't keep the frame pointer in a register for leaf functions.  This
34242 avoids the instructions to save, set up, and restore frame pointers and
34243 makes an extra register available in leaf functions.  The option
34244 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
34245 which might make debugging harder.
34247 @opindex mtls-direct-seg-refs
34248 @item -mtls-direct-seg-refs
34249 @itemx -mno-tls-direct-seg-refs
34250 Controls whether TLS variables may be accessed with offsets from the
34251 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
34252 or whether the thread base pointer must be added.  Whether or not this
34253 is valid depends on the operating system, and whether it maps the
34254 segment to cover the entire TLS area.
34256 For systems that use the GNU C Library, the default is on.
34258 @opindex msse2avx
34259 @item -msse2avx
34260 @itemx -mno-sse2avx
34261 Specify that the assembler should encode SSE instructions with VEX
34262 prefix.  The option @option{-mavx} turns this on by default.
34264 @opindex mfentry
34265 @item -mfentry
34266 @itemx -mno-fentry
34267 If profiling is active (@option{-pg}), put the profiling
34268 counter call before the prologue.
34269 Note: On x86 architectures the attribute @code{ms_hook_prologue}
34270 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
34272 @opindex mrecord-mcount
34273 @item -mrecord-mcount
34274 @itemx -mno-record-mcount
34275 If profiling is active (@option{-pg}), generate a __mcount_loc section
34276 that contains pointers to each profiling call. This is useful for
34277 automatically patching and out calls.
34279 @opindex mnop-mcount
34280 @item -mnop-mcount
34281 @itemx -mno-nop-mcount
34282 If profiling is active (@option{-pg}), generate the calls to
34283 the profiling functions as NOPs. This is useful when they
34284 should be patched in later dynamically. This is likely only
34285 useful together with @option{-mrecord-mcount}.
34287 @opindex minstrument-return
34288 @item -minstrument-return=@var{type}
34289 Instrument function exit in -pg -mfentry instrumented functions with
34290 call to specified function. This only instruments true returns ending
34291 with ret, but not sibling calls ending with jump. Valid types
34292 are @var{none} to not instrument, @var{call} to generate a call to __return__,
34293 or @var{nop5} to generate a 5 byte nop.
34295 @opindex mrecord-return
34296 @item -mrecord-return
34297 @itemx -mno-record-return
34298 Generate a __return_loc section pointing to all return instrumentation code.
34300 @opindex mfentry-name
34301 @item -mfentry-name=@var{name}
34302 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
34304 @opindex mfentry-section
34305 @item -mfentry-section=@var{name}
34306 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
34308 @opindex mskip-rax-setup
34309 @item -mskip-rax-setup
34310 @itemx -mno-skip-rax-setup
34311 When generating code for the x86-64 architecture with SSE extensions
34312 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
34313 register when there are no variable arguments passed in vector registers.
34315 @strong{Warning:} Since RAX register is used to avoid unnecessarily
34316 saving vector registers on stack when passing variable arguments, the
34317 impacts of this option are callees may waste some stack space,
34318 misbehave or jump to a random location.  GCC 4.4 or newer don't have
34319 those issues, regardless the RAX register value.
34321 @opindex m8bit-idiv
34322 @item -m8bit-idiv
34323 @itemx -mno-8bit-idiv
34324 On some processors, like Intel Atom, 8-bit unsigned integer divide is
34325 much faster than 32-bit/64-bit integer divide.  This option generates a
34326 run-time check.  If both dividend and divisor are within range of 0
34327 to 255, 8-bit unsigned integer divide is used instead of
34328 32-bit/64-bit integer divide.
34330 @opindex mavx256-split-unaligned-load
34331 @opindex mavx256-split-unaligned-store
34332 @item -mavx256-split-unaligned-load
34333 @itemx -mavx256-split-unaligned-store
34334 Split 32-byte AVX unaligned load and store.
34336 @opindex mstack-protector-guard
34337 @opindex mstack-protector-guard-reg
34338 @opindex mstack-protector-guard-offset
34339 @item -mstack-protector-guard=@var{guard}
34340 @itemx -mstack-protector-guard-reg=@var{reg}
34341 @itemx -mstack-protector-guard-offset=@var{offset}
34342 Generate stack protection code using canary at @var{guard}.  Supported
34343 locations are @samp{global} for global canary or @samp{tls} for per-thread
34344 canary in the TLS block (the default).  This option has effect only when
34345 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
34347 With the latter choice the options
34348 @option{-mstack-protector-guard-reg=@var{reg}} and
34349 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
34350 which segment register (@code{%fs} or @code{%gs}) to use as base register
34351 for reading the canary, and from what offset from that base register.
34352 The default for those is as specified in the relevant ABI.
34354 @opindex mgeneral-regs-only
34355 @item -mgeneral-regs-only
34356 Generate code that uses only the general-purpose registers.  This
34357 prevents the compiler from using floating-point, vector, mask and bound
34358 registers.
34360 @opindex mrelax-cmpxchg-loop
34361 @item -mrelax-cmpxchg-loop
34362 When emitting a compare-and-swap loop for @ref{__sync Builtins}
34363 and @ref{__atomic Builtins} lacking a native instruction, optimize
34364 for the highly contended case by issuing an atomic load before the
34365 @code{CMPXCHG} instruction, and using the @code{PAUSE} instruction
34366 to save CPU power when restarting the loop.
34368 @opindex mindirect-branch
34369 @item -mindirect-branch=@var{choice}
34370 Convert indirect call and jump with @var{choice}.  The default is
34371 @samp{keep}, which keeps indirect call and jump unmodified.
34372 @samp{thunk} converts indirect call and jump to call and return thunk.
34373 @samp{thunk-inline} converts indirect call and jump to inlined call
34374 and return thunk.  @samp{thunk-extern} converts indirect call and jump
34375 to external call and return thunk provided in a separate object file.
34376 You can control this behavior for a specific function by using the
34377 function attribute @code{indirect_branch}.  @xref{Function Attributes}.
34379 Note that @option{-mcmodel=large} is incompatible with
34380 @option{-mindirect-branch=thunk} and
34381 @option{-mindirect-branch=thunk-extern} since the thunk function may
34382 not be reachable in the large code model.
34384 Note that @option{-mindirect-branch=thunk-extern} is compatible with
34385 @option{-fcf-protection=branch} since the external thunk can be made
34386 to enable control-flow check.
34388 @opindex mfunction-return
34389 @item -mfunction-return=@var{choice}
34390 Convert function return with @var{choice}.  The default is @samp{keep},
34391 which keeps function return unmodified.  @samp{thunk} converts function
34392 return to call and return thunk.  @samp{thunk-inline} converts function
34393 return to inlined call and return thunk.  @samp{thunk-extern} converts
34394 function return to external call and return thunk provided in a separate
34395 object file.  You can control this behavior for a specific function by
34396 using the function attribute @code{function_return}.
34397 @xref{Function Attributes}.
34399 Note that @option{-mindirect-return=thunk-extern} is compatible with
34400 @option{-fcf-protection=branch} since the external thunk can be made
34401 to enable control-flow check.
34403 Note that @option{-mcmodel=large} is incompatible with
34404 @option{-mfunction-return=thunk} and
34405 @option{-mfunction-return=thunk-extern} since the thunk function may
34406 not be reachable in the large code model.
34409 @opindex mindirect-branch-register
34410 @item -mindirect-branch-register
34411 Force indirect call and jump via register.
34413 @opindex mharden-sls
34414 @item -mharden-sls=@var{choice}
34415 Generate code to mitigate against straight line speculation (SLS) with
34416 @var{choice}.  The default is @samp{none} which disables all SLS
34417 hardening.  @samp{return} enables SLS hardening for function returns.
34418 @samp{indirect-jmp} enables SLS hardening for indirect jumps.
34419 @samp{all} enables all SLS hardening.
34421 @opindex mindirect-branch-cs-prefix
34422 @item -mindirect-branch-cs-prefix
34423 Add CS prefix to call and jmp to indirect thunk with branch target in
34424 r8-r15 registers so that the call and jmp instruction length is 6 bytes
34425 to allow them to be replaced with @samp{lfence; call *%r8-r15} or
34426 @samp{lfence; jmp *%r8-r15} at run-time.
34428 @end table
34430 These @samp{-m} switches are supported in addition to the above
34431 on x86-64 processors in 64-bit environments.
34433 @table @gcctabopt
34434 @opindex m32
34435 @opindex m64
34436 @opindex mx32
34437 @opindex m16
34438 @opindex miamcu
34439 @item -m32
34440 @itemx -m64
34441 @itemx -mx32
34442 @itemx -m16
34443 @itemx -miamcu
34444 Generate code for a 16-bit, 32-bit or 64-bit environment.
34445 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
34446 to 32 bits, and
34447 generates code that runs in 32-bit mode.
34449 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
34450 types to 64 bits, and generates code for the x86-64 architecture.
34451 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
34452 and @option{-mdynamic-no-pic} options.
34454 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
34455 to 32 bits, and
34456 generates code for the x86-64 architecture.
34458 The @option{-m16} option is the same as @option{-m32}, except for that
34459 it outputs the @code{.code16gcc} assembly directive at the beginning of
34460 the assembly output so that the binary can run in 16-bit mode.
34462 The @option{-miamcu} option generates code which conforms to Intel MCU
34463 psABI.  It requires the @option{-m32} option to be turned on.
34465 @opindex mno-red-zone
34466 @opindex mred-zone
34467 @item -mno-red-zone
34468 Do not use a so-called ``red zone'' for x86-64 code.  The red zone is mandated
34469 by the x86-64 ABI; it is a 128-byte area beyond the location of the
34470 stack pointer that is not modified by signal or interrupt handlers
34471 and therefore can be used for temporary data without adjusting the stack
34472 pointer.  The flag @option{-mno-red-zone} disables this red zone.
34474 @opindex mcmodel=small
34475 @item -mcmodel=small
34476 Generate code for the small code model: the program and its symbols must
34477 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
34478 Programs can be statically or dynamically linked.  This is the default
34479 code model.
34481 @opindex mcmodel=kernel
34482 @item -mcmodel=kernel
34483 Generate code for the kernel code model.  The kernel runs in the
34484 negative 2 GB of the address space.
34485 This model has to be used for Linux kernel code.
34487 @opindex mcmodel=medium
34488 @item -mcmodel=medium
34489 Generate code for the medium model: the program is linked in the lower 2
34490 GB of the address space.  Small symbols are also placed there.  Symbols
34491 with sizes larger than @option{-mlarge-data-threshold} are put into
34492 large data or BSS sections and can be located above 2GB.  Programs can
34493 be statically or dynamically linked.
34495 @opindex mcmodel=large
34496 @item -mcmodel=large
34497 Generate code for the large model.  This model makes no assumptions
34498 about addresses and sizes of sections.
34500 @opindex maddress-mode=long
34501 @item -maddress-mode=long
34502 Generate code for long address mode.  This is only supported for 64-bit
34503 and x32 environments.  It is the default address mode for 64-bit
34504 environments.
34506 @opindex maddress-mode=short
34507 @item -maddress-mode=short
34508 Generate code for short address mode.  This is only supported for 32-bit
34509 and x32 environments.  It is the default address mode for 32-bit and
34510 x32 environments.
34512 @opindex mneeded
34513 @item -mneeded
34514 @itemx -mno-needed
34515 Emit GNU_PROPERTY_X86_ISA_1_NEEDED GNU property for Linux target to
34516 indicate the micro-architecture ISA level required to execute the binary.
34518 @opindex mno-direct-extern-access
34519 @opindex mdirect-extern-access
34520 @item -mno-direct-extern-access
34521 Without @option{-fpic} nor @option{-fPIC}, always use the GOT pointer
34522 to access external symbols.  With @option{-fpic} or @option{-fPIC},
34523 treat access to protected symbols as local symbols.  The default is
34524 @option{-mdirect-extern-access}.
34526 @strong{Warning:} shared libraries compiled with
34527 @option{-mno-direct-extern-access} and executable compiled with
34528 @option{-mdirect-extern-access} may not be binary compatible if
34529 protected symbols are used in shared libraries and executable.
34531 @opindex munroll-only-small-loops
34532 @opindex mno-unroll-only-small-loops
34533 @item -munroll-only-small-loops
34534 Controls conservative small loop unrolling. It is default enabled by
34535 O2, and unrolls loop with less than 4 insns by 1 time. Explicit
34536 -f[no-]unroll-[all-]loops would disable this flag to avoid any
34537 unintended unrolling behavior that user does not want.
34539 @opindex mlam
34540 @item -mlam=@var{choice}
34541 LAM(linear-address masking) allows special bits in the pointer to be used
34542 for metadata. The default is @samp{none}. With @samp{u48}, pointer bits in
34543 positions 62:48 can be used for metadata; With @samp{u57}, pointer bits in
34544 positions 62:57 can be used for metadata.
34545 @end table
34547 @node x86 Windows Options
34548 @subsection x86 Windows Options
34549 @cindex x86 Windows Options
34550 @cindex Windows Options for x86
34552 These additional options are available for Microsoft Windows targets:
34554 @table @gcctabopt
34555 @opindex mconsole
34556 @item -mconsole
34557 This option
34558 specifies that a console application is to be generated, by
34559 instructing the linker to set the PE header subsystem type
34560 required for console applications.
34561 This option is available for Cygwin and MinGW targets and is
34562 enabled by default on those targets.
34564 @opindex mcrtdll
34565 @item -mcrtdll=@var{library}
34566 Preprocess, compile or link with specified C RunTime DLL @var{library}.
34567 This option adjust predefined macros @code{__CRTDLL__}, @code{__MSVCRT__}
34568 and @code{__MSVCRT_VERSION__} for specified CRT @var{library}, choose
34569 start file for CRT @var{library} and link with CRT @var{library}.
34570 Recognized CRT library names for proprocessor are:
34571 @code{crtdll}, @code{msvcrt10}, @code{msvcrt20}, @code{msvcrt40},
34572 @code{msvcrt-os}, @code{msvcr70}, @code{msvcr80}, @code{msvcr90},
34573 @code{msvcr100}, @code{msvcr110}, @code{msvcr120} and @code{ucrt}.
34574 If this options is not specified then the default MinGW import library
34575 @code{msvcrt} is used for linking and no other adjustment for
34576 preprocessor is done. MinGW import library @code{msvcrt} is just a
34577 symlink to (or a copy of) another MinGW CRT import library
34578 chosen during MinGW compilation. MinGW import library @code{msvcrt-os}
34579 is for Windows system CRT DLL library @code{msvcrt.dll} and
34580 in most cases is the default MinGW import library.
34581 Generally speaking, changing the CRT DLL requires recompiling
34582 the entire MinGW CRT. This option is for experimental and testing
34583 purposes only.
34584 This option is available for MinGW targets.
34586 @opindex mdll
34587 @item -mdll
34588 This option is available for Cygwin and MinGW targets.  It
34589 specifies that a DLL---a dynamic link library---is to be
34590 generated, enabling the selection of the required runtime
34591 startup object and entry point.
34593 @opindex mnop-fun-dllimport
34594 @item -mnop-fun-dllimport
34595 This option is available for Cygwin and MinGW targets.  It
34596 specifies that the @code{dllimport} attribute should be ignored.
34598 @opindex mthreads
34599 @item -mthreads
34600 This option is available for MinGW targets. It specifies
34601 that MinGW-specific thread support is to be used.
34603 @opindex municode
34604 @item -municode
34605 This option is available for MinGW-w64 targets.  It causes
34606 the @code{UNICODE} preprocessor macro to be predefined, and
34607 chooses Unicode-capable runtime startup code.
34609 @opindex mwin32
34610 @item -mwin32
34611 This option is available for Cygwin and MinGW targets.  It
34612 specifies that the typical Microsoft Windows predefined macros are to
34613 be set in the pre-processor, but does not influence the choice
34614 of runtime library/startup code.
34616 @opindex mwindows
34617 @item -mwindows
34618 This option is available for Cygwin and MinGW targets.  It
34619 specifies that a GUI application is to be generated by
34620 instructing the linker to set the PE header subsystem type
34621 appropriately.
34623 @opindex fno-set-stack-executable
34624 @opindex fset-stack-executable
34625 @item -fno-set-stack-executable
34626 This option is available for MinGW targets. It specifies that
34627 the executable flag for the stack used by nested functions isn't
34628 set. This is necessary for binaries running in kernel mode of
34629 Microsoft Windows, as there the User32 API, which is used to set executable
34630 privileges, isn't available.
34632 @opindex fno-writable-relocated-rdata
34633 @opindex fwritable-relocated-rdata
34634 @item -fwritable-relocated-rdata
34635 This option is available for MinGW and Cygwin targets.  It specifies
34636 that relocated-data in read-only section is put into the @code{.data}
34637 section.  This is a necessary for older runtimes not supporting
34638 modification of @code{.rdata} sections for pseudo-relocation.
34640 @opindex mpe-aligned-commons
34641 @item -mpe-aligned-commons
34642 This option is available for Cygwin and MinGW targets.  It
34643 specifies that the GNU extension to the PE file format that
34644 permits the correct alignment of COMMON variables should be
34645 used when generating code.  It is enabled by default if
34646 GCC detects that the target assembler found during configuration
34647 supports the feature.
34648 @end table
34650 See also under @ref{x86 Options} for standard options.
34652 @node Xstormy16 Options
34653 @subsection Xstormy16 Options
34654 @cindex Xstormy16 Options
34656 These options are defined for Xstormy16:
34658 @table @gcctabopt
34659 @opindex msim
34660 @item -msim
34661 Choose startup files and linker script suitable for the simulator.
34662 @end table
34664 @node Xtensa Options
34665 @subsection Xtensa Options
34666 @cindex Xtensa Options
34668 These options are supported for Xtensa targets:
34670 @table @gcctabopt
34671 @opindex mconst16
34672 @opindex mno-const16
34673 @item -mconst16
34674 @itemx -mno-const16
34675 Enable or disable use of @code{CONST16} instructions for loading
34676 constant values.  The @code{CONST16} instruction is currently not a
34677 standard option from Tensilica.  When enabled, @code{CONST16}
34678 instructions are always used in place of the standard @code{L32R}
34679 instructions.  The use of @code{CONST16} is enabled by default only if
34680 the @code{L32R} instruction is not available.
34682 @opindex mfused-madd
34683 @opindex mno-fused-madd
34684 @item -mfused-madd
34685 @itemx -mno-fused-madd
34686 Enable or disable use of fused multiply/add and multiply/subtract
34687 instructions in the floating-point option.  This has no effect if the
34688 floating-point option is not also enabled.  Disabling fused multiply/add
34689 and multiply/subtract instructions forces the compiler to use separate
34690 instructions for the multiply and add/subtract operations.  This may be
34691 desirable in some cases where strict IEEE 754-compliant results are
34692 required: the fused multiply add/subtract instructions do not round the
34693 intermediate result, thereby producing results with @emph{more} bits of
34694 precision than specified by the IEEE standard.  Disabling fused multiply
34695 add/subtract instructions also ensures that the program output is not
34696 sensitive to the compiler's ability to combine multiply and add/subtract
34697 operations.
34699 @opindex mserialize-volatile
34700 @opindex mno-serialize-volatile
34701 @item -mserialize-volatile
34702 @itemx -mno-serialize-volatile
34703 When this option is enabled, GCC inserts @code{MEMW} instructions before
34704 @code{volatile} memory references to guarantee sequential consistency.
34705 The default is @option{-mserialize-volatile}.  Use
34706 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
34708 @opindex mforce-no-pic
34709 @item -mforce-no-pic
34710 For targets, like GNU/Linux, where all user-mode Xtensa code must be
34711 position-independent code (PIC), this option disables PIC for compiling
34712 kernel code.
34714 @opindex mtext-section-literals
34715 @opindex mno-text-section-literals
34716 @item -mtext-section-literals
34717 @itemx -mno-text-section-literals
34718 These options control the treatment of literal pools.  The default is
34719 @option{-mno-text-section-literals}, which places literals in a separate
34720 section in the output file.  This allows the literal pool to be placed
34721 in a data RAM/ROM, and it also allows the linker to combine literal
34722 pools from separate object files to remove redundant literals and
34723 improve code size.  With @option{-mtext-section-literals}, the literals
34724 are interspersed in the text section in order to keep them as close as
34725 possible to their references.  This may be necessary for large assembly
34726 files.  Literals for each function are placed right before that function.
34728 @opindex mauto-litpools
34729 @opindex mno-auto-litpools
34730 @item -mauto-litpools
34731 @itemx -mno-auto-litpools
34732 These options control the treatment of literal pools.  The default is
34733 @option{-mno-auto-litpools}, which places literals in a separate
34734 section in the output file unless @option{-mtext-section-literals} is
34735 used.  With @option{-mauto-litpools} the literals are interspersed in
34736 the text section by the assembler.  Compiler does not produce explicit
34737 @code{.literal} directives and loads literals into registers with
34738 @code{MOVI} instructions instead of @code{L32R} to let the assembler
34739 do relaxation and place literals as necessary.  This option allows
34740 assembler to create several literal pools per function and assemble
34741 very big functions, which may not be possible with
34742 @option{-mtext-section-literals}.
34744 @opindex mtarget-align
34745 @opindex mno-target-align
34746 @item -mtarget-align
34747 @itemx -mno-target-align
34748 When this option is enabled, GCC instructs the assembler to
34749 automatically align instructions to reduce branch penalties at the
34750 expense of some code density.  The assembler attempts to widen density
34751 instructions to align branch targets and the instructions following call
34752 instructions.  If there are not enough preceding safe density
34753 instructions to align a target, no widening is performed.  The
34754 default is @option{-mtarget-align}.  These options do not affect the
34755 treatment of auto-aligned instructions like @code{LOOP}, which the
34756 assembler always aligns, either by widening density instructions or
34757 by inserting NOP instructions.
34759 @opindex mlongcalls
34760 @opindex mno-longcalls
34761 @item -mlongcalls
34762 @itemx -mno-longcalls
34763 When this option is enabled, GCC instructs the assembler to translate
34764 direct calls to indirect calls unless it can determine that the target
34765 of a direct call is in the range allowed by the call instruction.  This
34766 translation typically occurs for calls to functions in other source
34767 files.  Specifically, the assembler translates a direct @code{CALL}
34768 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
34769 The default is @option{-mno-longcalls}.  This option should be used in
34770 programs where the call target can potentially be out of range.  This
34771 option is implemented in the assembler, not the compiler, so the
34772 assembly code generated by GCC still shows direct call
34773 instructions---look at the disassembled object code to see the actual
34774 instructions.  Note that the assembler uses an indirect call for
34775 every cross-file call, not just those that really are out of range.
34777 @opindex mabi
34778 @item -mabi=@var{name}
34779 Generate code for the specified ABI@.  Permissible values are: @samp{call0},
34780 @samp{windowed}.  Default ABI is chosen by the Xtensa core configuration.
34782 @opindex mabi=call0
34783 @item -mabi=call0
34784 When this option is enabled function parameters are passed in registers
34785 @code{a2} through @code{a7}, registers @code{a12} through @code{a15} are
34786 caller-saved, and register @code{a15} may be used as a frame pointer.
34787 When this version of the ABI is enabled the C preprocessor symbol
34788 @code{__XTENSA_CALL0_ABI__} is defined.
34790 @opindex mabi=windowed
34791 @item -mabi=windowed
34792 When this option is enabled function parameters are passed in registers
34793 @code{a10} through @code{a15}, and called function rotates register window
34794 by 8 registers on entry so that its arguments are found in registers
34795 @code{a2} through @code{a7}.  Register @code{a7} may be used as a frame
34796 pointer.  Register window is rotated 8 registers back upon return.
34797 When this version of the ABI is enabled the C preprocessor symbol
34798 @code{__XTENSA_WINDOWED_ABI__} is defined.
34800 @opindex mextra-l32r-costs
34801 @item -mextra-l32r-costs=@var{n}
34802 Specify an extra cost of instruction RAM/ROM access for @code{L32R}
34803 instructions, in clock cycles.  This affects, when optimizing for speed,
34804 whether loading a constant from literal pool using @code{L32R} or
34805 synthesizing the constant from a small one with a couple of arithmetic
34806 instructions.  The default value is 0.
34808 @opindex mstrict-align
34809 @opindex mno-strict-align
34810 @item -mstrict-align
34811 @itemx -mno-strict-align
34812 Avoid or allow generating memory accesses that may not be aligned on a natural
34813 object boundary as described in the architecture specification.
34814 The default is @option{-mno-strict-align} for cores that support both
34815 unaligned loads and stores in hardware and @option{-mstrict-align} for all
34816 other cores.
34818 @end table
34820 @node zSeries Options
34821 @subsection zSeries Options
34822 @cindex zSeries options
34824 These are listed under @xref{S/390 and zSeries Options}.
34827 @c man end
34829 @node Spec Files
34830 @section Specifying Subprocesses and the Switches to Pass to Them
34831 @cindex Spec Files
34833 @command{gcc} is a driver program.  It performs its job by invoking a
34834 sequence of other programs to do the work of compiling, assembling and
34835 linking.  GCC interprets its command-line parameters and uses these to
34836 deduce which programs it should invoke, and which command-line options
34837 it ought to place on their command lines.  This behavior is controlled
34838 by @dfn{spec strings}.  In most cases there is one spec string for each
34839 program that GCC can invoke, but a few programs have multiple spec
34840 strings to control their behavior.  The spec strings built into GCC can
34841 be overridden by using the @option{-specs=} command-line switch to specify
34842 a spec file.
34844 @dfn{Spec files} are plain-text files that are used to construct spec
34845 strings.  They consist of a sequence of directives separated by blank
34846 lines.  The type of directive is determined by the first non-whitespace
34847 character on the line, which can be one of the following:
34849 @table @code
34850 @item %@var{command}
34851 Issues a @var{command} to the spec file processor.  The commands that can
34852 appear here are:
34854 @table @code
34855 @cindex @code{%include}
34856 @item %include <@var{file}>
34857 Search for @var{file} and insert its text at the current point in the
34858 specs file.
34860 @cindex @code{%include_noerr}
34861 @item %include_noerr <@var{file}>
34862 Just like @samp{%include}, but do not generate an error message if the include
34863 file cannot be found.
34865 @cindex @code{%rename}
34866 @item %rename @var{old_name} @var{new_name}
34867 Rename the spec string @var{old_name} to @var{new_name}.
34869 @end table
34871 @item *[@var{spec_name}]:
34872 This tells the compiler to create, override or delete the named spec
34873 string.  All lines after this directive up to the next directive or
34874 blank line are considered to be the text for the spec string.  If this
34875 results in an empty string then the spec is deleted.  (Or, if the
34876 spec did not exist, then nothing happens.)  Otherwise, if the spec
34877 does not currently exist a new spec is created.  If the spec does
34878 exist then its contents are overridden by the text of this
34879 directive, unless the first character of that text is the @samp{+}
34880 character, in which case the text is appended to the spec.
34882 @item [@var{suffix}]:
34883 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
34884 and up to the next directive or blank line are considered to make up the
34885 spec string for the indicated suffix.  When the compiler encounters an
34886 input file with the named suffix, it processes the spec string in
34887 order to work out how to compile that file.  For example:
34889 @smallexample
34890 .ZZ:
34891 z-compile -input %i
34892 @end smallexample
34894 This says that any input file whose name ends in @samp{.ZZ} should be
34895 passed to the program @samp{z-compile}, which should be invoked with the
34896 command-line switch @option{-input} and with the result of performing the
34897 @samp{%i} substitution.  (See below.)
34899 As an alternative to providing a spec string, the text following a
34900 suffix directive can be one of the following:
34902 @table @code
34903 @item @@@var{language}
34904 This says that the suffix is an alias for a known @var{language}.  This is
34905 similar to using the @option{-x} command-line switch to GCC to specify a
34906 language explicitly.  For example:
34908 @smallexample
34909 .ZZ:
34910 @@c++
34911 @end smallexample
34913 Says that .ZZ files are, in fact, C++ source files.
34915 @item #@var{name}
34916 This causes an error messages saying:
34918 @smallexample
34919 @var{name} compiler not installed on this system.
34920 @end smallexample
34921 @end table
34923 GCC already has an extensive list of suffixes built into it.
34924 This directive adds an entry to the end of the list of suffixes, but
34925 since the list is searched from the end backwards, it is effectively
34926 possible to override earlier entries using this technique.
34928 @end table
34930 GCC has the following spec strings built into it.  Spec files can
34931 override these strings or create their own.  Note that individual
34932 targets can also add their own spec strings to this list.
34934 @smallexample
34935 asm          Options to pass to the assembler
34936 asm_final    Options to pass to the assembler post-processor
34937 cpp          Options to pass to the C preprocessor
34938 cc1          Options to pass to the C compiler
34939 cc1plus      Options to pass to the C++ compiler
34940 endfile      Object files to include at the end of the link
34941 link         Options to pass to the linker
34942 lib          Libraries to include on the command line to the linker
34943 libgcc       Decides which GCC support library to pass to the linker
34944 linker       Sets the name of the linker
34945 predefines   Defines to be passed to the C preprocessor
34946 signed_char  Defines to pass to CPP to say whether @code{char} is signed
34947              by default
34948 startfile    Object files to include at the start of the link
34949 @end smallexample
34951 Here is a small example of a spec file:
34953 @smallexample
34954 %rename lib                 old_lib
34956 *lib:
34957 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
34958 @end smallexample
34960 This example renames the spec called @samp{lib} to @samp{old_lib} and
34961 then overrides the previous definition of @samp{lib} with a new one.
34962 The new definition adds in some extra command-line options before
34963 including the text of the old definition.
34965 @dfn{Spec strings} are a list of command-line options to be passed to their
34966 corresponding program.  In addition, the spec strings can contain
34967 @samp{%}-prefixed sequences to substitute variable text or to
34968 conditionally insert text into the command line.  Using these constructs
34969 it is possible to generate quite complex command lines.
34971 Here is a table of all defined @samp{%}-sequences for spec
34972 strings.  Note that spaces are not generated automatically around the
34973 results of expanding these sequences.  Therefore you can concatenate them
34974 together or combine them with constant text in a single argument.
34976 @table @code
34977 @item %%
34978 Substitute one @samp{%} into the program name or argument.
34980 @item %"
34981 Substitute an empty argument.
34983 @item %i
34984 Substitute the name of the input file being processed.
34986 @item %b
34987 Substitute the basename for outputs related with the input file being
34988 processed.  This is often the substring up to (and not including) the
34989 last period and not including the directory but, unless %w is active, it
34990 expands to the basename for auxiliary outputs, which may be influenced
34991 by an explicit output name, and by various other options that control
34992 how auxiliary outputs are named.
34994 @item %B
34995 This is the same as @samp{%b}, but include the file suffix (text after
34996 the last period).  Without %w, it expands to the basename for dump
34997 outputs.
34999 @item %d
35000 Marks the argument containing or following the @samp{%d} as a
35001 temporary file name, so that that file is deleted if GCC exits
35002 successfully.  Unlike @samp{%g}, this contributes no text to the
35003 argument.
35005 @item %g@var{suffix}
35006 Substitute a file name that has suffix @var{suffix} and is chosen
35007 once per compilation, and mark the argument in the same way as
35008 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
35009 name is now chosen in a way that is hard to predict even when previously
35010 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
35011 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
35012 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
35013 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
35014 was simply substituted with a file name chosen once per compilation,
35015 without regard to any appended suffix (which was therefore treated
35016 just like ordinary text), making such attacks more likely to succeed.
35018 @item %u@var{suffix}
35019 Like @samp{%g}, but generates a new temporary file name
35020 each time it appears instead of once per compilation.
35022 @item %U@var{suffix}
35023 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
35024 new one if there is no such last file name.  In the absence of any
35025 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
35026 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
35027 involves the generation of two distinct file names, one
35028 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
35029 simply substituted with a file name chosen for the previous @samp{%u},
35030 without regard to any appended suffix.
35032 @item %j@var{suffix}
35033 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
35034 writable, and if @option{-save-temps} is not used; 
35035 otherwise, substitute the name
35036 of a temporary file, just like @samp{%u}.  This temporary file is not
35037 meant for communication between processes, but rather as a junk
35038 disposal mechanism.
35040 @item %|@var{suffix}
35041 @itemx %m@var{suffix}
35042 Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
35043 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
35044 all.  These are the two most common ways to instruct a program that it
35045 should read from standard input or write to standard output.  If you
35046 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
35047 construct: see for example @file{gcc/fortran/lang-specs.h}.
35049 @item %.@var{SUFFIX}
35050 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
35051 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
35052 terminated by the next space or %.
35054 @item %w
35055 Marks the argument containing or following the @samp{%w} as the
35056 designated output file of this compilation.  This puts the argument
35057 into the sequence of arguments that @samp{%o} substitutes.
35059 @item %V
35060 Indicates that this compilation produces no output file.
35062 @item %o
35063 Substitutes the names of all the output files, with spaces
35064 automatically placed around them.  You should write spaces
35065 around the @samp{%o} as well or the results are undefined.
35066 @samp{%o} is for use in the specs for running the linker.
35067 Input files whose names have no recognized suffix are not compiled
35068 at all, but they are included among the output files, so they are
35069 linked.
35071 @item %O
35072 Substitutes the suffix for object files.  Note that this is
35073 handled specially when it immediately follows @samp{%g, %u, or %U},
35074 because of the need for those to form complete file names.  The
35075 handling is such that @samp{%O} is treated exactly as if it had already
35076 been substituted, except that @samp{%g, %u, and %U} do not currently
35077 support additional @var{suffix} characters following @samp{%O} as they do
35078 following, for example, @samp{.o}.
35080 @item %I
35081 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
35082 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
35083 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
35084 and @option{-imultilib} as necessary.
35086 @item %s
35087 Current argument is the name of a library or startup file of some sort.
35088 Search for that file in a standard list of directories and substitute
35089 the full name found.  The current working directory is included in the
35090 list of directories scanned.
35092 @item %T
35093 Current argument is the name of a linker script.  Search for that file
35094 in the current list of directories to scan for libraries. If the file
35095 is located insert a @option{--script} option into the command line
35096 followed by the full path name found.  If the file is not found then
35097 generate an error message.  Note: the current working directory is not
35098 searched.
35100 @item %e@var{str}
35101 Print @var{str} as an error message.  @var{str} is terminated by a newline.
35102 Use this when inconsistent options are detected.
35104 @item %n@var{str}
35105 Print @var{str} as a notice.  @var{str} is terminated by a newline.
35107 @item %(@var{name})
35108 Substitute the contents of spec string @var{name} at this point.
35110 @item %x@{@var{option}@}
35111 Accumulate an option for @samp{%X}.
35113 @item %X
35114 Output the accumulated linker options specified by a @samp{%x} spec string.
35116 @item %Y
35117 Output the accumulated assembler options specified by @option{-Wa}.
35119 @item %Z
35120 Output the accumulated preprocessor options specified by @option{-Wp}.
35122 @item %M
35123 Output @code{multilib_os_dir}.
35125 @item %R
35126 Output the concatenation of @code{target_system_root} and @code{target_sysroot_suffix}.
35128 @item %a
35129 Process the @code{asm} spec.  This is used to compute the
35130 switches to be passed to the assembler.
35132 @item %A
35133 Process the @code{asm_final} spec.  This is a spec string for
35134 passing switches to an assembler post-processor, if such a program is
35135 needed.
35137 @item %l
35138 Process the @code{link} spec.  This is the spec for computing the
35139 command line passed to the linker.  Typically it makes use of the
35140 @samp{%L %G %S %D and %E} sequences.
35142 @item %D
35143 Dump out a @option{-L} option for each directory that GCC believes might
35144 contain startup files.  If the target supports multilibs then the
35145 current multilib directory is prepended to each of these paths.
35147 @item %L
35148 Process the @code{lib} spec.  This is a spec string for deciding which
35149 libraries are included on the command line to the linker.
35151 @item %G
35152 Process the @code{libgcc} spec.  This is a spec string for deciding
35153 which GCC support library is included on the command line to the linker.
35155 @item %S
35156 Process the @code{startfile} spec.  This is a spec for deciding which
35157 object files are the first ones passed to the linker.  Typically
35158 this might be a file named @file{crt0.o}.
35160 @item %E
35161 Process the @code{endfile} spec.  This is a spec string that specifies
35162 the last object files that are passed to the linker.
35164 @item %C
35165 Process the @code{cpp} spec.  This is used to construct the arguments
35166 to be passed to the C preprocessor.
35168 @item %1
35169 Process the @code{cc1} spec.  This is used to construct the options to be
35170 passed to the actual C compiler (@command{cc1}).
35172 @item %2
35173 Process the @code{cc1plus} spec.  This is used to construct the options to be
35174 passed to the actual C++ compiler (@command{cc1plus}).
35176 @item %*
35177 Substitute the variable part of a matched option.  See below.
35178 Note that each comma in the substituted string is replaced by
35179 a single space.
35181 @item %<S
35182 Remove all occurrences of @code{-S} from the command line.  Note---this
35183 command is position dependent.  @samp{%} commands in the spec string
35184 before this one see @code{-S}, @samp{%} commands in the spec string
35185 after this one do not.
35187 @item %<S*
35188 Similar to @samp{%<S}, but match all switches beginning with @code{-S}.
35190 @item %>S
35191 Similar to @samp{%<S}, but keep @code{-S} in the GCC command line.
35193 @item %:@var{function}(@var{args})
35194 Call the named function @var{function}, passing it @var{args}.
35195 @var{args} is first processed as a nested spec string, then split
35196 into an argument vector in the usual fashion.  The function returns
35197 a string which is processed as if it had appeared literally as part
35198 of the current spec.
35200 The following built-in spec functions are provided:
35202 @table @code
35203 @item @code{getenv}
35204 The @code{getenv} spec function takes two arguments: an environment
35205 variable name and a string.  If the environment variable is not
35206 defined, a fatal error is issued.  Otherwise, the return value is the
35207 value of the environment variable concatenated with the string.  For
35208 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
35210 @smallexample
35211 %:getenv(TOPDIR /include)
35212 @end smallexample
35214 expands to @file{/path/to/top/include}.
35216 @item @code{if-exists}
35217 The @code{if-exists} spec function takes one argument, an absolute
35218 pathname to a file.  If the file exists, @code{if-exists} returns the
35219 pathname.  Here is a small example of its usage:
35221 @smallexample
35222 *startfile:
35223 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
35224 @end smallexample
35226 @item @code{if-exists-else}
35227 The @code{if-exists-else} spec function is similar to the @code{if-exists}
35228 spec function, except that it takes two arguments.  The first argument is
35229 an absolute pathname to a file.  If the file exists, @code{if-exists-else}
35230 returns the pathname.  If it does not exist, it returns the second argument.
35231 This way, @code{if-exists-else} can be used to select one file or another,
35232 based on the existence of the first.  Here is a small example of its usage:
35234 @smallexample
35235 *startfile:
35236 crt0%O%s %:if-exists(crti%O%s) \
35237 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
35238 @end smallexample
35240 @item @code{if-exists-then-else}
35241 The @code{if-exists-then-else} spec function takes at least two arguments
35242 and an optional third one. The first argument is an absolute pathname to a
35243 file.  If the file exists, the function returns the second argument.
35244 If the file does not exist, the function returns the third argument if there
35245 is one, or NULL otherwise. This can be used to expand one text, or optionally
35246 another, based on the existence of a file.  Here is a small example of its
35247 usage:
35249 @smallexample
35250 -l%:if-exists-then-else(%:getenv(VSB_DIR rtnet.h) rtnet net)
35251 @end smallexample
35253 @item @code{sanitize}
35254 The @code{sanitize} spec function takes no arguments.  It returns non-NULL if
35255 any address, thread or undefined behavior sanitizers are active.
35257 @smallexample
35258 %@{%:sanitize(address):-funwind-tables@}
35259 @end smallexample
35261 @item @code{replace-outfile}
35262 The @code{replace-outfile} spec function takes two arguments.  It looks for the
35263 first argument in the outfiles array and replaces it with the second argument.  Here
35264 is a small example of its usage:
35266 @smallexample
35267 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
35268 @end smallexample
35270 @item @code{remove-outfile}
35271 The @code{remove-outfile} spec function takes one argument.  It looks for the
35272 first argument in the outfiles array and removes it.  Here is a small example
35273 its usage:
35275 @smallexample
35276 %:remove-outfile(-lm)
35277 @end smallexample
35279 @item @code{version-compare}
35280 The @code{version-compare} spec function takes four or five arguments of the following
35281 form:
35283 @smallexample
35284 <comparison-op> <arg1> [<arg2>] <switch> <result>
35285 @end smallexample
35287 It returns @code{result} if the comparison evaluates to true, and NULL if it doesn't.
35288 The supported @code{comparison-op} values are:
35290 @table @code
35291 @item >=
35292 True if @code{switch} is a later (or same) version than @code{arg1}
35294 @item !>
35295 Opposite of @code{>=}
35297 @item <
35298 True if @code{switch} is an earlier version than @code{arg1}
35300 @item !<
35301 Opposite of @code{<}
35303 @item ><
35304 True if @code{switch} is @code{arg1} or later, and earlier than @code{arg2}
35306 @item <>
35307 True if @code{switch} is earlier than @code{arg1}, or is @code{arg2} or later
35308 @end table
35310 If the @code{switch} is not present at all, the condition is false unless the first character
35311 of the @code{comparison-op} is @code{!}.
35313 @smallexample
35314 %:version-compare(>= 10.3 mmacosx-version-min= -lmx)
35315 @end smallexample
35317 The above example would add @option{-lmx} if @option{-mmacosx-version-min=10.3.9} was
35318 passed.
35320 @item @code{include}
35321 The @code{include} spec function behaves much like @code{%include}, with the advantage
35322 that it can be nested inside a spec and thus be conditionalized.  It takes one argument,
35323 the filename, and looks for it in the startfile path.  It always returns NULL.
35325 @smallexample
35326 %@{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)@}
35327 @end smallexample
35329 @item @code{pass-through-libs}
35330 The @code{pass-through-libs} spec function takes any number of arguments.  It
35331 finds any @option{-l} options and any non-options ending in @file{.a} (which it
35332 assumes are the names of linker input library archive files) and returns a
35333 result containing all the found arguments each prepended by
35334 @option{-plugin-opt=-pass-through=} and joined by spaces.  This list is
35335 intended to be passed to the LTO linker plugin.
35337 @smallexample
35338 %:pass-through-libs(%G %L %G)
35339 @end smallexample
35341 @item @code{print-asm-header}
35342 The @code{print-asm-header} function takes no arguments and simply
35343 prints a banner like:
35345 @smallexample
35346 Assembler options
35347 =================
35349 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
35350 @end smallexample
35352 It is used to separate compiler options from assembler options
35353 in the @option{--target-help} output.
35355 @item @code{gt}
35356 The @code{gt} spec function takes two or more arguments.  It returns @code{""} (the
35357 empty string) if the second-to-last argument is greater than the last argument, and NULL
35358 otherwise.  The following example inserts the @code{link_gomp} spec if the last
35359 @option{-ftree-parallelize-loops=} option given on the command line is greater than 1:
35361 @smallexample
35362 %@{%:gt(%@{ftree-parallelize-loops=*:%*@} 1):%:include(libgomp.spec)%(link_gomp)@}
35363 @end smallexample
35365 @item @code{debug-level-gt}
35366 The @code{debug-level-gt} spec function takes one argument and returns @code{""} (the
35367 empty string) if @code{debug_info_level} is greater than the specified number, and NULL
35368 otherwise.
35370 @smallexample
35371 %@{%:debug-level-gt(0):%@{gdwarf*:--gdwarf2@}@}
35372 @end smallexample
35373 @end table
35375 @item %@{S@}
35376 Substitutes the @code{-S} switch, if that switch is given to GCC@.
35377 If that switch is not specified, this substitutes nothing.  Note that
35378 the leading dash is omitted when specifying this option, and it is
35379 automatically inserted if the substitution is performed.  Thus the spec
35380 string @samp{%@{foo@}} matches the command-line option @option{-foo}
35381 and outputs the command-line option @option{-foo}.
35383 @item %W@{S@}
35384 Like %@{@code{S}@} but mark last argument supplied within as a file to be
35385 deleted on failure.
35387 @item %@@@{S@}
35388 Like %@{@code{S}@} but puts the result into a @code{FILE} and substitutes
35389 @code{@@FILE} if an @code{@@file} argument has been supplied.
35391 @item %@{S*@}
35392 Substitutes all the switches specified to GCC whose names start
35393 with @code{-S}, but which also take an argument.  This is used for
35394 switches like @option{-o}, @option{-D}, @option{-I}, etc.
35395 GCC considers @option{-o foo} as being
35396 one switch whose name starts with @samp{o}.  %@{o*@} substitutes this
35397 text, including the space.  Thus two arguments are generated.
35399 @item %@{S*&T*@}
35400 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
35401 (the order of @code{S} and @code{T} in the spec is not significant).
35402 There can be any number of ampersand-separated variables; for each the
35403 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
35405 @item %@{S:X@}
35406 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
35408 @item %@{!S:X@}
35409 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
35411 @item %@{S*:X@}
35412 Substitutes @code{X} if one or more switches whose names start with
35413 @code{-S} are specified to GCC@.  Normally @code{X} is substituted only
35414 once, no matter how many such switches appeared.  However, if @code{%*}
35415 appears somewhere in @code{X}, then @code{X} is substituted once
35416 for each matching switch, with the @code{%*} replaced by the part of
35417 that switch matching the @code{*}.
35419 If @code{%*} appears as the last part of a spec sequence then a space
35420 is added after the end of the last substitution.  If there is more
35421 text in the sequence, however, then a space is not generated.  This
35422 allows the @code{%*} substitution to be used as part of a larger
35423 string.  For example, a spec string like this:
35425 @smallexample
35426 %@{mcu=*:--script=%*/memory.ld@}
35427 @end smallexample
35429 @noindent
35430 when matching an option like @option{-mcu=newchip} produces:
35432 @smallexample
35433 --script=newchip/memory.ld
35434 @end smallexample
35436 @item %@{.S:X@}
35437 Substitutes @code{X}, if processing a file with suffix @code{S}.
35439 @item %@{!.S:X@}
35440 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
35442 @item %@{,S:X@}
35443 Substitutes @code{X}, if processing a file for language @code{S}.
35445 @item %@{!,S:X@}
35446 Substitutes @code{X}, if not processing a file for language @code{S}.
35448 @item %@{S|P:X@}
35449 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
35450 GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
35451 @code{*} sequences as well, although they have a stronger binding than
35452 the @samp{|}.  If @code{%*} appears in @code{X}, all of the
35453 alternatives must be starred, and only the first matching alternative
35454 is substituted.
35456 For example, a spec string like this:
35458 @smallexample
35459 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
35460 @end smallexample
35462 @noindent
35463 outputs the following command-line options from the following input
35464 command-line options:
35466 @smallexample
35467 fred.c        -foo -baz
35468 jim.d         -bar -boggle
35469 -d fred.c     -foo -baz -boggle
35470 -d jim.d      -bar -baz -boggle
35471 @end smallexample
35473 @item %@{%:@var{function}(@var{args}):X@}
35475 Call function named @var{function} with args @var{args}.  If the
35476 function returns non-NULL, then @code{X} is substituted, if it returns
35477 NULL, it isn't substituted.
35479 @item %@{S:X; T:Y; :D@}
35481 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
35482 given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
35483 be as many clauses as you need.  This may be combined with @code{.},
35484 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
35487 @end table
35489 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
35490 or similar construct can use a backslash to ignore the special meaning
35491 of the character following it, thus allowing literal matching of a
35492 character that is otherwise specially treated.  For example,
35493 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
35494 @option{-std=iso9899:1999} option is given.
35496 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
35497 construct may contain other nested @samp{%} constructs or spaces, or
35498 even newlines.  They are processed as usual, as described above.
35499 Trailing white space in @code{X} is ignored.  White space may also
35500 appear anywhere on the left side of the colon in these constructs,
35501 except between @code{.} or @code{*} and the corresponding word.
35503 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
35504 handled specifically in these constructs.  If another value of
35505 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
35506 @option{-W} switch is found later in the command line, the earlier
35507 switch value is ignored, except with @{@code{S}*@} where @code{S} is
35508 just one letter, which passes all matching options.
35510 The character @samp{|} at the beginning of the predicate text is used to
35511 indicate that a command should be piped to the following command, but
35512 only if @option{-pipe} is specified.
35514 It is built into GCC which switches take arguments and which do not.
35515 (You might think it would be useful to generalize this to allow each
35516 compiler's spec to say which switches take arguments.  But this cannot
35517 be done in a consistent fashion.  GCC cannot even decide which input
35518 files have been specified without knowing which switches take arguments,
35519 and it must know which input files to compile in order to tell which
35520 compilers to run).
35522 GCC also knows implicitly that arguments starting in @option{-l} are to be
35523 treated as compiler output files, and passed to the linker in their
35524 proper position among the other output files.
35526 @node Environment Variables
35527 @section Environment Variables Affecting GCC
35528 @cindex environment variables
35530 @c man begin ENVIRONMENT
35531 This section describes several environment variables that affect how GCC
35532 operates.  Some of them work by specifying directories or prefixes to use
35533 when searching for various kinds of files.  Some are used to specify other
35534 aspects of the compilation environment.
35536 Note that you can also specify places to search using options such as
35537 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
35538 take precedence over places specified using environment variables, which
35539 in turn take precedence over those specified by the configuration of GCC@.
35540 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
35541 GNU Compiler Collection (GCC) Internals}.
35543 @table @env
35544 @vindex LANG
35545 @vindex LC_CTYPE
35546 @c @vindex LC_COLLATE
35547 @vindex LC_MESSAGES
35548 @c @vindex LC_MONETARY
35549 @c @vindex LC_NUMERIC
35550 @c @vindex LC_TIME
35551 @vindex LC_ALL
35552 @cindex locale
35553 @item LANG
35554 @itemx LC_CTYPE
35555 @c @itemx LC_COLLATE
35556 @itemx LC_MESSAGES
35557 @c @itemx LC_MONETARY
35558 @c @itemx LC_NUMERIC
35559 @c @itemx LC_TIME
35560 @itemx LC_ALL
35561 These environment variables control the way that GCC uses
35562 localization information which allows GCC to work with different
35563 national conventions.  GCC inspects the locale categories
35564 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
35565 so.  These locale categories can be set to any value supported by your
35566 installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
35567 Kingdom encoded in UTF-8.
35569 The @env{LC_CTYPE} environment variable specifies character
35570 classification.  GCC uses it to determine the character boundaries in
35571 a string; this is needed for some multibyte encodings that contain quote
35572 and escape characters that are otherwise interpreted as a string
35573 end or escape.
35575 The @env{LC_MESSAGES} environment variable specifies the language to
35576 use in diagnostic messages.
35578 If the @env{LC_ALL} environment variable is set, it overrides the value
35579 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
35580 and @env{LC_MESSAGES} default to the value of the @env{LANG}
35581 environment variable.  If none of these variables are set, GCC
35582 defaults to traditional C English behavior.
35584 @vindex TMPDIR
35585 @item TMPDIR
35586 If @env{TMPDIR} is set, it specifies the directory to use for temporary
35587 files.  GCC uses temporary files to hold the output of one stage of
35588 compilation which is to be used as input to the next stage: for example,
35589 the output of the preprocessor, which is the input to the compiler
35590 proper.
35592 @vindex GCC_COMPARE_DEBUG
35593 @item GCC_COMPARE_DEBUG
35594 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
35595 @option{-fcompare-debug} to the compiler driver.  See the documentation
35596 of this option for more details.
35598 @vindex GCC_EXEC_PREFIX
35599 @item GCC_EXEC_PREFIX
35600 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
35601 names of the subprograms executed by the compiler.  No slash is added
35602 when this prefix is combined with the name of a subprogram, but you can
35603 specify a prefix that ends with a slash if you wish.
35605 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
35606 an appropriate prefix to use based on the pathname it is invoked with.
35608 If GCC cannot find the subprogram using the specified prefix, it
35609 tries looking in the usual places for the subprogram.
35611 The default value of @env{GCC_EXEC_PREFIX} is
35612 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
35613 the installed compiler. In many cases @var{prefix} is the value
35614 of @code{prefix} when you ran the @file{configure} script.
35616 Other prefixes specified with @option{-B} take precedence over this prefix.
35618 This prefix is also used for finding files such as @file{crt0.o} that are
35619 used for linking.
35621 In addition, the prefix is used in an unusual way in finding the
35622 directories to search for header files.  For each of the standard
35623 directories whose name normally begins with @samp{/usr/local/lib/gcc}
35624 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
35625 replacing that beginning with the specified prefix to produce an
35626 alternate directory name.  Thus, with @option{-Bfoo/}, GCC searches
35627 @file{foo/bar} just before it searches the standard directory 
35628 @file{/usr/local/lib/bar}.
35629 If a standard directory begins with the configured
35630 @var{prefix} then the value of @var{prefix} is replaced by
35631 @env{GCC_EXEC_PREFIX} when looking for header files.
35633 @vindex COMPILER_PATH
35634 @item COMPILER_PATH
35635 The value of @env{COMPILER_PATH} is a colon-separated list of
35636 directories, much like @env{PATH}.  GCC tries the directories thus
35637 specified when searching for subprograms, if it cannot find the
35638 subprograms using @env{GCC_EXEC_PREFIX}.
35640 @vindex LIBRARY_PATH
35641 @item LIBRARY_PATH
35642 The value of @env{LIBRARY_PATH} is a colon-separated list of
35643 directories, much like @env{PATH}.  When configured as a native compiler,
35644 GCC tries the directories thus specified when searching for special
35645 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}.  Linking
35646 using GCC also uses these directories when searching for ordinary
35647 libraries for the @option{-l} option (but directories specified with
35648 @option{-L} come first).
35650 @vindex LANG
35651 @cindex locale definition
35652 @item LANG
35653 This variable is used to pass locale information to the compiler.  One way in
35654 which this information is used is to determine the character set to be used
35655 when character literals, string literals and comments are parsed in C and C++.
35656 When the compiler is configured to allow multibyte characters,
35657 the following values for @env{LANG} are recognized:
35659 @table @samp
35660 @item C-JIS
35661 Recognize JIS characters.
35662 @item C-SJIS
35663 Recognize SJIS characters.
35664 @item C-EUCJP
35665 Recognize EUCJP characters.
35666 @end table
35668 If @env{LANG} is not defined, or if it has some other value, then the
35669 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
35670 recognize and translate multibyte characters.
35672 @vindex GCC_EXTRA_DIAGNOSTIC_OUTPUT
35673 @item GCC_EXTRA_DIAGNOSTIC_OUTPUT
35674 If @env{GCC_EXTRA_DIAGNOSTIC_OUTPUT} is set to one of the following values,
35675 then additional text will be emitted to stderr when fix-it hints are
35676 emitted.  @option{-fdiagnostics-parseable-fixits} and
35677 @option{-fno-diagnostics-parseable-fixits} take precedence over this
35678 environment variable.
35680 @table @samp
35681 @item fixits-v1
35682 Emit parseable fix-it hints, equivalent to
35683 @option{-fdiagnostics-parseable-fixits}.  In particular, columns are
35684 expressed as a count of bytes, starting at byte 1 for the initial column.
35686 @item fixits-v2
35687 As @code{fixits-v1}, but columns are expressed as display columns,
35688 as per @option{-fdiagnostics-column-unit=display}.
35689 @end table
35691 @end table
35693 @noindent
35694 Some additional environment variables affect the behavior of the
35695 preprocessor.
35697 @include cppenv.texi
35699 @c man end
35701 @node Precompiled Headers
35702 @section Using Precompiled Headers
35703 @cindex precompiled headers
35704 @cindex speed of compilation
35706 Often large projects have many header files that are included in every
35707 source file.  The time the compiler takes to process these header files
35708 over and over again can account for nearly all of the time required to
35709 build the project.  To make builds faster, GCC allows you to
35710 @dfn{precompile} a header file.
35712 To create a precompiled header file, simply compile it as you would any
35713 other file, if necessary using the @option{-x} option to make the driver
35714 treat it as a C or C++ header file.  You may want to use a
35715 tool like @command{make} to keep the precompiled header up-to-date when
35716 the headers it contains change.
35718 A precompiled header file is searched for when @code{#include} is
35719 seen in the compilation.  As it searches for the included file
35720 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
35721 compiler looks for a precompiled header in each directory just before it
35722 looks for the include file in that directory.  The name searched for is
35723 the name specified in the @code{#include} with @samp{.gch} appended.  If
35724 the precompiled header file cannot be used, it is ignored.
35726 For instance, if you have @code{#include "all.h"}, and you have
35727 @file{all.h.gch} in the same directory as @file{all.h}, then the
35728 precompiled header file is used if possible, and the original
35729 header is used otherwise.
35731 Alternatively, you might decide to put the precompiled header file in a
35732 directory and use @option{-I} to ensure that directory is searched
35733 before (or instead of) the directory containing the original header.
35734 Then, if you want to check that the precompiled header file is always
35735 used, you can put a file of the same name as the original header in this
35736 directory containing an @code{#error} command.
35738 This also works with @option{-include}.  So yet another way to use
35739 precompiled headers, good for projects not designed with precompiled
35740 header files in mind, is to simply take most of the header files used by
35741 a project, include them from another header file, precompile that header
35742 file, and @option{-include} the precompiled header.  If the header files
35743 have guards against multiple inclusion, they are skipped because
35744 they've already been included (in the precompiled header).
35746 If you need to precompile the same header file for different
35747 languages, targets, or compiler options, you can instead make a
35748 @emph{directory} named like @file{all.h.gch}, and put each precompiled
35749 header in the directory, perhaps using @option{-o}.  It doesn't matter
35750 what you call the files in the directory; every precompiled header in
35751 the directory is considered.  The first precompiled header
35752 encountered in the directory that is valid for this compilation is
35753 used; they're searched in no particular order.
35755 There are many other possibilities, limited only by your imagination,
35756 good sense, and the constraints of your build system.
35758 A precompiled header file can be used only when these conditions apply:
35760 @itemize
35761 @item
35762 Only one precompiled header can be used in a particular compilation.
35764 @item
35765 A precompiled header cannot be used once the first C token is seen.  You
35766 can have preprocessor directives before a precompiled header; you cannot
35767 include a precompiled header from inside another header.
35769 @item
35770 The precompiled header file must be produced for the same language as
35771 the current compilation.  You cannot use a C precompiled header for a C++
35772 compilation.
35774 @item
35775 The precompiled header file must have been produced by the same compiler
35776 binary as the current compilation is using.
35778 @item
35779 Any macros defined before the precompiled header is included must
35780 either be defined in the same way as when the precompiled header was
35781 generated, or must not affect the precompiled header, which usually
35782 means that they don't appear in the precompiled header at all.
35784 The @option{-D} option is one way to define a macro before a
35785 precompiled header is included; using a @code{#define} can also do it.
35786 There are also some options that define macros implicitly, like
35787 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
35788 defined this way.
35790 @item If debugging information is output when using the precompiled
35791 header, using @option{-g} or similar, the same kind of debugging information
35792 must have been output when building the precompiled header.  However,
35793 a precompiled header built using @option{-g} can be used in a compilation
35794 when no debugging information is being output.
35796 @item The same @option{-m} options must generally be used when building
35797 and using the precompiled header.  @xref{Submodel Options},
35798 for any cases where this rule is relaxed.
35800 @item Each of the following options must be the same when building and using
35801 the precompiled header:
35803 @gccoptlist{-fexceptions}
35805 @item
35806 Some other command-line options starting with @option{-f},
35807 @option{-p}, or @option{-O} must be defined in the same way as when
35808 the precompiled header was generated.  At present, it's not clear
35809 which options are safe to change and which are not; the safest choice
35810 is to use exactly the same options when generating and using the
35811 precompiled header.  The following are known to be safe:
35813 @gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock
35814 -fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous
35815 -fsched-verbose=@var{number}  -fschedule-insns  -fvisibility=
35816 -pedantic-errors}
35818 @item Address space layout randomization (ASLR) can lead to not binary identical
35819 PCH files.  If you rely on stable PCH file contents disable ASLR when generating
35820 PCH files.
35822 @end itemize
35824 For all of these except the last, the compiler automatically
35825 ignores the precompiled header if the conditions aren't met.  If you
35826 find an option combination that doesn't work and doesn't cause the
35827 precompiled header to be ignored, please consider filing a bug report,
35828 see @ref{Bugs}.
35830 If you do use differing options when generating and using the
35831 precompiled header, the actual behavior is a mixture of the
35832 behavior for the options.  For instance, if you use @option{-g} to
35833 generate the precompiled header but not when using it, you may or may
35834 not get debugging information for routines in the precompiled header.
35836 @node C++ Modules
35837 @section C++ Modules
35838 @cindex speed of compilation
35840 Modules are a C++20 language feature.  As the name suggests, they
35841 provides a modular compilation system, intending to provide both
35842 faster builds and better library isolation.  The ``Merging Modules''
35843 paper @uref{https://wg21.link/p1103}, provides the easiest to read set
35844 of changes to the standard, although it does not capture later
35845 changes.
35847 @emph{G++'s modules support is not complete.}  Other than bugs, the
35848 known missing pieces are:
35850 @table @emph
35852 @item Private Module Fragment
35853 The Private Module Fragment is recognized, but an error is emitted.
35855 @item Partition definition visibility rules
35856 Entities may be defined in implementation partitions, and those
35857 definitions are not available outside of the module.  This is not
35858 implemented, and the definitions are available to extra-module use.
35860 @item Textual merging of reachable GM entities
35861 Entities may be multiply defined across different header-units.
35862 These must be de-duplicated, and this is implemented across imports,
35863 or when an import redefines a textually-defined entity.  However the
35864 reverse is not implemented---textually redefining an entity that has
35865 been defined in an imported header-unit.  A redefinition error is
35866 emitted.
35868 @item Translation-Unit local referencing rules
35869 Papers p1815 (@uref{https://wg21.link/p1815}) and p2003
35870 (@uref{https://wg21.link/p2003}) add limitations on which entities an
35871 exported region may reference (for instance, the entities an exported
35872 template definition may reference).  These are not fully implemented.
35874 @item Standard Library Header Units
35875 The Standard Library is not provided as importable header units.  If
35876 you want to import such units, you must explicitly build them first.
35877 If you do not do this with care, you may have multiple declarations,
35878 which the module machinery must merge---compiler resource usage can be
35879 affected by how you partition header files into header units.
35881 @end table
35883 Modular compilation is @emph{not} enabled with just the
35884 @option{-std=c++20} option.  You must explicitly enable it with the
35885 @option{-fmodules-ts} option.  It is independent of the language
35886 version selected, although in pre-C++20 versions, it is of course an
35887 extension.
35889 No new source file suffixes are required or supported.  If you wish to
35890 use a non-standard suffix (@pxref{Overall Options}), you also need
35891 to provide a @option{-x c++} option too.@footnote{Some users like to
35892 distinguish module interface files with a new suffix, such as naming
35893 the source @code{module.cppm}, which involves
35894 teaching all tools about the new suffix.  A different scheme, such as
35895 naming @code{module-m.cpp} would be less invasive.}
35897 Compiling a module interface unit produces an additional output (to
35898 the assembly or object file), called a Compiled Module Interface
35899 (CMI).  This encodes the exported declarations of the module.
35900 Importing a module reads in the CMI.  The import graph is a Directed
35901 Acyclic Graph (DAG).  You must build imports before the importer.
35903 Header files may themselves be compiled to header units, which are a
35904 transitional ability aiming at faster compilation.  The
35905 @option{-fmodule-header} option is used to enable this, and implies
35906 the @option{-fmodules-ts} option.  These CMIs are named by the fully
35907 resolved underlying header file, and thus may be a complete pathname
35908 containing subdirectories.  If the header file is found at an absolute
35909 pathname, the CMI location is still relative to a CMI root directory.
35911 As header files often have no suffix, you commonly have to specify a
35912 @option{-x} option to tell the compiler the source is a header file.
35913 You may use @option{-x c++-header}, @option{-x c++-user-header} or
35914 @option{-x c++-system-header}.  When used in conjunction with
35915 @option{-fmodules-ts}, these all imply an appropriate
35916 @option{-fmodule-header} option.  The latter two variants use the
35917 user or system include path to search for the file specified.  This
35918 allows you to, for instance, compile standard library header files as
35919 header units, without needing to know exactly where they are
35920 installed.  Specifying the language as one of these variants also
35921 inhibits output of the object file, as header files have no associated
35922 object file.
35924 The @option{-fmodule-only} option disables generation of the
35925 associated object file for compiling a module interface.  Only the CMI
35926 is generated.  This option is implied when using the
35927 @option{-fmodule-header} option.
35929 The @option{-flang-info-include-translate} and
35930 @option{-flang-info-include-translate-not} options notes whether
35931 include translation occurs or not.  With no argument, the first will
35932 note all include translation.  The second will note all
35933 non-translations of include files not known to intentionally be
35934 textual.  With an argument, queries about include translation of a
35935 header files with that particular trailing pathname are noted.  You
35936 may repeat this form to cover several different header files.  This
35937 option may be helpful in determining whether include translation is
35938 happening---if it is working correctly, it behaves as if it isn't
35939 there at all.
35941 The @option{-flang-info-module-cmi} option can be used to determine
35942 where the compiler is reading a CMI from.  Without the option, the
35943 compiler is silent when such a read is successful.  This option has an
35944 optional argument, which will restrict the notification to just the
35945 set of named modules or header units specified.
35947 The @option{-Winvalid-imported-macros} option causes all imported macros
35948 to be resolved at the end of compilation.  Without this, imported
35949 macros are only resolved when expanded or (re)defined.  This option
35950 detects conflicting import definitions for all macros.
35952 For details of the @option{-fmodule-mapper} family of options,
35953 @pxref{C++ Module Mapper}.
35955 @menu
35956 * C++ Module Mapper::       Module Mapper
35957 * C++ Module Preprocessing::  Module Preprocessing
35958 * C++ Compiled Module Interface:: Compiled Module Interface
35959 @end menu
35961 @node C++ Module Mapper
35962 @subsection Module Mapper
35963 @cindex C++ Module Mapper
35965 A module mapper provides a server or file that the compiler queries to
35966 determine the mapping between module names and CMI files.  It is also
35967 used to build CMIs on demand.  @emph{Mapper functionality is in its
35968 infancy and is intended for experimentation with build system
35969 interactions.}
35971 You can specify a mapper with the @option{-fmodule-mapper=@var{val}}
35972 option or @env{CXX_MODULE_MAPPER} environment variable.  The value may
35973 have one of the following forms:
35975 @table @gcctabopt
35977 @item @r{[}@var{hostname}@r{]}:@var{port}@r{[}?@var{ident}@r{]}
35978 An optional hostname and a numeric port number to connect to.  If the
35979 hostname is omitted, the loopback address is used.  If the hostname
35980 corresponds to multiple IPV6 addresses, these are tried in turn, until
35981 one is successful.  If your host lacks IPv6, this form is
35982 non-functional.  If you must use IPv4 use
35983 @option{-fmodule-mapper='|ncat @var{ipv4host} @var{port}'}.
35985 @item =@var{socket}@r{[}?@var{ident}@r{]}
35986 A local domain socket.  If your host lacks local domain sockets, this
35987 form is non-functional.
35989 @item |@var{program}@r{[}?@var{ident}@r{]} @r{[}@var{args...}@r{]}
35990 A program to spawn, and communicate with on its stdin/stdout streams.
35991 Your @var{PATH} environment variable is searched for the program.
35992 Arguments are separated by space characters, (it is not possible for
35993 one of the arguments delivered to the program to contain a space).  An
35994 exception is if @var{program} begins with @@.  In that case
35995 @var{program} (sans @@) is looked for in the compiler's internal
35996 binary directory.  Thus the sample mapper-server can be specified
35997 with @code{@@g++-mapper-server}.
35999 @item <>@r{[}?@var{ident}@r{]}
36000 @item <>@var{inout}@r{[}?@var{ident}@r{]}
36001 @item <@var{in}>@var{out}@r{[}?@var{ident}@r{]}
36002 Named pipes or file descriptors to communicate over.  The first form,
36003 @option{<>}, communicates over stdin and stdout.  The other forms
36004 allow you to specify a file descriptor or name a pipe.  A numeric value
36005 is interpreted as a file descriptor, otherwise named pipe is opened.
36006 The second form specifies a bidirectional pipe and the last form
36007 allows specifying two independent pipes.  Using file descriptors
36008 directly in this manner is fragile in general, as it can require the
36009 cooperation of intermediate processes.  In particular using stdin &
36010 stdout is fraught with danger as other compiler options might also
36011 cause the compiler to read stdin or write stdout, and it can have
36012 unfortunate interactions with signal delivery from the terminal.
36014 @item @var{file}@r{[}?@var{ident}@r{]}
36015 A mapping file consisting of space-separated module-name, filename
36016 pairs, one per line.  Only the mappings for the direct imports and any
36017 module export name need be provided.  If other mappings are provided,
36018 they override those stored in any imported CMI files.  A repository
36019 root may be specified in the mapping file by using @samp{$root} as the
36020 module name in the first active line.  Use of this option will disable
36021 any default module->CMI name mapping.
36023 @end table
36025 As shown, an optional @var{ident} may suffix the first word of the
36026 option, indicated by a @samp{?} prefix.  The value is used in the
36027 initial handshake with the module server, or to specify a prefix on
36028 mapping file lines.  In the server case, the main source file name is
36029 used if no @var{ident} is specified.  In the file case, all non-blank
36030 lines are significant, unless a value is specified, in which case only
36031 lines beginning with @var{ident} are significant.  The @var{ident}
36032 must be separated by whitespace from the module name.  Be aware that
36033 @samp{<}, @samp{>}, @samp{?}, and @samp{|} characters are often
36034 significant to the shell, and therefore may need quoting.
36036 The mapper is connected to or loaded lazily, when the first module
36037 mapping is required.  The networking protocols are only supported on
36038 hosts that provide networking.  If no mapper is specified a default is
36039 provided.
36041 A project-specific mapper is expected to be provided by the build
36042 system that invokes the compiler.  It is not expected that a
36043 general-purpose server is provided for all compilations.  As such, the
36044 server will know the build configuration, the compiler it invoked, and
36045 the environment (such as working directory) in which that is
36046 operating.  As it may parallelize builds, several compilations may
36047 connect to the same socket.
36049 The default mapper generates CMI files in a @samp{gcm.cache}
36050 directory.  CMI files have a @samp{.gcm} suffix.  The module unit name
36051 is used directly to provide the basename.  Header units construct a
36052 relative path using the underlying header file name.  If the path is
36053 already relative, a @samp{,} directory is prepended.  Internal
36054 @samp{..} components are translated to @samp{,,}.  No attempt is made
36055 to canonicalize these filenames beyond that done by the preprocessor's
36056 include search algorithm, as in general it is ambiguous when symbolic
36057 links are present.
36059 The mapper protocol was published as ``A Module Mapper''
36060 @uref{https://wg21.link/p1184}.  The implementation is provided by
36061 @command{libcody}, @uref{https://github.com/urnathan/libcody},
36062 which specifies the canonical protocol definition.  A proof of concept
36063 server implementation embedded in @command{make} was described in
36064 ''Make Me A Module'', @uref{https://wg21.link/p1602}.
36066 @node C++ Module Preprocessing
36067 @subsection Module Preprocessing
36068 @cindex C++ Module Preprocessing
36070 Modules affect preprocessing because of header units and include
36071 translation.  Some uses of the preprocessor as a separate step either
36072 do not produce a correct output, or require CMIs to be available.
36074 Header units import macros.  These macros can affect later conditional
36075 inclusion, which therefore can cascade to differing import sets.  When
36076 preprocessing, it is necessary to load the CMI.  If a header unit is
36077 unavailable, the preprocessor issues a warning and continue (when
36078 not just preprocessing, an error is emitted).  Detecting such imports
36079 requires preprocessor tokenization of the input stream to phase 4
36080 (macro expansion).
36082 Include translation converts @code{#include}, @code{#include_next} and
36083 @code{#import} directives to internal @code{import} declarations.
36084 Whether a particular directive is translated is controlled by the
36085 module mapper.  Header unit names are canonicalized during
36086 preprocessing.
36088 Dependency information can be emitted for macro import, extending the
36089 functionality of @option{-MD} and @option{-MMD} options.  Detection of
36090 import declarations also requires phase 4 preprocessing, and thus
36091 requires full preprocessing (or compilation).
36093 The @option{-M}, @option{-MM} and @option{-E -fdirectives-only} options halt
36094 preprocessing before phase 4.
36096 The @option{-save-temps} option uses @option{-fdirectives-only} for
36097 preprocessing, and preserve the macro definitions in the preprocessed
36098 output.  Usually you also want to use this option when explicitly
36099 preprocessing a header-unit, or consuming such preprocessed output:
36101 @smallexample
36102 g++ -fmodules-ts -E -fdirectives-only my-header.hh -o my-header.ii
36103 g++ -x c++-header -fmodules-ts -fpreprocessed -fdirectives-only my-header.ii
36104 @end smallexample
36106 @node C++ Compiled Module Interface
36107 @subsection Compiled Module Interface
36108 @cindex C++ Compiled Module Interface
36110 CMIs are an additional artifact when compiling named module
36111 interfaces, partitions or header units.  These are read when
36112 importing.  CMI contents are implementation-specific, and in GCC's
36113 case tied to the compiler version.  Consider them a rebuildable cache
36114 artifact, not a distributable object.
36116 When creating an output CMI, any missing directory components are
36117 created in a manner that is safe for concurrent builds creating
36118 multiple, different, CMIs within a common subdirectory tree.
36120 CMI contents are written to a temporary file, which is then atomically
36121 renamed.  Observers either see old contents (if there is an
36122 existing file), or complete new contents.  They do not observe the
36123 CMI during its creation.  This is unlike object file writing, which
36124 may be observed by an external process.
36126 CMIs are read in lazily, if the host OS provides @code{mmap}
36127 functionality.  Generally blocks are read when name lookup or template
36128 instantiation occurs.  To inhibit this, the @option{-fno-module-lazy}
36129 option may be used.
36131 The @option{--param lazy-modules=@var{n}} parameter controls the limit
36132 on the number of concurrently open module files during lazy loading.
36133 Should more modules be imported, an LRU algorithm is used to determine
36134 which files to close---until that file is needed again.  This limit
36135 may be exceeded with deep module dependency hierarchies.  With large
36136 code bases there may be more imports than the process limit of file
36137 descriptors.  By default, the limit is a few less than the per-process
36138 file descriptor hard limit, if that is determinable.@footnote{Where
36139 applicable the soft limit is incremented as needed towards the hard limit.}
36141 GCC CMIs use ELF32 as an architecture-neutral encapsulation mechanism.
36142 You may use @command{readelf} to inspect them, although section
36143 contents are largely undecipherable.  There is a section named
36144 @code{.gnu.c++.README}, which contains human-readable text.  Other
36145 than the first line, each line consists of @code{@var{tag}: @code{value}}
36146 tuples.
36148 @smallexample
36149 > @command{readelf -p.gnu.c++.README gcm.cache/foo.gcm}
36151 String dump of section '.gnu.c++.README':
36152   [     0]  GNU C++ primary module interface
36153   [    21]  compiler: 11.0.0 20201116 (experimental) [c++-modules revision 20201116-0454]
36154   [    6f]  version: 2020/11/16-04:54
36155   [    89]  module: foo
36156   [    95]  source: c_b.ii
36157   [    a4]  dialect: C++20/coroutines
36158   [    be]  cwd: /data/users/nathans/modules/obj/x86_64/gcc
36159   [    ee]  repository: gcm.cache
36160   [   104]  buildtime: 2020/11/16 15:03:21 UTC
36161   [   127]  localtime: 2020/11/16 07:03:21 PST
36162   [   14a]  export: foo:part1 foo-part1.gcm
36163 @end smallexample
36165 Amongst other things, this lists the source that was built, C++
36166 dialect used and imports of the module.@footnote{The precise contents
36167 of this output may change.} The timestamp is the same value as that
36168 provided by the @code{__DATE__} & @code{__TIME__} macros, and may be
36169 explicitly specified with the environment variable
36170 @code{SOURCE_DATE_EPOCH}.  For further details
36171 @pxref{Environment Variables}.
36173 A set of related CMIs may be copied, provided the relative pathnames
36174 are preserved.
36176 The @code{.gnu.c++.README} contents do not affect CMI integrity, and
36177 it may be removed or altered.  The section numbering of the sections
36178 whose names do not begin with @code{.gnu.c++.}, or are not the string
36179 section is significant and must not be altered.